ATLAS Offline Software
TRTDigitizationTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TRTDigitizationTool.cxx
7 //
8 // Implementation file for class TRTDigitizationTool
9 //
11 
12 #include "TRTDigitizationTool.h"
15 #include "TRTProcessingOfStraw.h"
17 
18 #include "TRTDigCondBase.h"
19 #include "TRTDigCondFakeMap.h"
20 
21 #include "TRTNoise.h"
22 #include "TRTDigiHelper.h"
23 #include "TRTElectronicsNoise.h"
24 
25 #include "Identifier/Identifier.h"
29 
31 
32 // Det descr includes:
33 #include "InDetIdentifier/TRT_ID.h"
35 #include "TRTDigSettings.h"
36 
39 
40 // Gaudi includes
41 #include "GaudiKernel/SmartDataPtr.h"
42 #include "GaudiKernel/EventContext.h"
43 #include "GaudiKernel/ThreadLocalContext.h"
44 
45 
46 //CondDB
50 #include <limits>
51 #include <cstdint>
52 
53 // Random Number Generation
55 #include "CLHEP/Random/RandomEngine.h"
56 #include "CLHEP/Random/RandGaussZiggurat.h"
57 
59 
60 //#include "driftCircle.h" // local copy for debugging and development
61 
62 //_____________________________________________________________________________
64  const std::string& name,
65  const IInterface* parent)
67 {
68  m_settings = new TRTDigSettings();
69  m_settings->addPropertiesForOverrideableParameters(static_cast<AlgTool*>(this));
70 }
71 
72 //_____________________________________________________________________________
74 
75  ATH_MSG_VERBOSE ( "Begin TRTDigitizationTool::Destructor");
77  delete m_pProcessingOfStraw;
78  delete m_pDigConditions;
79  delete m_pNoise;
80  delete m_settings;
81  ATH_MSG_VERBOSE ( "End TRTDigitizationTool::Destructor");
82 
83 }
84 
85 //_____________________________________________________________________________
87 {
88 
89  ATH_MSG_DEBUG ( name()<<"::initialize() begin" );
90 
91  // Get the TRT Detector Manager
93  ATH_MSG_DEBUG ( "Retrieved TRT_DetectorManager with version " << m_manager->getVersion().majorNum() );
94 
95  ATH_CHECK(detStore()->retrieve(m_trt_id, "TRT_ID"));
96 
98 
99  // Fill setting defaults and process joboption overrides:
101 
103  m_settings->printFlagsForOverrideableParameters("TRTDigSettings Overrideables : ");
104  }
105 
107 
108  ATH_CHECK(m_TRTpaiToolXe.retrieve());
109  ATH_MSG_DEBUG ( "Retrieved the PAI Tool for Xe straws" );
110 
111  ATH_CHECK(m_TRTpaiToolAr.retrieve());
112  ATH_MSG_DEBUG ( "Retrieved the PAI Tool for Ar straws" );
113 
114  ATH_CHECK(m_TRTpaiToolKr.retrieve());
115  ATH_MSG_DEBUG ( "Retrieved the PAI Tool for Kr straws" );
116 
118  ATH_CHECK(m_TRTsimdrifttimetool.retrieve());
119  ATH_MSG_DEBUG ( "Retrieved the Sim. Drifttime Tool" );
120 
121  // Check data object name
122  if (m_hitsContainerKey.key().empty()) {
123  ATH_MSG_FATAL ( "Property DataObjectName not set!" );
124  return StatusCode::FAILURE;
125  }
127  ATH_MSG_DEBUG ( "Input hits: " << m_dataObjectName );
128 
129  // Initialize ReadHandleKey
130  ATH_CHECK(m_hitsContainerKey.initialize(true));
131 
132  // Initialize data handle keys
133  ATH_CHECK(m_outputRDOCollName.initialize());
135 
136  // Get Random Service
137  ATH_CHECK(m_rndmSvc.retrieve());
138 
139  // Get the Particle Properties Service
140  ATH_CHECK(m_ppSvc.retrieve());
141  m_particleTable = m_ppSvc->PDT();
142 
143  //locate the PileUpMergeSvc and initialize our local ptr
145  ATH_CHECK(m_mergeSvc.retrieve());
146  }
147 
148  //Retrieve TRT_StrawNeighbourService.
149  ATH_CHECK(m_TRTStrawNeighbourSvc.retrieve());
150 
151  //Retrieve TRT_CalDbTool
152  if (m_settings->getT0FromData()) {
153  ATH_CHECK(m_calDbTool.retrieve());
154  }
155  else {
156  m_calDbTool.disable();
157  }
158 
160 
161  // Set SDO readout range
162  const double intervalBetweenCrossings(m_settings->timeInterval() / 3.);
163 
164  switch ( (m_settings->storeSDO() )) {
165  case 0: m_minCrossingTimeSDO = -1.*CLHEP::ns; m_maxCrossingTimeSDO = -1.*CLHEP::ns; break;
166  case 1: m_minCrossingTimeSDO = -1.*CLHEP::ns; m_maxCrossingTimeSDO = (intervalBetweenCrossings * 2. + 1.*CLHEP::ns); break;
167  case 2: m_minCrossingTimeSDO = -(intervalBetweenCrossings * 2. + 1.*CLHEP::ns); m_maxCrossingTimeSDO = (intervalBetweenCrossings * 2. + 1.*CLHEP::ns); break;
168  default:
169  ATH_MSG_ERROR ( "storeSDO is out of range:"<<m_settings->storeSDO()<<"allowed values are: 0,1,2. Setting storeSDO = 2 " );
171  break;
172  }
173 
177 
178  return StatusCode::SUCCESS;
179 }
180 
181 //_____________________________________________________________________________
182 StatusCode TRTDigitizationTool::prepareEvent(const EventContext& /*ctx*/, unsigned int)
183 {
184  m_vDigits.clear();
185  m_trtHitCollList.clear();
188  return StatusCode::SUCCESS;
189 }
190 
191 //_____________________________________________________________________________
193  SubEventIterator bSubEvents,
194  SubEventIterator eSubEvents) {
195 
196  m_seen.emplace_back(std::distance(bSubEvents,eSubEvents), bunchXing);
197  //decide if this event will be processed depending on HardScatterSplittingMode & bunchXing
198  if (m_HardScatterSplittingMode == 2 && !m_HardScatterSplittingSkipper ) { m_HardScatterSplittingSkipper = true; return StatusCode::SUCCESS; }
199  if (m_HardScatterSplittingMode == 1 && m_HardScatterSplittingSkipper ) { return StatusCode::SUCCESS; }
201 
202 
203  //TRTUncompressedHit
204 
206  TimedHitCollList hitCollList;
207 
208  if (!(m_mergeSvc->retrieveSubSetEvtData(m_dataObjectName, hitCollList, bunchXing,
209  bSubEvents, eSubEvents).isSuccess()) &&
210  hitCollList.empty()) {
211  ATH_MSG_ERROR("Could not fill TimedHitCollList");
212  return StatusCode::FAILURE;
213  } else {
214  ATH_MSG_VERBOSE(hitCollList.size() << " TRTUncompressedHitCollection with key " <<
215  m_dataObjectName << " found");
216  }
217 
218  TimedHitCollList::iterator iColl(hitCollList.begin());
219  TimedHitCollList::iterator endColl(hitCollList.end());
220 
221  for( ; iColl != endColl; ++iColl){
222  TRTUncompressedHitCollection *hitCollPtr = new TRTUncompressedHitCollection(*iColl->second);
223  PileUpTimeEventIndex timeIndex(iColl->first);
224  ATH_MSG_DEBUG("TRTUncompressedHitCollection found with " << hitCollPtr->size() <<
225  " hits");
226  ATH_MSG_VERBOSE("time index info. time: " << timeIndex.time()
227  << " index: " << timeIndex.index()
228  << " type: " << timeIndex.type());
229  m_thpctrt->insert(timeIndex, hitCollPtr);
230  m_trtHitCollList.push_back(hitCollPtr);
231  }
232 
233  return StatusCode::SUCCESS;
234 }
235 
236 //_____________________________________________________________________________
238 
239  // setup the RNGs which are only used in the first event
240  CLHEP::HepRandomEngine *fakeCondRndmEngine = getRandomEngine("TRT_FakeConditions", m_randomSeedOffset, ctx);
241  CLHEP::HepRandomEngine *noiseInitRndmEngine = getRandomEngine("TRT_Noise", m_randomSeedOffset, ctx);
242  CLHEP::HepRandomEngine *noiseElecRndmEngine = getRandomEngine("TRT_Noise_Electronics", m_randomSeedOffset, ctx);
243  CLHEP::HepRandomEngine *noiseThreshRndmEngine = getRandomEngine("TRT_Noise_ThresholdFluctuations", m_randomSeedOffset, ctx);
244  CLHEP::HepRandomEngine *noiseElecResetRndmEngine = getRandomEngine("TRT_ElectronicsNoiseReset", m_randomSeedOffset, ctx);
245  m_first_event=false;
246 
247  if (!m_digverscontainerkey.empty()) {
248 
249  if ( ConditionsDependingInitialization(ctx).isFailure() ) {
250  ATH_MSG_ERROR ( "Folder holder TRT digitization version exists in condDB, but tag is faulty" );
251  return StatusCode::FAILURE;
252  } else {
253  ATH_MSG_DEBUG ( "Using Digitization version as defined in conditions tag" );
254  }
255 
256  } else {
257  ATH_MSG_DEBUG ( "No folder containing TRT digitization version found in CondDB. Using default from Det Desc tag: " << m_settings->digVers() );
258  }
259 
260  //Resuming initialiazation. Section below had to be moved into event loop due to dependence on conditions data
261 
262  TRTElectronicsNoise *electronicsNoise(nullptr);
264  electronicsNoise = new TRTElectronicsNoise(m_settings, noiseElecRndmEngine);
265  }
266  // ElectronicsProcessing is needed for the regular straw processing,
267  // but also for the noise (it assumes ownership of electronicsnoise )
269 
271  m_manager,
272  m_trt_id,
273  m_UseGasMix,
274  m_sumTool);
275 
276  m_pDigConditions->initialize(fakeCondRndmEngine);
277 
279 
280  // In short this next constructor does 3 things;
281  // i) tunes the amplitude of the electronics noise,
282  // ii) creates a pool of noise digits,
283  // iii) figures out exact low thresholds needed to reproduce actual
284  // straw noise-frequencies:
286  m_manager,
287  noiseInitRndmEngine,
288  noiseElecRndmEngine,
289  noiseThreshRndmEngine,
290  noiseElecResetRndmEngine,
293  electronicsNoise,
294  m_trt_id,
295  m_UseGasMix,
296  m_sumTool);
297 
298  ATH_MSG_DEBUG ( "Average straw noise level is " << m_pDigConditions->strawAverageNoiseLevel() );
299 
300  } else {
301  m_pNoise = nullptr;
302  }
303 
304  ITRT_PAITool *TRTpaiToolXe = &(* m_TRTpaiToolXe);
305  ITRT_PAITool *TRTpaiToolAr = &(* m_TRTpaiToolAr);
306  ITRT_PAITool *TRTpaiToolKr = &(* m_TRTpaiToolKr);
307 
308  ITRT_SimDriftTimeTool *pTRTsimdrifttimetool = &(*m_TRTsimdrifttimetool);
309 
310  const ITRT_CalDbTool* calDbTool = nullptr;
311  if (m_settings->getT0FromData()) {
312  calDbTool = m_calDbTool.get();
313  }
316  m_manager,
317  TRTpaiToolXe,
318  pTRTsimdrifttimetool,
320  m_pNoise,
323  m_trt_id,
324  TRTpaiToolAr,
325  TRTpaiToolKr,
326  calDbTool);
327 
328  ATH_MSG_INFO ( "Gas Property: UseGasMix is " << m_UseGasMix );
329 
330  return StatusCode::SUCCESS;
331 }
332 
333 //_____________________________________________________________________________
336  std::set<int>& sim_hitids, std::set<Identifier>& simhitsIdentifiers,
337  CLHEP::HepRandomEngine *rndmEngine,
338  CLHEP::HepRandomEngine *strawRndmEngine,
339  CLHEP::HepRandomEngine *elecProcRndmEngine,
340  CLHEP::HepRandomEngine *elecNoiseRndmEngine,
341  CLHEP::HepRandomEngine *paiRndmEngine) {
342 
343  // Create a map for the SDO
345 
347  MagField::AtlasFieldCache fieldCache;
349 
350  // Get field cache object
352  const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
353 
354  if (fieldCondObj == nullptr) {
355  ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
356  return StatusCode::FAILURE;
357  }
358  fieldCondObj->getInitializedCache (fieldCache);
359  }
360 
362 
363 
364  ATH_CHECK(simDataMap.record(std::make_unique<InDetSimDataCollection>() ));
365 
366  // Register the map into StoreGate
367  if (not simDataMap.isValid()) {
368  ATH_MSG_FATAL ( "InDetSimData map " << m_outputSDOCollName.key() << " could not be registered in StoreGate !" );
369  return StatusCode::FAILURE;
370  } else {
371  ATH_MSG_DEBUG ( "InDetSimData map " << m_outputSDOCollName.key() << " registered in StoreGate" );
372  }
373 
374  m_cosmicEventPhase = 0.0;
375  if (m_settings->doCosmicTimingPit()) {
377  };
378 
379  // Create a vector of deposits
380  std::vector<InDetSimData::Deposit> depositVector(100);
381 
382  // loop over all straws
384  while (thpctrt.nextDetectorElement(i, e)) {
385 
386  int hitID((*i)->GetHitID()); // Get hitID
387 
388  // evtIndex should be 0 for main event and 1,2,3,... for pileup events:
389  // (event Id is a property of the TimedHitPtr)
390  HepMcParticleLink::index_type evtIndex(i->eventId());
391 
392  if ( m_settings->noiseInUnhitStraws() ) {
393  sim_hitids.insert(hitID);
394  }
395  //Safeguard against a rare case of hitID corruption found by Davide:
396  if ( hitID & 0xc0000000 ) {
397  ATH_MSG_ERROR ( "Hit ID not Valid (" << MSG::hex << hitID << ")" << MSG::dec );
398  continue;
399  }
400 
401  // Convert hitID to Identifier
402  IdentifierHash IdHash;
403  Identifier idLayer;
404  bool identifierOK;
405  Identifier idStraw(getIdentifier(hitID, IdHash, idLayer, identifierOK));
406  if ( !identifierOK ) {
407  ATH_MSG_ERROR ( "Ignoring simhits with suspicious identifier (1)" );
408  continue;
409  }
410 
411  //For crosstalk sim
412  simhitsIdentifiers.insert(idStraw);
413 
415  // Fill a vector of deposits
416  depositVector.clear();
417  depositVector.reserve(std::distance(i,e));
418  for (TimedHitCollection<TRTUncompressedHit>::const_iterator hit_iter(i); hit_iter != e; ++hit_iter ) {
419  // create a new deposit
420  InDetSimData::Deposit deposit( HepMcParticleLink::getRedirectedLink((*hit_iter)->particleLink(), hit_iter->eventId(), ctx), // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc.
421  (*hit_iter)->GetEnergyDeposit() );
422  if (HepMC::ignoreTruthLink(deposit.first, m_vetoPileUpTruthLinks)) {
423  continue;
424  }
425  ATH_MSG_VERBOSE ( "Deposit: trackID " << deposit.first << " energyDeposit " << deposit.second );
426  depositVector.emplace_back(std::move(deposit));
427  }
428 
429  const TimedHitPtr<TRTUncompressedHit>& theHit(*i);
430  const double bunchCrossingTime(hitTime(theHit) - static_cast<double>(theHit->GetGlobalTime()));
431 
432  // Add the simdata object to the map.
433  if ( !depositVector.empty() &&
434  (evtIndex == 0 || ((*i)->GetKineticEnergy()>m_minpileuptruthEkin)) &&
435  (bunchCrossingTime < m_maxCrossingTimeSDO) && (bunchCrossingTime > m_minCrossingTimeSDO) ) {
436  simDataMap->try_emplace(idStraw, std::move(depositVector));
437  }
439 
440  // Digitization for the given straw
441  TRTDigit digit_straw;
442 
444  //if (m_settings->doCosmicTimingPit()) {
445  // if ( StatusCode::SUCCESS == evtStore()->retrieve(m_ComTime,"ComTime")) {
446  // ATH_MSG_VERBOSE ( "Found tool for cosmic timing: ComTime" );
447  // } else {
448  // ATH_MSG_ERROR ( "Did not find tool needed for cosmic timing: ComTime" );
449  // }
450  //}
451 
452  // if StatusHT == 6 thats emulate argon, ==7 that's emulate krypton
453  bool emulateArFlag = m_sumTool->getStatusHT(idStraw, ctx) == 6;
454  bool emulateKrFlag = m_sumTool->getStatusHT(idStraw, ctx) == 7;
455  const int statusHT = m_sumTool->getStatusHT(idStraw, ctx);
456  m_pProcessingOfStraw->ProcessStraw(fieldCache, i, e, digit_straw,
458  m_cosmicEventPhase, //m_ComTime,
460  emulateArFlag,
461  emulateKrFlag,
462  strawRndmEngine,
463  elecProcRndmEngine,
464  elecNoiseRndmEngine,
465  paiRndmEngine);
466 
467  // Print out the digits etc (for debugging)
468  //int mstrw = digit_straw.GetStrawID();
469  //unsigned int mword = digit_straw.GetDigit();
470  //std::cout << "AJB " << mstrw << ":" << mword << std::endl;
471  //print_mword_properties(mword);
472  //std::cout << "AJB "; bits24(mword);
473  //std::cout << "AJB "; bits27(mword);
474 
475  // finally push back the output digit.
476  if ( digit_straw.GetDigit() ) {
477  m_vDigits.push_back(digit_straw);
478  }
479 
480  } // end of straw loop
481 
482  return StatusCode::SUCCESS;
483 }
484 
485 //_____________________________________________________________________________
487 
488  // Set the RNGs to use for this event.
489  CLHEP::HepRandomEngine *rndmEngine = getRandomEngine("", ctx);
490  CLHEP::HepRandomEngine *elecNoiseRndmEngine = getRandomEngine("TRT_ElectronicsNoise", ctx);
491  CLHEP::HepRandomEngine *noiseRndmEngine = getRandomEngine("TRT_NoiseDigitPool", ctx);
492  CLHEP::HepRandomEngine *strawRndmEngine = getRandomEngine("TRT_ProcessStraw", ctx);
493  CLHEP::HepRandomEngine *elecProcRndmEngine = getRandomEngine("TRT_ThresholdFluctuations", ctx);
494  CLHEP::HepRandomEngine *paiRndmEngine = getRandomEngine("TRT_PAI", ctx);
495 
496  if (m_first_event) {
497  if(this->lateInitialize(ctx).isFailure()) {
498  ATH_MSG_FATAL ( "lateInitialize method failed!" );
499  return StatusCode::FAILURE;
500  }
501  }
502 
504 
505  ATH_MSG_DEBUG ( "TRTDigitizationTool::processAllSubEvents()" );
506 
508  ATH_CHECK(m_trtrdo_container.record(std::make_unique<TRT_RDO_Container>(m_trt_id->straw_layer_hash_max())));
509  ATH_MSG_DEBUG ( " TRT_RDO_Container created " );
510 
511  if (not m_trtrdo_container.isValid()) {
512  ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
513  return StatusCode::FAILURE;
514  }else {
515  ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
516  }
517 
518  m_vDigits.clear();
519 
520  // get the container(s)
523  // In case of single hits container just load the collection using read handles
524  if (!m_onlyUseContainerName) {
526  if (!hitCollection.isValid()) {
527  ATH_MSG_ERROR("Could not get TRTUncompressedHitCollection container " << hitCollection.name() << " from store " << hitCollection.store());
528  return StatusCode::FAILURE;
529  }
530 
531  // Define Hit Collection
532  thpctrt.reserve(1);
533 
534  // create a new hits collection
535  thpctrt.insert(0, hitCollection.cptr());
536  ATH_MSG_DEBUG("TRTUncompressedHitCollection found with " << hitCollection->size() << " hits");
537  }
538  else {
539  TimedHitCollList hitCollList; // this is a list<pair<time_t, DataLink<TRTUncompressedHitCollection> > >
540  unsigned int numberOfSimHits(0);
541  if ( !(m_mergeSvc->retrieveSubEvtsData(m_dataObjectName, hitCollList, numberOfSimHits).isSuccess()) && hitCollList.empty() ) {
542  ATH_MSG_ERROR ( "Could not fill TimedHitCollList" );
543  return StatusCode::FAILURE;
544  } else {
545  ATH_MSG_DEBUG ( hitCollList.size() << " TRTUncompressedHitCollections with key " << m_dataObjectName << " found" );
546  }
547 
548  // Define Hit Collection
549  thpctrt.reserve(numberOfSimHits);
550 
551  //now merge all collections into one
552  TimedHitCollList::iterator iColl(hitCollList.begin());
553  TimedHitCollList::iterator endColl(hitCollList.end() );
555  // loop on the hit collections
556  while ( iColl != endColl ) {
557  //decide if this event will be processed depending on HardScatterSplittingMode & bunchXing
559  if (m_HardScatterSplittingMode == 1 && m_HardScatterSplittingSkipper ) { ++iColl; continue; }
561  const TRTUncompressedHitCollection* p_collection(iColl->second);
562  thpctrt.insert(iColl->first, p_collection);
563  ATH_MSG_DEBUG ( "TRTUncompressedHitCollection found with " << p_collection->size() << " hits" );
564  ++iColl;
565  }
566  }
567 
568  //Set of all hitid's with simhits (used for noise simulation).
569  std::set<int> sim_hitids;
570  std::set<Identifier> simhitsIdentifiers;
571 
572  // Process the Hits straw by straw: get the iterator pairs for given straw
573  ATH_CHECK(this->processStraws(ctx, thpctrt, sim_hitids, simhitsIdentifiers, rndmEngine, strawRndmEngine, elecProcRndmEngine, elecNoiseRndmEngine,paiRndmEngine));
574 
575  // no more hits
576 
577  //Noise in straws without simhits:
579  const int numberOfDigitsBeforeNoise(m_vDigits.size());
580 
581  m_pNoise->appendPureNoiseToProperDigits(m_vDigits, sim_hitids, noiseRndmEngine);
582  if (m_settings->doCrosstalk()) {
583  m_pNoise->appendCrossTalkNoiseToProperDigits(m_vDigits, simhitsIdentifiers,m_TRTStrawNeighbourSvc, noiseRndmEngine);
584  }
585 
586  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() << " (" << m_vDigits.size()-numberOfDigitsBeforeNoise << " of those are pure noise)" );
587 
589 
590  } else {
591  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() );
592  }
593 
594  // All digits are ready.
595  // We just need to convert to relevant identifiers and output to storegate.
596 
597  if (createAndStoreRDOs().isFailure()) {
598  ATH_MSG_FATAL ( "createAndStoreRDOs() failed!" );
599  return StatusCode::FAILURE;
600  }
601  else {
602  ATH_MSG_DEBUG ( "createAndStoreRDOs() succeeded" );
603  }
604 
605  return StatusCode::SUCCESS;
606 }
607 
608 CLHEP::HepRandomEngine* TRTDigitizationTool::getRandomEngine(const std::string& streamName,
609  const EventContext& ctx) const
610 {
611  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
612  std::string rngName = name()+streamName;
613  rngWrapper->setSeed( rngName, ctx );
614  return rngWrapper->getEngine(ctx);
615 }
616 
617 //_____________________________________________________________________________
618 CLHEP::HepRandomEngine* TRTDigitizationTool::getRandomEngine(const std::string& streamName, unsigned long int randomSeedOffset,
619  const EventContext& ctx) const
620 {
621  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
622  rngWrapper->setSeed( streamName, ctx.slot(), randomSeedOffset, ctx.eventID().run_number() );
623  return rngWrapper->getEngine(ctx);
624 }
625 
626 //_____________________________________________________________________________
627 StatusCode TRTDigitizationTool::mergeEvent(const EventContext& ctx) {
628  std::vector<std::pair<unsigned int, int> >::iterator ii(m_seen.begin());
629  std::vector<std::pair<unsigned int, int> >::iterator ee(m_seen.end());
630  while (ii != ee) {
631  ATH_MSG_DEBUG( "mergeEvent: there are " << ii->first << " events in bunch xing " << ii->second );
632  ++ii;
633  }
634 
635  // Set the RNGs to use for this event.
636  CLHEP::HepRandomEngine *rndmEngine = getRandomEngine("", ctx);
637  CLHEP::HepRandomEngine *elecNoiseRndmEngine = getRandomEngine("TRT_ElectronicsNoise", ctx);
638  CLHEP::HepRandomEngine *noiseRndmEngine = getRandomEngine("TRT_NoiseDigitPool", ctx);
639  CLHEP::HepRandomEngine *strawRndmEngine = getRandomEngine("TRT_ProcessStraw", ctx);
640  CLHEP::HepRandomEngine *elecProcRndmEngine = getRandomEngine("TRT_ThresholdFluctuations", ctx);
641  CLHEP::HepRandomEngine *paiRndmEngine = getRandomEngine("TRT_PAI", ctx);
642 
643  if (m_first_event) {
644  if(this->lateInitialize(ctx).isFailure()) {
645  ATH_MSG_FATAL ( "lateInitialize method failed!" );
646  return StatusCode::FAILURE;
647  }
648  }
649 
651 
652  ATH_MSG_DEBUG ( "TRTDigitization::execute()" );
653 
655  ATH_CHECK(m_trtrdo_container.record(std::make_unique<TRT_RDO_Container>(m_trt_id->straw_layer_hash_max())));
656  ATH_MSG_DEBUG ( " TRT_RDO_Container created " );
657  if (not m_trtrdo_container.isValid()) {
658  ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
659  return StatusCode::FAILURE;
660  } else {
661  ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
662  }
663 
664  //Set of all hitid's with simhits (used for noise simulation).
665  std::set<int> sim_hitids;
666  std::set<Identifier> simhitsIdentifiers;
667 
668  // Process the Hits straw by straw:
669  // get the iterator pairs for given straw
670  ATH_CHECK(this->processStraws(ctx, *m_thpctrt, sim_hitids, simhitsIdentifiers, rndmEngine, strawRndmEngine, elecProcRndmEngine, elecNoiseRndmEngine,paiRndmEngine));
671 
672  delete m_thpctrt;
674  m_trtHitCollList.clear();
675  // no more hits
676 
677  //Noise in straws without simhits:
679  const unsigned int numberOfDigitsBeforeNoise(m_vDigits.size());
680 
681  m_pNoise->appendPureNoiseToProperDigits(m_vDigits, sim_hitids, noiseRndmEngine);
682  if (m_settings->doCrosstalk()) {
683  m_pNoise->appendCrossTalkNoiseToProperDigits(m_vDigits, simhitsIdentifiers,m_TRTStrawNeighbourSvc, noiseRndmEngine);
684  }
685 
686  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() << " (" << m_vDigits.size()-numberOfDigitsBeforeNoise << " of those are pure noise)" );
687 
689 
690  } else {
691  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() );
692  };
693 
694  // All digits are ready.
695  // We just need to convert to relevant identifiers and output to storegate.
696 
697  if (createAndStoreRDOs().isFailure()) {
698  ATH_MSG_FATAL ( "createAndStoreRDOs() failed!" );
699  return StatusCode::FAILURE;
700  }
701  else {
702  ATH_MSG_DEBUG ( "createAndStoreRDOs() succeeded" );
703  }
704 
705  return StatusCode::SUCCESS;
706 }
707 
708 //_____________________________________________________________________________
710 {
711 
712  std::vector<TRTDigit>::const_iterator TRTDigitIter(m_vDigits.begin());
713  std::vector<TRTDigit>::const_iterator endOfTRTDigits(m_vDigits.end());
714 
715  // for testing
716  IdentifierHash IdHash; // default value is 0xFFFFFFFF
717  IdentifierHash IdHashOld; // default value is 0xFFFFFFFF
718  TRT_RDO_Collection *RDOColl(nullptr);
719 
720  Identifier idStraw;
721 
722  while (TRTDigitIter != endOfTRTDigits) {
723  ATH_MSG_DEBUG ( "Digit ID " << TRTDigitIter->GetStrawID() << " Digit " << TRTDigitIter->GetDigit() );
724 
725  Identifier layer_id;
726  bool identifierOK(false);
727  idStraw = getIdentifier(TRTDigitIter->GetStrawID(), IdHash, layer_id, identifierOK);
728  if (!identifierOK) {
729  ATH_MSG_ERROR ( "Ignoring simhits with suspicious identifier (2)" );
730  ++TRTDigitIter;
731  continue;
732  };
733 
734  // Create new TRT RDO Collection
735  ATH_MSG_DEBUG ( " RDO ID " << m_trt_id->print_to_string(idStraw) );
736 
737  //TK: wauv - we are really betting the farm on the fact that the
738  //ordering of digits will result in a similar ordering of the
739  //idhash'es here... (this is not immediately the case when noise
740  //hits are appended afterwards).
741 
742  if (IdHash != IdHashOld) {
743  RDOColl = new TRT_RDO_Collection(IdHash);
744  ATH_MSG_DEBUG ( "New TRT RDO Collection created with IdHash " << static_cast<int>(IdHash) );
745  IdHashOld = IdHash;
746  RDOColl->setIdentifier(layer_id);
747 
748  // Add to the container
749  if (m_trtrdo_container->addCollection(RDOColl, RDOColl->identifyHash()).isFailure()) {
750  ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
751  return StatusCode::FAILURE;
752  } else {
753  ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
754  }
755  }
756 
757  // Put RDO into Collection
758  TRT_LoLumRawData *p_rdo(new TRT_LoLumRawData(idStraw, TRTDigitIter->GetDigit()));
759  if (RDOColl) {
760  RDOColl->push_back(p_rdo);
761  } else {
762  ATH_MSG_FATAL ( "Failed to create the TRT_RDO_Collection before trying to add an RDO to it! IdHash = " << static_cast<int>(IdHash) );
763  delete p_rdo;
764  return StatusCode::FAILURE;
765  }
766  ++TRTDigitIter;
767  }
768 
769  m_vDigits.clear();
770  return StatusCode::SUCCESS;
771 }
772 
773 
774 //_____________________________________________________________________________
776  IdentifierHash& hashId,
777  Identifier& IdLayer,
778  bool & statusok ) const
779 {
780  statusok = true;
781 
782  Identifier IdStraw;
783 
784  const int mask(0x0000001F);
785  const int word_shift(5);
786  int trtID, ringID, moduleID, layerID, strawID;
787  int wheelID, planeID, sectorID;
788 
789  const InDetDD::TRT_BarrelElement *barrelElement;
790  const InDetDD::TRT_EndcapElement *endcapElement;
791 
792  if ( !(hitID & 0x00200000) ) { // barrel
793  strawID = hitID & mask;
794  hitID >>= word_shift;
795  layerID = hitID & mask;
796  hitID >>= word_shift;
797  moduleID = hitID & mask;
798  hitID >>= word_shift;
799  ringID = hitID & mask;
800  trtID = hitID >> word_shift;
801 
802  barrelElement = m_manager->getBarrelElement(trtID, ringID, moduleID, layerID);
803  if ( barrelElement ) {
804  hashId = barrelElement->identifyHash();
805  IdLayer = barrelElement->identify();
806  IdStraw = m_trt_id->straw_id(IdLayer, strawID);
807  } else {
808  ATH_MSG_ERROR ( "Could not find detector element for barrel identifier with "
809  << "(ipos,iring,imod,ilayer,istraw) = ("
810  << trtID << ", " << ringID << ", " << moduleID << ", "
811  << layerID << ", " << strawID << ")" );
812  statusok = false;
813  }
814  } else { // endcap
815  strawID = hitID & mask;
816  hitID >>= word_shift;
817  planeID = hitID & mask;
818  hitID >>= word_shift;
819  sectorID = hitID & mask;
820  hitID >>= word_shift;
821  wheelID = hitID & mask;
822  trtID = hitID >> word_shift;
823 
824  // change trtID (which is 2/3 for endcaps) to use 0/1 in getEndcapElement
825  if (trtID == 3) { trtID = 0; }
826  else { trtID = 1; }
827 
828  endcapElement = m_manager->getEndcapElement(trtID, wheelID, planeID, sectorID);
829 
830  if ( endcapElement ) {
831  hashId = endcapElement->identifyHash();
832  IdLayer = endcapElement->identify();
833  IdStraw = m_trt_id->straw_id(IdLayer, strawID);
834  } else {
835  ATH_MSG_ERROR ( "Could not find detector element for endcap identifier with "
836  << "(ipos,iwheel,isector,iplane,istraw) = ("
837  << trtID << ", " << wheelID << ", " << sectorID << ", "
838  << planeID << ", " << strawID << ")" );
839  ATH_MSG_ERROR ( "If this happens very rarely, don't be alarmed (it is a Geant4 'feature')" );
840  ATH_MSG_ERROR ( "If it happens a lot, you probably have misconfigured geometry in the sim. job." );
841  statusok = false;
842  }
843 
844  }
845 
846  return IdStraw;
847 }
848 
849 //_____________________________________________________________________________
851 
853  m_settings->print("TRTDigSettings Settings : ");
854  }
855 
856  ATH_MSG_INFO ( "TRTDigitizationTool::finalize()" );
857 
858  return StatusCode::SUCCESS;
859 }
860 
861 //_____________________________________________________________________________
862 
864 {
866  int dig_vers_from_condDB = (**digvers)["TRT_Dig_Vers"].data<int>();
867 
868  if (dig_vers_from_condDB!=0) {
869 
870  if (StatusCode::SUCCESS == m_settings->DigSettingsFromCondDB(dig_vers_from_condDB)) {
871  ATH_MSG_INFO ( "Retrieved TRT_Settings from CondDB with TRT digitization version: digversion = " <<
872  dig_vers_from_condDB );
873  } else {
874  ATH_MSG_WARNING ( "Unknown TRT digitization version: digversion = " << dig_vers_from_condDB <<
875  " read from CondDB. Overriding to use default from Det Desc tag: " <<
876  m_settings->digVers() );
877  }
878 
879  } else {
880  ATH_MSG_WARNING ( "TRT digitization version: digversion = " << dig_vers_from_condDB <<
881  " read from CondDB. Overriding to use default from Det Desc tag: " <<
882  m_settings->digVers() );
883  }
884 
885  return StatusCode::SUCCESS;
886 
887 }
888 
889 //_____________________________________________________________________________
890 double TRTDigitizationTool::getCosmicEventPhase(CLHEP::HepRandomEngine *rndmEngine) {
891  // 13th February 2015: replace ComTime with a hack (fixme) based on an
892  // event phase distribution from Alex (alejandro.alonso@cern.ch) that
893  // is modelled as a Guassian of mean 5.48 ns and sigma 8.91 ns.
894  return CLHEP::RandGaussZiggurat::shoot(rndmEngine, 5.48, 8.91);
895 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TRTDigitizationTool::ConditionsDependingInitialization
StatusCode ConditionsDependingInitialization(const EventContext &ctx)
Definition: TRTDigitizationTool.cxx:863
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TRTProcessingOfStraw.h
TRTDigSettings::pileUpSDOsMinEkin
double pileUpSDOsMinEkin() const
Get minimum Ekin for pileup track to enter MC-truth.
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
TRTDigCondFakeMap.h
TRTDigSettings::getT0FromData
bool getT0FromData() const
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TRTDigSettings::doCosmicTimingPit
bool doCosmicTimingPit() const
Cosmics timing corresponding to pit setup?
InDetDD::TRT_BarrelElement
Definition: TRT_BarrelElement.h:44
TRTDigit::GetDigit
unsigned GetDigit() const
Get digit.
Definition: TRTDigit.h:27
InDetRawDataCollection::setIdentifier
void setIdentifier(Identifier id)
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TRTDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: TRTDigitizationTool.h:133
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TRT_DetectorManager.h
AtlasFieldCacheCondObj
Definition: AtlasFieldCacheCondObj.h:19
TRTDigSettings.h
TRTDigSettings::useMagneticFieldMap
bool useMagneticFieldMap() const
ITRT_PAITool
Definition: ITRT_PAITool.h:20
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TRT_LoLumRawData
Definition: TRT_LoLumRawData.h:25
TRTDigitizationTool::m_calDbTool
ToolHandle< ITRT_CalDbTool > m_calDbTool
Definition: TRTDigitizationTool.h:131
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
InDetDD::TRT_DetectorManager::getBarrelElement
const TRT_BarrelElement * getBarrelElement(unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
Access Barrel Elements:---------------—(Fast)-------------------------—.
Definition: TRT_DetectorManager.cxx:103
TRTDigitizationTool::m_vDigits
std::vector< TRTDigit > m_vDigits
Vector of all digits.
Definition: TRTDigitizationTool.h:154
TRTNoise::sortDigits
static void sortDigits(std::vector< TRTDigit > &digitVect)
Definition: TRTNoise.cxx:447
TRT_ID::straw_layer_hash_max
size_type straw_layer_hash_max(void) const
Definition: TRT_ID.h:920
TRT_RDO_Collection.h
AtlasHitsVector
Definition: AtlasHitsVector.h:33
TRTNoise::appendCrossTalkNoiseToProperDigits
void appendCrossTalkNoiseToProperDigits(std::vector< TRTDigit > &digitVect, const std::set< Identifier > &simhitsIdentifiers, const ServiceHandle< ITRT_StrawNeighbourSvc > &m_TRTStrawNeighbourSvc, CLHEP::HepRandomEngine *noiseRndmEngine)
Definition: TRTNoise.cxx:356
TRTDigitizationTool::m_outputRDOCollName
SG::WriteHandleKey< TRT_RDO_Container > m_outputRDOCollName
name of the output RDOs.
Definition: TRTDigitizationTool.h:141
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRTDigitizationTool::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: TRTDigitizationTool.cxx:192
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:44
TRTDigSettings::digVers
int digVers() const
TRTDigitizationTool::~TRTDigitizationTool
~TRTDigitizationTool()
Destructor.
Definition: TRTDigitizationTool.cxx:73
TRTElectronicsProcessing
Electronics Processing.
Definition: TRTElectronicsProcessing.h:23
TRTDigSettings::printFlagsForOverrideableParameters
void printFlagsForOverrideableParameters(const std::string &front="") const
Print TRT digitization settings overrideable parameters.
Definition: TRTDigSettings.cxx:281
TRTDigitizationTool::processStraws
StatusCode processStraws(const EventContext &ctx, TimedHitCollection< TRTUncompressedHit > &thpctrt, std::set< int > &sim_hitids, std::set< Identifier > &simhitsIdentifiers, CLHEP::HepRandomEngine *rndmEngine, CLHEP::HepRandomEngine *strawRndmEngine, CLHEP::HepRandomEngine *elecProcRndmEngine, CLHEP::HepRandomEngine *elecNoiseRndmEngine, CLHEP::HepRandomEngine *paiRndmEngine)
Definition: TRTDigitizationTool.cxx:334
TRTDigSettings::addPropertiesForOverrideableParameters
void addPropertiesForOverrideableParameters(Algorithm *alg)
Add properties for overrideable parameters.
Definition: TRTDigSettings.cxx:244
TRTDigSettings::noiseInUnhitStraws
bool noiseInUnhitStraws() const
Query whether simulation of noise in unhit straws.
TRTDigitizationTool::m_trtrdo_container
SG::WriteHandle< TRT_RDO_Container > m_trtrdo_container
Definition: TRTDigitizationTool.h:143
PileUpTimeEventIndex::index
index_type index() const
the index of the component event in PileUpEventInfo
Definition: PileUpTimeEventIndex.cxx:76
TRTDigitizationTool::m_seen
std::vector< std::pair< unsigned int, int > > m_seen
Definition: TRTDigitizationTool.h:153
TRTDigitizationTool::m_pNoise
TRTNoise * m_pNoise
Definition: TRTDigitizationTool.h:158
TimedHitPtr< TRTUncompressedHit >
TRTDigitizationTool.h
a sample implementation of IPileUpTool to test the framework
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
TRTDigitizationTool::m_settings
TRTDigSettings * m_settings
Definition: TRTDigitizationTool.h:151
TRTDigitizationTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TRTDigitizationTool.h:136
HepMC::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:345
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
AthenaAttributeList.h
TRTDigitizationTool::m_pDigConditions
TRTDigCondBase * m_pDigConditions
Definition: TRTDigitizationTool.h:157
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
StrawStatusMultChanContainer.h
ReadCondHandle.h
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
PileUpToolBase::m_vetoPileUpTruthLinks
Gaudi::Property< int > m_vetoPileUpTruthLinks
Definition: PileUpToolBase.h:58
TRTDigitizationTool::m_particleTable
const HepPDT::ParticleDataTable * m_particleTable
Definition: TRTDigitizationTool.h:173
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
TRTDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: TRTDigitizationTool.h:132
InDetRawDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
TRTDigitizationTool::m_randomSeedOffset
Gaudi::Property< unsigned long int > m_randomSeedOffset
Definition: TRTDigitizationTool.h:149
TRTDigCondFakeMap
"Fake" straw map until "real" map is known.
Definition: TRTDigCondFakeMap.h:14
TRTDigitizationTool::m_manager
const InDetDD::TRT_DetectorManager * m_manager
Definition: TRTDigitizationTool.h:160
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
TRTElectronicsNoise
Simulate TRT Electronics Noise For description of metod, see Thomas Kittelmanns PhD thesis chapters ...
Definition: TRTElectronicsNoise.h:18
TRTHitIdHelper.h
TRTDigitizationTool::getRandomEngine
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
Definition: TRTDigitizationTool.cxx:608
TRT_RDO_Collection
InDetRawDataCollection< TRT_RDORawData > TRT_RDO_Collection
Definition: TRT_RDO_Collection.h:20
TRTDigitizationTool::createAndStoreRDOs
StatusCode createAndStoreRDOs()
Definition: TRTDigitizationTool.cxx:709
TRTNoise::appendPureNoiseToProperDigits
void appendPureNoiseToProperDigits(std::vector< TRTDigit > &digitVect, const std::set< int > &sim_hitids, CLHEP::HepRandomEngine *noiseRndmEngine)
Append noise digits to list of digits from proper hits.
Definition: TRTNoise.cxx:333
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TimedHitCollection::insert
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
TRTDigitizationTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, const unsigned int nInputEvents) override final
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: TRTDigitizationTool.cxx:182
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRTDigitizationTool::m_TRTpaiToolAr
ToolHandle< ITRT_PAITool > m_TRTpaiToolAr
Definition: TRTDigitizationTool.h:127
TimedHitCollection::reserve
void reserve(unsigned int numberOfHits)
reserve a timed vector numberOfHits in size.
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
TRTDigitizationTool::m_minpileuptruthEkin
double m_minpileuptruthEkin
Definition: TRTDigitizationTool.h:167
TRTDigitizationTool::m_dataObjectName
std::string m_dataObjectName
Definition: TRTDigitizationTool.h:140
TRTDigitizationTool::getCosmicEventPhase
static double getCosmicEventPhase(CLHEP::HepRandomEngine *rndmEngine)
Definition: TRTDigitizationTool.cxx:890
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
TRTDigitizationTool::m_UseGasMix
Gaudi::Property< int > m_UseGasMix
Definition: TRTDigitizationTool.h:148
TRTNoise
Simulation of noise hits in the TRT.
Definition: TRTNoise.h:39
InDetSimData.h
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
InDetDD::InDetDetectorManager::getVersion
const Version & getVersion() const
Get version information.
Definition: InDetDetectorManager.cxx:33
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TimedHitCollection.h
TRTDigitizationTool::m_pProcessingOfStraw
TRTProcessingOfStraw * m_pProcessingOfStraw
Definition: TRTDigitizationTool.h:156
InDetDD::Version::majorNum
int majorNum() const
Major version number.
Definition: Version.cxx:62
TRTDigitizationTool::m_printOverrideableSettings
Gaudi::Property< bool > m_printOverrideableSettings
Definition: TRTDigitizationTool.h:145
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDetDD::TRT_BaseElement::identify
virtual Identifier identify() const override final
identifier of this detector element:
TRTDigitizationTool::m_sumTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_sumTool
Definition: TRTDigitizationTool.h:130
TRTElectronicsProcessing.h
TRTDigiHelper.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TRTDigit
Class for TRT digits.
Definition: TRTDigit.h:11
TRTDigitizationTool::m_TRTpaiToolKr
ToolHandle< ITRT_PAITool > m_TRTpaiToolKr
Definition: TRTDigitizationTool.h:128
ITRT_CalDbTool
Definition: ITRT_CalDbTool.h:30
InDetDD::TRT_BaseElement::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash
TRTDigitizationTool::getIdentifier
Identifier getIdentifier(int hitID, IdentifierHash &hashId, Identifier &layerID, bool &statusok) const
Definition: TRTDigitizationTool.cxx:775
TRTDigSettings::noiseInSimhits
bool noiseInSimhits() const
Query whether simulation of noise in hit straws.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PileUpToolBase
Definition: PileUpToolBase.h:18
TRTProcessingOfStraw
TRT Digitization: Processing of a TRT Straws.
Definition: TRTProcessingOfStraw.h:55
TRTDigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Perform digitization:
Definition: TRTDigitizationTool.cxx:486
TRTDigitizationTool::m_HardScatterSplittingMode
Gaudi::Property< int > m_HardScatterSplittingMode
Definition: TRTDigitizationTool.h:147
TRTProcessingOfStraw::ProcessStraw
void ProcessStraw(MagField::AtlasFieldCache &fieldCache, hitCollConstIter i, hitCollConstIter e, TRTDigit &outdigit, bool &m_alreadyPrintedPDGcodeWarning, double m_cosmicEventPhase, int strawGasType, bool emulationArflag, bool emulationKrflag, CLHEP::HepRandomEngine *rndmEngine, CLHEP::HepRandomEngine *elecProcRndmEngine, CLHEP::HepRandomEngine *elecNoiseRndmEngine, CLHEP::HepRandomEngine *paiRndmEngine)
Process this straw all the way from Geant4 hit to output digit.
Definition: TRTProcessingOfStraw.cxx:249
InDetDD::TRT_DetectorManager::getEndcapElement
const TRT_EndcapElement * getEndcapElement(unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex) const
Access Endcap Elements:---------------—(Fast)--------------------------—.
Definition: TRT_DetectorManager.cxx:119
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
AtlasDetectorID::print_to_string
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:655
TRTDigitizationTool::TRTDigitizationTool
TRTDigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TRTDigitizationTool.cxx:63
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TRTDigitizationTool::m_TRTStrawNeighbourSvc
ServiceHandle< ITRT_StrawNeighbourSvc > m_TRTStrawNeighbourSvc
Definition: TRTDigitizationTool.h:134
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
PileUpTimeEventIndex::time
time_type time() const
bunch xing time in ns
Definition: PileUpTimeEventIndex.cxx:71
TRTDigitizationTool::m_trtHitCollList
std::vector< TRTUncompressedHitCollection * > m_trtHitCollList
Definition: TRTDigitizationTool.h:162
TRTDigCondBase.h
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TRTElectronicsNoise.h
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
TRTDigitizationTool::lateInitialize
StatusCode lateInitialize(const EventContext &ctx)
Definition: TRTDigitizationTool.cxx:237
TRTDigSettings::DigSettingsFromCondDB
StatusCode DigSettingsFromCondDB(int m_dig_vers_from_condDB)
Definition: TRTDigSettings.cxx:220
SG::WriteHandle< InDetSimDataCollection >
TRTDigitizationTool::m_trt_id
const TRT_ID * m_trt_id
TRT Id Helper.
Definition: TRTDigitizationTool.h:161
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
TRTDigitizationTool::m_TRTpaiToolXe
ToolHandle< ITRT_PAITool > m_TRTpaiToolXe
Configurable properties.
Definition: TRTDigitizationTool.h:126
TRTDigitizationTool::m_printUsedDigSettings
Gaudi::Property< bool > m_printUsedDigSettings
Definition: TRTDigitizationTool.h:146
TRTUncompressedHitCollection.h
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
TRTDigitizationTool::m_pElectronicsProcessing
TRTElectronicsProcessing * m_pElectronicsProcessing
Definition: TRTDigitizationTool.h:155
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TRTDigSettings::storeSDO
unsigned int storeSDO() const
TRTDigitizationTool::m_cosmicEventPhase
double m_cosmicEventPhase
Definition: TRTDigitizationTool.h:169
TRTDigSettings::timeInterval
double timeInterval() const
Get time interval covered by each digit.
TRTDigitizationTool::initialize
virtual StatusCode initialize() override final
Initialize.
Definition: TRTDigitizationTool.cxx:86
TRTDigitizationTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop. Not (necessarily) able to access SubEvents
Definition: TRTDigitizationTool.cxx:627
TRTNoise.h
InDetSimDataCollection.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
ITRT_SimDriftTimeTool
Definition: ITRT_SimDriftTimeTool.h:30
TRTDigitizationTool::m_maxCrossingTimeSDO
double m_maxCrossingTimeSDO
Definition: TRTDigitizationTool.h:166
TRTDigSettings::print
void print(const std::string &front="") const
Printing of TRT digitization settings.
Definition: TRTDigSettings.cxx:186
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
TRTDigitizationTool::finalize
virtual StatusCode finalize() override final
Finalize.
Definition: TRTDigitizationTool.cxx:850
TRTDigSettings::initialize
void initialize(const InDetDD::TRT_DetectorManager *detmgr)
Initialize: fill defaults and overwrite by user values where appropriate.
Definition: TRTDigSettings.cxx:52
TRTDigiHelper::StrawGasType
int StrawGasType(int statusHT, int useGasMix, MsgStream *log)
Definition: TRTDigiHelper.cxx:11
TRTDigitizationTool::m_alreadyPrintedPDGcodeWarning
bool m_alreadyPrintedPDGcodeWarning
Definition: TRTDigitizationTool.h:164
TRTDigitizationTool::m_outputSDOCollName
SG::WriteHandleKey< InDetSimDataCollection > m_outputSDOCollName
name of the output SDOs.
Definition: TRTDigitizationTool.h:142
hitTime
float hitTime(const AFP_SIDSimHit &hit)
Definition: AFP_SIDSimHit.h:39
TRTDigitizationTool::m_first_event
bool m_first_event
Definition: TRTDigitizationTool.h:176
TRTDigSettings
Class containing parameters and settings used by TRT digitization.
Definition: TRTDigSettings.h:35
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
InDetSimData::Deposit
std::pair< HepMcParticleLink, float > Deposit
Definition: InDetSimData.h:48
TRTDigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< TRTUncompressedHitCollection > m_hitsContainerKey
Definition: TRTDigitizationTool.h:139
checker_macros.h
Define macros for attributes used to control the static checker.
TRTDigSettings::doCrosstalk
bool doCrosstalk() const
Switch on crosstalk noise based on Cosmic 08 measurements.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
PileUpTimeEventIndex
a struct encapsulating the identifier of a pile-up event
Definition: PileUpTimeEventIndex.h:12
TRTDigitizationTool::m_digverscontainerkey
SG::ReadCondHandleKey< AthenaAttributeList > m_digverscontainerkey
Definition: TRTDigitizationTool.h:175
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
PileUpTimeEventIndex::type
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
Definition: PileUpTimeEventIndex.cxx:81
TRTDigitizationTool::m_HardScatterSplittingSkipper
bool m_HardScatterSplittingSkipper
Definition: TRTDigitizationTool.h:178
TRTDigitizationTool::m_TRTsimdrifttimetool
ToolHandle< ITRT_SimDriftTimeTool > m_TRTsimdrifttimetool
Definition: TRTDigitizationTool.h:129
TRTDigitizationTool::m_thpctrt
TimedHitCollection< TRTUncompressedHit > * m_thpctrt
Definition: TRTDigitizationTool.h:163
TRTDigitizationTool::m_onlyUseContainerName
Gaudi::Property< bool > m_onlyUseContainerName
Definition: TRTDigitizationTool.h:138
TRTDigCondBase::strawAverageNoiseLevel
float strawAverageNoiseLevel() const
Get average noise level in straw.
Definition: TRTDigCondBase.cxx:47
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TimedHitCollection< TRTUncompressedHit >
TRTDigitizationTool::m_minCrossingTimeSDO
double m_minCrossingTimeSDO
Definition: TRTDigitizationTool.h:165
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581
TRT_LoLumRawData.h
TRTDigitizationTool::m_ppSvc
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition: TRTDigitizationTool.h:172
TRTDigCondBase::initialize
void initialize(CLHEP::HepRandomEngine *rndmEngine)
Definition: TRTDigCondBase.cxx:64
Identifier
Definition: IdentifierFieldParser.cxx:14
TRTUncompressedHitCollection
AtlasHitsVector< TRTUncompressedHit > TRTUncompressedHitCollection
Definition: TRTUncompressedHitCollection.h:16