298 {
299
300
302
303 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{
m_cablingKey, ctx};
306 return StatusCode::FAILURE;
307 }
308 const LArOnOffIdMapping*
cabling=*cablingHdl;
309 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey,ctx};
310 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
311
312
317 ATH_MSG_DEBUG(
" Number of created cells in Map " << hitmap->GetNbCells());
318
320
321
323 SG::WriteHandle<LArHitEMap> hitmap_DigiHSTruth;
327 if (!
m_useMBTime)
data.m_energySum_DigiHSTruth.assign(hitmap_DigiHSTruth->GetNbCells(),0.);
328 data.m_hitmap_DigiHSTruth=hitmap_DigiHSTruth.
ptr();
329 }
330
331
332
335 SG::ReadHandle<CosTrigTime> cosTimeHdl(
m_timeKey,ctx);
336 data.m_trigtime = cosTimeHdl->time();
338 }
339
343
344
347 }
348
353 data.m_hitmap->BuildWindows(mcCollptr,
357 data.m_hitmap_DigiHSTruth->BuildWindows(mcCollptr,
359 }
360
361 }
362
363
364
365
366
368 SG::ReadCondHandle<LArXTalkWeightGlobal> weightHdl(
m_xtalkKey, ctx);
369 data.m_weights=weightHdl.cptr();
370 }
371
374 for (auto & inputHits : hitVectorHandles) {
375 if (!inputHits.isValid()) {
377 return StatusCode::FAILURE;
378 }
379 bool isSignal(true);
380 double SubEvtTimOffset(0.0);
381 double timeCurrBunch=-9999999.;
382 for (const LArHit* hit : *inputHits) {
386 else time = (
float) (SubEvtTimOffset+ hit->time() -
data.m_trigtime);
387 Identifier cellId = hit->cellID();
389 if (std::fabs(SubEvtTimOffset-timeCurrBunch)>1.) {
390 if (timeCurrBunch>-9999.) {
393 return(StatusCode::FAILURE);
394 }
395 }
396 timeCurrBunch = SubEvtTimOffset;
397 }
398 }
399 if (this->
AddHit(cellId,energy,time,isSignal,
data).isFailure())
return StatusCode::FAILURE;
400 }
401 }
402 }
403
408 return StatusCode::FAILURE;
409 }
410 }
411
412 else {
413
415
417
418 double timeCurrBunch=-9999999.;
419
422 TimedHitContList hitContList;
423
424
425
426 if (!(
m_mergeSvc->retrieveSubEvtsData(containerName
427 ,hitContList).isSuccess()) && hitContList.empty()) {
429 return StatusCode::FAILURE;
430 }
431
432
433 TimedHitContList::iterator iFirstCont(hitContList.begin());
434 TimedHitContList::iterator iEndCont(hitContList.end());
436 iEndCont = iFirstCont ;
437 ATH_MSG_DEBUG(
" random event overlay mode : only time 0 read ");
438 ++iEndCont ;
439 }
440 double SubEvtTimOffset;
441 while (iFirstCont != iEndCont) {
442
443
444 bool isSignal = ( iFirstCont == hitContList.begin());
445 const PileUpTimeEventIndex* time_evt = &(iFirstCont->first);
446 SubEvtTimOffset = time_evt->
time();
447
449
450 for (const LArHit* hit : firstCont) {
454 else time = (
float) (SubEvtTimOffset+ hit->time() -
data.m_trigtime);
455 Identifier cellId = hit->cellID();
456
458 if (std::fabs(SubEvtTimOffset-timeCurrBunch)>1.) {
459 if (timeCurrBunch>-9999.) {
462 return(StatusCode::FAILURE);
463 }
464 }
465 timeCurrBunch = SubEvtTimOffset;
466 }
467 }
468 if (this->
AddHit(cellId,energy,time,isSignal,
data).isFailure())
return StatusCode::FAILURE;
469 }
470 ++iFirstCont;
471 }
472 }
473
474 else {
475
477 TimedHitContList hitContList;
478
479
480
481 if (!(
m_mergeSvc->retrieveSubEvtsData(containerName
482 ,hitContList).isSuccess()) && hitContList.empty()) {
484 return StatusCode::FAILURE;
485 }
486
487
488 TimedHitContList::iterator iFirstCont(hitContList.begin());
489 TimedHitContList::iterator iEndCont(hitContList.end());
491 iEndCont = iFirstCont ;
492 ATH_MSG_DEBUG(
"random event overlay mode : only time 0 read ");
493 ++iEndCont ;
494 }
495 double SubEvtTimOffset;
496 while (iFirstCont != iEndCont) {
497 bool isSignal = ( iFirstCont == hitContList.begin());
498
499
500 const PileUpTimeEventIndex* time_evt = &(iFirstCont->first);
501 SubEvtTimOffset = time_evt->
time();
502
503 const LArHitFloatContainer& firstCont = *(iFirstCont->second);
504
505 for (const LArHitFloat& hit : firstCont) {
509 else time = (
float) (SubEvtTimOffset+ hit.time() -
data.m_trigtime);
510 Identifier cellId = hit.cellID();
511
513 if (std::fabs(SubEvtTimOffset-timeCurrBunch)>1.) {
514 if (timeCurrBunch>-9999.) {
517 return(StatusCode::FAILURE);
518 }
519 }
520 timeCurrBunch = SubEvtTimOffset;
521 }
522 }
523 if (this->
AddHit(cellId,energy,time,isSignal,
data).isFailure())
return StatusCode::FAILURE;
524 }
525 ++iFirstCont;
526 }
527
528 }
529
533 return(StatusCode::FAILURE);
534 }
535 }
536
537 }
538
539
541 {
543 {
545 if (!digitCollection.isValid()) {
546 ATH_MSG_ERROR(
"Could not get LArDigitContainer container " << digitCollection.name() <<
" from store " << digitCollection.store());
547 return StatusCode::FAILURE;
548 }
549
550 ATH_MSG_DEBUG(
"LArDigitContainer found with " << digitCollection->size() <<
" digits");
551
552 size_t ndigit{};
553 for (const LArDigit* digit : *digitCollection) {
554 if (hitmap->AddDigit(digit)) ndigit++;
555 }
556 ATH_MSG_DEBUG(
" Number of digits stored for RndmEvt Overlay " << ndigit);
557 }
558 else
559 {
564
565
566 TimedDigitContList digitContList;
568 digitContList).isSuccess()) || digitContList.empty())
569 {
570 ATH_MSG_ERROR(
"Cannot retrieve LArDigitContainer for random event overlay or empty Container");
572 return StatusCode::FAILURE ;
573 }
574 TimedDigitContList::iterator iTzeroDigitCont(digitContList.begin()) ;
575 double SubEvtTimOffset;
576
577 const PileUpTimeEventIndex* time_evt = &(iTzeroDigitCont->first);
578 SubEvtTimOffset = time_evt->
time();
580 const LArDigitContainer& rndm_digit_container = *(iTzeroDigitCont->second);
581 int ndigit=0;
582 for (const LArDigit* digit : rndm_digit_container) {
583 if (hitmap->AddDigit(digit)) ndigit++;
584 }
585 ATH_MSG_INFO(
" Number of digits stored for RndmEvt Overlay " << ndigit);
586 }
587 }
588
589 }
590
591 return StatusCode::SUCCESS;
592
593}
DataModel_detail::const_iterator< DataVector > const_iterator
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
std::list< value_t > type
type of the collection of timed data object
time_type time() const
bunch xing time in ns