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 // particle table
41 #include "HepPDT/ParticleDataTable.hh"
42 #include "GaudiKernel/IPartPropSvc.h"
43 
44 // for the tool
45 #include "GaudiKernel/IToolSvc.h"
46 
47 // Gaudi includes
48 #include "GaudiKernel/SmartDataPtr.h"
49 #include "GaudiKernel/EventContext.h"
50 #include "GaudiKernel/ThreadLocalContext.h"
51 
52 
53 //CondDB
57 #include <limits>
58 #include <cstdint>
59 
60 // Random Number Generation
62 #include "CLHEP/Random/RandomEngine.h"
63 #include "CLHEP/Random/RandGaussZiggurat.h"
64 
66 
67 //#include "driftCircle.h" // local copy for debugging and development
68 
69 //_____________________________________________________________________________
71  const std::string& name,
72  const IInterface* parent)
74 {
75  m_settings = new TRTDigSettings();
76  m_settings->addPropertiesForOverrideableParameters(static_cast<AlgTool*>(this));
77 }
78 
79 //_____________________________________________________________________________
81 
82  ATH_MSG_VERBOSE ( "Begin TRTDigitizationTool::Destructor");
84  delete m_pProcessingOfStraw;
85  delete m_pDigConditions;
86  delete m_pNoise;
87  delete m_settings;
88  ATH_MSG_VERBOSE ( "End TRTDigitizationTool::Destructor");
89 
90 }
91 
92 //_____________________________________________________________________________
94 {
95 
96  ATH_MSG_DEBUG ( name()<<"::initialize() begin" );
97 
98  // Get the TRT Detector Manager
100  ATH_MSG_DEBUG ( "Retrieved TRT_DetectorManager with version " << m_manager->getVersion().majorNum() );
101 
102  ATH_CHECK(detStore()->retrieve(m_trt_id, "TRT_ID"));
103 
105 
106  // Fill setting defaults and process joboption overrides:
108 
110  m_settings->printFlagsForOverrideableParameters("TRTDigSettings Overrideables : ");
111  }
112 
114 
115  ATH_CHECK(m_TRTpaiToolXe.retrieve());
116  ATH_MSG_DEBUG ( "Retrieved the PAI Tool for Xe straws" );
117 
118  ATH_CHECK(m_TRTpaiToolAr.retrieve());
119  ATH_MSG_DEBUG ( "Retrieved the PAI Tool for Ar straws" );
120 
121  ATH_CHECK(m_TRTpaiToolKr.retrieve());
122  ATH_MSG_DEBUG ( "Retrieved the PAI Tool for Kr straws" );
123 
125  ATH_CHECK(m_TRTsimdrifttimetool.retrieve());
126  ATH_MSG_DEBUG ( "Retrieved the Sim. Drifttime Tool" );
127 
128  // Check data object name
129  if (m_hitsContainerKey.key().empty()) {
130  ATH_MSG_FATAL ( "Property DataObjectName not set!" );
131  return StatusCode::FAILURE;
132  }
134  ATH_MSG_DEBUG ( "Input hits: " << m_dataObjectName );
135 
136  // Initialize ReadHandleKey
137  ATH_CHECK(m_hitsContainerKey.initialize(true));
138 
139  // Initialize data handle keys
140  ATH_CHECK(m_outputRDOCollName.initialize());
142 
143  // Get Random Service
144  ATH_CHECK(m_rndmSvc.retrieve());
145 
146  // Get the Particle Properties Service
147  IPartPropSvc* p_PartPropSvc(nullptr);
148  static const bool CREATEIFNOTTHERE(true);
149  ATH_CHECK(service("PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE));
150  m_particleTable = p_PartPropSvc->PDT();
151 
152  //locate the PileUpMergeSvc and initialize our local ptr
154  ATH_CHECK(m_mergeSvc.retrieve());
155  }
156 
157  //Retrieve TRT_StrawNeighbourService.
158  ATH_CHECK(m_TRTStrawNeighbourSvc.retrieve());
159 
160  //Retrieve TRT_CalDbTool
161  if (m_settings->getT0FromData()) {
162  ATH_CHECK(m_calDbTool.retrieve());
163  }
164  else {
165  m_calDbTool.disable();
166  }
167 
169 
170  // Set SDO readout range
171  const double intervalBetweenCrossings(m_settings->timeInterval() / 3.);
172 
173  switch ( (m_settings->storeSDO() )) {
174  case 0: m_minCrossingTimeSDO = -1.*CLHEP::ns; m_maxCrossingTimeSDO = -1.*CLHEP::ns; break;
175  case 1: m_minCrossingTimeSDO = -1.*CLHEP::ns; m_maxCrossingTimeSDO = (intervalBetweenCrossings * 2. + 1.*CLHEP::ns); break;
176  case 2: m_minCrossingTimeSDO = -(intervalBetweenCrossings * 2. + 1.*CLHEP::ns); m_maxCrossingTimeSDO = (intervalBetweenCrossings * 2. + 1.*CLHEP::ns); break;
177  default:
178  ATH_MSG_ERROR ( "storeSDO is out of range:"<<m_settings->storeSDO()<<"allowed values are: 0,1,2. Setting storeSDO = 2 " );
180  break;
181  }
182 
186 
187  return StatusCode::SUCCESS;
188 }
189 
190 //_____________________________________________________________________________
191 StatusCode TRTDigitizationTool::prepareEvent(const EventContext& /*ctx*/, unsigned int)
192 {
193  m_vDigits.clear();
194  m_trtHitCollList.clear();
197  return StatusCode::SUCCESS;
198 }
199 
200 //_____________________________________________________________________________
202  SubEventIterator bSubEvents,
203  SubEventIterator eSubEvents) {
204 
205  m_seen.emplace_back(std::distance(bSubEvents,eSubEvents), bunchXing);
206  //decide if this event will be processed depending on HardScatterSplittingMode & bunchXing
207  if (m_HardScatterSplittingMode == 2 && !m_HardScatterSplittingSkipper ) { m_HardScatterSplittingSkipper = true; return StatusCode::SUCCESS; }
208  if (m_HardScatterSplittingMode == 1 && m_HardScatterSplittingSkipper ) { return StatusCode::SUCCESS; }
210 
211 
212  //TRTUncompressedHit
213 
215  TimedHitCollList hitCollList;
216 
217  if (!(m_mergeSvc->retrieveSubSetEvtData(m_dataObjectName, hitCollList, bunchXing,
218  bSubEvents, eSubEvents).isSuccess()) &&
219  hitCollList.empty()) {
220  ATH_MSG_ERROR("Could not fill TimedHitCollList");
221  return StatusCode::FAILURE;
222  } else {
223  ATH_MSG_VERBOSE(hitCollList.size() << " TRTUncompressedHitCollection with key " <<
224  m_dataObjectName << " found");
225  }
226 
227  TimedHitCollList::iterator iColl(hitCollList.begin());
228  TimedHitCollList::iterator endColl(hitCollList.end());
229 
230  for( ; iColl != endColl; ++iColl){
231  TRTUncompressedHitCollection *hitCollPtr = new TRTUncompressedHitCollection(*iColl->second);
232  PileUpTimeEventIndex timeIndex(iColl->first);
233  ATH_MSG_DEBUG("TRTUncompressedHitCollection found with " << hitCollPtr->size() <<
234  " hits");
235  ATH_MSG_VERBOSE("time index info. time: " << timeIndex.time()
236  << " index: " << timeIndex.index()
237  << " type: " << timeIndex.type());
238  m_thpctrt->insert(timeIndex, hitCollPtr);
239  m_trtHitCollList.push_back(hitCollPtr);
240  }
241 
242  return StatusCode::SUCCESS;
243 }
244 
245 //_____________________________________________________________________________
247 
248  // setup the RNGs which are only used in the first event
249  CLHEP::HepRandomEngine *fakeCondRndmEngine = getRandomEngine("TRT_FakeConditions", m_randomSeedOffset, ctx);
250  CLHEP::HepRandomEngine *noiseInitRndmEngine = getRandomEngine("TRT_Noise", m_randomSeedOffset, ctx);
251  CLHEP::HepRandomEngine *noiseElecRndmEngine = getRandomEngine("TRT_Noise_Electronics", m_randomSeedOffset, ctx);
252  CLHEP::HepRandomEngine *noiseThreshRndmEngine = getRandomEngine("TRT_Noise_ThresholdFluctuations", m_randomSeedOffset, ctx);
253  CLHEP::HepRandomEngine *noiseElecResetRndmEngine = getRandomEngine("TRT_ElectronicsNoiseReset", m_randomSeedOffset, ctx);
254  m_first_event=false;
255 
256  if (!m_digverscontainerkey.empty()) {
257 
258  if ( ConditionsDependingInitialization(ctx).isFailure() ) {
259  ATH_MSG_ERROR ( "Folder holder TRT digitization version exists in condDB, but tag is faulty" );
260  return StatusCode::FAILURE;
261  } else {
262  ATH_MSG_DEBUG ( "Using Digitization version as defined in conditions tag" );
263  }
264 
265  } else {
266  ATH_MSG_DEBUG ( "No folder containing TRT digitization version found in CondDB. Using default from Det Desc tag: " << m_settings->digVers() );
267  }
268 
269  //Resuming initialiazation. Section below had to be moved into event loop due to dependence on conditions data
270 
271  TRTElectronicsNoise *electronicsNoise(nullptr);
273  electronicsNoise = new TRTElectronicsNoise(m_settings, noiseElecRndmEngine);
274  }
275  // ElectronicsProcessing is needed for the regular straw processing,
276  // but also for the noise (it assumes ownership of electronicsnoise )
278 
280  m_manager,
281  m_trt_id,
282  m_UseGasMix,
283  m_sumTool);
284 
285  m_pDigConditions->initialize(fakeCondRndmEngine);
286 
288 
289  // In short this next constructor does 3 things;
290  // i) tunes the amplitude of the electronics noise,
291  // ii) creates a pool of noise digits,
292  // iii) figures out exact low thresholds needed to reproduce actual
293  // straw noise-frequencies:
295  m_manager,
296  noiseInitRndmEngine,
297  noiseElecRndmEngine,
298  noiseThreshRndmEngine,
299  noiseElecResetRndmEngine,
302  electronicsNoise,
303  m_trt_id,
304  m_UseGasMix,
305  m_sumTool);
306 
307  ATH_MSG_DEBUG ( "Average straw noise level is " << m_pDigConditions->strawAverageNoiseLevel() );
308 
309  } else {
310  m_pNoise = nullptr;
311  }
312 
313  ITRT_PAITool *TRTpaiToolXe = &(* m_TRTpaiToolXe);
314  ITRT_PAITool *TRTpaiToolAr = &(* m_TRTpaiToolAr);
315  ITRT_PAITool *TRTpaiToolKr = &(* m_TRTpaiToolKr);
316 
317  ITRT_SimDriftTimeTool *pTRTsimdrifttimetool = &(*m_TRTsimdrifttimetool);
318 
319  const ITRT_CalDbTool* calDbTool = nullptr;
320  if (m_settings->getT0FromData()) {
321  calDbTool = m_calDbTool.get();
322  }
325  m_manager,
326  TRTpaiToolXe,
327  pTRTsimdrifttimetool,
329  m_pNoise,
332  m_trt_id,
333  TRTpaiToolAr,
334  TRTpaiToolKr,
335  calDbTool);
336 
337  ATH_MSG_INFO ( "Gas Property: UseGasMix is " << m_UseGasMix );
338 
339  return StatusCode::SUCCESS;
340 }
341 
342 //_____________________________________________________________________________
345  std::set<int>& sim_hitids, std::set<Identifier>& simhitsIdentifiers,
346  CLHEP::HepRandomEngine *rndmEngine,
347  CLHEP::HepRandomEngine *strawRndmEngine,
348  CLHEP::HepRandomEngine *elecProcRndmEngine,
349  CLHEP::HepRandomEngine *elecNoiseRndmEngine,
350  CLHEP::HepRandomEngine *paiRndmEngine) {
351 
352  // Create a map for the SDO
354 
356  MagField::AtlasFieldCache fieldCache;
358 
359  // Get field cache object
361  const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
362 
363  if (fieldCondObj == nullptr) {
364  ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
365  return StatusCode::FAILURE;
366  }
367  fieldCondObj->getInitializedCache (fieldCache);
368  }
369 
371 
372 
373  ATH_CHECK(simDataMap.record(std::make_unique<InDetSimDataCollection>() ));
374 
375  // Register the map into StoreGate
376  if (not simDataMap.isValid()) {
377  ATH_MSG_FATAL ( "InDetSimData map " << m_outputSDOCollName.key() << " could not be registered in StoreGate !" );
378  return StatusCode::FAILURE;
379  } else {
380  ATH_MSG_DEBUG ( "InDetSimData map " << m_outputSDOCollName.key() << " registered in StoreGate" );
381  }
382 
383  m_cosmicEventPhase = 0.0;
384  if (m_settings->doCosmicTimingPit()) {
386  };
387 
388  // Create a vector of deposits
389  std::vector<InDetSimData::Deposit> depositVector(100);
390 
391  // loop over all straws
393  while (thpctrt.nextDetectorElement(i, e)) {
394 
395  int hitID((*i)->GetHitID()); // Get hitID
396 
397  // evtIndex should be 0 for main event and 1,2,3,... for pileup events:
398  // (event Id is a property of the TimedHitPtr)
399  HepMcParticleLink::index_type evtIndex(i->eventId());
400 
401  if ( m_settings->noiseInUnhitStraws() ) {
402  sim_hitids.insert(hitID);
403  }
404  //Safeguard against a rare case of hitID corruption found by Davide:
405  if ( hitID & 0xc0000000 ) {
406  ATH_MSG_ERROR ( "Hit ID not Valid (" << MSG::hex << hitID << ")" << MSG::dec );
407  continue;
408  }
409 
410  // Convert hitID to Identifier
411  IdentifierHash IdHash;
412  Identifier idLayer;
413  bool identifierOK;
414  Identifier idStraw(getIdentifier(hitID, IdHash, idLayer, identifierOK));
415  if ( !identifierOK ) {
416  ATH_MSG_ERROR ( "Ignoring simhits with suspicious identifier (1)" );
417  continue;
418  }
419 
420  //For crosstalk sim
421  simhitsIdentifiers.insert(idStraw);
422 
424  // Fill a vector of deposits
425  depositVector.clear();
426  depositVector.reserve(std::distance(i,e));
427  for (TimedHitCollection<TRTUncompressedHit>::const_iterator hit_iter(i); hit_iter != e; ++hit_iter ) {
428  // create a new deposit
429  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.
430  (*hit_iter)->GetEnergyDeposit() );
431  if (HepMC::ignoreTruthLink(deposit.first, m_vetoPileUpTruthLinks)) {
432  continue;
433  }
434  ATH_MSG_VERBOSE ( "Deposit: trackID " << deposit.first << " energyDeposit " << deposit.second );
435  depositVector.emplace_back(std::move(deposit));
436  }
437 
438  const TimedHitPtr<TRTUncompressedHit>& theHit(*i);
439  const double bunchCrossingTime(hitTime(theHit) - static_cast<double>(theHit->GetGlobalTime()));
440 
441  // Add the simdata object to the map.
442  if ( !depositVector.empty() &&
443  (evtIndex == 0 || ((*i)->GetKineticEnergy()>m_minpileuptruthEkin)) &&
444  (bunchCrossingTime < m_maxCrossingTimeSDO) && (bunchCrossingTime > m_minCrossingTimeSDO) ) {
445  simDataMap->try_emplace(idStraw, std::move(depositVector));
446  }
448 
449  // Digitization for the given straw
450  TRTDigit digit_straw;
451 
453  //if (m_settings->doCosmicTimingPit()) {
454  // if ( StatusCode::SUCCESS == evtStore()->retrieve(m_ComTime,"ComTime")) {
455  // ATH_MSG_VERBOSE ( "Found tool for cosmic timing: ComTime" );
456  // } else {
457  // ATH_MSG_ERROR ( "Did not find tool needed for cosmic timing: ComTime" );
458  // }
459  //}
460 
461  // if StatusHT == 6 thats emulate argon, ==7 that's emulate krypton
462  bool emulateArFlag = m_sumTool->getStatusHT(idStraw) == 6;
463  bool emulateKrFlag = m_sumTool->getStatusHT(idStraw) == 7;
464  const int statusHT = m_sumTool->getStatusHT(idStraw);
465  m_pProcessingOfStraw->ProcessStraw(fieldCache, i, e, digit_straw,
467  m_cosmicEventPhase, //m_ComTime,
469  emulateArFlag,
470  emulateKrFlag,
471  strawRndmEngine,
472  elecProcRndmEngine,
473  elecNoiseRndmEngine,
474  paiRndmEngine);
475 
476  // Print out the digits etc (for debugging)
477  //int mstrw = digit_straw.GetStrawID();
478  //unsigned int mword = digit_straw.GetDigit();
479  //std::cout << "AJB " << mstrw << ":" << mword << std::endl;
480  //print_mword_properties(mword);
481  //std::cout << "AJB "; bits24(mword);
482  //std::cout << "AJB "; bits27(mword);
483 
484  // finally push back the output digit.
485  if ( digit_straw.GetDigit() ) {
486  m_vDigits.push_back(digit_straw);
487  }
488 
489  } // end of straw loop
490 
491  return StatusCode::SUCCESS;
492 }
493 
494 //_____________________________________________________________________________
496 
497  // Set the RNGs to use for this event.
498  CLHEP::HepRandomEngine *rndmEngine = getRandomEngine("", ctx);
499  CLHEP::HepRandomEngine *elecNoiseRndmEngine = getRandomEngine("TRT_ElectronicsNoise", ctx);
500  CLHEP::HepRandomEngine *noiseRndmEngine = getRandomEngine("TRT_NoiseDigitPool", ctx);
501  CLHEP::HepRandomEngine *strawRndmEngine = getRandomEngine("TRT_ProcessStraw", ctx);
502  CLHEP::HepRandomEngine *elecProcRndmEngine = getRandomEngine("TRT_ThresholdFluctuations", ctx);
503  CLHEP::HepRandomEngine *paiRndmEngine = getRandomEngine("TRT_PAI", ctx);
504 
505  if (m_first_event) {
506  if(this->lateInitialize(ctx).isFailure()) {
507  ATH_MSG_FATAL ( "lateInitialize method failed!" );
508  return StatusCode::FAILURE;
509  }
510  }
511 
513 
514  ATH_MSG_DEBUG ( "TRTDigitizationTool::processAllSubEvents()" );
515 
517  ATH_CHECK(m_trtrdo_container.record(std::make_unique<TRT_RDO_Container>(m_trt_id->straw_layer_hash_max())));
518  ATH_MSG_DEBUG ( " TRT_RDO_Container created " );
519 
520  if (not m_trtrdo_container.isValid()) {
521  ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
522  return StatusCode::FAILURE;
523  }else {
524  ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
525  }
526 
527  m_vDigits.clear();
528 
529  // get the container(s)
532  // In case of single hits container just load the collection using read handles
533  if (!m_onlyUseContainerName) {
535  if (!hitCollection.isValid()) {
536  ATH_MSG_ERROR("Could not get TRTUncompressedHitCollection container " << hitCollection.name() << " from store " << hitCollection.store());
537  return StatusCode::FAILURE;
538  }
539 
540  // Define Hit Collection
541  thpctrt.reserve(1);
542 
543  // create a new hits collection
544  thpctrt.insert(0, hitCollection.cptr());
545  ATH_MSG_DEBUG("TRTUncompressedHitCollection found with " << hitCollection->size() << " hits");
546  }
547  else {
548  TimedHitCollList hitCollList; // this is a list<pair<time_t, DataLink<TRTUncompressedHitCollection> > >
549  unsigned int numberOfSimHits(0);
550  if ( !(m_mergeSvc->retrieveSubEvtsData(m_dataObjectName, hitCollList, numberOfSimHits).isSuccess()) && hitCollList.empty() ) {
551  ATH_MSG_ERROR ( "Could not fill TimedHitCollList" );
552  return StatusCode::FAILURE;
553  } else {
554  ATH_MSG_DEBUG ( hitCollList.size() << " TRTUncompressedHitCollections with key " << m_dataObjectName << " found" );
555  }
556 
557  // Define Hit Collection
558  thpctrt.reserve(numberOfSimHits);
559 
560  //now merge all collections into one
561  TimedHitCollList::iterator iColl(hitCollList.begin());
562  TimedHitCollList::iterator endColl(hitCollList.end() );
564  // loop on the hit collections
565  while ( iColl != endColl ) {
566  //decide if this event will be processed depending on HardScatterSplittingMode & bunchXing
568  if (m_HardScatterSplittingMode == 1 && m_HardScatterSplittingSkipper ) { ++iColl; continue; }
570  const TRTUncompressedHitCollection* p_collection(iColl->second);
571  thpctrt.insert(iColl->first, p_collection);
572  ATH_MSG_DEBUG ( "TRTUncompressedHitCollection found with " << p_collection->size() << " hits" );
573  ++iColl;
574  }
575  }
576 
577  //Set of all hitid's with simhits (used for noise simulation).
578  std::set<int> sim_hitids;
579  std::set<Identifier> simhitsIdentifiers;
580 
581  // Process the Hits straw by straw: get the iterator pairs for given straw
582  ATH_CHECK(this->processStraws(ctx, thpctrt, sim_hitids, simhitsIdentifiers, rndmEngine, strawRndmEngine, elecProcRndmEngine, elecNoiseRndmEngine,paiRndmEngine));
583 
584  // no more hits
585 
586  //Noise in straws without simhits:
588  const int numberOfDigitsBeforeNoise(m_vDigits.size());
589 
590  m_pNoise->appendPureNoiseToProperDigits(m_vDigits, sim_hitids, noiseRndmEngine);
591  if (m_settings->doCrosstalk()) {
592  m_pNoise->appendCrossTalkNoiseToProperDigits(m_vDigits, simhitsIdentifiers,m_TRTStrawNeighbourSvc, noiseRndmEngine);
593  }
594 
595  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() << " (" << m_vDigits.size()-numberOfDigitsBeforeNoise << " of those are pure noise)" );
596 
598 
599  } else {
600  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() );
601  }
602 
603  // All digits are ready.
604  // We just need to convert to relevant identifiers and output to storegate.
605 
606  if (createAndStoreRDOs().isFailure()) {
607  ATH_MSG_FATAL ( "createAndStoreRDOs() failed!" );
608  return StatusCode::FAILURE;
609  }
610  else {
611  ATH_MSG_DEBUG ( "createAndStoreRDOs() succeeded" );
612  }
613 
614  return StatusCode::SUCCESS;
615 }
616 
617 CLHEP::HepRandomEngine* TRTDigitizationTool::getRandomEngine(const std::string& streamName,
618  const EventContext& ctx) const
619 {
620  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
621  std::string rngName = name()+streamName;
622  rngWrapper->setSeed( rngName, ctx );
623  return rngWrapper->getEngine(ctx);
624 }
625 
626 //_____________________________________________________________________________
627 CLHEP::HepRandomEngine* TRTDigitizationTool::getRandomEngine(const std::string& streamName, unsigned long int randomSeedOffset,
628  const EventContext& ctx) const
629 {
630  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
631  rngWrapper->setSeed( streamName, ctx.slot(), randomSeedOffset, ctx.eventID().run_number() );
632  return rngWrapper->getEngine(ctx);
633 }
634 
635 //_____________________________________________________________________________
636 StatusCode TRTDigitizationTool::mergeEvent(const EventContext& ctx) {
637  std::vector<std::pair<unsigned int, int> >::iterator ii(m_seen.begin());
638  std::vector<std::pair<unsigned int, int> >::iterator ee(m_seen.end());
639  while (ii != ee) {
640  ATH_MSG_DEBUG( "mergeEvent: there are " << ii->first << " events in bunch xing " << ii->second );
641  ++ii;
642  }
643 
644  // Set the RNGs to use for this event.
645  CLHEP::HepRandomEngine *rndmEngine = getRandomEngine("", ctx);
646  CLHEP::HepRandomEngine *elecNoiseRndmEngine = getRandomEngine("TRT_ElectronicsNoise", ctx);
647  CLHEP::HepRandomEngine *noiseRndmEngine = getRandomEngine("TRT_NoiseDigitPool", ctx);
648  CLHEP::HepRandomEngine *strawRndmEngine = getRandomEngine("TRT_ProcessStraw", ctx);
649  CLHEP::HepRandomEngine *elecProcRndmEngine = getRandomEngine("TRT_ThresholdFluctuations", ctx);
650  CLHEP::HepRandomEngine *paiRndmEngine = getRandomEngine("TRT_PAI", ctx);
651 
652  if (m_first_event) {
653  if(this->lateInitialize(ctx).isFailure()) {
654  ATH_MSG_FATAL ( "lateInitialize method failed!" );
655  return StatusCode::FAILURE;
656  }
657  }
658 
660 
661  ATH_MSG_DEBUG ( "TRTDigitization::execute()" );
662 
664  ATH_CHECK(m_trtrdo_container.record(std::make_unique<TRT_RDO_Container>(m_trt_id->straw_layer_hash_max())));
665  ATH_MSG_DEBUG ( " TRT_RDO_Container created " );
666  if (not m_trtrdo_container.isValid()) {
667  ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
668  return StatusCode::FAILURE;
669  } else {
670  ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
671  }
672 
673  //Set of all hitid's with simhits (used for noise simulation).
674  std::set<int> sim_hitids;
675  std::set<Identifier> simhitsIdentifiers;
676 
677  // Process the Hits straw by straw:
678  // get the iterator pairs for given straw
679  ATH_CHECK(this->processStraws(ctx, *m_thpctrt, sim_hitids, simhitsIdentifiers, rndmEngine, strawRndmEngine, elecProcRndmEngine, elecNoiseRndmEngine,paiRndmEngine));
680 
681  delete m_thpctrt;
682  for(TRTUncompressedHitCollection* ptr : m_trtHitCollList) delete ptr;
683  m_trtHitCollList.clear();
684  // no more hits
685 
686  //Noise in straws without simhits:
688  const unsigned int numberOfDigitsBeforeNoise(m_vDigits.size());
689 
690  m_pNoise->appendPureNoiseToProperDigits(m_vDigits, sim_hitids, noiseRndmEngine);
691  if (m_settings->doCrosstalk()) {
692  m_pNoise->appendCrossTalkNoiseToProperDigits(m_vDigits, simhitsIdentifiers,m_TRTStrawNeighbourSvc, noiseRndmEngine);
693  }
694 
695  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() << " (" << m_vDigits.size()-numberOfDigitsBeforeNoise << " of those are pure noise)" );
696 
698 
699  } else {
700  ATH_MSG_DEBUG ( " Number of digits " << m_vDigits.size() );
701  };
702 
703  // All digits are ready.
704  // We just need to convert to relevant identifiers and output to storegate.
705 
706  if (createAndStoreRDOs().isFailure()) {
707  ATH_MSG_FATAL ( "createAndStoreRDOs() failed!" );
708  return StatusCode::FAILURE;
709  }
710  else {
711  ATH_MSG_DEBUG ( "createAndStoreRDOs() succeeded" );
712  }
713 
714  return StatusCode::SUCCESS;
715 }
716 
717 //_____________________________________________________________________________
719 {
720 
721  std::vector<TRTDigit>::const_iterator TRTDigitIter(m_vDigits.begin());
722  std::vector<TRTDigit>::const_iterator endOfTRTDigits(m_vDigits.end());
723 
724  // for testing
725  IdentifierHash IdHash; // default value is 0xFFFFFFFF
726  IdentifierHash IdHashOld; // default value is 0xFFFFFFFF
727  TRT_RDO_Collection *RDOColl(nullptr);
728 
729  Identifier idStraw;
730 
731  while (TRTDigitIter != endOfTRTDigits) {
732  ATH_MSG_DEBUG ( "Digit ID " << TRTDigitIter->GetStrawID() << " Digit " << TRTDigitIter->GetDigit() );
733 
734  Identifier layer_id;
735  bool identifierOK(false);
736  idStraw = getIdentifier(TRTDigitIter->GetStrawID(), IdHash, layer_id, identifierOK);
737  if (!identifierOK) {
738  ATH_MSG_ERROR ( "Ignoring simhits with suspicious identifier (2)" );
739  ++TRTDigitIter;
740  continue;
741  };
742 
743  // Create new TRT RDO Collection
744  ATH_MSG_DEBUG ( " RDO ID " << m_trt_id->print_to_string(idStraw) );
745 
746  //TK: wauv - we are really betting the farm on the fact that the
747  //ordering of digits will result in a similar ordering of the
748  //idhash'es here... (this is not immediately the case when noise
749  //hits are appended afterwards).
750 
751  if (IdHash != IdHashOld) {
752  RDOColl = new TRT_RDO_Collection(IdHash);
753  ATH_MSG_DEBUG ( "New TRT RDO Collection created with IdHash " << static_cast<int>(IdHash) );
754  IdHashOld = IdHash;
755  RDOColl->setIdentifier(layer_id);
756 
757  // Add to the container
758  if (m_trtrdo_container->addCollection(RDOColl, RDOColl->identifyHash()).isFailure()) {
759  ATH_MSG_FATAL ( "Container " << m_outputRDOCollName.key() << " could not be registered in StoreGate !" );
760  return StatusCode::FAILURE;
761  } else {
762  ATH_MSG_DEBUG ( "Container " << m_outputRDOCollName.key() << " registered in StoreGate" );
763  }
764  }
765 
766  // Put RDO into Collection
767  TRT_LoLumRawData *p_rdo(new TRT_LoLumRawData(idStraw, TRTDigitIter->GetDigit()));
768  if (RDOColl) {
769  RDOColl->push_back(p_rdo);
770  } else {
771  ATH_MSG_FATAL ( "Failed to create the TRT_RDO_Collection before trying to add an RDO to it! IdHash = " << static_cast<int>(IdHash) );
772  delete p_rdo;
773  return StatusCode::FAILURE;
774  }
775  ++TRTDigitIter;
776  }
777 
778  m_vDigits.clear();
779  return StatusCode::SUCCESS;
780 }
781 
782 
783 //_____________________________________________________________________________
785  IdentifierHash& hashId,
786  Identifier& IdLayer,
787  bool & statusok ) const
788 {
789  statusok = true;
790 
791  Identifier IdStraw;
792 
793  const int mask(0x0000001F);
794  const int word_shift(5);
795  int trtID, ringID, moduleID, layerID, strawID;
796  int wheelID, planeID, sectorID;
797 
798  const InDetDD::TRT_BarrelElement *barrelElement;
799  const InDetDD::TRT_EndcapElement *endcapElement;
800 
801  if ( !(hitID & 0x00200000) ) { // barrel
802  strawID = hitID & mask;
803  hitID >>= word_shift;
804  layerID = hitID & mask;
805  hitID >>= word_shift;
806  moduleID = hitID & mask;
807  hitID >>= word_shift;
808  ringID = hitID & mask;
809  trtID = hitID >> word_shift;
810 
811  barrelElement = m_manager->getBarrelElement(trtID, ringID, moduleID, layerID);
812  if ( barrelElement ) {
813  hashId = barrelElement->identifyHash();
814  IdLayer = barrelElement->identify();
815  IdStraw = m_trt_id->straw_id(IdLayer, strawID);
816  } else {
817  ATH_MSG_ERROR ( "Could not find detector element for barrel identifier with "
818  << "(ipos,iring,imod,ilayer,istraw) = ("
819  << trtID << ", " << ringID << ", " << moduleID << ", "
820  << layerID << ", " << strawID << ")" );
821  statusok = false;
822  }
823  } else { // endcap
824  strawID = hitID & mask;
825  hitID >>= word_shift;
826  planeID = hitID & mask;
827  hitID >>= word_shift;
828  sectorID = hitID & mask;
829  hitID >>= word_shift;
830  wheelID = hitID & mask;
831  trtID = hitID >> word_shift;
832 
833  // change trtID (which is 2/3 for endcaps) to use 0/1 in getEndcapElement
834  if (trtID == 3) { trtID = 0; }
835  else { trtID = 1; }
836 
837  endcapElement = m_manager->getEndcapElement(trtID, wheelID, planeID, sectorID);
838 
839  if ( endcapElement ) {
840  hashId = endcapElement->identifyHash();
841  IdLayer = endcapElement->identify();
842  IdStraw = m_trt_id->straw_id(IdLayer, strawID);
843  } else {
844  ATH_MSG_ERROR ( "Could not find detector element for endcap identifier with "
845  << "(ipos,iwheel,isector,iplane,istraw) = ("
846  << trtID << ", " << wheelID << ", " << sectorID << ", "
847  << planeID << ", " << strawID << ")" );
848  ATH_MSG_ERROR ( "If this happens very rarely, don't be alarmed (it is a Geant4 'feature')" );
849  ATH_MSG_ERROR ( "If it happens a lot, you probably have misconfigured geometry in the sim. job." );
850  statusok = false;
851  }
852 
853  }
854 
855  return IdStraw;
856 }
857 
858 //_____________________________________________________________________________
860 
862  m_settings->print("TRTDigSettings Settings : ");
863  }
864 
865  ATH_MSG_INFO ( "TRTDigitizationTool::finalize()" );
866 
867  return StatusCode::SUCCESS;
868 }
869 
870 //_____________________________________________________________________________
871 
873 {
875  int dig_vers_from_condDB = (**digvers)["TRT_Dig_Vers"].data<int>();
876 
877  if (dig_vers_from_condDB!=0) {
878 
879  if (StatusCode::SUCCESS == m_settings->DigSettingsFromCondDB(dig_vers_from_condDB)) {
880  ATH_MSG_INFO ( "Retrieved TRT_Settings from CondDB with TRT digitization version: digversion = " <<
881  dig_vers_from_condDB );
882  } else {
883  ATH_MSG_WARNING ( "Unknown TRT digitization version: digversion = " << dig_vers_from_condDB <<
884  " read from CondDB. Overriding to use default from Det Desc tag: " <<
885  m_settings->digVers() );
886  }
887 
888  } else {
889  ATH_MSG_WARNING ( "TRT digitization version: digversion = " << dig_vers_from_condDB <<
890  " read from CondDB. Overriding to use default from Det Desc tag: " <<
891  m_settings->digVers() );
892  }
893 
894  return StatusCode::SUCCESS;
895 
896 }
897 
898 //_____________________________________________________________________________
899 double TRTDigitizationTool::getCosmicEventPhase(CLHEP::HepRandomEngine *rndmEngine) {
900  // 13th February 2015: replace ComTime with a hack (fixme) based on an
901  // event phase distribution from Alex (alejandro.alonso@cern.ch) that
902  // is modelled as a Guassian of mean 5.48 ns and sigma 8.91 ns.
903  return CLHEP::RandGaussZiggurat::shoot(rndmEngine, 5.48, 8.91);
904 }
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:872
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:113
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:201
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:44
TRTDigSettings::digVers
int digVers() const
TRTDigitizationTool::~TRTDigitizationTool
~TRTDigitizationTool()
Destructor.
Definition: TRTDigitizationTool.cxx:80
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:343
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
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:296
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:170
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:269
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:617
TRT_RDO_Collection
InDetRawDataCollection< TRT_RDORawData > TRT_RDO_Collection
Definition: TRT_RDO_Collection.h:20
TRTDigitizationTool::createAndStoreRDOs
StatusCode createAndStoreRDOs()
Definition: TRTDigitizationTool.cxx:718
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:191
lumiFormat.i
int i
Definition: lumiFormat.py:92
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.
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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:899
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition: StoreGate/src/VarHandleBase.cxx:379
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:29
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:784
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:495
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:248
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:129
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:70
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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:246
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
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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:93
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:636
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:859
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:172
TRTDigSettings
Class containing parameters and settings used by TRT digitization.
Definition: TRTDigSettings.h:35
IdentifierHash
Definition: IdentifierHash.h:38
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:171
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:174
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
TRTDigCondBase::initialize
void initialize(CLHEP::HepRandomEngine *rndmEngine)
Definition: TRTDigCondBase.cxx:64
TRTUncompressedHitCollection
AtlasHitsVector< TRTUncompressedHit > TRTUncompressedHitCollection
Definition: TRTUncompressedHitCollection.h:16