ATLAS Offline Software
Loading...
Searching...
No Matches
ALFA_PileUpTool Class Reference

#include <ALFA_PileUpTool.h>

Inheritance diagram for ALFA_PileUpTool:
Collaboration diagram for ALFA_PileUpTool:

Public Member Functions

 ALFA_PileUpTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override final
virtual StatusCode finalize () override final
virtual StatusCode prepareEvent (const EventContext &ctx, const unsigned int nInputEvents) override final
 code taken from ZDC; author (highly) probably John Chapman called before the subevts loop.
virtual StatusCode processBunchXing (int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
 called for each active bunch-crossing to process current SubEvents bunchXing is in ns
virtual StatusCode mergeEvent (const EventContext &ctx) override final
 return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing
virtual StatusCode processAllSubEvents (const EventContext &ctx) override final

Private Member Functions

StatusCode recordCollection (ServiceHandle< StoreGateSvc > &evtStore, const std::string &key_digitCnt)
void ALFA_MD_info (const ALFA_HitCollection *)
void ALFA_MD_info (TimedHitCollection< ALFA_Hit > &)
StatusCode fill_MD_DigitCollection (CLHEP::HepRandomEngine *)
StatusCode recordODCollection (ServiceHandle< StoreGateSvc > &evtStore, const std::string &key_ODdigitCnt)
void ALFA_OD_info (const ALFA_ODHitCollection *)
void ALFA_OD_info (TimedHitCollection< ALFA_ODHit > &)
StatusCode fill_OD_DigitCollection (CLHEP::HepRandomEngine *)
StatusCode XTalk ()

Private Attributes

ServiceHandle< PileUpMergeSvcm_mergeSvc {this, "mergeSvc", "PileUpMergeSvc", ""}
ServiceHandle< IAthRNGSvcm_randomSvc {this, "RndmSvc", "AthRNGSvc", ""}
Gaudi::Property< std::string > m_randomStreamName {this, "RandomStreamName", "ALFARndEng", ""}
double m_E_fib [8][20][64] {}
double m_E_ODfib [8][2][3][30] {}
std::string m_SimHitCollectionName
std::string m_SimODHitCollectionName
std::string m_key_DigitCollection
std::string m_key_ODDigitCollection
ALFA_DigitCollectionm_digitCollection {}
ALFA_ODDigitCollectionm_ODdigitCollection {}
double m_sigma0 {}
double m_sigma1 {}
double m_meanE_dep {}
double m_meanN_photo {}
double m_mean {}
double m_stdDev {}
double m_AmplitudeCut {}
ALFA_HitCollectionm_mergedALFA_HitList {}
ALFA_ODHitCollectionm_mergedALFA_ODHitList {}
double m_cross_talk [8][127] {}
int m_fibres [8][20][64] {}

structors and AlgTool implementation

virtual bool toProcess (int bunchXing) const override
 the method this base class helps implementing
virtual bool filterPassed () const override
 dummy implementation of passing filter
virtual void resetFilter () override
 dummy implementation of filter reset
Gaudi::Property< int > m_firstXing
Gaudi::Property< int > m_lastXing
Gaudi::Property< int > m_vetoPileUpTruthLinks
bool m_filterPassed {true}

Detailed Description

Definition at line 32 of file ALFA_PileUpTool.h.

Constructor & Destructor Documentation

◆ ALFA_PileUpTool()

ALFA_PileUpTool::ALFA_PileUpTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 50 of file ALFA_PileUpTool.cxx.

52 :
53 PileUpToolBase(type, name, parent),
54 m_SimHitCollectionName ("ALFA_HitCollection"),
55 m_SimODHitCollectionName ("ALFA_ODHitCollection"),
56 m_key_DigitCollection ("ALFA_DigitCollection"),
57 m_key_ODDigitCollection ("ALFA_ODDigitCollection"),
58 m_digitCollection (nullptr),
59 m_ODdigitCollection (nullptr),
60 m_sigma0 (0.1),
61 m_sigma1 (1.0),
62 m_meanE_dep (0.0863), //MeV
63 m_meanN_photo (4.11),
64 m_mean (0.0),
65 m_stdDev (1.0),
66 m_AmplitudeCut (0.24),
67 m_mergedALFA_HitList (nullptr),
69{
70 // Properties
71 declareProperty("SimHitCollection", m_SimHitCollectionName, "Name of the input ALFA Sim Hit Collection of simulated hits");
72 declareProperty("SimODHitCollection", m_SimODHitCollectionName, "Name of the input ALFA Sim OD Hit Collection of simulated hits");
73
74 declareProperty("ALFA_DigitCollection", m_key_DigitCollection, "Name of the Collection to hold the output from the ALFA main detector digitization");
75 declareProperty("ALFA_ODDigitCollection", m_key_ODDigitCollection, "Name of the Collection to hold the output from the ALFA OD digitization");
76
77
78// declareProperty("fillRootTree", m_fillRootTree);
79
80
81 declareProperty("sigma0", m_sigma0);
82 declareProperty("sigma1", m_sigma1);
83 declareProperty("meanE_dep", m_meanE_dep);
84 declareProperty("meanN_photo", m_meanN_photo);
85 declareProperty("mean", m_mean);
86 declareProperty("stdDev", m_stdDev);
87 declareProperty("AmplitudeCut", m_AmplitudeCut);
88// declareProperty("fillRootTree", m_fillRootTree);
89}
ALFA_ODHitCollection * m_mergedALFA_ODHitList
std::string m_SimODHitCollectionName
ALFA_DigitCollection * m_digitCollection
std::string m_SimHitCollectionName
std::string m_key_DigitCollection
ALFA_HitCollection * m_mergedALFA_HitList
std::string m_key_ODDigitCollection
ALFA_ODDigitCollection * m_ODdigitCollection
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ ALFA_MD_info() [1/2]

void ALFA_PileUpTool::ALFA_MD_info ( const ALFA_HitCollection * ALFA_HitCollection)
private

Definition at line 400 of file ALFA_PileUpTool.cxx.

401{
402
403// cleaning
404
405 for ( int l = 0; l < 8; l++ )
406 {
407 for ( int i = 0; i < 20; i++ )
408 {
409 for ( int j = 0; j < 64; j++ )
410 {
411
412 m_E_fib[l][i][j] = 0.;
413 m_fibres[l][i][j] = 0;
414
415
416 }
417 }
418 }
419
420// cleaning end
421
422 int fiber, plate, sign, station;
423
426
427 for (; it != itend; ++it) {
428
429 station = it->GetStationNumber();
430 plate = it->GetPlateNumber();
431 fiber = it->GetFiberNumber();
432 sign = it->GetSignFiber();
433
434 ATH_MSG_DEBUG ("station=" << station << ", plate= "<< plate << ", fiber=" << fiber << ", sign=" << sign << ", dep energy=" << it->GetEnergyDeposit());
435
436 m_E_fib[station-1][2*(plate-1)+(1-sign)/2][fiber-1] += it->GetEnergyDeposit();
437
438
439 }
440}
AtlasHitsVector< ALFA_Hit >::const_iterator ALFA_HitConstIter
AtlasHitsVector< ALFA_Hit > ALFA_HitCollection
#define ATH_MSG_DEBUG(x)
int sign(int a)
double m_E_fib[8][20][64]
int m_fibres[8][20][64]
const_iterator begin() const
const_iterator end() const
l
Printing final latex table to .tex output file.

◆ ALFA_MD_info() [2/2]

void ALFA_PileUpTool::ALFA_MD_info ( TimedHitCollection< ALFA_Hit > & tHitALFA)
private

Definition at line 356 of file ALFA_PileUpTool.cxx.

357{
358
359// cleaning
360
361 for ( int l = 0; l < 8; l++ )
362 {
363 for ( int i = 0; i < 20; i++ )
364 {
365 for ( int j = 0; j < 64; j++ )
366 {
367
368 m_E_fib[l][i][j] = 0.;
369 m_fibres[l][i][j] = 0;
370
371 }
372 }
373 }
374
375// cleaning end
376
377 int fiber, plate, sign, station;
378
379 TimedHitCollection<ALFA_Hit> thpc = tHitALFA;
381
382 while (thpc.nextDetectorElement(i, e)) for (it = i; it != e; ++it) {
383
384 station = (*it)->GetStationNumber();
385 plate = (*it)->GetPlateNumber();
386 fiber = (*it)->GetFiberNumber();
387 sign = (*it)->GetSignFiber();
388
389 ATH_MSG_DEBUG ("station=" << station << ", plate= "<< plate << ", fiber=" << fiber << ", sign=" << sign << ", dep energy=" << ((*it)->GetEnergyDeposit()));
390
391 m_E_fib[station-1][2*(plate-1)+(1-sign)/2][fiber-1] += ((*it)->GetEnergyDeposit());
392
393 }
394
395}
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
TimedVector::const_iterator const_iterator

◆ ALFA_OD_info() [1/2]

void ALFA_PileUpTool::ALFA_OD_info ( const ALFA_ODHitCollection * ALFA_ODHitCollection)
private

Definition at line 491 of file ALFA_PileUpTool.cxx.

492{
493
494 // cleaning
495
496 for ( int l = 0; l < 8; l++ ){
497 for ( int i = 0; i < 2; i++ ){
498 for ( int j = 0; j < 3; j++ ){
499 for ( int k = 0; k < 30; k++ ){
500
501 m_E_ODfib[l][i][j][k] = 0.;
502
503 }
504 }
505 }
506 }
507
508// cleaning end
509
510 int fiber, plate, sign, side, station;
511
512
515
516 for (; it != itend; ++it) {
517
518
519 station = it->GetStationNumber();
520 side = it->GetODSide();
521 plate = it->GetPlateNumber();
522 fiber = it->GetFiberNumber();
523 sign = it->GetSignFiber();
524
525
526 ATH_MSG_DEBUG ("station=" << station << ", side=" << side << ", plate= "<< plate << ", fiber=" << fiber << ", sign=" << sign << ", dep energy=" << it->GetEnergyDeposit());
527
528 if (sign==0) m_E_ODfib[station-1][side-1][plate-1][fiber+15] += it->GetEnergyDeposit();
529 else m_E_ODfib[station-1][side-1][plate-1][fiber] += it->GetEnergyDeposit();
530
531 }
532}
AtlasHitsVector< ALFA_ODHit > ALFA_ODHitCollection
AtlasHitsVector< ALFA_ODHit >::const_iterator ALFA_ODHitConstIter
double m_E_ODfib[8][2][3][30]

◆ ALFA_OD_info() [2/2]

void ALFA_PileUpTool::ALFA_OD_info ( TimedHitCollection< ALFA_ODHit > & tODHitALFA)
private

Definition at line 445 of file ALFA_PileUpTool.cxx.

446{
447
448// cleaning
449
450 for ( int l = 0; l < 8; l++ ){
451 for ( int i = 0; i < 2; i++ ){
452 for ( int j = 0; j < 3; j++ ){
453 for ( int k = 0; k < 30; k++ ){
454
455 m_E_ODfib[l][i][j][k] = 0.;
456
457 }
458 }
459 }
460 }
461
462// cleaning end
463
464 int fiber, plate, sign, side, station;
465
466
467 TimedHitCollection<ALFA_ODHit> thpc = tODHitALFA;
469
470 while (thpc.nextDetectorElement(i, e)) for (it = i; it != e; ++it) {
471
472 station = (*it)->GetStationNumber();
473 side = (*it)->GetODSide();
474 plate = (*it)->GetPlateNumber();
475 fiber = (*it)->GetFiberNumber();
476 sign = (*it)->GetSignFiber();
477
478
479 ATH_MSG_DEBUG ("station=" << station << ", side=" << side << ", plate= "<< plate << ", fiber=" << fiber << ", sign=" << sign << ", dep energy=" << ((*it)->GetEnergyDeposit()));
480
481 if (sign==0) m_E_ODfib[station-1][side-1][plate-1][fiber+15] += ((*it)->GetEnergyDeposit());
482 else m_E_ODfib[station-1][side-1][plate-1][fiber] += ((*it)->GetEnergyDeposit());
483
484 }
485
486}

◆ fill_MD_DigitCollection()

StatusCode ALFA_PileUpTool::fill_MD_DigitCollection ( CLHEP::HepRandomEngine * rndEngine)
private

Definition at line 537 of file ALFA_PileUpTool.cxx.

537 {
538
539 ATH_MSG_DEBUG(" ALFA_PileUpTool::fill_MD_DigitCollection()");
540
541 double N_photo = 0.;
542 //double N_CTphoto = 0.;
543 //double sigma = 0.;
544 double amplitude = 0.;
545 //double amplitude_CT = 0.;
546
547
548 for ( int l = 0; l < 8; l++ )
549 {
550 for ( int i = 0; i < 20; i++ )
551 {
552 for ( int j = 0; j < 64; j++ )
553 {
554
555 N_photo = CLHEP::RandPoisson::shoot(rndEngine,m_E_fib[l][i][j]*m_meanN_photo/m_meanE_dep);
556
557 //sigma = m_sigma1 * sqrt(N_photo);
558 //double noise_1 = sigma * CLHEP::RandGaussZiggurat::shoot (rndEngine, m_mean, m_stdDev);
559 //double noise_2 = m_sigma0 * CLHEP::RandGaussZiggurat::shoot (rndEngine, m_mean, m_stdDev);
560
561 //amplitude = N_photo
562 // + noise_1
563 // + noise_2;
564
565 amplitude = CLHEP::RandGaussZiggurat::shoot(rndEngine, N_photo, sqrt(pow(m_sigma0,2)+N_photo*pow(m_sigma1,2)));
566
567 //N_photo_CT = CLHEP::RandPoisson::shoot(rndEngine,0.08*m_E_fib[l][i][j]*m_meanN_photo/m_meanE_dep);
568 //amplitude_CT = CLHEP::RandGaussQ::shoot (rndEngine, N_photo_CT, sqrt(pow(m_sigma0,2)+N_photo_CT*pow(m_sigma1,2)));
569
570
571 if (amplitude >= m_AmplitudeCut )
572 {
573 ATH_MSG_DEBUG(" ALFA_Digitization::fillDigitCollection, amplitude " << amplitude);
574 ATH_MSG_DEBUG(" station = " << l << ", plate= " << i << ", fiber=" << j );
575 m_digitCollection->push_back(new ALFA_Digit(l,i,j));
576 m_fibres[l][i][j] = m_fibres[l][i][j] + 1;
577 }
578
579 }
580 }
581 }
582
583 double rand_fib;
584
585 for ( int l = 0; l < 8; l++ )
586 {
587 for ( int i = 0; i < 20; i++ )
588 {
589 for ( int j = 0; j < 64; j++ )
590 {
591 if ( m_fibres[l][i][j] > 0 )
592 {
593 for (int f = j+1; f < 64; f++)
594 {
595 rand_fib = CLHEP::RandFlat::shoot(rndEngine,0.,1.);
596
597 if ( m_fibres[l][i][f] == 0)
598 {
599 if (rand_fib <= m_cross_talk[l][63+f-j])
600 {
601 m_digitCollection->push_back(new ALFA_Digit(l,i,f));
602 }
603 }
604 }
605
606 for (int f = j-1; f > -1; f--)
607 {
608 rand_fib = CLHEP::RandFlat::shoot(rndEngine,0.,1.);
609
610 if ( m_fibres[l][i][f] == 0)
611 {
612 if (rand_fib <= m_cross_talk[l][63-(j-f)])
613 {
614 m_digitCollection->push_back(new ALFA_Digit(l,i,f));
615 }
616 }
617 }
618 }
619 }
620 }
621 }
622 return StatusCode::SUCCESS;
623
624}
constexpr int pow(int base, int exp) noexcept
double m_cross_talk[8][127]

◆ fill_OD_DigitCollection()

StatusCode ALFA_PileUpTool::fill_OD_DigitCollection ( CLHEP::HepRandomEngine * rndEngine)
private

Definition at line 629 of file ALFA_PileUpTool.cxx.

629 {
630
631 ATH_MSG_DEBUG(" ALFA_PileUpTool::fill_OD_DigitCollection ");
632
633 double N_photo = 0.;
634 double sigma = 0.;
635 double amplitude = 0.;
636
637 for ( int l = 0; l < 8; l++ )
638 {
639 for ( int i = 0; i < 2; i++ )
640 {
641 for ( int j = 0; j < 3; j++ )
642 {
643 for (int k = 0; k < 30; k++)
644 {
645
646 N_photo = CLHEP::RandPoisson::shoot(rndEngine,m_E_ODfib[l][i][j][k]*m_meanN_photo/m_meanE_dep);
647 sigma = m_sigma1 * sqrt(N_photo);
648
649 double noise_1 = sigma * CLHEP::RandGaussZiggurat::shoot (rndEngine, m_mean, m_stdDev);
650 double noise_2 = m_sigma0 * CLHEP::RandGaussZiggurat::shoot (rndEngine, m_mean, m_stdDev);
651
652
653 amplitude = N_photo
654 + noise_1
655 + noise_2;
656
657
658 if (amplitude >= m_AmplitudeCut )
659 {
660 ATH_MSG_DEBUG(" ALFA_Digitization::fill_OD_DigitCollection, amplitude " << amplitude);
661 ATH_MSG_DEBUG(" station = " << l << ", side = " << i << ", plate = " << j << ", fiber = " << k);
662
663 m_ODdigitCollection->push_back(new ALFA_ODDigit(l,i,j,k));
664 }
665
666
667 }
668 }
669 }
670 }
671
672 return StatusCode::SUCCESS;
673}

◆ filterPassed()

virtual bool PileUpToolBase::filterPassed ( ) const
inlineoverridevirtualinherited

dummy implementation of passing filter

Definition at line 49 of file PileUpToolBase.h.

49{ return m_filterPassed; }

◆ finalize()

StatusCode ALFA_PileUpTool::finalize ( )
finaloverridevirtual

Definition at line 326 of file ALFA_PileUpTool.cxx.

326{ return StatusCode::SUCCESS; }

◆ initialize()

StatusCode ALFA_PileUpTool::initialize ( )
finaloverridevirtual

Reimplemented from PileUpToolBase.

Definition at line 94 of file ALFA_PileUpTool.cxx.

94 {
95
96 ATH_MSG_DEBUG ("ALFA_digiti initialize() called");
97
98 ATH_MSG_DEBUG (" Pedestal: " << m_AmplitudeCut);
99
100 ATH_CHECK (m_randomSvc.retrieve());
101 ATH_MSG_DEBUG ( "Retrieved RandomNumber Service" );
102
103 ATH_CHECK (m_mergeSvc.retrieve());
104 ATH_MSG_DEBUG("Retrieved PileUpMergeSvc");
105
108
109 return StatusCode::SUCCESS;
110}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< PileUpMergeSvc > m_mergeSvc
ServiceHandle< IAthRNGSvc > m_randomSvc

◆ mergeEvent()

StatusCode ALFA_PileUpTool::mergeEvent ( const EventContext & ctx)
finaloverridevirtual

return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing

called at the end of the subevts loop. Not (necessarily) able to access SubEvents

Definition at line 299 of file ALFA_PileUpTool.cxx.

299 {
300
301
303
304 // Prepare RNG Service
305 ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
306 rngWrapper->setSeed( m_randomStreamName, ctx );
307 CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
309 if (sc.isFailure()) {
310 ATH_MSG_WARNING ("ALFA_PileUpTool::fill_MD_DigitCollection() failed");
311 return StatusCode::SUCCESS;
312 }
313
314
316
317 sc = fill_OD_DigitCollection(rngEngine);
318 if (sc.isFailure()) {
319 ATH_MSG_WARNING ("ALFA_PileUpTool::fill_OD_DigitCollection() failed");
320 return StatusCode::SUCCESS;
321 }
322
323 return StatusCode::SUCCESS;
324}
#define ATH_MSG_WARNING(x)
static Double_t sc
StatusCode fill_OD_DigitCollection(CLHEP::HepRandomEngine *)
void ALFA_OD_info(const ALFA_ODHitCollection *)
void ALFA_MD_info(const ALFA_HitCollection *)
StatusCode fill_MD_DigitCollection(CLHEP::HepRandomEngine *)
Gaudi::Property< std::string > m_randomStreamName
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ prepareEvent()

StatusCode ALFA_PileUpTool::prepareEvent ( const EventContext & ctx,
const unsigned int nInputEvents )
finaloverridevirtual

code taken from ZDC; author (highly) probably John Chapman called before the subevts loop.

Not (necessarily) able to access SubEvents

Definition at line 223 of file ALFA_PileUpTool.cxx.

223 {
224
225 ATH_MSG_DEBUG ( "ALFA_PileUpTool::prepareEvent() called for " << nInputEvents << " input events" );
226
228
229 if (sc.isFailure()) { ATH_MSG_FATAL ( " ALFA_PileUpTool::prepareEvent(): Could not record the empty digit container in StoreGate " ); return sc; }
230 else { ATH_MSG_DEBUG ( " ALFA_PileUpTool::prepareEvent(): Digit container is recorded in StoreGate " ); }
231
232 sc = recordODCollection(this->evtStore(), m_key_ODDigitCollection);
233
234 if (sc.isFailure()) { ATH_MSG_FATAL ( " ALFA_PileUpTool::prepareEvent(): Could not record the empty digit OD container in StoreGate " ); return sc; }
235 else { ATH_MSG_DEBUG ( " ALFA_PileUpTool::prepareEvent(): Digit OD container is recorded in StoreGate " ); }
236
237 m_mergedALFA_HitList->clear();
238 m_mergedALFA_ODHitList->clear();
239
240 return StatusCode::SUCCESS;
241}
#define ATH_MSG_FATAL(x)
StatusCode recordCollection(ServiceHandle< StoreGateSvc > &evtStore, const std::string &key_digitCnt)
StatusCode recordODCollection(ServiceHandle< StoreGateSvc > &evtStore, const std::string &key_ODdigitCnt)

◆ processAllSubEvents()

StatusCode ALFA_PileUpTool::processAllSubEvents ( const EventContext & ctx)
finaloverridevirtual

Reimplemented from PileUpToolBase.

Definition at line 117 of file ALFA_PileUpTool.cxx.

117 {
118
119 ATH_MSG_DEBUG ("ALFA_PileUpTool::processAllSubEvents()");
120
121 using TimedALFAHitCollList = PileUpMergeSvc::TimedList<ALFA_HitCollection>::type;
122 using TimedALFAODHitCollList = PileUpMergeSvc::TimedList<ALFA_ODHitCollection>::type;
123
124 TimedALFAHitCollList tHitCollList;
125 TimedALFAODHitCollList tODHitCollList;
126
127
128 if (m_mergeSvc->retrieveSubEvtsData(m_SimHitCollectionName, tHitCollList).isFailure()) {
129
130 ATH_MSG_FATAL ( "Could not fill TimedALFAHitCollList" ); return StatusCode::FAILURE;
131 }
132 else { ATH_MSG_DEBUG ( "Retrieved TimedALFAHitCollList" ); }
133
134 ATH_MSG_DEBUG ( "PileUp: Merge " << tHitCollList.size() << " ALFA_HitCollection with key" << m_SimHitCollectionName );
135
136
137 if (m_mergeSvc->retrieveSubEvtsData(m_SimODHitCollectionName, tODHitCollList).isFailure()) {
138
139 ATH_MSG_FATAL ( "Could not fill TimedALFAODHitCollList" ); return StatusCode::FAILURE;
140 }
141 else { ATH_MSG_DEBUG ( "Retrieved TimedALFAODHitCollList" ); }
142
143 ATH_MSG_DEBUG ( "PileUp: Merge " << tODHitCollList.size() << " ALFA_ODHitCollection with key " << m_SimODHitCollectionName );
144
145
146 TimedHitCollection<ALFA_Hit> tALFAhit;
147
148 TimedALFAHitCollList::iterator iHitColl (tHitCollList.begin());
149 TimedALFAHitCollList::iterator eHitColl (tHitCollList.end());
150
151 while (iHitColl != eHitColl) {
152
153 const ALFA_HitCollection* tmpColl(iHitColl->second);
154
155 tALFAhit.insert(iHitColl->first, tmpColl);
156
157 ATH_MSG_DEBUG ( " ALFA_HitCollection found with " << tmpColl->size() << " hits " << iHitColl->first );
158
159 ++iHitColl;
160 }
161
162 TimedHitCollection<ALFA_ODHit> tALFAODhit;
163
164 TimedALFAODHitCollList::iterator iODHitColl (tODHitCollList.begin());
165 TimedALFAODHitCollList::iterator eODHitColl (tODHitCollList.end());
166
167 while (iODHitColl != eODHitColl) {
168
169 const ALFA_ODHitCollection* tmpColl(iODHitColl->second);
170
171 tALFAODhit.insert(iODHitColl->first, tmpColl);
172
173 ATH_MSG_DEBUG ( " ALFA_ODHitCollection found with " << tmpColl->size() << " hits " << iODHitColl->first );
174
175 ++iODHitColl;
176 }
177
178 // preparing containers
179
180 if (recordCollection(this->evtStore(), m_key_DigitCollection).isFailure()) {
181
182 ATH_MSG_FATAL ( " ALFA_PileUpTool::processAllSubEvents(): Could not record the empty ALFA digit container in StoreGate " ); return StatusCode::FAILURE;
183 }
184 else { ATH_MSG_DEBUG ( " ALFA_PileUpTool::processAllSubEvents(): ALFA Digit container is recorded in StoreGate " ); }
185
186
187 if (recordODCollection(this->evtStore(), m_key_ODDigitCollection).isFailure()) {
188
189 ATH_MSG_FATAL ( " ALFA_PileUpTool::processAllSubEvents(): Could not record the empty ALFA OD digit container in StoreGate " ); return StatusCode::FAILURE;
190 }
191 else { ATH_MSG_DEBUG ( " ALFA_PileUpTool::processAllSubEvents(): ALFA OD Digit container is recorded in StoreGate " ); }
192
193
194 // filling containers
195
196 ALFA_MD_info(tALFAhit);
197
198 // Prepare RNG Service
199 ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
200 rngWrapper->setSeed( m_randomStreamName, ctx );
201 CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
203 if (sc.isFailure()) {
204 ATH_MSG_WARNING ("ALFA_PileUpTool::fill_MD_DigitCollection() failed");
205 return StatusCode::SUCCESS;
206 }
207
208
209 ALFA_OD_info(tALFAODhit);
210
211 sc = fill_OD_DigitCollection(rngEngine);
212 if (sc.isFailure()) {
213 ATH_MSG_WARNING ("ALFA_PileUpTool::fill_OD_DigitCollection() failed");
214 return StatusCode::SUCCESS;
215 }
216
217 return StatusCode::SUCCESS;
218}
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
std::list< value_t > type
type of the collection of timed data object

◆ processBunchXing()

StatusCode ALFA_PileUpTool::processBunchXing ( int bunchXing,
SubEventIterator bSubEvents,
SubEventIterator eSubEvents )
finaloverridevirtual

called for each active bunch-crossing to process current SubEvents bunchXing is in ns

Reimplemented from PileUpToolBase.

Definition at line 244 of file ALFA_PileUpTool.cxx.

246 {
247 ATH_MSG_DEBUG ( "ALFA_PileUpTool::processBunchXing() " << bunchXing );
248 SubEventIterator iEvt = bSubEvents;
249 for (; iEvt!=eSubEvents; ++iEvt) {
250 StoreGateSvc& seStore = *iEvt->ptr()->evtStore();
251 //PileUpTimeEventIndex thisEventIndex = PileUpTimeEventIndex(static_cast<int>(iEvt->time()),iEvt->index()); not used
252 ATH_MSG_VERBOSE("SubEvt StoreGate " << seStore.name() << " :"
253 << " bunch crossing : " << bunchXing
254 << " time offset : " << iEvt->time()
255 << " event number : " << iEvt->ptr()->eventNumber()
256 << " run number : " << iEvt->ptr()->runNumber()
257 );
258
259
260 const ALFA_HitCollection* tmpHitColl = nullptr;
261
262 if (!seStore.retrieve(tmpHitColl, m_SimHitCollectionName).isSuccess()) {
263
264 ATH_MSG_ERROR ("SubEvent ALFA_HitCollection not found in StoreGate " << seStore.name() );
265
266 return StatusCode::FAILURE;
267 }
268
269 ATH_MSG_DEBUG ("SubEvent, ALFA_HitCollection found with " << tmpHitColl->size() << " hits");
270
271 ALFA_HitCollection::const_iterator iHitColl = tmpHitColl->begin();
272 ALFA_HitCollection::const_iterator eHitColl = tmpHitColl->end();
273
274 for (; iHitColl!=eHitColl; ++iHitColl) m_mergedALFA_HitList->push_back((*iHitColl));
275
276 const ALFA_ODHitCollection* tmpODHitColl = nullptr;
277
278 if (!seStore.retrieve(tmpODHitColl, m_SimODHitCollectionName).isSuccess()) {
279
280 ATH_MSG_ERROR ( "SubEvent ALFA_ODHitCollection not found in StoreGate " << seStore.name() );
281
282 return StatusCode::FAILURE;
283 }
284
285 ATH_MSG_DEBUG ( "ALFA_ODHitCollection found with " << tmpODHitColl->size() << " hits" );
286
287 ALFA_ODHitCollection::const_iterator iODHitColl = tmpODHitColl->begin();
288 ALFA_ODHitCollection::const_iterator eODHitColl = tmpODHitColl->end();
289
290 for (; iODHitColl!=eODHitColl; ++iODHitColl) m_mergedALFA_ODHitList->push_back((*iODHitColl));
291 }
292
293 return StatusCode::SUCCESS;
294}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
CONT::const_iterator const_iterator
size_type size() const
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.

◆ recordCollection()

StatusCode ALFA_PileUpTool::recordCollection ( ServiceHandle< StoreGateSvc > & evtStore,
const std::string & key_digitCnt )
private

Definition at line 330 of file ALFA_PileUpTool.cxx.

331{
332 ATH_MSG_DEBUG ("ALFA_Digitization::recordCollection");
333
334 m_digitCollection = new ALFA_DigitCollection();
335
336 StatusCode sc = evtStore->record(m_digitCollection, key_digitCnt);
337
338 return sc;
339}

◆ recordODCollection()

StatusCode ALFA_PileUpTool::recordODCollection ( ServiceHandle< StoreGateSvc > & evtStore,
const std::string & key_ODdigitCnt )
private

Definition at line 342 of file ALFA_PileUpTool.cxx.

342 {
343
344 ATH_MSG_DEBUG ("ALFA_Digitization::recordODCollection");
345
346 m_ODdigitCollection = new ALFA_ODDigitCollection();
347
348 StatusCode sc = evtStore->record(m_ODdigitCollection, key_ODdigitCnt);
349
350 return sc;
351}

◆ resetFilter()

virtual void PileUpToolBase::resetFilter ( )
inlineoverridevirtualinherited

dummy implementation of filter reset

Reimplemented in MergeTruthJetsTool.

Definition at line 51 of file PileUpToolBase.h.

51{ m_filterPassed=true; }

◆ toProcess()

virtual bool PileUpToolBase::toProcess ( int bunchXing) const
inlineoverridevirtualinherited

the method this base class helps implementing

Reimplemented in MergeHijingParsTool, and MergeTrackRecordCollTool.

Definition at line 32 of file PileUpToolBase.h.

32 {
33 //closed interval [m_firstXing,m_lastXing]
34 return !((m_firstXing > bunchXing) || (bunchXing > m_lastXing));
35 }
Gaudi::Property< int > m_firstXing
Gaudi::Property< int > m_lastXing

◆ XTalk()

StatusCode ALFA_PileUpTool::XTalk ( )
private

Definition at line 677 of file ALFA_PileUpTool.cxx.

677 {
678 std::ifstream fXTalk;
679 for (unsigned int j=0; j<8; j++){
680
681 const std::string fname = "ALFA_Digitization/Xtalk_station" + std::to_string(j+1) + ".txt";
682 ATH_MSG_DEBUG("file name " << fname);
683
684 std::string filePath = PathResolverFindDataFile(fname);
685
686 if(filePath.length() == 0)
687 {
688 ATH_MSG_FATAL(" XTalk file " << fname<< " not found in Datapath");
689 throw std::runtime_error("FATAL: mapping MD maroc-mapmt not found in Datapath.");
690 }
691
692 else
693 {
694 ATH_MSG_DEBUG("the XTALK file \"" << fname << "\" found in Datapath");
695 ATH_MSG_DEBUG("filePath = " << filePath);
696 }
697
698 fXTalk.open(filePath.c_str());
699
700 if (fXTalk.is_open())
701 {
702 for (unsigned int i=0;i<127;i++)
703 {
704 fXTalk >> m_cross_talk[j][i];
705
706 ATH_MSG_DEBUG("cross_talk[" << j << "][" << i << "] = " << m_cross_talk[j][i]);
707
708 }
709 fXTalk.close();
710 }
711 else
712 {
713 ATH_MSG_ERROR("the file " << fname<< " was not open");
714 return StatusCode::FAILURE;
715 }
716 }
717 return StatusCode::SUCCESS;
718 }
std::string PathResolverFindDataFile(const std::string &logical_file_name)
str filePath
Definition hancool.py:27

Member Data Documentation

◆ m_AmplitudeCut

double ALFA_PileUpTool::m_AmplitudeCut {}
private

Definition at line 105 of file ALFA_PileUpTool.h.

105{};

◆ m_cross_talk

double ALFA_PileUpTool::m_cross_talk[8][127] {}
private

Definition at line 110 of file ALFA_PileUpTool.h.

110{};

◆ m_digitCollection

ALFA_DigitCollection* ALFA_PileUpTool::m_digitCollection {}
private

Definition at line 95 of file ALFA_PileUpTool.h.

95{};

◆ m_E_fib

double ALFA_PileUpTool::m_E_fib[8][20][64] {}
private

Definition at line 86 of file ALFA_PileUpTool.h.

86{};

◆ m_E_ODfib

double ALFA_PileUpTool::m_E_ODfib[8][2][3][30] {}
private

Definition at line 87 of file ALFA_PileUpTool.h.

87{};

◆ m_fibres

int ALFA_PileUpTool::m_fibres[8][20][64] {}
private

Definition at line 111 of file ALFA_PileUpTool.h.

111{};

◆ m_filterPassed

bool PileUpToolBase::m_filterPassed {true}
protectedinherited

Definition at line 60 of file PileUpToolBase.h.

60{true};

◆ m_firstXing

Gaudi::Property<int> PileUpToolBase::m_firstXing
protectedinherited
Initial value:
{this, "FirstXing", -999,
"First bunch-crossing in which det is live"}

Definition at line 54 of file PileUpToolBase.h.

54 {this, "FirstXing", -999,
55 "First bunch-crossing in which det is live"};

◆ m_key_DigitCollection

std::string ALFA_PileUpTool::m_key_DigitCollection
private

Definition at line 92 of file ALFA_PileUpTool.h.

◆ m_key_ODDigitCollection

std::string ALFA_PileUpTool::m_key_ODDigitCollection
private

Definition at line 93 of file ALFA_PileUpTool.h.

◆ m_lastXing

Gaudi::Property<int> PileUpToolBase::m_lastXing
protectedinherited
Initial value:
{this, "LastXing", 999,
"Last bunch-crossing in which det is live"}

Definition at line 56 of file PileUpToolBase.h.

56 {this, "LastXing", 999,
57 "Last bunch-crossing in which det is live"};

◆ m_mean

double ALFA_PileUpTool::m_mean {}
private

Definition at line 103 of file ALFA_PileUpTool.h.

103{};

◆ m_meanE_dep

double ALFA_PileUpTool::m_meanE_dep {}
private

Definition at line 101 of file ALFA_PileUpTool.h.

101{};

◆ m_meanN_photo

double ALFA_PileUpTool::m_meanN_photo {}
private

Definition at line 102 of file ALFA_PileUpTool.h.

102{};

◆ m_mergedALFA_HitList

ALFA_HitCollection* ALFA_PileUpTool::m_mergedALFA_HitList {}
private

Definition at line 107 of file ALFA_PileUpTool.h.

107{};

◆ m_mergedALFA_ODHitList

ALFA_ODHitCollection* ALFA_PileUpTool::m_mergedALFA_ODHitList {}
private

Definition at line 108 of file ALFA_PileUpTool.h.

108{};

◆ m_mergeSvc

ServiceHandle<PileUpMergeSvc> ALFA_PileUpTool::m_mergeSvc {this, "mergeSvc", "PileUpMergeSvc", ""}
private

Definition at line 82 of file ALFA_PileUpTool.h.

82{this, "mergeSvc", "PileUpMergeSvc", ""};

◆ m_ODdigitCollection

ALFA_ODDigitCollection* ALFA_PileUpTool::m_ODdigitCollection {}
private

Definition at line 96 of file ALFA_PileUpTool.h.

96{};

◆ m_randomStreamName

Gaudi::Property<std::string> ALFA_PileUpTool::m_randomStreamName {this, "RandomStreamName", "ALFARndEng", ""}
private

Definition at line 84 of file ALFA_PileUpTool.h.

84{this, "RandomStreamName", "ALFARndEng", ""};

◆ m_randomSvc

ServiceHandle<IAthRNGSvc> ALFA_PileUpTool::m_randomSvc {this, "RndmSvc", "AthRNGSvc", ""}
private

Definition at line 83 of file ALFA_PileUpTool.h.

83{this, "RndmSvc", "AthRNGSvc", ""};

◆ m_sigma0

double ALFA_PileUpTool::m_sigma0 {}
private

Definition at line 99 of file ALFA_PileUpTool.h.

99{};

◆ m_sigma1

double ALFA_PileUpTool::m_sigma1 {}
private

Definition at line 100 of file ALFA_PileUpTool.h.

100{};

◆ m_SimHitCollectionName

std::string ALFA_PileUpTool::m_SimHitCollectionName
private

Definition at line 90 of file ALFA_PileUpTool.h.

◆ m_SimODHitCollectionName

std::string ALFA_PileUpTool::m_SimODHitCollectionName
private

Definition at line 91 of file ALFA_PileUpTool.h.

◆ m_stdDev

double ALFA_PileUpTool::m_stdDev {}
private

Definition at line 104 of file ALFA_PileUpTool.h.

104{};

◆ m_vetoPileUpTruthLinks

Gaudi::Property<int> PileUpToolBase::m_vetoPileUpTruthLinks
protectedinherited
Initial value:
{this, "VetoPileUpTruthLinks", true,
"Ignore links to suppressed pile-up truth"}

Definition at line 58 of file PileUpToolBase.h.

58 {this, "VetoPileUpTruthLinks", true,
59 "Ignore links to suppressed pile-up truth"};

The documentation for this class was generated from the following files: