ATLAS Offline Software
AFP_PileUpTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
9 #include "xAODForward/AFPSiHit.h"
10 #include "xAODForward/AFPToFHit.h"
14 #include "CLHEP/Random/RandomEngine.h"
15 #include "CLHEP/Random/RandFlat.h"
16 #include "CLHEP/Random/RandGaussQ.h"
17 #include "CLHEP/Random/RandPoissonQ.h"
18 
20  const std::string& name,
21  const IInterface* parent) :
23  m_totToChargeTransformation ("totToChargeTransformation", "1909 + x*363 + x*x*141"),
24  m_ArrSize(645120)
25 {
26 }
27 
28 
30 {
31  ATH_MSG_INFO("AFP_PileUpTool::initialize() called");
32  ATH_MSG_INFO(" CollectionEff: " << m_CollectionEff);
33 
34  // Setting up quantum efficincy of PMT (in 5 nm steps)
36 
37  m_deposited_charge.resize(m_ArrSize, 0.f); // = 4 x 6 x 336 x 80
38  m_deposited_energy.resize(m_ArrSize, 0.f);
39 
40  // Offsets for TOF TDC (to have the average TDC consistent between all trains and bars)
41  for(int i=0; i<4; ++i){
42  for(int j=0; j<4; ++j){
43  for(int k=0; k<4; ++k){
44  m_TDC_offsets[i][j][k] = 0.0;
45  }
46  }
47  }
49 
50  m_totToChargeTransformation=TF1(m_totToChargeTransfName.toString().c_str(), m_totToChargeTransfExpr.toString().c_str());
51  for(int i=0; i<16; ++i)
53 
54  m_deposited_charge = std::vector<float>(m_ArrSize);
55  m_deposited_energy = std::vector<float>(m_ArrSize);
56 
57  m_SignalVect = std::vector<double>( 2*static_cast<unsigned int>( m_TofSignalTimeRangeLength ) );
58  for(unsigned int i=0; i<m_SignalVect.size(); ++i)
59  {
61  }
62 
63  for( int i=0; i<4; i++) {
64  for( int j=0; j<4; j++) {
65  for( int k=0; k<4; k++) {
66  // NOTE the signal histograms and the methods processing those signals assume that 1 bin = 1 ps
67  m_SignalHist[i][j][k] = TH1F(Form("m_SignalHist%d%d%d", i, j, k), "", m_TofSignalTimeRangeLength, 0, m_TofSignalTimeRangeLength);
68  }
69  }
70  }
71 
72  ATH_CHECK(m_randomSvc.retrieve());
73  ATH_MSG_DEBUG("Retrieved RandomNumber Service");
74 
76  ATH_CHECK(m_mergeSvc.retrieve());
77  ATH_MSG_DEBUG("Retrieved PileUpMergeSvc");
78  }
79 
80 
81  m_mergedTDSimHitList = AFP_TDSimHitCollection("mergedTDSimHitList");
82  m_mergedSIDSimHitList = AFP_SIDSimHitCollection("mergedSIDSimHitList");
83 
84  // check the input object names
85  if (m_TDSimHitCollectionKey.key().empty()) {
86  ATH_MSG_FATAL("Property TDSimHitCollectionName not set !");
87  return StatusCode::FAILURE;
88  }
89  if (m_SIDSimHitCollectionKey.key().empty()) {
90  ATH_MSG_FATAL("Property SIDSimHitCollectionName not set !");
91  return StatusCode::FAILURE;
92  }
93 
94  // Initialize ReadHandleKeys
95  ATH_CHECK(m_TDSimHitCollectionKey.initialize());
96  ATH_CHECK(m_SIDSimHitCollectionKey.initialize());
97 
98  ATH_MSG_INFO("m_onlyUseContainerName = " <<m_onlyUseContainerName);
100  {
102  ATH_MSG_INFO("Input TD SimHits in container : '" <<m_TDSimHitCollectionName << "'");
104  ATH_MSG_INFO("Input SID SimHits in container : '" <<m_SIDSimHitCollectionName << "'");
105  }
106  else
107  {
108  ATH_MSG_INFO("TD SimHits container key: " <<m_TDSimHitCollectionKey);
109  ATH_MSG_INFO("SID SimHits container key: " <<m_SIDSimHitCollectionKey);
110  }
111 
112  ATH_CHECK(m_TDDigiCollectionKey.initialize());
113  ATH_CHECK(m_SiDigiCollectionKey.initialize());
114 
115  ATH_CHECK(m_AFPSiHitsContainerName.initialize());
116  ATH_CHECK(m_AFPHitsContainerNameToF.initialize());
117 
118  return StatusCode::SUCCESS;
119 }
120 
121 
122 StatusCode AFP_PileUpTool::recoAll(const EventContext& ctx, std::unique_ptr<AFP_TDDigiCollection>& digitCollection, std::unique_ptr<AFP_SiDigiCollection>& siDigiCollection) const
123 {
124  ATH_CHECK( recoSiHits(ctx, siDigiCollection) );
125  ATH_CHECK( recoToFHits(ctx, digitCollection) );
126 
127  return StatusCode::SUCCESS;
128 }
129 
130 
131 StatusCode AFP_PileUpTool::recoSiHits(const EventContext& ctx, std::unique_ptr<AFP_SiDigiCollection>& siDigiCollection) const
132 {
133  auto afpSiHits=std::make_unique<xAOD::AFPSiHitContainer>();
134  auto afpSiHitsAux=std::make_unique<xAOD::AFPSiHitAuxContainer>();
135  afpSiHits->setStore(afpSiHitsAux.get());
136 
137  newXAODHitSi(afpSiHits, siDigiCollection);
138 
139  ATH_MSG_DEBUG("AFP_PileUpTool: after newXAODHitSi, simulated digi container size = "<<siDigiCollection->size()<<", got afpSiHits with size "<<afpSiHits->size());
140 
142  ATH_CHECK( siHitContainer.record(std::move(afpSiHits), std::move(afpSiHitsAux)) );
143 
144  return StatusCode::SUCCESS;
145 }
146 
147 
149 {
150  int i = 0;
151  do{
152  if( ch < m_ChargeVsTot_LUT[i] ) break;
153  else ++i;
154  } while( i<16 );
155  return i;
156 }
157 
158 
159 inline int AFP_PileUpTool::tot2charge(int tot) const
160 {
161  return tot>0 ? static_cast<int>( m_totToChargeTransformation.Eval(tot) ) : 0;
162 }
163 
164 
165 void AFP_PileUpTool::newXAODHitSi (std::unique_ptr<xAOD::AFPSiHitContainer>& siHitContainer, std::unique_ptr<AFP_SiDigiCollection>& container) const
166 {
167  AFP_SiDigiConstIter it = container->begin();
168  AFP_SiDigiConstIter itend = container->end();
169 
170  for (; it != itend; ++it) {
171  auto * xAODSiHit = siHitContainer->push_back(std::make_unique<xAOD::AFPSiHit>());
172 
173  xAODSiHit->setStationID(it->m_nStationID);
174  xAODSiHit->setPixelLayerID(it->m_nDetectorID);
175  xAODSiHit->setPixelColIDChip(80-it->m_nPixelRow); // Chip is rotated by 90 degree Row-->Col
176  xAODSiHit->setPixelRowIDChip(336-it->m_nPixelCol); // Chip is rotated by 90 degree Col-->Row
177  xAODSiHit->setDepositedCharge( it->m_fADC );
178  int tot = charge2tot( it->m_fADC );
179  tot = tot<16 ? tot : 16;
180  xAODSiHit->setTimeOverThreshold( tot );
181  }
182 }
183 
184 
185 StatusCode AFP_PileUpTool::recoToFHits(const EventContext& ctx, std::unique_ptr<AFP_TDDigiCollection>& digitCollection) const
186 {
187  auto afpToFHits=std::make_unique<xAOD::AFPToFHitContainer>();
188  auto afpToFHitsAux=std::make_unique<xAOD::AFPToFHitAuxContainer>();
189  afpToFHits->setStore(afpToFHitsAux.get());
190 
191  newXAODHitToF(afpToFHits, digitCollection);
192 
193  ATH_MSG_DEBUG("AFP_PileUpTool: after recoToFHits, simulated TD digi container size = "<<digitCollection->size()<<", got afpToFHits with size "<<afpToFHits->size());
194 
196  ATH_CHECK(ToFHitsContainer.record(std::move(afpToFHits),std::move(afpToFHitsAux)));
197 
198  return StatusCode::SUCCESS;
199 }
200 
201 
202 void AFP_PileUpTool::newXAODHitToF (std::unique_ptr<xAOD::AFPToFHitContainer>& tofHitContainer, std::unique_ptr<AFP_TDDigiCollection>& container) const
203 {
204  AFP_TDDigiConstIter it = container->begin();
205  AFP_TDDigiConstIter itend = container->end();
206 
207  for (; it != itend; ++it) {
208  auto * xAODToFHit = tofHitContainer->push_back(std::make_unique<xAOD::AFPToFHit>());
209  xAODToFHit->setStationID(it->m_nStationID);
210  xAODToFHit->setHptdcChannel(-1);
211  xAODToFHit->setBarInTrainID(it->m_nDetectorID%10-1);
212  xAODToFHit->setTrainID(it->m_nDetectorID/10-1);
213  xAODToFHit->setHptdcID(-1);
214  xAODToFHit->setPulseLength(it->m_fADC);
215  xAODToFHit->setTime(it->m_fTDC);
216  }
217 }
218 
219 
221 {
222  ATH_MSG_DEBUG ( "AFP_PileUpTool::processAllSubEvents()" );
223 
224  using TimedTDSimHitCollList = PileUpMergeSvc::TimedList<AFP_TDSimHitCollection>::type;
225  using TimedSIDSimHitCollList = PileUpMergeSvc::TimedList<AFP_SIDSimHitCollection>::type;
226 
227  TimedHitCollection<AFP_TDSimHit> thpcAFP_TDPmt;
228  TimedHitCollection<AFP_SIDSimHit> thpcAFP_SiPmt;
229 
230  if (!m_onlyUseContainerName) {
232  if (!hitCollection.isValid()) {
233  ATH_MSG_ERROR("Could not get AFP_TDSimHitCollection container " << hitCollection.name() << " from store " << hitCollection.store());
234  return StatusCode::FAILURE;
235  }
236 
237  // create a new hits collection
238  thpcAFP_TDPmt = TimedHitCollection<AFP_TDSimHit>(1);
239  thpcAFP_TDPmt.insert(0, hitCollection.cptr());
240  ATH_MSG_DEBUG("AFP_TDSimHitCollection found with " << hitCollection->size() << " hits");
241  }
242  else {
243  TimedTDSimHitCollList TDSimHitCollList;
244  unsigned int numberOfTDSimHits{0};
245  if (not (m_mergeSvc->retrieveSubEvtsData(m_TDSimHitCollectionName, TDSimHitCollList, numberOfTDSimHits).isSuccess()) and TDSimHitCollList.empty()) {
246  ATH_MSG_FATAL ( "Could not fill TimedTDSimHitCollList" );
247  return StatusCode::FAILURE;
248  }
249  ATH_MSG_DEBUG ( " PileUp: Merge " << TDSimHitCollList.size() << " AFP_TDSimHitCollections with key " << m_TDSimHitCollectionName << " found." );
250 
251  TimedTDSimHitCollList::iterator iColl (TDSimHitCollList.begin());
252  TimedTDSimHitCollList::iterator endColl(TDSimHitCollList.end());
253 
254  while (iColl != endColl) {
255  const AFP_TDSimHitCollection* tmpColl(iColl->second);
256  thpcAFP_TDPmt.insert(iColl->first, tmpColl);
257  ATH_MSG_DEBUG ( " AFP_TDSimHitCollection found with " << tmpColl->size() << " hits " << iColl->first );
258  ++iColl;
259  }
260  }
261 
262  if (!m_onlyUseContainerName) {
264  if (!hitCollection.isValid()) {
265  ATH_MSG_ERROR("Could not get AFP_SIDSimHitCollection container " << hitCollection.name() << " from store " << hitCollection.store());
266  return StatusCode::FAILURE;
267  }
268 
269  // create a new hits collection
270  thpcAFP_SiPmt = TimedHitCollection<AFP_SIDSimHit>(1);
271  thpcAFP_SiPmt.insert(0, hitCollection.cptr());
272  ATH_MSG_DEBUG("AFP_SIDSimHitCollection found with " << hitCollection->size() << " hits");
273  }
274  else {
275  TimedSIDSimHitCollList SIDSimHitCollList;
276  unsigned int numberOfSIDSimHits{0};
277  if (not (m_mergeSvc->retrieveSubEvtsData(m_SIDSimHitCollectionName, SIDSimHitCollList, numberOfSIDSimHits).isSuccess()) and SIDSimHitCollList.empty()) {
278  ATH_MSG_FATAL ( "Could not fill TimedSIDSimHitCollList" );
279  return StatusCode::FAILURE;
280  }
281  ATH_MSG_DEBUG ( " PileUp: Merge " << SIDSimHitCollList.size() << " AFP_SIDSimHitCollections with key " << m_SIDSimHitCollectionName << " found." );
282 
283  TimedSIDSimHitCollList::iterator iSiColl (SIDSimHitCollList.begin());
284  TimedSIDSimHitCollList::iterator endSiColl(SIDSimHitCollList.end());
285 
286  while (iSiColl != endSiColl) {
287  const AFP_SIDSimHitCollection* tmpSiColl(iSiColl->second);
288  thpcAFP_SiPmt.insert(iSiColl->first, tmpSiColl);
289  ATH_MSG_DEBUG ( " AFP_SIDSimHitCollection found with " << tmpSiColl->size() << " hits " << iSiColl->first );
290  ++iSiColl;
291  }
292  }
293 
294  ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
295  rngWrapper->setSeed( m_randomStreamName, ctx );
296  CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
297 
298  std::unique_ptr<AFP_TDDigiCollection> digitCollection = std::make_unique<AFP_TDDigiCollection>();
299  std::unique_ptr<AFP_SiDigiCollection> siDigiCollection = std::make_unique<AFP_SiDigiCollection>();
300 
301  ATH_CHECK(fillTDDigiCollection(thpcAFP_TDPmt, rngEngine, ctx, digitCollection));
302  ATH_CHECK(fillSiDigiCollection(thpcAFP_SiPmt, ctx, siDigiCollection));
303 
304  ATH_CHECK( recoAll(ctx, digitCollection, siDigiCollection) );
305 
307  ATH_CHECK( digitWriteHandle.record(std::move(digitCollection)) );
308 
310  ATH_CHECK( siDigiWriteHandle.record(std::move(siDigiCollection)) );
311 
312  return StatusCode::SUCCESS;
313 }
314 
315 
316 StatusCode AFP_PileUpTool::prepareEvent(const EventContext& /*ctx*/, const unsigned int nInputEvents)
317 {
318  ATH_MSG_DEBUG ( "AFP_PileUpTool::prepareEvent() called for " << nInputEvents << " input events" );
319 
320  m_digitCollection = std::make_unique<AFP_TDDigiCollection>();
322 
323  m_SiDigiCollection = std::make_unique<AFP_SiDigiCollection>();
325 
326  return StatusCode::SUCCESS;
327 }
328 
329 
331 {
332  ATH_MSG_DEBUG ( "AFP_PileUpTool::processBunchXing() " << bunchXing );
333  SubEventIterator iEvt = bSubEvents;
334  for (; iEvt!=eSubEvents; ++iEvt) {
335  StoreGateSvc& seStore = *iEvt->ptr()->evtStore();
336  ATH_MSG_VERBOSE ("SubEvt StoreGate " << seStore.name() << " :"
337  << " bunch crossing : " << bunchXing
338  << " time offset : " << iEvt->time()
339  << " event number : " << iEvt->ptr()->eventNumber()
340  << " run number : " << iEvt->ptr()->runNumber()
341  );
342 
343  const AFP_TDSimHitCollection* tmpColl = nullptr;
344 
345  if (!seStore.retrieve(tmpColl, m_TDSimHitCollectionName).isSuccess()) {
346  ATH_MSG_ERROR ( "SubEvent AFP_TDSimHitCollection not found in StoreGate " << seStore.name() );
347  return StatusCode::FAILURE;
348  }
349 
350  ATH_MSG_DEBUG ( "AFP_TDSimHitCollection found with " << tmpColl->size() << " hits" );
351 
354 
355  for (; iPmt!=ePmt; ++iPmt) m_mergedTDSimHitList.push_back((*iPmt));
356 
357  const AFP_SIDSimHitCollection* tmpSiColl = nullptr;
358 
359  if (!seStore.retrieve(tmpSiColl, m_SIDSimHitCollectionName).isSuccess()) {
360  ATH_MSG_ERROR ( "SubEvent AFP_SIDSimHitCollection not found in StoreGate " << seStore.name() );
361  return StatusCode::FAILURE;
362  }
363 
364  ATH_MSG_DEBUG ( "AFP_TDSimHitCollection found with " << tmpSiColl->size() << " hits" );
365 
366  AFP_SIDSimHitCollection::const_iterator iSiPmt = tmpSiColl->begin();
367  AFP_SIDSimHitCollection::const_iterator eSiPmt = tmpSiColl->end();
368 
369  for (; iSiPmt!=eSiPmt; ++iSiPmt) m_mergedSIDSimHitList.push_back((*iSiPmt));
370  }
371 
372  return StatusCode::SUCCESS;
373 }
374 
375 
376 StatusCode AFP_PileUpTool::mergeEvent(const EventContext& ctx)
377 {
378  ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
379  rngWrapper->setSeed( m_randomStreamName, ctx );
380  CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
381 
384 
386  ATH_CHECK( digitWriteHandle.record(std::move(m_digitCollection)) );
387 
389  ATH_CHECK( siDigiWriteHandle.record(std::move(m_SiDigiCollection)) );
390 
391  return StatusCode::SUCCESS;
392 }
393 
394 
396 {
397  return StatusCode::SUCCESS;
398 }
399 
400 
402 {
403  for( int i=0; i<4; i++) {
404  for( int j=0; j<4; j++) {
405  for( int k=0; k<4; k++) {
406  m_SignalHist[i][j][k].Reset();
407  }
408  }
409  }
410 }
411 
412 
413 StatusCode AFP_PileUpTool::fillTDDigiCollection(TimedHitCollection<AFP_TDSimHit>& thpcAFP, CLHEP::HepRandomEngine* rndEngine, const EventContext& ctx, std::unique_ptr<AFP_TDDigiCollection>& digitCollection)
414 {
416 
417  TimedHitCollection<AFP_TDSimHit> thpc = thpcAFP;
419 
420  while (thpc.nextDetectorElement(i, e)) {
421  for (it = i; it != e; ++it) {
422  int Station = (*it)->m_nStationID;
423  int Detector = (*it)->m_nDetectorID;
424  int SensitiveElement = (*it)->m_nSensitiveElementID;
425  float GlobalTime = (*it)->m_fGlobalTime;
426  float WaveLength = (*it)->m_fWaveLength;
427 
428  if(SensitiveElement%2 == 1) createTDDigi(Station, Detector, SensitiveElement, GlobalTime, WaveLength, rndEngine);
429  }
430  }
431 
432  ATH_CHECK(StoreTDDigi(ctx, digitCollection));
433  return StatusCode::SUCCESS;
434 }
435 
436 
437 StatusCode AFP_PileUpTool::fillTDDigiCollection(AFP_TDSimHitCollection& AFP_TDSimHitColl, CLHEP::HepRandomEngine* rndEngine, const EventContext& ctx)
438 {
440 
441  AFP_TDSimHitConstIter it = AFP_TDSimHitColl.begin();
442  AFP_TDSimHitConstIter itend = AFP_TDSimHitColl.end();
443 
444  for (; it != itend; ++it) {
445  int Station = it->m_nStationID;
446  int Detector = it->m_nDetectorID;
447  int SensitiveElement = it->m_nSensitiveElementID;
448  float GlobalTime = it->m_fGlobalTime;
449  float WaveLength = it->m_fWaveLength;
450 
451  if(SensitiveElement%2 == 1) createTDDigi(Station, Detector, SensitiveElement, GlobalTime, WaveLength, rndEngine);
452  }
453 
455 
456  return StatusCode::SUCCESS;
457 }
458 
459 
460 StatusCode AFP_PileUpTool::fillSiDigiCollection(TimedHitCollection<AFP_SIDSimHit>& thpcAFP, const EventContext& ctx, std::unique_ptr<AFP_SiDigiCollection>& siDigiCollection)
461 {
462  TimedHitCollection<AFP_SIDSimHit> thpc = thpcAFP;
464 
465  m_deposited_charge.assign(m_ArrSize, 0.f); // here just 6 layers per detector are considered
466 
467  while (thpc.nextDetectorElement(i, e)) {
468  for (it = i; it != e; ++it) {
469  int Station = (*it)->m_nStationID;
470  int Detector = (*it)->m_nDetectorID;
471  int PixelRow = (*it)->m_nPixelRow;
472  int PixelCol = (*it)->m_nPixelCol;
473  float PreStepX = (*it)->m_fPreStepX;
474  float PreStepY = (*it)->m_fPreStepY;
475  float PreStepZ = (*it)->m_fPreStepZ;
476  float PostStepX = (*it)->m_fPostStepX;
477  float PostStepY = (*it)->m_fPostStepY;
478  float PostStepZ = (*it)->m_fPostStepZ;
479  float DepEnergy = (*it)->m_fEnergyDeposit;
480 
481  createSiDigi(ctx, Station, Detector, PixelRow, PixelCol, PreStepX, PreStepY, PreStepZ, PostStepX, PostStepY, PostStepZ, DepEnergy);
482  }
483  }
484  ATH_CHECK(StoreSiDigi(ctx, siDigiCollection));
485  return StatusCode::SUCCESS;
486 }
487 
488 
489 StatusCode AFP_PileUpTool::fillSiDigiCollection(AFP_SIDSimHitCollection& AFP_SIDSimHitColl, const EventContext& ctx)
490 {
491  AFP_SIDSimHitConstIter it = AFP_SIDSimHitColl.begin();
492  AFP_SIDSimHitConstIter itend = AFP_SIDSimHitColl.end();
493 
494  m_deposited_charge.assign(m_ArrSize, 0.f); // here just 6 layers per detector are considered
495 
496  for (; it != itend; ++it) {
497  int Station = it->m_nStationID;
498  int Detector = it->m_nDetectorID;
499  int PixelRow = it->m_nPixelRow;
500  int PixelCol = it->m_nPixelCol;
501  float PreStepX = it->m_fPreStepX;
502  float PreStepY = it->m_fPreStepY;
503  float PreStepZ = it->m_fPreStepZ;
504  float PostStepX = it->m_fPostStepX;
505  float PostStepY = it->m_fPostStepY;
506  float PostStepZ = it->m_fPostStepZ;
507  float DepEnergy = it->m_fEnergyDeposit;
508 
509  createSiDigi(ctx, Station, Detector, PixelRow, PixelCol, PreStepX, PreStepY, PreStepZ, PostStepX, PostStepY, PostStepZ, DepEnergy);
510  }
512  return StatusCode::SUCCESS;
513 }
514 
515 
516 bool AFP_PileUpTool::isPhotoelectronInduced(double lambda, CLHEP::HepRandomEngine* rndEngine) const
517 {
518  double qEff = getQE( lambda );
519  return CLHEP::RandFlat::shoot(rndEngine, 0.0, 1.0) < qEff*m_CollectionEff;
520 }
521 
522 
523 void AFP_PileUpTool::addPhotoconvTimeSmear(double & t, CLHEP::HepRandomEngine* rndEngine) const
524 {
525  t += CLHEP::RandGaussQ::shoot(rndEngine, 5.* m_ConversionSpr, m_ConversionSpr);
526 }
527 
528 
529 void AFP_PileUpTool::createTDDigi(int Station, int Detector, int SensitiveElement, float GlobalTime, float WaveLength, CLHEP::HepRandomEngine* rndEngine)
530 {
531  ATH_MSG_DEBUG ( " iterating Pmt " << Station << " " << Detector << " " << SensitiveElement << " " << GlobalTime << " " << WaveLength );
532 
533  if ( Station >3 || Station < 0 || Detector >49 || Detector < 10 || (SensitiveElement-1)/2>1 || (SensitiveElement-1)/2<0) {
534  ATH_MSG_ERROR ( "Wrong station, detector or sensitive detector id" );
535  return;
536  }
537 
538  if( isPhotoelectronInduced(WaveLength, rndEngine) )
539  {
540  const int train = Detector/10 - 1;
541  const int bar = Detector%10-1;
542  //check index value against array extent
543  if (train<0 or train >3 or bar<0 or bar>3){
544  ATH_MSG_ERROR ( "Wrong train or bar; allowed values are 0-3, actual values "<<train<<", "<<bar);
545  return;
546  }
547 
548  double photoelectronTime = GlobalTime - m_TimeOffset - m_TDC_offsets[Station][train][bar];
549  addPhotoconvTimeSmear( photoelectronTime, rndEngine );
550  addSignalFunc( m_SignalHist[Station][train][bar], photoelectronTime );
551  }
552 }
553 
554 
555 double AFP_PileUpTool::getTDC(const TH1F & hSignal) const
556 {
557  const int nBinsDelay = static_cast<int>(m_CfSignalDelay); // assuming that 1 bin = 1 ps
558  TH1F hSignal_delayed(hSignal);
559  for(int l = hSignal.GetNbinsX(); l>0; l-- ){
560  double val = l > nBinsDelay ? hSignal.GetBinContent(l-nBinsDelay) : 0;
561  hSignal_delayed.SetBinContent(l, val);
562  }
563  TH1F hSignal_forTDC(hSignal);
564  hSignal_forTDC.Add(&hSignal, &hSignal_delayed, -m_CfdThr, 1);
565 
566  const int bin = hSignal_forTDC.FindFirstBinAbove(0);
567  double TDC = hSignal_forTDC.GetBinCenter( bin );
568  if( bin-1 <= nBinsDelay ) // very erly signals
569  TDC = 0;
570  return TDC;
571 }
572 
573 
574 double AFP_PileUpTool::getADC(const TH1F & hSignal, const double threshold) const
575 {
576  int first = hSignal.FindFirstBinAbove(threshold);
577  int last = first;
578  while( hSignal.GetBinContent(++last) > threshold && last < hSignal.GetNbinsX() );
579  double ADC = last-first;
580  return ADC;
581 }
582 
583 
584 StatusCode AFP_PileUpTool::StoreTDDigi(const EventContext& /*ctx*/, std::unique_ptr<AFP_TDDigiCollection>& digitCollection) const
585 {
586  for( int i=0; i<4; i++) {
587  for( int j=0; j<4; j++) {
588  for( int k=0; k<4; k++){
589 
590  const TH1F & hSignal = m_SignalHist[i][j][k];
591  const double peakVal = hSignal.GetBinContent( hSignal.GetMaximumBin() );
592 
593  if( peakVal > 2 /*signal from more than two photoel.*/ ){
594 
595  const double TDC = getTDC( hSignal );
596  const double ADC = getADC( hSignal, 0.5*peakVal );
597 
598  AFP_TDDigi tddigi;
599  tddigi.m_nStationID=i;
600  tddigi.m_nDetectorID=10*(j+1)+k+1; // restoring original numeration of bars and trains
601  tddigi.m_nSensitiveElementID=-1; // this variable is currently redundant
602  tddigi.m_fADC=ADC;
603  tddigi.m_fTDC=TDC;
604 
605  digitCollection->push_back(tddigi);
606  }
607  }
608  }
609  }
610 
611  return StatusCode::SUCCESS;
612 }
613 
614 
615 double AFP_PileUpTool::generateSiCCE(CLHEP::HepRandomEngine* rndEngine) const
616 {
617  double eff = CLHEP::RandGaussQ::shoot(rndEngine, m_SiT_ChargeCollEff, m_SiT_ChargeCollEffSigma);
618  eff = eff>1?1:eff;
619  eff = eff<0?0:eff;
620  return eff;
621 }
622 
623 
624 void AFP_PileUpTool::createSiDigi(const EventContext& ctx, int Station, int Detector, int PixelRow, int PixelCol, float PreStepX, float PreStepY, float PreStepZ, float PostStepX, float PostStepY, float PostStepZ, float DepEnergy)
625 {
626  ATH_MSG_DEBUG ( " iterating Pmt, station " << Station << ", detector " << Detector << ", pixel_col " << PixelCol << ", pixel_row " << PixelRow << ", dep_energy" << DepEnergy << " (x,y,z)_pre (" << PreStepX <<"," << PreStepY <<"," << PreStepZ <<"), (x,y,z)_post (" << PostStepX <<"," << PostStepY <<"," << PostStepZ <<")" );
627 
628  ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
629  rngWrapper->setSeed( m_randomStreamName, ctx );
630  CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
631 
632  double cce = generateSiCCE(rngEngine);
633  double depositedCharge = DepEnergy * cce * m_SiT_Energy2ChargeFactor;
634 
635  ATH_MSG_DEBUG ( "deposted charge for given hit " << depositedCharge );
636 
637  if ((PixelCol>=336) || (PixelRow >= 80) || (Station >= 4) || (Detector >= 6 ) )
638  {
639  if (Detector == 11)
640  {
641  ATH_MSG_DEBUG ( "Hit in the vacuum layer in front of the station " << Station );
642  }
643  else
644  {
645  ATH_MSG_WARNING ( "WRONG NUMBER of PIXEL coordinates or station or detector !!!:" );
646  ATH_MSG_WARNING ( "station [max 4] " << Station << ", detector [max 6]" << Detector << ", pixel_col [max 336] " << PixelCol << ", pixel_row [max 80] " << PixelRow );
647  }
648  return;
649  }
650 
651  m_deposited_charge[6*336*80*Station + 80*336*Detector + 80*PixelCol + PixelRow] += depositedCharge;
652  m_deposited_energy[6*336*80*Station + 80*336*Detector + 80*PixelCol + PixelRow] += DepEnergy;
653 }
654 
655 
656 inline double AFP_PileUpTool::generateSiNoise(CLHEP::HepRandomEngine* rndEngine) const
657 {
658  return CLHEP::RandGaussQ::shoot(rndEngine, m_SiT_NoiseMu, m_SiT_NoiseSigma);
659 }
660 
661 
662 StatusCode AFP_PileUpTool::StoreSiDigi(const EventContext& ctx, std::unique_ptr<AFP_SiDigiCollection>& siDigiCollection)
663 {
664  ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
665  rngWrapper->setSeed( m_randomStreamName, ctx );
666  CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
667 
668  long index = 0;
669  while ( index != m_ArrSize ) // here just 6 layers per detector are considered
670  {
671  // adding random noise
673 
675 
677  {
678  ATH_MSG_DEBUG ( " total # of pairs from dep_energy (with all effects included) " << m_deposited_charge[index]);
679  ATH_MSG_DEBUG ( " total # of pairs from dep_energy (true value)" << m_SiT_Energy2ChargeFactor*m_deposited_energy[index]);
680 
681  int station = static_cast<int>(index/(80*336*6));
682  int detector = static_cast<int>((index-station*80*336*6)/(80*336));
683  int column = static_cast<int>((index-station*80*336*6-detector*80*336)/80);
684  int row = static_cast<int>(index-station*80*336*6-detector*80*336-column*80);
685 
686  ATH_MSG_DEBUG ( " reversed mapping, station " << station << ", detector " << detector << ", pixel_col " << column << ", pixel_row " << row );
687 
688  AFP_SiDigi sidigi;
689 
690  sidigi.m_nStationID = station;
691  sidigi.m_nDetectorID = detector;
692  sidigi.m_nPixelCol = column;
693  sidigi.m_nPixelRow = row;
694  sidigi.m_fADC = tot2charge(tot);
695  sidigi.m_fTDC = 0.;
696 
697  siDigiCollection->push_back(sidigi);
698  }
699 
700  index++;
701  }
702 
703  return StatusCode::SUCCESS;
704 }
705 
706 
707 void AFP_PileUpTool::addSignalFunc(TH1F & h, double x) const
708 {
709  int xDiscrete = static_cast<int>(x);
710  int iMin = xDiscrete;
711  int iMax = h.GetNbinsX();
712  if(xDiscrete<0)
713  {
714  iMin = 0;
715  iMax = h.GetNbinsX() + xDiscrete - 1;
716  }
717  for(int i = iMin; i<=iMax; ++i){
718  h.SetBinContent(i, h.GetBinContent(i) + m_SignalVect[i-xDiscrete]);
719  }
720 }
721 
722 
723 double AFP_PileUpTool::getQE(double lambda) const
724 {
725  int id = (static_cast<int>(lambda)-200)/5;
726  if(id > 81 || id < 0) return 0;
727  return m_QuantumEff_PMT[id];
728 }
729 
730 
731 double AFP_PileUpTool::SignalFun(double Time, double RiseTime, double FallTime, double offset) const
732 {
733  double f=0;
734  Time -= offset;
735  if ( Time < 0) return f;
736  double p = (FallTime-RiseTime*TMath::Log(1.+FallTime/RiseTime))/TMath::Log(10.);
737  f = TMath::Power(Time/p,RiseTime/p)*TMath::Exp(-(Time/p));
738  f /= (TMath::Power(RiseTime/p,RiseTime/p)*TMath::Exp(-(RiseTime/p)));
739  return f;
740 }
741 
742 
744 {
745  m_TDC_offsets[0][0][0] = -65.125366;
746  m_TDC_offsets[0][0][1] = -78.942017;
747  m_TDC_offsets[0][0][2] = -92.000610;
748  m_TDC_offsets[0][0][3] = -87.115967;
749  m_TDC_offsets[0][1][0] = 21.883667;
750  m_TDC_offsets[0][1][1] = 10.356201;
751  m_TDC_offsets[0][1][2] = 2.336792;
752  m_TDC_offsets[0][1][3] = -9.625732;
753  m_TDC_offsets[0][2][0] = 46.980957;
754  m_TDC_offsets[0][2][1] = 45.204224;
755  m_TDC_offsets[0][2][2] = 53.081421;
756  m_TDC_offsets[0][2][3] = 43.045776;
757  m_TDC_offsets[0][3][0] = 90.227905;
758  m_TDC_offsets[0][3][1] = 84.472900;
759  m_TDC_offsets[0][3][2] = 81.739990;
760  m_TDC_offsets[0][3][3] = 74.882812;
761  m_TDC_offsets[3][0][0] = -23.122681;
762  m_TDC_offsets[3][0][1] = -16.655273;
763  m_TDC_offsets[3][0][2] = -35.254150;
764  m_TDC_offsets[3][0][3] = -27.525635;
765  m_TDC_offsets[3][1][0] = 45.818359;
766  m_TDC_offsets[3][1][1] = 46.052856;
767  m_TDC_offsets[3][1][2] = 58.809570;
768  m_TDC_offsets[3][1][3] = 49.068848;
769  m_TDC_offsets[3][2][0] = 67.897339;
770  m_TDC_offsets[3][2][1] = 78.327393;
771  m_TDC_offsets[3][2][2] = 72.782471;
772  m_TDC_offsets[3][2][3] = 69.975464;
773  m_TDC_offsets[3][3][0] = 96.650635;
774  m_TDC_offsets[3][3][1] = 97.994019;
775  m_TDC_offsets[3][3][2] = 88.561279;
776  m_TDC_offsets[3][3][3] = 79.530396;
777 }
778 
779 
781 {
782  switch(m_QEffVer){
783  case QE1:
784  {
785  // QE ver. 1
786  m_QuantumEff_PMT[0]=0.035;
787  m_QuantumEff_PMT[1]=0.047;
788  m_QuantumEff_PMT[3]=0.064;
789  m_QuantumEff_PMT[4]=0.084;
790  m_QuantumEff_PMT[5]=0.101;
791  m_QuantumEff_PMT[6]=0.114;
792  m_QuantumEff_PMT[7]=0.122;
793  m_QuantumEff_PMT[8]=0.128;
794  m_QuantumEff_PMT[9]=0.132;
795  m_QuantumEff_PMT[10]=0.134;
796  m_QuantumEff_PMT[11]=0.135;
797  m_QuantumEff_PMT[12]=0.138;
798  m_QuantumEff_PMT[13]=0.142;
799  m_QuantumEff_PMT[14]=0.146;
800  m_QuantumEff_PMT[15]=0.151;
801  m_QuantumEff_PMT[16]=0.158;
802  m_QuantumEff_PMT[17]=0.164;
803  m_QuantumEff_PMT[18]=0.171;
804  m_QuantumEff_PMT[19]=0.178;
805  m_QuantumEff_PMT[20]=0.185;
806  m_QuantumEff_PMT[21]=0.194;
807  m_QuantumEff_PMT[22]=0.203;
808  m_QuantumEff_PMT[23]=0.211;
809  m_QuantumEff_PMT[24]=0.217;
810  m_QuantumEff_PMT[25]=0.224;
811  m_QuantumEff_PMT[26]=0.229;
812  m_QuantumEff_PMT[27]=0.232;
813  m_QuantumEff_PMT[28]=0.235;
814  m_QuantumEff_PMT[29]=0.237;
815  m_QuantumEff_PMT[30]=0.240;
816  m_QuantumEff_PMT[31]=0.242;
817  m_QuantumEff_PMT[32]=0.244;
818  m_QuantumEff_PMT[33]=0.248;
819  m_QuantumEff_PMT[34]=0.250;
820  m_QuantumEff_PMT[35]=0.253;
821  m_QuantumEff_PMT[36]=0.256;
822  m_QuantumEff_PMT[37]=0.258;
823  m_QuantumEff_PMT[38]=0.260;
824  m_QuantumEff_PMT[39]=0.262;
825  m_QuantumEff_PMT[40]=0.262;
826  m_QuantumEff_PMT[41]=0.261;
827  m_QuantumEff_PMT[42]=0.257;
828  m_QuantumEff_PMT[43]=0.253;
829  m_QuantumEff_PMT[44]=0.250;
830  m_QuantumEff_PMT[45]=0.245;
831  m_QuantumEff_PMT[46]=0.240;
832  m_QuantumEff_PMT[47]=0.235;
833  m_QuantumEff_PMT[48]=0.230;
834  m_QuantumEff_PMT[49]=0.225;
835  m_QuantumEff_PMT[50]=0.221;
836  m_QuantumEff_PMT[51]=0.213;
837  m_QuantumEff_PMT[52]=0.203;
838  m_QuantumEff_PMT[53]=0.191;
839  m_QuantumEff_PMT[54]=0.179;
840  m_QuantumEff_PMT[55]=0.169;
841  m_QuantumEff_PMT[56]=0.161;
842  m_QuantumEff_PMT[57]=0.154;
843  m_QuantumEff_PMT[58]=0.147;
844  m_QuantumEff_PMT[59]=0.141;
845  m_QuantumEff_PMT[60]=0.138;
846  m_QuantumEff_PMT[61]=0.134;
847  m_QuantumEff_PMT[62]=0.129;
848  m_QuantumEff_PMT[63]=0.119;
849  m_QuantumEff_PMT[64]=0.103;
850  m_QuantumEff_PMT[65]=0.086;
851  m_QuantumEff_PMT[66]=0.072;
852  m_QuantumEff_PMT[67]=0.062;
853  m_QuantumEff_PMT[68]=0.055;
854  m_QuantumEff_PMT[69]=0.049;
855  m_QuantumEff_PMT[70]=0.045;
856  m_QuantumEff_PMT[71]=0.041;
857  m_QuantumEff_PMT[72]=0.037;
858  m_QuantumEff_PMT[73]=0.034;
859  m_QuantumEff_PMT[74]=0.031;
860  m_QuantumEff_PMT[75]=0.028;
861  m_QuantumEff_PMT[76]=0.025;
862  m_QuantumEff_PMT[77]=0.022;
863  m_QuantumEff_PMT[78]=0.020;
864  m_QuantumEff_PMT[79]=0.017;
865  m_QuantumEff_PMT[80]=0.015;
866  m_QuantumEff_PMT[81]=0.013;
867  break;
868  }
869  case QE2:
870  {
871  // QE ver. 2
872  m_QuantumEff_PMT[0]=0.042;
873  m_QuantumEff_PMT[1]=0.056;
874  m_QuantumEff_PMT[3]=0.075;
875  m_QuantumEff_PMT[4]=0.095;
876  m_QuantumEff_PMT[5]=0.110;
877  m_QuantumEff_PMT[6]=0.119;
878  m_QuantumEff_PMT[7]=0.123;
879  m_QuantumEff_PMT[8]=0.125;
880  m_QuantumEff_PMT[9]=0.126;
881  m_QuantumEff_PMT[10]=0.125;
882  m_QuantumEff_PMT[11]=0.125;
883  m_QuantumEff_PMT[12]=0.126;
884  m_QuantumEff_PMT[13]=0.130;
885  m_QuantumEff_PMT[14]=0.133;
886  m_QuantumEff_PMT[15]=0.137;
887  m_QuantumEff_PMT[16]=0.143;
888  m_QuantumEff_PMT[17]=0.148;
889  m_QuantumEff_PMT[18]=0.153;
890  m_QuantumEff_PMT[19]=0.159;
891  m_QuantumEff_PMT[20]=0.163;
892  m_QuantumEff_PMT[21]=0.170;
893  m_QuantumEff_PMT[22]=0.179;
894  m_QuantumEff_PMT[23]=0.187;
895  m_QuantumEff_PMT[24]=0.196;
896  m_QuantumEff_PMT[25]=0.204;
897  m_QuantumEff_PMT[26]=0.210;
898  m_QuantumEff_PMT[27]=0.215;
899  m_QuantumEff_PMT[28]=0.220;
900  m_QuantumEff_PMT[29]=0.225;
901  m_QuantumEff_PMT[30]=0.229;
902  m_QuantumEff_PMT[31]=0.232;
903  m_QuantumEff_PMT[32]=0.235;
904  m_QuantumEff_PMT[33]=0.239;
905  m_QuantumEff_PMT[34]=0.243;
906  m_QuantumEff_PMT[35]=0.247;
907  m_QuantumEff_PMT[36]=0.251;
908  m_QuantumEff_PMT[37]=0.252;
909  m_QuantumEff_PMT[38]=0.255;
910  m_QuantumEff_PMT[39]=0.257;
911  m_QuantumEff_PMT[40]=0.259;
912  m_QuantumEff_PMT[41]=0.260;
913  m_QuantumEff_PMT[42]=0.260;
914  m_QuantumEff_PMT[43]=0.261;
915  m_QuantumEff_PMT[44]=0.261;
916  m_QuantumEff_PMT[45]=0.260;
917  m_QuantumEff_PMT[46]=0.258;
918  m_QuantumEff_PMT[47]=0.256;
919  m_QuantumEff_PMT[48]=0.252;
920  m_QuantumEff_PMT[49]=0.249;
921  m_QuantumEff_PMT[50]=0.245;
922  m_QuantumEff_PMT[51]=0.241;
923  m_QuantumEff_PMT[52]=0.236;
924  m_QuantumEff_PMT[53]=0.229;
925  m_QuantumEff_PMT[54]=0.222;
926  m_QuantumEff_PMT[55]=0.213;
927  m_QuantumEff_PMT[56]=0.206;
928  m_QuantumEff_PMT[57]=0.199;
929  m_QuantumEff_PMT[58]=0.193;
930  m_QuantumEff_PMT[59]=0.186;
931  m_QuantumEff_PMT[60]=0.181;
932  m_QuantumEff_PMT[61]=0.177;
933  m_QuantumEff_PMT[62]=0.173;
934  m_QuantumEff_PMT[63]=0.165;
935  m_QuantumEff_PMT[64]=0.150;
936  m_QuantumEff_PMT[65]=0.129;
937  m_QuantumEff_PMT[66]=0.108;
938  m_QuantumEff_PMT[67]=0.092;
939  m_QuantumEff_PMT[68]=0.081;
940  m_QuantumEff_PMT[69]=0.073;
941  m_QuantumEff_PMT[70]=0.066;
942  m_QuantumEff_PMT[71]=0.060;
943  m_QuantumEff_PMT[72]=0.055;
944  m_QuantumEff_PMT[73]=0.050;
945  m_QuantumEff_PMT[74]=0.046;
946  m_QuantumEff_PMT[75]=0.041;
947  m_QuantumEff_PMT[76]=0.037;
948  m_QuantumEff_PMT[77]=0.033;
949  m_QuantumEff_PMT[78]=0.029;
950  m_QuantumEff_PMT[79]=0.025;
951  m_QuantumEff_PMT[80]=0.022;
952  m_QuantumEff_PMT[81]=0.019;
953  break;
954  }
955  default: break;
956  }
957 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AFP_PileUpTool::initialize
virtual StatusCode initialize() override final
Definition: AFP_PileUpTool.cxx:29
query_example.row
row
Definition: query_example.py:24
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
AFP_PileUpTool::m_TDSimHitCollectionKey
SG::ReadHandleKey< AFP_TDSimHitCollection > m_TDSimHitCollectionKey
Definition: AFP_PileUpTool.h:138
AFP_PileUpTool::StoreSiDigi
StatusCode StoreSiDigi(const EventContext &ctx, std::unique_ptr< AFP_SiDigiCollection > &siDigiCollection)
Definition: AFP_PileUpTool.cxx:662
AFP_SIDSimHitConstIter
AtlasHitsVector< AFP_SIDSimHit >::const_iterator AFP_SIDSimHitConstIter
Definition: AFP_SIDSimHitCollection.h:15
AFP_PileUpTool::m_SiT_NoiseMu
Gaudi::Property< double > m_SiT_NoiseMu
Definition: AFP_PileUpTool.h:159
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
AFP_PileUpTool::StoreTDDigi
StatusCode StoreTDDigi(const EventContext &ctx, std::unique_ptr< AFP_TDDigiCollection > &digitCollection) const
Definition: AFP_PileUpTool.cxx:584
MonDataType::ADC
@ ADC
AFP_PileUpTool::recoToFHits
StatusCode recoToFHits(const EventContext &ctx, std::unique_ptr< AFP_TDDigiCollection > &digitCollection) const
Creates xAOD for time-of-flight detector.
Definition: AFP_PileUpTool.cxx:185
AFP_PileUpTool::m_QuantumEff_PMT
double m_QuantumEff_PMT[82]
Definition: AFP_PileUpTool.h:170
AFP_PileUpTool::m_randomSvc
ServiceHandle< IAthRNGSvc > m_randomSvc
Definition: AFP_PileUpTool.h:134
AFP_PileUpTool::tot2charge
int tot2charge(int) const
Function that converts discrete time-over-threshold to discrete charge.
Definition: AFP_PileUpTool.cxx:159
AFP_PileUpTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: AFP_PileUpTool.cxx:376
AFP_PileUpTool::m_totToChargeTransfName
Gaudi::Property< std::string > m_totToChargeTransfName
Definition: AFP_PileUpTool.h:130
AFP_SiDigi::m_nPixelRow
int m_nPixelRow
Definition: AFP_SiDigi.h:20
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AFP_PileUpTool::m_totToChargeTransfExpr
Gaudi::Property< std::string > m_totToChargeTransfExpr
Function that transforms time-over-threshold to charge.
Definition: AFP_PileUpTool.h:129
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
AFP_PileUpTool::m_ArrSize
const int m_ArrSize
Definition: AFP_PileUpTool.h:174
AFP_PileUpTool::m_SiT_NoiseSigma
Gaudi::Property< double > m_SiT_NoiseSigma
Definition: AFP_PileUpTool.h:160
AFP_TDDigi::m_fADC
float m_fADC
Definition: AFP_TDDigi.h:15
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
AFP_PileUpTool::addPhotoconvTimeSmear
void addPhotoconvTimeSmear(double &, CLHEP::HepRandomEngine *) const
Modifies the hit time passed as an argument by the photoconversion time smearing.
Definition: AFP_PileUpTool.cxx:523
AFPToFHit.h
AtlasHitsVector< AFP_TDSimHit >
AFP_PileUpTool::m_TDC_offsets
double m_TDC_offsets[4][4][4]
Definition: AFP_PileUpTool.h:171
skel.it
it
Definition: skel.GENtoEVGEN.py:396
bin
Definition: BinsDiffFromStripMedian.h:43
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
AFP_PileUpTool::recoAll
StatusCode recoAll(const EventContext &ctx, std::unique_ptr< AFP_TDDigiCollection > &digitCollection, std::unique_ptr< AFP_SiDigiCollection > &siDigiCollection) const
Definition: AFP_PileUpTool.cxx:122
AFP_PileUpTool::setupQuantumEff
void setupQuantumEff()
Definition: AFP_PileUpTool.cxx:780
AFP_PileUpTool::m_SiT_ToTThresholdForHit
Gaudi::Property< int > m_SiT_ToTThresholdForHit
Definition: AFP_PileUpTool.h:162
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AFP_PileUpTool::m_ConversionSpr
Gaudi::Property< double > m_ConversionSpr
Definition: AFP_PileUpTool.h:150
AFP_PileUpTool::m_onlyUseContainerName
BooleanProperty m_onlyUseContainerName
Definition: AFP_PileUpTool.h:137
AFP_PileUpTool::newXAODHitSi
void newXAODHitSi(std::unique_ptr< xAOD::AFPSiHitContainer > &xAODSiHit, std::unique_ptr< AFP_SiDigiCollection > &collection) const
Method that creates a new AFPSiHit and sets it valus according to #digi collection.
Definition: AFP_PileUpTool.cxx:165
AtlasHitsVector::begin
const_iterator begin() const
Definition: AtlasHitsVector.h:131
x
#define x
AFP_PileUpTool::m_mergedSIDSimHitList
AFP_SIDSimHitCollection m_mergedSIDSimHitList
Definition: AFP_PileUpTool.h:168
TimedHitCollection::nextDetectorElement
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
AFP_SIDSimHitCollection
AtlasHitsVector< AFP_SIDSimHit > AFP_SIDSimHitCollection
Definition: AFP_SIDSimHitCollection.h:13
AFP_PileUpTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: AFP_PileUpTool.h:133
AtlasHitsVector< AFP_TDSimHit >::const_iterator
CONT::const_iterator const_iterator
Definition: AtlasHitsVector.h:43
AFP_PileUpTool::m_TimeOffset
Gaudi::Property< double > m_TimeOffset
Definition: AFP_PileUpTool.h:154
AtlasHitsVector::clear
void clear()
Definition: AtlasHitsVector.h:153
AFP_PileUpTool::QE1
@ QE1
Definition: AFP_PileUpTool.h:164
AFP_PileUpTool::QE2
@ QE2
Definition: AFP_PileUpTool.h:164
AFP_PileUpTool::generateSiNoise
double generateSiNoise(CLHEP::HepRandomEngine *rndEngine) const
Function that provides random noise (in charge units)
Definition: AFP_PileUpTool.cxx:656
AFP_TDSimHitCollection
AtlasHitsVector< AFP_TDSimHit > AFP_TDSimHitCollection
Definition: AFP_TDSimHitCollection.h:14
AthExHiveOpts.Time
Time
Definition: AthExHiveOpts.py:63
AFP_PileUpTool::m_deposited_energy
std::vector< float > m_deposited_energy
Definition: AFP_PileUpTool.h:176
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
AFP_PileUpTool::m_SignalHist
TH1F m_SignalHist[4][4][4]
array of histograms storing final signals in the PMTs
Definition: AFP_PileUpTool.h:182
AFP_PileUpTool::processBunchXing
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
Definition: AFP_PileUpTool.cxx:330
AFPSiHitAuxContainer.h
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AFPToFHitAuxContainer.h
AFP_PileUpTool::m_CfSignalDelay
Gaudi::Property< double > m_CfSignalDelay
Definition: AFP_PileUpTool.h:155
AFP_PileUpTool::fillTDDigiCollection
StatusCode fillTDDigiCollection(AFP_TDSimHitCollection &AFP_TDSimHitColl, CLHEP::HepRandomEngine *rndEngine, const EventContext &ctx)
Definition: AFP_PileUpTool.cxx:437
AFP_PileUpTool::getQE
double getQE(double) const
Provides quantum efficiency for given wavelength (in nm)
Definition: AFP_PileUpTool.cxx:723
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TimedHitCollection::insert
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
AFP_PileUpTool::m_SiT_ChargeCollEffSigma
Gaudi::Property< double > m_SiT_ChargeCollEffSigma
Definition: AFP_PileUpTool.h:158
lumiFormat.i
int i
Definition: lumiFormat.py:85
AFP_PileUpTool::m_RiseTime
Gaudi::Property< double > m_RiseTime
Definition: AFP_PileUpTool.h:151
AFP_PileUpTool::m_TofSignalTimeRangeLength
Gaudi::Property< double > m_TofSignalTimeRangeLength
Definition: AFP_PileUpTool.h:153
AFP_TDDigi
Definition: AFP_TDDigi.h:9
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AFP_PileUpTool::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Definition: AFP_PileUpTool.h:135
AFP_PileUpTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Definition: AFP_PileUpTool.cxx:220
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition: StoreGate/src/VarHandleBase.cxx:376
AFP_SiDigi::m_nPixelCol
int m_nPixelCol
Definition: AFP_SiDigi.h:21
AFP_SiDigi::m_fTDC
float m_fTDC
Definition: AFP_SiDigi.h:16
AFP_SiDigiConstIter
AtlasHitsVector< AFP_SiDigi >::const_iterator AFP_SiDigiConstIter
Definition: AFP_SiDigiCollection.h:15
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AFP_PileUpTool::m_SiDigiCollectionKey
SG::WriteHandleKey< AFP_SiDigiCollection > m_SiDigiCollectionKey
Definition: AFP_PileUpTool.h:145
jet::CompCategory::Detector
@ Detector
Definition: UncertaintyEnum.h:19
AFP_PileUpTool::m_digitCollection
std::unique_ptr< AFP_TDDigiCollection > m_digitCollection
Definition: AFP_PileUpTool.h:192
AFP_PileUpTool::getADC
double getADC(const TH1F &, const double) const
Returns the ADC determined from the signal shape passed as an (1st) argument; 2nd arg is peak value.
Definition: AFP_PileUpTool.cxx:574
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AFP_TDDigiConstIter
AtlasHitsVector< AFP_TDDigi >::const_iterator AFP_TDDigiConstIter
Definition: AFP_TDDigiCollection.h:15
hist_file_dump.f
f
Definition: hist_file_dump.py:135
AFP_PileUpTool::m_totToChargeTransformation
TF1 m_totToChargeTransformation
Definition: AFP_PileUpTool.h:131
AFP_PileUpTool::addSignalFunc
void addSignalFunc(TH1F &, double) const
Adds pre-calculated single photoelectron signal function stored in m_SignalVect to the passed histogr...
Definition: AFP_PileUpTool.cxx:707
AFP_PileUpTool::m_mergedTDSimHitList
AFP_TDSimHitCollection m_mergedTDSimHitList
Definition: AFP_PileUpTool.h:167
AFP_PileUpTool::m_CollectionEff
Gaudi::Property< double > m_CollectionEff
Definition: AFP_PileUpTool.h:149
AFP_TDSimHit.h
AFP_PileUpTool::m_FallTime
Gaudi::Property< double > m_FallTime
Definition: AFP_PileUpTool.h:152
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PileUpToolBase
Definition: PileUpToolBase.h:18
AFP_PileUpTool::newXAODHitToF
void newXAODHitToF(std::unique_ptr< xAOD::AFPToFHitContainer > &tofHitContainer, std::unique_ptr< AFP_TDDigiCollection > &collection) const
Method that creates a new AFPToFHit and sets it valus according to #digi collection.
Definition: AFP_PileUpTool.cxx:202
AFP_PileUpTool::m_QEffVer
Gaudi::Property< int > m_QEffVer
Definition: AFP_PileUpTool.h:165
AFP_PileUpTool::finalize
virtual StatusCode finalize() override final
Definition: AFP_PileUpTool.cxx:395
AFPSiHit.h
AFP_PileUpTool::createSiDigi
void createSiDigi(const EventContext &ctx, int Station, int Detector, int PixelRow, int PixelCol, float PreStepX, float PreStepY, float PreStepZ, float PostStepX, float PostStepY, float PostStepZ, float DepEnergy)
Definition: AFP_PileUpTool.cxx:624
python.SystemOfUnits.bar
int bar
Definition: SystemOfUnits.py:188
AFP_PileUpTool::m_ChargeVsTot_LUT
int m_ChargeVsTot_LUT[16]
Definition: AFP_PileUpTool.h:172
AFP_TDDigi::m_nStationID
int m_nStationID
Definition: AFP_TDDigi.h:18
AFP_PileUpTool::m_SIDSimHitCollectionKey
SG::ReadHandleKey< AFP_SIDSimHitCollection > m_SIDSimHitCollectionKey
Definition: AFP_PileUpTool.h:143
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
AFP_PileUpTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
threshold
Definition: chainparser.cxx:74
AFP_PileUpTool::m_CfdThr
Gaudi::Property< double > m_CfdThr
Definition: AFP_PileUpTool.h:156
AFP_PileUpTool::AFP_PileUpTool
AFP_PileUpTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: AFP_PileUpTool.cxx:19
AFP_PileUpTool::m_TDSimHitCollectionName
std::string m_TDSimHitCollectionName
Definition: AFP_PileUpTool.h:139
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
AFP_TDDigi::m_nSensitiveElementID
int m_nSensitiveElementID
Definition: AFP_TDDigi.h:20
AFP_PileUpTool::charge2tot
int charge2tot(int) const
Function that converts quasi-continous charge to discrete time-over-threshold.
Definition: AFP_PileUpTool.cxx:148
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
RNGWrapper.h
AFP_PileUpTool::m_AFPHitsContainerNameToF
SG::WriteHandleKey< xAOD::AFPToFHitContainer > m_AFPHitsContainerNameToF
Definition: AFP_PileUpTool.h:141
AFP_SiDigi::m_nDetectorID
int m_nDetectorID
Definition: AFP_SiDigi.h:19
AFP_PileUpTool::m_SiDigiCollection
std::unique_ptr< AFP_SiDigiCollection > m_SiDigiCollection
Definition: AFP_PileUpTool.h:193
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
AFP_PileUpTool::SignalFun
double SignalFun(double Time, double RiseTime, double FallTime, double offset=0.0) const
Definition: AFP_PileUpTool.cxx:731
AFP_PileUpTool::m_SIDSimHitCollectionName
std::string m_SIDSimHitCollectionName
Definition: AFP_PileUpTool.h:144
DeMoScan.index
string index
Definition: DeMoScan.py:364
AFP_PileUpTool::m_AFPSiHitsContainerName
SG::WriteHandleKey< xAOD::AFPSiHitContainer > m_AFPSiHitsContainerName
Definition: AFP_PileUpTool.h:146
AFP_PileUpTool::m_SignalVect
std::vector< double > m_SignalVect
vector with pre-calculated single signal from the photoelectron
Definition: AFP_PileUpTool.h:179
h
AFP_SiDigi::m_fADC
float m_fADC
Definition: AFP_SiDigi.h:15
AFP_PileUpTool::isPhotoelectronInduced
bool isPhotoelectronInduced(double, CLHEP::HepRandomEngine *) const
Returns random response if the photon of given wavelegth induces the photoelectron.
Definition: AFP_PileUpTool.cxx:516
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AtlasHitsVector::end
const_iterator end() const
Definition: AtlasHitsVector.h:134
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
TimedHitCollection::const_iterator
TimedVector::const_iterator const_iterator
Definition: TimedHitCollection.h:20
AFP_PileUpTool::resetSignalHistograms
void resetSignalHistograms()
Invokes Reset() on all m_SignalHist objects.
Definition: AFP_PileUpTool.cxx:401
AFP_PileUpTool::generateSiCCE
double generateSiCCE(CLHEP::HepRandomEngine *rndEngine) const
Function that provides charge collection efficiency.
Definition: AFP_PileUpTool.cxx:615
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
AFP_PileUpTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, const unsigned int nInputEvents) override final
called before the subevts loop. Not (necessarily) able to access SubEvents
Definition: AFP_PileUpTool.cxx:316
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
AFP_PileUpTool::fillSiDigiCollection
StatusCode fillSiDigiCollection(AFP_SIDSimHitCollection &AFP_SIDSimHitColl, const EventContext &ctx)
Definition: AFP_PileUpTool.cxx:489
AFP_TDDigi::m_nDetectorID
int m_nDetectorID
Definition: AFP_TDDigi.h:19
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
AFP_PileUpTool::m_SiT_Energy2ChargeFactor
Gaudi::Property< double > m_SiT_Energy2ChargeFactor
Definition: AFP_PileUpTool.h:161
AFP_PileUpTool::m_SiT_ChargeCollEff
Gaudi::Property< double > m_SiT_ChargeCollEff
Definition: AFP_PileUpTool.h:157
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
AFP_PileUpTool::recoSiHits
StatusCode recoSiHits(const EventContext &ctx, std::unique_ptr< AFP_SiDigiCollection > &siDigiCollection) const
Creates xAOD for silicon detector.
Definition: AFP_PileUpTool.cxx:131
AFP_PileUpTool::m_deposited_charge
std::vector< float > m_deposited_charge
Definition: AFP_PileUpTool.h:175
AFP_TDDigi::m_fTDC
float m_fTDC
Definition: AFP_TDDigi.h:16
AFP_PileUpTool::createTDDigi
void createTDDigi(int Station, int Detector, int SensitiveElement, float GlobalTime, float WafeLength, CLHEP::HepRandomEngine *rndEngine)
Definition: AFP_PileUpTool.cxx:529
AFP_TDSimHitConstIter
AtlasHitsVector< AFP_TDSimHit >::const_iterator AFP_TDSimHitConstIter
Definition: AFP_TDSimHitCollection.h:16
AFP_PileUpTool::m_TDDigiCollectionKey
SG::WriteHandleKey< AFP_TDDigiCollection > m_TDDigiCollectionKey
Definition: AFP_PileUpTool.h:140
AFP_PileUpTool::getTDC
double getTDC(const TH1F &) const
Returns the TDC determined from the signal shape passed as an argument.
Definition: AFP_PileUpTool.cxx:555
TimedHitCollection
Definition: TimedHitCollection.h:15
AFP_SiDigi::m_nStationID
int m_nStationID
Definition: AFP_SiDigi.h:18
AFP_SIDSimHit.h
AFP_PileUpTool::setupTDCOffsets
void setupTDCOffsets()
Definition: AFP_PileUpTool.cxx:743
AtlasHitsVector::push_back
void push_back(const T &t)
Definition: AtlasHitsVector.h:145
fitman.k
k
Definition: fitman.py:528
AFP_SiDigi
Definition: AFP_SiDigi.h:9