ATLAS Offline Software
sTgcDigitizationTool.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 //
7 // sTgcDigitizationTool
8 // ------------
9 // Authors: Nectarios Benekos <nectarios.benekos@cern.ch>
10 // Jiaming Yu <jiaming.yu@cern.ch>
12 
13 //sTGC digitization includes
15 
19 
20 //Outputs
22 
23 
24 //Geometry
31 #include "TrkSurfaces/Surface.h"
32 #include "CLHEP/Random/RandGaussZiggurat.h"
33 
34 //Truth
36 #include "AtlasHepMC/GenParticle.h"
37 
39 
40 #include <sstream>
41 #include <iostream>
42 #include <fstream>
43 
44 #include <memory>
45 
46 
47 using namespace MuonGM;
49 
50 
51 /*******************************************************************************/
52 sTgcDigitizationTool::sTgcDigitizationTool(const std::string& type, const std::string& name, const IInterface* parent) :
54 
55 /*******************************************************************************/
56 // member function implementation
57 //--------------------------------------------
59 
60  ATH_MSG_INFO (" sTgcDigitizationTool retrieved");
61  ATH_MSG_INFO ( "Configuration sTgcDigitizationTool" );
62  ATH_MSG_INFO ( "doSmearing "<< m_doSmearing);
63  ATH_MSG_INFO ( "RndmSvc " << m_rndmSvc );
64  ATH_MSG_INFO ( "RndmEngine " << m_rndmEngineName );
65  ATH_MSG_INFO ( "InputObjectName " << m_hitsContainerKey.key());
66  ATH_MSG_INFO ( "OutputObjectName " << m_outputDigitCollectionKey.key());
67  ATH_MSG_INFO ( "OutputSDOName " << m_outputSDO_CollectionKey.key());
68  ATH_MSG_INFO ( "HV " << m_runVoltage);
69  ATH_MSG_INFO ( "threshold " << m_chargeThreshold);
70  ATH_MSG_INFO ( "useCondThresholds " << m_useCondThresholds);
71 
72  if (m_hitsContainerKey.key().empty()) {
73  ATH_MSG_FATAL("Property InputObjectName not set !");
74  return StatusCode::FAILURE;
75  }
76 
78  ATH_MSG_DEBUG("Input objects in container: '" << m_inputObjectName << "'");
79 
80  // Pile-up merge service
82  ATH_CHECK(m_mergeSvc.retrieve());
83  }
84 
85  // retrieve MuonDetctorManager from DetectorStore
87  ATH_CHECK(m_idHelperSvc.retrieve());
89 
90 
91  // calibration tool
92  ATH_CHECK(m_calibTool.retrieve());
93  // initialize ReadCondHandleKey
95  // Initialize ReadHandleKey
96  ATH_CHECK(m_hitsContainerKey.initialize());
97 
98  //initialize the output WriteHandleKeys
101 
102  // initialize sTgcDigitMaker class to digitize hits
103  // meanGasGain is the mean value of the polya gas gain function describing the
104  // avalanche of electrons caused by the electric field
105  // Parameterization is obtained from ATL-MUON-PUB-2014-001 and the corrected
106  // fit to data to parameterize gain vs HV in kV
107  // m_runVoltage MUST BE in kV!
108  if (m_runVoltage < 2.3 || m_runVoltage > 3.2){
109  ATH_MSG_ERROR("STGC run voltage must be in kV and within fit domain of 2.3 kV to 3.2 kV");
110  return StatusCode::FAILURE;
111  }
112  double meanGasGain = 2.15 * 1E-4 * std::exp(6.88*m_runVoltage);
113  m_digitizer = std::make_unique<sTgcDigitMaker>(m_idHelperSvc.get(), m_doChannelTypes, meanGasGain, m_doPadSharing, m_stripChargeScale);
114  m_digitizer->setLevel(static_cast<MSG::Level>(msgLevel()));
115  ATH_CHECK(m_digitizer->initialize());
116 
117  ATH_CHECK(m_rndmSvc.retrieve());
118  // getting our random numbers stream
119  ATH_MSG_DEBUG("Getting random number engine : <" << m_rndmEngineName << ">");
120 
121  return StatusCode::SUCCESS;
122 }
123 /*******************************************************************************/
124 StatusCode sTgcDigitizationTool::prepareEvent(const EventContext& /*ctx*/, unsigned int nInputEvents) {
125 
126  ATH_MSG_DEBUG("sTgcDigitizationTool::prepareEvent() called for " << nInputEvents << " input events" );
127  m_STGCHitCollList.clear();
128 
129  return StatusCode::SUCCESS;
130 }
131 /*******************************************************************************/
132 
134  SubEventIterator bSubEvents,
135  SubEventIterator eSubEvents) {
136  ATH_MSG_DEBUG ( "sTgcDigitizationTool::in processBunchXing()" );
137  if (m_thpcsTGC == nullptr) {
138  m_thpcsTGC = std::make_unique<TimedHitCollection<sTGCSimHit>>();
139  }
141  TimedHitCollList hitCollList;
142 
143  if (!(m_mergeSvc->retrieveSubSetEvtData(m_inputObjectName, hitCollList, bunchXing,
144  bSubEvents, eSubEvents).isSuccess()) &&
145  hitCollList.empty()) {
146  ATH_MSG_ERROR("Could not fill TimedHitCollList");
147  return StatusCode::FAILURE;
148  } else {
149  ATH_MSG_VERBOSE(hitCollList.size() << " sTGCSimHitCollection with key " <<
150  m_inputObjectName << " found");
151  }
152 
153  TimedHitCollList::iterator iColl(hitCollList.begin());
154  TimedHitCollList::iterator endColl(hitCollList.end());
155 
156  // Iterating over the list of collections
157  for( ; iColl != endColl; ++iColl){
158 
159  auto hitCollPtr = std::make_unique<sTGCSimHitCollection>(*iColl->second);
160  PileUpTimeEventIndex timeIndex(iColl->first);
161 
162  ATH_MSG_DEBUG("sTGCSimHitCollection found with " << hitCollPtr->size() << " hits");
163  ATH_MSG_VERBOSE("time index info. time: " << timeIndex.time()
164  << " index: " << timeIndex.index()
165  << " type: " << timeIndex.type());
166 
167  m_thpcsTGC->insert(timeIndex, hitCollPtr.get());
168  m_STGCHitCollList.push_back(std::move(hitCollPtr));
169  }
170  return StatusCode::SUCCESS;
171 }
172 /*******************************************************************************/
174 
175  ATH_MSG_DEBUG ( "sTgcDigitizationTool::getNextEvent()" );
176 
177  // get the container(s)
179 
180  // In case of single hits container just load the collection using read handles
181  if (!m_onlyUseContainerName) {
183  if (!hitCollection.isValid()) {
184  ATH_MSG_ERROR("Could not get sTGCSimHitCollection container " << hitCollection.name() << " from store " << hitCollection.store());
185  return StatusCode::FAILURE;
186  }
187 
188  // create a new hits collection
189  m_thpcsTGC = std::make_unique<TimedHitCollection<sTGCSimHit>>(1);
190  m_thpcsTGC->insert(0, hitCollection.cptr());
191  ATH_MSG_DEBUG("sTGCSimHitCollection found with " << hitCollection->size() << " hits");
192  return StatusCode::SUCCESS;
193  }
194 
195  //this is a list<info<time_t, DataLink<sTGCSimHitCollection> > >
196  TimedHitCollList hitCollList;
197 
198  if (!(m_mergeSvc->retrieveSubEvtsData(m_inputObjectName, hitCollList).isSuccess()) ) {
199  ATH_MSG_ERROR ( "Could not fill TimedHitCollList" );
200  return StatusCode::FAILURE;
201  }
202  if (hitCollList.empty()) {
203  ATH_MSG_ERROR ( "TimedHitCollList has size 0" );
204  return StatusCode::FAILURE;
205  }
206  else {
207  ATH_MSG_DEBUG ( hitCollList.size() << " sTGC SimHitCollections with key " << m_inputObjectName << " found" );
208  }
209 
210  //Perform null check on m_thpcsTGC. If pointer is not null throw error
211  if (!m_thpcsTGC) {
212  m_thpcsTGC = std::make_unique<TimedHitCollection<sTGCSimHit>>();
213  }else{
214  ATH_MSG_ERROR ( "m_thpcsTGC is not null" );
215  return StatusCode::FAILURE;
216  }
217 
218  //now merge all collections into one
219  TimedHitCollList::iterator iColl(hitCollList.begin());
220  TimedHitCollList::iterator endColl(hitCollList.end());
221  while (iColl != endColl) {
222  const sTGCSimHitCollection* p_collection(iColl->second);
223  m_thpcsTGC->insert(iColl->first, p_collection);
224  ATH_MSG_DEBUG ( "sTGC SimHitCollection found with " << p_collection->size() << " hits" );
225  ++iColl;
226  }
227 
228  return StatusCode::SUCCESS;
229 }
230 
231 /*******************************************************************************/
233  ATH_MSG_DEBUG ( "sTgcDigitizationTool::in mergeEvent()" );
235  // reset the pointer
236  m_thpcsTGC.reset();
237  m_STGCHitCollList.clear();
238 
239  return StatusCode::SUCCESS;
240 }
241 /*******************************************************************************/
242 StatusCode sTgcDigitizationTool::digitize(const EventContext& ctx) {
243  return this->processAllSubEvents(ctx);
244 }
245 /*******************************************************************************/
247  ATH_MSG_DEBUG (" sTgcDigitizationTool::processAllSubEvents()" );
248  //merging of the hit collection in getNextEvent method
249  if (!m_thpcsTGC ) {
250  ATH_CHECK(getNextEvent(ctx));
251  }
253  // reset the pointer
254  m_thpcsTGC.reset();
255 
256  return StatusCode::SUCCESS;
257 }
258 
259 template <class CondType> StatusCode sTgcDigitizationTool::retrieveCondData(const EventContext& ctx,
261  const CondType* & condPtr) const{
262  if (key.empty()) {
263  ATH_MSG_DEBUG("No key has been configured for object "<<typeid(CondType).name()<<". Clear pointer");
264  condPtr = nullptr;
265  return StatusCode::SUCCESS;
266  }
267  SG::ReadCondHandle<CondType> readHandle{key, ctx};
268  if (!readHandle.isValid()){
269  ATH_MSG_FATAL("Failed to load conditions object "<<key.fullKey()<<".");
270  return StatusCode::FAILURE;
271  }
272  condPtr = readHandle.cptr();
273  return StatusCode::SUCCESS;
274 }
275 
276 /*******************************************************************************/
278 
279  ATH_MSG_DEBUG ("sTgcDigitizationTool::doDigitization()" );
280  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
281 
282  sTgcDigitMaker::DigiConditions digitCond{};
283  digitCond.rndmEngine = getRandomEngine(m_rndmEngineName, ctx);
284  ATH_CHECK(retrieveCondData(ctx, m_detMgrKey, digitCond.detMgr));
285  ATH_CHECK(retrieveCondData(ctx, m_effiKey, digitCond.efficiencies));
286  ATH_CHECK(retrieveCondData(ctx, m_condThrshldsKey , digitCond.thresholdData));
287 
288 
289  // create and record the Digit container in StoreGate
291  ATH_CHECK(digitContainer.record(std::make_unique<sTgcDigitContainer>(idHelper.module_hash_max())));
292  ATH_MSG_DEBUG ( "sTgcDigitContainer recorded in StoreGate." );
293 
294  // Create and record the SDO container in StoreGate
296  ATH_CHECK(sdoContainer.record(std::make_unique<MuonSimDataCollection>()));
297  ATH_MSG_DEBUG( "sTgcSDOCollection recorded in StoreGate." );
298 
299 
301 
302  // Collections of digits by digit type associated with a detector element
303  sTgcSimDigitCont unmergedPadDigits{}, unmergedStripDigits{}, unmergedWireDigits{};
304  sTgcDigtCont outputDigits{};
305 
306  ATH_MSG_DEBUG("create Digit container of size " << idHelper.module_hash_max());
307 
308  double earliestEventTime = 9999;
309 
310  // --nextDetectorElement>sets an iterator range with the hits of current detector element , returns a bool when done
311  while(m_thpcsTGC->nextDetectorElement(i, e)) {
312  int nhits = 0;
313  ATH_MSG_VERBOSE("Next Detector Element");
314  while(i != e){ //loop through the hits on this Detector Element
315  ATH_MSG_VERBOSE("Looping over hit " << nhits+1 << " on this Detector Element." );
316 
317  ++nhits;
318  TimedHitPtr<sTGCSimHit> phit = *i++;
319  const sTGCSimHit& hit = *phit;
320  ATH_MSG_VERBOSE("Hit Particle ID : " << hit.particleEncoding() );
321  double eventTime = phit.eventTime();
322  if(eventTime < earliestEventTime) earliestEventTime = eventTime;
323  // Cut on energy deposit of the particle
325  ATH_MSG_VERBOSE("Hit with Energy Deposit of " << hit.depositEnergy()
326  << " less than " << m_energyDepositThreshold << ". Skip this hit." );
327  continue;
328  }
329 
330  // Old HITS format doesn't have kinetic energy (i.e it is set to -1).
331  double hit_kineticEnergy = hit.kineticEnergy();
332 
333  // Skip digitizing some problematic hits, if processing compatible HITS format
334  if (hit_kineticEnergy > 0.) {
335  // Skip electron with low kinetic energy, since electrons are mainly secondary particles.
336  if ((std::abs(hit.particleEncoding()) == 11) && (hit_kineticEnergy < m_limitElectronKineticEnergy)) {
337  ATH_MSG_DEBUG("Skip electron hit with kinetic energy " << hit_kineticEnergy
338  << ", which is less than the lower limit of " << m_limitElectronKineticEnergy);
339  continue;
340  }
341 
342  // No support for particles with direction perpendicular to the beam line, since such particles
343  // can deposit energy on a lot of strips and pads of the gas gap. So a good model of charge
344  // spreading should be implemented. Also, these particles are rare, and most of them are
345  // secondary particles suh as electrons.
346  if (std::abs(hit.globalPosition().z() - hit.globalPrePosition().z()) < 0.00001) {
347  ATH_MSG_VERBOSE("Skip hit with a direction perpendicular to the beam line, ie z-component is less than 0.00001 mm.");
348  continue;
349  }
350  }
351 
352  if(eventTime != 0){
353  ATH_MSG_DEBUG("Updated hit global time to include off set of " << eventTime << " ns from OOT bunch.");
354  }
355  else {
356  ATH_MSG_DEBUG("This hit came from the in time bunch.");
357  }
358  sTgcSimIdToOfflineId simToOffline(&idHelper);
359  const int idHit = hit.sTGCId();
360  ATH_MSG_VERBOSE("Hit ID " << idHit );
361  Identifier layid = simToOffline.convert(idHit);
362  int eventId = phit.eventId();
363 
366  if (m_doSmearing) {
367  bool acceptHit = true;
368  ATH_CHECK(m_smearingTool->isAccepted(layid, acceptHit, digitCond.rndmEngine));
369  if ( !acceptHit ) {
370  ATH_MSG_DEBUG("Dropping the hit - smearing tool");
371  continue;
372  }
373  }
374 
375  const MuonGM::sTgcReadoutElement* detEL = digitCond.detMgr->getsTgcReadoutElement(layid); //retreiving the sTGC this hit is located in
376  if(!detEL) {
377  ATH_MSG_WARNING("Failed to retrieve detector element for "
378  << m_idHelperSvc->toStringDetEl(layid));
379  continue;
380  }
381 
382  // project the hit position to wire surface (along the incident angle)
383  ATH_MSG_VERBOSE("Projecting hit to Wire Surface" );
384  const Amg::Vector3D& HPOS{hit.globalPosition()}; //Global position of the hit
385  const Amg::Vector3D& GLODIRE{hit.globalDirection()};
386  const Amg::Vector3D& global_preStepPos{hit.globalPrePosition()};
387 
388  ATH_MSG_VERBOSE("Global Direction " << Amg::toString(GLODIRE, 2) );
389  ATH_MSG_VERBOSE("Global Position " << Amg::toString(HPOS, 2) );
390 
391  int surfHash_wire = detEL->surfaceHash(idHelper.gasGap(layid),
392  sTgcIdHelper::sTgcChannelTypes::Wire);
393  ATH_MSG_VERBOSE("Surface Hash for wire plane" << surfHash_wire );
394  const Trk::PlaneSurface& SURF_WIRE = detEL->surface(surfHash_wire); //Plane of the wire surface in this gasGap
395  ATH_MSG_VERBOSE("Wire Surface Defined " <<Amg::toString(SURF_WIRE.center(), 2) );
396 
397  const Amg::Transform3D wireTrans = SURF_WIRE.transform().inverse();
398  Amg::Vector3D LOCDIRE = wireTrans.linear()*GLODIRE;
399  Amg::Vector3D LPOS = wireTrans * HPOS; //Position of the hit on the wire plane in local coordinates
400 
401  ATH_MSG_VERBOSE("Local Direction: "<<Amg::toString(LOCDIRE, 2));
402  ATH_MSG_VERBOSE("Local Position: " << Amg::toString(LPOS, 2));
403 
404  const double scale = Amg::intersect<3>(LPOS, LOCDIRE, Amg::Vector3D::UnitZ(), 0.).value_or(0);
405  // Hit on the wire surface in local coordinates
406  Amg::Vector3D hitOnSurf_wire = LPOS + scale * LOCDIRE;
407 
408  //The hit on the wire in Global coordinates
409  Amg::Vector3D glob_hitOnSurf_wire = SURF_WIRE.transform() * hitOnSurf_wire;
410 
411  ATH_MSG_VERBOSE("Local Hit on Wire Surface: " << Amg::toString(hitOnSurf_wire, 2));
412  ATH_MSG_VERBOSE("Global Hit on Wire Surface: " <<Amg::toString(glob_hitOnSurf_wire, 2));
413 
414  ATH_MSG_DEBUG("sTgcDigitizationTool::doDigitization hits mapped");
415 
416  const HepMcParticleLink particleLink = HepMcParticleLink::getRedirectedLink(hit.particleLink(), eventId, ctx); // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc.
417  const sTGCSimHit temp_hit(hit.sTGCId(), hit.globalTime(),
418  HPOS,
419  hit.particleEncoding(),
420  hit.globalDirection(),
421  hit.depositEnergy(),
422  particleLink,
423  hit_kineticEnergy,
424  global_preStepPos);
425 
426 
427  double globalHitTime = temp_hit.globalTime() + eventTime;
428  double tof = temp_hit.globalPosition().mag()/CLHEP::c_light;
429  double bunchTime = globalHitTime - tof;
430 
431  // Create all the digits for this particular Sim Hit
432  sTgcDigitVec digiHits = m_digitizer->executeDigi(digitCond, temp_hit);
433  if (digiHits.empty()) {
434  continue;
435  }
436  ATH_MSG_VERBOSE("Hit produced " << digiHits.size() << " digits." );
437  for( std::unique_ptr<sTgcDigit>& digit : digiHits) {
438  /*
439  NOTE:
440  -----
441  Since not every hit might end up resulting in a
442  digit, this construction might take place after the hit loop
443  in a loop of its own!
444  */
445  // make new sTgcDigit
446  Identifier newDigitId = digit->identify(); //This Identifier should be sufficient to determine which RE the digit is from
447  double newTime = digit->time();
448  int newChannelType = idHelper.channelType(newDigitId);
449 
450  double timeJitterElectronicsStrip = CLHEP::RandGaussZiggurat::shoot(digitCond.rndmEngine, 0, m_timeJitterElectronicsStrip);
451  double timeJitterElectronicsPad = CLHEP::RandGaussZiggurat::shoot(digitCond.rndmEngine, 0, m_timeJitterElectronicsPad);
452  if(newChannelType== sTgcIdHelper::sTgcChannelTypes::Strip)
453  newTime += timeJitterElectronicsStrip;
454  else
455  newTime += timeJitterElectronicsPad;
456  uint16_t newBcTag = bcTagging(newTime+bunchTime);
457 
459  newTime += bunchTime;
460  else
461  newTime += globalHitTime;
462 
463  double newCharge = digit->charge();
464 
465  bool isDead{false}, isPileup{eventId != 0};
466  ATH_MSG_VERBOSE("Hit is from the main signal subevent if eventId is zero, eventId = " << eventId << " newTime: " << newTime);
467 
468 
469  // Create a new digit with updated time and BCTag
470  sTgcDigit newDigit(newDigitId, newBcTag, newTime, newCharge, isDead, isPileup);
471  ATH_MSG_VERBOSE("Unmerged Digit "<<m_idHelperSvc->toString(newDigitId)
472  <<" BC tag = " << newDigit.bcTag()
473  <<" digitTime = " << newDigit.time()
474  <<" charge = " << newDigit.charge()) ;
475 
476 
477  // Create a MuonSimData (SDO) corresponding to the digit
478  MuonSimData::Deposit deposit(particleLink, MuonMCData(hit.depositEnergy(), tof));
479  std::vector<MuonSimData::Deposit> deposits;
480  deposits.push_back(std::move(deposit));
481  MuonSimData simData(std::move(deposits), hit.particleEncoding());
482  // The sTGC SDO should be placed at the center of the gap, on the wire plane.
483  // We use the position from the hit on the wire surface which is by construction in the center of the gap
484  // glob_hitOnSurf_wire projects the whole hit to the center of the gap
485  simData.setPosition(glob_hitOnSurf_wire);
486  simData.setTime(globalHitTime);
487  const unsigned int modHash = static_cast<unsigned>(m_idHelperSvc->detElementHash(newDigitId));
488  sTgcSimDigitCont& contToPush = newChannelType == sTgcIdHelper::sTgcChannelTypes::Pad ? unmergedPadDigits :
489  newChannelType == sTgcIdHelper::sTgcChannelTypes::Strip ? unmergedStripDigits : unmergedWireDigits;
491  if (contToPush.size() <= modHash) contToPush.resize(modHash + 1);
492  contToPush[modHash].emplace_back(std::move(simData), std::move(newDigit));
493  } // end of loop digiHits
494  } // end of while(i != e)
495  } //end of while(m_thpcsTGC->nextDetectorElement(i, e))
496 
497 
498  /*********************
499  * Process Strip Digits *
500  *********************/
501  /* Comments from Alexandre Laurier, October 2022:
502  Big update to VMM handling of digits to sTGC digitization
503  For each channel type, the digits are processed on a layer-by-layer level
504  This is done to improve the performance of strip neighborOn functionnality
505  For wires, pads, and neighborOn=false strips, the digits on each channel
506  are ordered by earlier to latest and processed in order.
507  The digits are merged according to the VMM merging time window.
508  Above threshold digits are saved to output unless a previous digit is found
509  within the deadtime window.
510  --- For neighborOn=true strips ---
511  A strip above threshold forces the VMM readout of neighbor strips, even if
512  neighbor strips are below threshold.
513  We apply the logic as above, but for strips below threshold we search for one
514  direct neighbor strip to be above VMM threshold which triggers the VMM
515  to read the strip digit.
516  */
517  ATH_CHECK(processDigitsWithVMM(ctx, digitCond, unmergedStripDigits, m_deadtimeStrip,
518  m_doNeighborOn, outputDigits, *sdoContainer));
519  /*********************
520  * Process Pad Digits *
521  *********************/
522  ATH_CHECK(processDigitsWithVMM(ctx, digitCond, unmergedPadDigits, m_deadtimePad,
523  false, outputDigits, *sdoContainer));
524  /*********************
525  * Process Wire Digits *
526  *********************/
527  ATH_CHECK(processDigitsWithVMM(ctx, digitCond, unmergedWireDigits, m_deadtimeWire,
528  false, outputDigits, *sdoContainer));
529  /*************************************************
530  * Output the digits to the StoreGate collection *
531  *************************************************/
532  for (sTgcDigitVec& digits : outputDigits) {
533  if (digits.empty()) continue;
534  const Identifier elemID = m_idHelperSvc->chamberId(digits[0]->identify());
535  const IdentifierHash modHash = m_idHelperSvc->moduleHash(elemID);
536  std::unique_ptr<sTgcDigitCollection> collection = std::make_unique<sTgcDigitCollection>(elemID, modHash);
537  collection->insert(collection->end(), std::make_move_iterator(digits.begin()),
538  std::make_move_iterator(digits.end()));
539  ATH_CHECK(digitContainer->addCollection(collection.release(), modHash));
540  }
541  return StatusCode::SUCCESS;
542 }
543 
544 /*******************************************************************************/
545 uint16_t sTgcDigitizationTool::bcTagging(const double digitTime) {
546 
547  uint16_t bctag = 0;
548 
549  int bunchInteger{0}; //Define the absolute distance from t0 in units of BX
550  if(digitTime > 0) bunchInteger = (int)(abs(digitTime/25.0)); //absolute bunch for future bunches
551  else bunchInteger = (int)(abs(digitTime/25.0)) + 1; //The absolute bunch for negative time needs to be shifted by 1 as there is no negative zero bunch
552  bctag = (bctag | bunchInteger); //Store bitwise the abs(BX). This should be equivalent to regular variable assignment
553  if(digitTime < 0) bctag = ~bctag; //If from a PREVIOUS BX, apply bitwise negation
554 
555  return bctag;
556 }
557 
558 double sTgcDigitizationTool::getChannelThreshold(const EventContext& ctx,
559  const Identifier& channelID,
560  const NswCalibDbThresholdData& thresholdData) const {
561 
562  float threshold = m_chargeThreshold, elecThrsld{0.f};
563 
564  if(!thresholdData.getThreshold(channelID, elecThrsld))
565  ATH_MSG_ERROR("Cannot find retrieve VMM threshold from conditions data base!");
566  if(!m_calibTool->pdoToCharge(ctx, true, elecThrsld, channelID, threshold))
567  ATH_MSG_ERROR("Cannot convert VMM charge threshold via conditions data!");
568 
569  return threshold;
570 }
571 
572 
573 CLHEP::HepRandomEngine* sTgcDigitizationTool::getRandomEngine(const std::string& streamName, const EventContext& ctx) const
574 {
575  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
576  std::string rngName = name()+streamName;
577  rngWrapper->setSeed( rngName, ctx );
578  CLHEP::HepRandomEngine* engine = rngWrapper->getEngine(ctx);
579  ATH_MSG_VERBOSE(streamName<<" rngName "<<rngName<<" "<<engine);
580  return engine;
581 }
582 
584  const DigiConditions& digiCond,
585  sTgcSimDigitCont& unmergedDigits,
586  const double vmmDeadTime,
587  const bool isNeighbourOn,
588  sTgcDigtCont& outDigitContainer,
589  MuonSimDataCollection& outSdoContainer) const {
590 
591  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
593  for (sTgcSimDigitVec& digitsInCham : unmergedDigits) {
594 
595  if (digitsInCham.empty()) continue;
597  sTgcSimDigitVec mergedDigits = processDigitsWithVMM(ctx, digiCond, vmmDeadTime,
598  digitsInCham, isNeighbourOn);
600  if (mergedDigits.empty()) continue;
601 
602  const IdentifierHash hash = m_idHelperSvc->moduleHash(mergedDigits.front().identify());
603  const unsigned int hashIdx = static_cast<unsigned>(hash);
605  if (hash >= outDigitContainer.size()) {
606  outDigitContainer.resize(hash + 1);
607  }
608  for (sTgcSimDigitData& merged : mergedDigits) {
610  outSdoContainer.insert(std::make_pair(merged.identify(), std::move(merged.getSimData())));
612  bool acceptDigit{true};
613  float chargeAfterSmearing = merged.getDigit().charge();
614  if (m_doSmearing) {
615  ATH_CHECK(m_smearingTool->smearCharge(merged.identify(), chargeAfterSmearing, acceptDigit,
616  digiCond.rndmEngine));
617  }
618  if (!acceptDigit) {
619  continue;
620  }
623  if (idHelper.channelType(merged.identify()) == sTgcIdHelper::sTgcChannelTypes::Strip &&
624  chargeAfterSmearing < 0.001) {
625  continue;
626  }
627  std::unique_ptr<sTgcDigit> finalDigit = std::make_unique<sTgcDigit>(std::move(merged.getDigit()));
628  if (m_doSmearing) {
629  finalDigit->set_charge(chargeAfterSmearing);
630  }
631  ATH_MSG_VERBOSE("Final Digit "<<m_idHelperSvc->toString(finalDigit->identify())<<
632  " BC tag = " << finalDigit->bcTag()<<
633  " digitTime = " << finalDigit->time() <<
634  " charge = " << finalDigit->charge());
635  outDigitContainer[hashIdx].push_back(std::move(finalDigit));
636  }
637  }
638  return StatusCode::SUCCESS;
639 }
641  const DigiConditions& digiCond,
642  const double vmmDeadTime,
643  sTgcSimDigitVec& unmergedDigits,
644  const bool isNeighborOn) const {
645 
646  const MuonGM::MuonDetectorManager* detMgr{digiCond.detMgr};
647  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
649  std::stable_sort(unmergedDigits.begin(), unmergedDigits.end(),
650  [&idHelper](const sTgcSimDigitData& a, const sTgcSimDigitData& b) {
651  const int layA = idHelper.gasGap(a.identify());
652  const int layB = idHelper.gasGap(b.identify());
653  if (layA != layB) return layA < layB;
654  const int chA = idHelper.channel(a.identify());
655  const int chB = idHelper.channel(b.identify());
656  if (chA != chB) return chA < chB;
657  return a.time() < b.time();
658  });
659  sTgcSimDigitVec savedDigits{}, premerged{};
660 
661  premerged.reserve(unmergedDigits.size());
662  savedDigits.reserve(premerged.capacity());
663 
664 
665  auto passNeigbourLogic = [&](const sTgcSimDigitData& candidate) {
666  if (!isNeighborOn || savedDigits.empty()) return false;
667  if (savedDigits.back().identify() == candidate.identify() &&
668  std::abs(savedDigits.back().time() - candidate.time()) < vmmDeadTime) {
669  ATH_MSG_VERBOSE("Digits are too close in time ");
670  return false;
671  }
672  const Identifier digitId = candidate.identify();
673  const int channel = idHelper.channel(digitId);
674  const int maxChannel = detMgr->getsTgcReadoutElement(digitId)->numberOfStrips(digitId);
675  for (int neighbour : {std::max(1, channel -1), std::min(maxChannel, channel+1)}) {
677  if (neighbour == channel) continue;
678  const Identifier neighbourId = idHelper.channelID(digitId,
679  idHelper.multilayer(digitId),
680  idHelper.gasGap(digitId),
681  idHelper.channelType(digitId), neighbour);
682  const double threshold = m_useCondThresholds ? getChannelThreshold(ctx, neighbourId, *digiCond.thresholdData)
683  : m_chargeThreshold.value();
684  if (std::find_if(savedDigits.begin(), savedDigits.end(), [&](const sTgcSimDigitData& known){
685  return known.identify() == neighbourId &&
686  known.getDigit().charge() > threshold &&
687  std::abs(known.time() - candidate.time()) < m_hitTimeMergeThreshold;
688  }) != savedDigits.end()) return true;
689 
690  }
691  return false;
692  };
693  // Sort digits on every channel by earliest to latest time
694  // Also do hit merging to help with neighborOn logic
695  double threshold = m_chargeThreshold;
696  for (sTgcSimDigitVec::iterator merge_me = unmergedDigits.begin(); merge_me!= unmergedDigits.end(); ++merge_me) {
697  if(m_useCondThresholds) {
698  threshold = getChannelThreshold(ctx, (*merge_me).identify(), *digiCond.thresholdData);
699  }
702  sTgcDigit& digit1{(*merge_me).getDigit()};
703  double totalCharge = digit1.charge();
704  double weightedTime = digit1.time();
705 
706  sTgcSimDigitVec::iterator merge_with = merge_me + 1;
707  for ( ; merge_with!= unmergedDigits.end(); ++merge_with) {
709  if ((*merge_with).identify() != (*merge_me).identify()) {
710  break;
711  }
712  const sTgcDigit& mergeDigit{(*merge_with).getDigit()};
713  // If future digits are within window, digit1 absorbs its charge
714  if (mergeDigit.time() - digit1.time() > m_hitTimeMergeThreshold) break;
715  // If digit1 is not above threshold prior to merging, the new time is
716  // a weighted average. Do it for every merging pair.
717  if (totalCharge < threshold) {
718  weightedTime = (weightedTime * totalCharge + mergeDigit.time() * mergeDigit.charge())
719  / (totalCharge + mergeDigit.charge());
720  }
721  totalCharge += mergeDigit.charge();
722  }
723  digit1.set_charge(totalCharge);
724  digit1.set_time(weightedTime);
725  sTgcSimDigitData& mergedHit{*merge_me};
726  if (!savedDigits.empty() &&
727  savedDigits.back().identify() == digit1.identify() &&
728  std::abs(savedDigits.back().time() - digit1.time()) <= vmmDeadTime) continue;
729  if (digit1.charge() > threshold || passNeigbourLogic(mergedHit)){
730  savedDigits.emplace_back(std::move(mergedHit));
731  } else if (isNeighborOn) {
732  premerged.emplace_back(std::move(mergedHit));
733  }
734  } // end of time-ordering and hit merging loop
735  std::copy_if(std::make_move_iterator(premerged.begin()),
736  std::make_move_iterator(premerged.end()),
737  std::back_inserter(savedDigits), passNeigbourLogic);
738  return savedDigits;
739 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
sTgcDigitizationTool::m_doSmearing
Gaudi::Property< bool > m_doSmearing
Definition: sTgcDigitizationTool.h:149
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
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
sTgcDigitizationTool::getChannelThreshold
double getChannelThreshold(const EventContext &ctx, const Identifier &channelID, const NswCalibDbThresholdData &thresholdData) const
Definition: sTgcDigitizationTool.cxx:558
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:61
MuonSimData::Deposit
std::pair< HepMcParticleLink, MuonMCData > Deposit
Definition: MuonSimData.h:66
sTgcDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: sTgcDigitizationTool.h:128
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
sTgcDigitizationTool::sTgcDigitizationTool
sTgcDigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: sTgcDigitizationTool.cxx:52
NswCalibDbThresholdData
Definition: NswCalibDbThresholdData.h:17
sTgcSimIdToOfflineId
Definition: sTgcSimIdToOfflineId.h:12
sTgcDigitizationTool::m_doToFCorrection
Gaudi::Property< bool > m_doToFCorrection
Definition: sTgcDigitizationTool.h:150
sTgcDigitizationTool::m_doEfficiencyCorrection
Gaudi::Property< bool > m_doEfficiencyCorrection
Definition: sTgcDigitizationTool.h:151
sTgcDigit::set_charge
void set_charge(float newCharge)
Definition: sTgcDigit.cxx:71
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
sTgcDigitizationTool::retrieveCondData
StatusCode retrieveCondData(const EventContext &ctx, SG::ReadCondHandleKey< CondType > &key, const CondType *&condPtr) const
Definition: sTgcDigitizationTool.cxx:259
sTGCSimHit::particleLink
const HepMcParticleLink & particleLink() const
Definition: sTGCSimHit.h:96
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
Surface.h
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
IdentifiableContainerMT::addCollection
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
Definition: IdentifiableContainerMT.h:297
sTgcReadoutElement.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
sTgcDigitizationTool::initialize
virtual StatusCode initialize()
Initialize.
Definition: sTgcDigitizationTool.cxx:58
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
sTgcDigitizationTool::m_smearingTool
ToolHandle< Muon::INSWCalibSmearingTool > m_smearingTool
Definition: sTgcDigitizationTool.h:143
AtlasHitsVector
Definition: AtlasHitsVector.h:33
sTgcDigitizationTool.h
sTgcSimDigitVec
sTgcDigitizationTool::sTgcSimDigitVec sTgcSimDigitVec
Definition: sTgcDigitizationTool.cxx:48
sTgcDigit::bcTag
uint16_t bcTag() const
Definition: sTgcDigit.cxx:34
sTgcDigitizationTool::m_deadtimePad
Gaudi::Property< double > m_deadtimePad
Definition: sTgcDigitizationTool.h:171
PileUpTimeEventIndex::index
index_type index() const
the index of the component event in PileUpEventInfo
Definition: PileUpTimeEventIndex.cxx:76
sTgcDigitMaker::DigiConditions
Digitize a given hit, determining the time and charge spread on wires, pads and strips.
Definition: sTgcDigitMaker.h:57
TimedHitPtr< sTGCSimHit >
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
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
sTgcDigitizationTool::m_deadtimeWire
Gaudi::Property< double > m_deadtimeWire
Definition: sTgcDigitizationTool.h:172
sTgcDigitizationTool::m_energyDepositThreshold
Gaudi::Property< double > m_energyDepositThreshold
Definition: sTgcDigitizationTool.h:175
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
sTgcDigitizationTool::sTgcDigitVec
sTgcDigitMaker::sTgcDigitVec sTgcDigitVec
Definition: sTgcDigitizationTool.h:114
sTgcDigitizationTool::m_doNeighborOn
Gaudi::Property< bool > m_doNeighborOn
Definition: sTgcDigitizationTool.h:173
sTgcDigitizationTool::m_inputObjectName
std::string m_inputObjectName
Definition: sTgcDigitizationTool.h:161
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
GenParticle.h
sTgcDigitizationTool::m_condThrshldsKey
SG::ReadCondHandleKey< NswCalibDbThresholdData > m_condThrshldsKey
Definition: sTgcDigitizationTool.h:164
sTgcSimIdToOfflineId::convert
Identifier convert(int simId) const
Definition: sTgcSimIdToOfflineId.h:24
sTgcDigitizationTool::m_chargeThreshold
Gaudi::Property< double > m_chargeThreshold
Definition: sTgcDigitizationTool.h:178
sTgcDigitizationTool::getNextEvent
StatusCode getNextEvent(const EventContext &ctx)
Get next event and extract collection of hit collections.
Definition: sTgcDigitizationTool.cxx:173
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
TimedHitPtr::eventTime
float eventTime() const
t0 offset of the bunch xing containing the hit in ns.
Definition: TimedHitPtr.h:53
sTgcDigit
Definition: sTgcDigit.h:20
sTgcDigitizationTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: sTgcDigitizationTool.h:130
sTgcDigitizationTool::m_doPadSharing
Gaudi::Property< bool > m_doPadSharing
Definition: sTgcDigitizationTool.h:167
GeometryStatics.h
sTgcDigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx)
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
Definition: sTgcDigitizationTool.cxx:246
sTgcDigitizationTool::m_digitizer
std::unique_ptr< sTgcDigitMaker > m_digitizer
Definition: sTgcDigitizationTool.h:139
sTgcDigitizationTool::m_useCondThresholds
Gaudi::Property< bool > m_useCondThresholds
Definition: sTgcDigitizationTool.h:163
sTgcDigitizationTool::m_calibTool
ToolHandle< Muon::INSWCalibTool > m_calibTool
Definition: sTgcDigitizationTool.h:144
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
sTgcDigitizationTool::m_timeJitterElectronicsPad
const double m_timeJitterElectronicsPad
Definition: sTgcDigitizationTool.h:183
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
sTgcDigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< sTGCSimHitCollection > m_hitsContainerKey
Definition: sTgcDigitizationTool.h:160
sTgcDigitizationTool::m_doChannelTypes
Gaudi::Property< int > m_doChannelTypes
Definition: sTgcDigitizationTool.h:166
sTgcDigit::charge
float charge() const
Definition: sTgcDigit.cxx:46
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonGM::sTgcReadoutElement::surfaceHash
virtual int surfaceHash(const Identifier &id) const override final
returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tra...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:257
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
sTgcDigitizationTool::m_effiKey
SG::ReadCondHandleKey< Muon::DigitEffiData > m_effiKey
Definition: sTgcDigitizationTool.h:135
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:30
MuonSimDataCollection
Definition: MuonSimDataCollection.h:21
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
sTgcDigit::time
float time() const
Definition: sTgcDigit.cxx:61
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
sTgcDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Definition: sTgcDigitizationTool.h:129
sTgcDigitizationTool::m_deadtimeStrip
Gaudi::Property< double > m_deadtimeStrip
Definition: sTgcDigitizationTool.h:170
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AnalysisUtils::copy_if
Out copy_if(In first, const In &last, Out res, const Pred &p)
Definition: IFilterUtils.h:30
sTGCSimHit::sTGCId
HitID sTGCId() const
Definition: sTGCSimHit.h:51
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector::insert
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
sTgcSimIdToOfflineId.h
sTgcDigitizationTool::processBunchXing
StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents)
Definition: sTgcDigitizationTool.cxx:133
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
sTgcDigitizationTool::m_limitElectronKineticEnergy
Gaudi::Property< double > m_limitElectronKineticEnergy
Definition: sTgcDigitizationTool.h:176
sTgcDigitMaker::DigiConditions::thresholdData
const NswCalibDbThresholdData * thresholdData
Definition: sTgcDigitMaker.h:60
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
sTgcDigitizationTool::sTgcSimDigitCont
std::vector< sTgcSimDigitVec > sTgcSimDigitCont
Definition: sTgcDigitizationTool.h:111
PileUpToolBase
Definition: PileUpToolBase.h:18
sTgcDigitizationTool::m_timeJitterElectronicsStrip
const double m_timeJitterElectronicsStrip
Definition: sTgcDigitizationTool.h:182
sTgcDigitizationTool::sTgcSimDigitVec
std::vector< sTgcSimDigitData > sTgcSimDigitVec
Definition: sTgcDigitizationTool.h:110
sTgcDigitizationTool::m_onlyUseContainerName
Gaudi::Property< bool > m_onlyUseContainerName
Definition: sTgcDigitizationTool.h:159
sTGCSimHit::globalDirection
const Amg::Vector3D & globalDirection() const
Definition: sTGCSimHit.h:46
sTgcDigitizationTool::prepareEvent
StatusCode prepareEvent(const EventContext &ctx, const unsigned int)
Definition: sTgcDigitizationTool.cxx:124
sTgcDigitizationTool::m_rndmEngineName
Gaudi::Property< std::string > m_rndmEngineName
Definition: sTgcDigitizationTool.h:157
sTGCSimHit::kineticEnergy
double kineticEnergy() const
Definition: sTGCSimHit.h:48
sTGCSimHit::globalTime
double globalTime() const
Definition: sTGCSimHit.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
sTgcDigitizationTool::processDigitsWithVMM
StatusCode processDigitsWithVMM(const EventContext &ctx, const DigiConditions &digiCond, sTgcSimDigitCont &unmergedContainer, const double vmmDeadTime, const bool isNeighbourOn, sTgcDigtCont &outDigitContainer, MuonSimDataCollection &outSdoContainer) const
Definition: sTgcDigitizationTool.cxx:583
sTgcDigitizationTool::mergeEvent
StatusCode mergeEvent(const EventContext &ctx)
Definition: sTgcDigitizationTool.cxx:232
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
PileUpTimeEventIndex::time
time_type time() const
bunch xing time in ns
Definition: PileUpTimeEventIndex.cxx:71
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
threshold
Definition: chainparser.cxx:74
sTgcDigitizationTool::doDigitization
StatusCode doDigitization(const EventContext &ctx)
Core part of digitization use by mergeEvent (IPileUpTool) and digitize (IMuonDigitizationTool)
Definition: sTgcDigitizationTool.cxx:277
sTgcIdHelper
Definition: sTgcIdHelper.h:55
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
MuonSimData
Definition: MuonSimData.h:62
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonDetectorManager.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
sTGCSimHit::particleEncoding
int particleEncoding() const
Definition: sTGCSimHit.h:45
sTgcDigitMaker::DigiConditions::detMgr
const MuonGM::MuonDetectorManager * detMgr
Definition: sTgcDigitMaker.h:58
sTGCSimHit
Definition: sTGCSimHit.h:15
InDet::TrkOrigin::isPileup
bool isPileup(int origin)
from pileup
Definition: InDetTrackTruthOriginDefs.h:49
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SG::ReadCondHandleKey
Definition: ReadCondHandleKey.h:20
MuonDigit::identify
Identifier identify() const
Definition: MuonDigit.h:30
sTgcDigitizationTool::getRandomEngine
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
Definition: sTgcDigitizationTool.cxx:573
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
a
TList * a
Definition: liststreamerinfos.cxx:10
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
sTgcDigitizationTool::m_outputDigitCollectionKey
SG::WriteHandleKey< sTgcDigitContainer > m_outputDigitCollectionKey
Definition: sTgcDigitizationTool.h:146
TimedHitPtr::eventId
unsigned short eventId() const
the index of the component event in PileUpEventInfo.
Definition: TimedHitPtr.h:45
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::PlaneSurface
Definition: PlaneSurface.h:64
sTgcDigitizationTool::m_stripChargeScale
Gaudi::Property< double > m_stripChargeScale
Definition: sTgcDigitizationTool.h:180
sTgcDigitizationTool::sTgcSimDigitData
Definition: sTgcDigitizationTool.h:89
known
Definition: TrigBStoxAODTool.cxx:107
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
sTgcDigitizationTool::sTgcDigtCont
std::vector< sTgcDigitVec > sTgcDigtCont
Definition: sTgcDigitizationTool.h:115
sTgcDigitizationTool::m_hitTimeMergeThreshold
const double m_hitTimeMergeThreshold
Definition: sTgcDigitizationTool.h:184
NswCalibDbThresholdData::getThreshold
bool getThreshold(const Identifier &, float &) const
Definition: NswCalibDbThresholdData.cxx:63
GeoPrimitivesToStringConverter.h
sTgcDigitizationTool::m_STGCHitCollList
std::vector< std::unique_ptr< sTGCSimHitCollection > > m_STGCHitCollList
Definition: sTgcDigitizationTool.h:141
sTGCSimHit::depositEnergy
double depositEnergy() const
Definition: sTGCSimHit.h:47
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
sTgcDigitContainer.h
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
LocalDirection.h
sTgcDigitMaker::DigiConditions::rndmEngine
CLHEP::HepRandomEngine * rndmEngine
Definition: sTgcDigitMaker.h:61
simData
constexpr bool simData
Definition: constants.h:36
sTGCSimHit::globalPrePosition
const Amg::Vector3D & globalPrePosition() const
Definition: sTGCSimHit.h:49
MuonSimDataCollection.h
sTgcDigitizationTool::digitize
StatusCode digitize(const EventContext &ctx)
Just calls processAllSubEvents - leaving for back-compatibility (IMuonDigitizationTool)
Definition: sTgcDigitizationTool.cxx:242
PileUpTimeEventIndex
a struct encapsulating the identifier of a pile-up event
Definition: PileUpTimeEventIndex.h:12
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
PileUpTimeEventIndex::type
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
Definition: PileUpTimeEventIndex.cxx:81
sTgcDigitizationTool::m_runVoltage
Gaudi::Property< double > m_runVoltage
Definition: sTgcDigitizationTool.h:155
sTgcDigitizationTool::m_thpcsTGC
std::unique_ptr< TimedHitCollection< sTGCSimHit > > m_thpcsTGC
Definition: sTgcDigitizationTool.h:140
sTgcDigitizationTool::m_outputSDO_CollectionKey
SG::WriteHandleKey< MuonSimDataCollection > m_outputSDO_CollectionKey
Definition: sTgcDigitizationTool.h:147
sTGCSimHit::globalPosition
const Amg::Vector3D & globalPosition() const
Definition: sTGCSimHit.h:44
TimedHitCollection
Definition: TimedHitCollection.h:15
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
sTgcDigitizationTool::m_detMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
Definition: sTgcDigitizationTool.h:132
sTgcDigitizationTool::bcTagging
static uint16_t bcTagging(const double digittime)
Definition: sTgcDigitizationTool.cxx:545
MuonMCData
Definition: MuonSimData.h:42
MuonSimData.h
sTgcHitIdHelper.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14