ATLAS Offline Software
MuonTruthDecorationAlg.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 
17 #include "TrkSegment/Segment.h"
19 #include "xAODMuon/MuonSegment.h"
24 #include "AthContainers/Accessor.h"
26 namespace {
27  const SG::Decorator<int> dec_truthOrigin{"truthOrigin"};
28  const SG::Decorator<int> dec_truthType{"truthType"};
29  const std::vector<float> emptyVec;
30 
31  // Only reject muons from light quark deays
32  const std::set<int> bad_origins{
40 
41  };
42  constexpr float dummy_val = -1.;
43 
44  struct RecordPars {
45  RecordPars() = default;
46  RecordPars(Amg::Vector3D&& _pos, Amg::Vector3D&&_mom):
47  pos{std::move(_pos)},
48  mom{std::move(_mom)}{}
49  RecordPars(const CLHEP::Hep3Vector& _pos, const CLHEP::Hep3Vector& _mom):
50  pos{_pos.x(), _pos.y(), _pos.z()},
51  mom{_mom.x(), _mom.y(), _mom.z()}{
52 
53  }
56 
57  std::string record_name;
58  const Trk::TrackingVolume* volume{nullptr};
59  };
60 
61 } // namespace
62 namespace Muon {
63 
64  // Constructor with parameters:
65  MuonTruthDecorationAlg::MuonTruthDecorationAlg(const std::string& name, ISvcLocator* pSvcLocator) :
66  AthReentrantAlgorithm(name, pSvcLocator) {}
67 
68  // Initialize method:
74  ATH_CHECK(m_PRD_TruthNames.initialize());
75  ATH_CHECK(m_SDO_TruthNames.initialize());
77  ATH_CHECK(m_idHelperSvc.retrieve());
78  ATH_CHECK(m_truthClassifier.retrieve());
79  ATH_CHECK(m_extrapolator.retrieve());
81  return StatusCode::SUCCESS;
82  }
83 
84  // Execute method:
85  StatusCode MuonTruthDecorationAlg::execute(const EventContext& ctx) const {
86  // skip if no input data found
88  if (!truthContainer.isPresent()) return StatusCode::SUCCESS;
89  if (!truthContainer.isValid()) {
90  ATH_MSG_WARNING("truth container " << truthContainer.name() << " not valid");
91  return StatusCode::FAILURE;
92  }
93 
94  // create output container
96  ATH_CHECK(muonTruthContainer.record(std::make_unique<xAOD::TruthParticleContainer>(),
97  std::make_unique<xAOD::TruthParticleAuxContainer>()));
98  ATH_MSG_DEBUG("Recorded TruthParticleContainer with key: " << m_muonTruthParticleContainerName);
99 
101  if (m_createTruthSegment) {
102  ATH_CHECK(
103  segmentContainer.record(std::make_unique<xAOD::MuonSegmentContainer>(), std::make_unique<xAOD::MuonSegmentAuxContainer>()));
104  ATH_MSG_DEBUG("Recorded MuonSegmentContainer with key: " << segmentContainer.name());
105  }
106 
107  // loop over truth coll
108  for (const xAOD::TruthParticle* truth : *truthContainer) {
109  if (!MC::isStable(truth) || !truth->isMuon() || truth->pt() < 1000.) continue;
110  xAOD::TruthParticle* truthParticle = new xAOD::TruthParticle();
111  muonTruthContainer->push_back(truthParticle);
112  truthParticle->setPdgId(truth->pdgId());
113  truthParticle->setBarcode(HepMC::barcode(truth)); // FIXME barcode-based
114  truthParticle->setStatus(truth->status());
115  truthParticle->setPx(truth->px());
116  truthParticle->setPy(truth->py());
117  truthParticle->setPz(truth->pz());
118  truthParticle->setE(truth->e());
119  truthParticle->setM(truth->m());
120  if (truth->hasProdVtx()) truthParticle->setProdVtxLink(truth->prodVtxLink());
121  ElementLink<xAOD::TruthParticleContainer> truthLink(*muonTruthContainer, muonTruthContainer->size() - 1);
122  truthLink.toPersistent();
123  ATH_MSG_DEBUG("Found stable muon: " << truth->pt() << " eta " << truth->eta() << " phi " << truth->phi() << " mass "
124  << truth->m() << " barcode " << HepMC::barcode(truth) << " truthParticle->barcode "
125  << HepMC::barcode(truthParticle) << " (*truthLink)->barcode " << HepMC::barcode(*truthLink) << " "
126  << truthLink); // FIXME barcode-based
127  int iType = 0;
128  int iOrigin = 0;
129 
130  // if configured look up truth classification
131  if (!m_truthClassifier.empty()) {
132  // if configured also get truth classification
133  std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> truthClass =
134  m_truthClassifier->particleTruthClassifier(truth);
135  iType = truthClass.first;
136  iOrigin = truthClass.second;
137  ATH_MSG_VERBOSE("Got truth type " << iType << " origin " << iOrigin);
138  dec_truthOrigin(*truthParticle) = iOrigin;
139  dec_truthType(*truthParticle) = iType;
140  }
141 
143  ATH_CHECK(addTrackRecords(ctx, *truthParticle));
145 
146  // add hit counts
147  ATH_CHECK(addHitCounts(ctx, *truthParticle, ids));
148 
149  // add hit ID vectors
150  addHitIDVectors(*truthParticle, ids);
151 
152  bool goodMuon = bad_origins.find(iOrigin) == bad_origins.end();
153 
154  ATH_MSG_DEBUG("good muon with type " << iType << " and origin" << iOrigin);
155 
156  // create segments
157  if (m_createTruthSegment && goodMuon) {
158  ATH_CHECK(createSegments(ctx, truthLink, segmentContainer, ids));
159  }
160  }
161 
162  ATH_MSG_DEBUG("Registered " << muonTruthContainer->size() << " truth muons ");
163  if (m_createTruthSegment) ATH_MSG_DEBUG("Registered " << segmentContainer->size() << " truth muon segments ");
164 
165  return StatusCode::SUCCESS;
166  }
167 
171  const ChamberIdMap& ids) const {
173 
174  std::vector<SG::ReadHandle<MuonSimDataCollection> > sdoCollections(6);
177  if (!col.isPresent()) {
178  ATH_MSG_ERROR("MuonSimDataCollection " << col.name() << " not in StoreGate");
179  return StatusCode::FAILURE;
180  }
181  if (col->empty()) {
182  continue;
183  }
184  Identifier id = col->begin()->first;
185  int index = m_idHelperSvc->technologyIndex(id);
186  if (index >= (int)sdoCollections.size()) {
187  ATH_MSG_WARNING("SDO collection index out of range " << index << " " << m_idHelperSvc->toStringChamber(id));
188  } else {
189  sdoCollections[index] = std::move(col);
190  }
191 
192  }
193 
194  bool useSDO = (!sdoCollections.empty() || !m_CSC_SDO_TruthNames.empty());
195  std::map<Muon::MuonStationIndex::ChIndex, int> matchMap;
196  ATH_MSG_DEBUG(" Creating Truth segments ");
197  // loop over chamber layers
198  for (const auto& lay : ids) {
199  // skip empty layers
200  Amg::Vector3D firstPos{Amg::Vector3D::Zero()}, secondPos{Amg::Vector3D::Zero()};
201  bool firstPosSet{false}, secondPosSet{false};
202  Identifier chId;
203  int index = -1;
204  uint8_t nprecLayers{0}, nphiLayers{0}, ntrigEtaLayers{0};
205  std::set<int> phiLayers, etaLayers, precLayers;
206  ATH_MSG_DEBUG(" new chamber layer " << Muon::MuonStationIndex::chName(lay.first) << " hits " << ids.size());
207  // loop over hits
208  for (const auto& id : lay.second) {
209  ATH_MSG_VERBOSE(" hit " << m_idHelperSvc->toString(id));
210  bool measPhi = m_idHelperSvc->measuresPhi(id);
211  bool isCsc = m_idHelperSvc->isCsc(id);
212  bool isMM = m_idHelperSvc->isMM(id);
213  bool isTrig = m_idHelperSvc->isTrigger(id);
214  bool isEndcap = m_idHelperSvc->isEndcap(id);
215  if (measPhi) {
216  phiLayers.insert(m_idHelperSvc->gasGap(id));
217  } else {
218  if (!isTrig) {
219  if (!chId.is_valid()) chId = id; // use first precision hit in list
220  if (isCsc || isMM) {
221  precLayers.insert(m_idHelperSvc->gasGap(id));
222  } else {
223  int iid = 10 * m_idHelperSvc->mdtIdHelper().multilayer(id) + m_idHelperSvc->mdtIdHelper().tubeLayer(id);
224  precLayers.insert(iid);
225  // ATH_MSG_VERBOSE("iid " << iid << " precLayers size " << precLayers.size() );
226  }
227  } else {
228  etaLayers.insert(m_idHelperSvc->gasGap(id));
229  }
230  }
231  // use SDO to look-up truth position of the hit
232  if (!useSDO) {
233  continue;
234  }
236  if (!isCsc) {
237  bool ok = false;
238  int index = m_idHelperSvc->technologyIndex(id);
239  if (index < (int)sdoCollections.size() && !sdoCollections[index]->empty()) {
240  auto pos = sdoCollections[index]->find(id);
241  if (pos != sdoCollections[index]->end()) {
242  gpos = pos->second.globalPosition();
243  if (gpos.perp() > 0.1) ok = true; // sanity check
244  }
245  }
246  // look up successful, calculate
247  if (!ok) continue;
248 
249  // small comparison function
250  auto isSmaller = [isEndcap](const Amg::Vector3D& p1, const Amg::Vector3D& p2) {
251  if (isEndcap)
252  return std::abs(p1.z()) < std::abs(p2.z());
253  else
254  return p1.perp() < p2.perp();
255  };
256  if (!firstPosSet) {
257  firstPos = gpos;
258  firstPosSet = true;
259  } else if (!secondPosSet) {
260  secondPos = gpos;
261  secondPosSet = true;
262  if (isSmaller(secondPos, firstPos)) std::swap(firstPos, secondPos);
263  } else {
264  // update position if we can increase the distance between the two positions
265  if (isSmaller(gpos, firstPos))
266  firstPos = gpos;
267  else if (isSmaller(secondPos, gpos))
268  secondPos = gpos;
269  }
270  } else {
272  auto pos = cscCollection->find(id);
273  if (pos == cscCollection->end()) {
274  continue;
275  }
276  const MuonGM::CscReadoutElement* descriptor = detMgr->getCscReadoutElement(id);
277  ATH_MSG_DEBUG("found csc sdo with " << pos->second.getdeposits().size() << " deposits");
278  Amg::Vector3D locpos(0, pos->second.getdeposits()[0].second.ypos(), pos->second.getdeposits()[0].second.zpos());
279  gpos = descriptor->localToGlobalCoords(locpos, m_idHelperSvc->cscIdHelper().elementID(id));
280  ATH_MSG_DEBUG("got CSC global position " << gpos);
281  if (!firstPosSet) {
282  firstPos = gpos;
283  firstPosSet = true;
284  } else if (!secondPosSet) {
285  secondPos = gpos;
286  secondPosSet = true;
287  if (secondPos.perp() < firstPos.perp()) std::swap(firstPos, secondPos);
288  } else {
289  if (gpos.perp() < firstPos.perp())
290  firstPos = gpos;
291  else if (secondPos.perp() < gpos.perp())
292  secondPos = gpos;
293  }
294  }
295  }
296  if (precLayers.size() > 2) {
297  matchMap[lay.first] = index;
298  if (!phiLayers.empty()) nphiLayers = phiLayers.size();
299  ntrigEtaLayers = etaLayers.size();
300  nprecLayers = precLayers.size();
301  ATH_MSG_DEBUG(" total counts: precision " << static_cast<int>(nprecLayers) << " phi layers " << static_cast<int>(nphiLayers)
302  << " eta trig layers " << static_cast<int>(ntrigEtaLayers)
303  << " associated reco muon " << index << " barcode " << HepMC::barcode(*truthLink) // FIXME barcode-based
304  << " truthLink " << truthLink);
306  segmentContainer->push_back(segment);
307  segment->setNHits(nprecLayers, nphiLayers, ntrigEtaLayers);
309  truthParticleLinkAcc("truthParticleLink");
310  truthParticleLinkAcc(*segment) = truthLink;
311  if (chId.is_valid()) {
312  int eta = m_idHelperSvc->stationEta(chId);
313  int sector = m_idHelperSvc->sector(chId);
314  MuonStationIndex::TechnologyIndex technology = m_idHelperSvc->technologyIndex(chId);
315  MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(chId);
316  segment->setIdentifier(sector, chIndex, eta, technology);
317  }
318  if (firstPosSet && secondPosSet) {
319  Amg::Vector3D gpos = (firstPos + secondPos) / 2.;
320  Amg::Vector3D gdir = (firstPos - secondPos).unit();
321  ATH_MSG_DEBUG(" got position : r " << gpos.perp() << " z " << gpos.z() << " and direction: theta " << gdir.theta()
322  << " phi " << gdir.phi());
323  segment->setPosition(gpos.x(), gpos.y(), gpos.z());
324  segment->setDirection(gdir.x(), gdir.y(), gdir.z());
325  }
326  }
327  }
328  return StatusCode::SUCCESS;
329  }
330 
331  StatusCode MuonTruthDecorationAlg::addTrackRecords(const EventContext& ctx, xAOD::TruthParticle& truthParticle) const {
332  // first loop over track records, store parameters at the different positions
333  const xAOD::TruthVertex* vertex = truthParticle.prodVtx();
334  const Trk::TrackingGeometry* trackingGeometry = !m_extrapolator.empty()? m_extrapolator->trackingGeometry() : nullptr;
335 
336  std::vector<RecordPars> parameters;
337  if (vertex) {
338  parameters.emplace_back(Amg::Vector3D{vertex->x(), vertex->y(), vertex->z()},
339  Amg::Vector3D{truthParticle.px(), truthParticle.py(), truthParticle.pz()});
340  }
341  for (SG::ReadHandle<TrackRecordCollection>& trackRecordCollection : m_trackRecordCollectionNames.makeHandles(ctx)) {
342  if (!trackRecordCollection.isPresent()) {
343  ATH_MSG_FATAL("Failed to retrieve "<<trackRecordCollection.key());
344  return StatusCode::FAILURE;
345  }
346  const std::string r_name = trackRecordCollection.key();
347 
348  SG::Accessor<float> xAcc (r_name + "_x");
349  SG::Accessor<float> yAcc (r_name + "_y");
350  SG::Accessor<float> zAcc (r_name + "_z");
351  SG::Accessor<float> pxAcc (r_name + "_px");
352  SG::Accessor<float> pyAcc (r_name + "_py");
353  SG::Accessor<float> pzAcc (r_name + "_pz");
354  float& x = xAcc(truthParticle);
355  float& y = yAcc(truthParticle);
356  float& z = zAcc(truthParticle);
357  float& px = pxAcc(truthParticle);
358  float& py = pyAcc(truthParticle);
359  float& pz = pzAcc(truthParticle);
360 
361  SG::Accessor<bool> matchedAcc (r_name + "_is_matched");
362  bool& found_truth = matchedAcc(truthParticle);
363 
364  x = y = z = px = py = pz = dummy_val;
365  found_truth = false;
366 
367  // Need to always make these, to avoid crashes later
368  SG::Accessor<float> exAcc (r_name + "_x_extr");
369  SG::Accessor<float> eyAcc (r_name + "_y_extr");
370  SG::Accessor<float> ezAcc (r_name + "_z_extr");
371  SG::Accessor<float> epxAcc (r_name + "_px_extr");
372  SG::Accessor<float> epyAcc (r_name + "_py_extr");
373  SG::Accessor<float> epzAcc (r_name + "_pz_extr");
374  float& ex = exAcc(truthParticle);
375  float& ey = eyAcc(truthParticle);
376  float& ez = ezAcc(truthParticle);
377  float& epx = epxAcc(truthParticle);
378  float& epy = epyAcc(truthParticle);
379  float& epz = epzAcc(truthParticle);
380 
381  SG::Accessor<std::vector<float> > ecovAcc (r_name + "_cov_extr");
382  ecovAcc(truthParticle) = emptyVec;
383 
384  SG::Accessor<bool> eisAcc (r_name+"_is_extr");
385  eisAcc(truthParticle) = false;
386  ex = ey = ez = epx = epy = epz = dummy_val;
387 
388  // loop over collection and find trackRecord with the same bar code
389  for (const auto& trackRecord : *trackRecordCollection) {
390  if (!HepMC::is_sim_descendant(&trackRecord,&truthParticle)) continue;
391  CLHEP::Hep3Vector pos = trackRecord.GetPosition();
392  CLHEP::Hep3Vector mom = trackRecord.GetMomentum();
393  ATH_MSG_VERBOSE("Found associated " << r_name << " pt " << mom.perp() << " position: r " << pos.perp() << " z " << pos.z());
394  x = pos.x(); y = pos.y(); z = pos.z();
395  px = mom.x(); py = mom.y(); pz = mom.z();
396  parameters.emplace_back(pos, mom);
397  found_truth = true;
398  break;
399  }
400 
401  if (!trackingGeometry) continue;
402 
404  if (!found_truth) parameters.emplace_back();
405  RecordPars& r_pars = parameters.back();
406  r_pars.record_name = r_name;
407  const Trk::TrackingVolume* volume = nullptr;
408  if (r_name == "CaloEntryLayer")
409  volume = trackingGeometry->trackingVolume("InDet::Containers::InnerDetector");
410  else if (r_name == "MuonEntryLayer")
411  volume = trackingGeometry->trackingVolume("Calo::Container");
412  else if (r_name == "MuonExitLayer")
413  volume = trackingGeometry->trackingVolume("Muon::Containers::MuonSystem");
414  else {
415  ATH_MSG_WARNING("no destination surface for track record "<<r_name);
416  }
417  r_pars.volume = found_truth ? volume : nullptr;
418  }
420 
422  if (!trackingGeometry) return StatusCode::SUCCESS;
423 
424 
425  AmgSymMatrix(5) cov{AmgSymMatrix(5)::Identity()};
426  cov(0, 0) = cov(1, 1) = 1e-3;
427  cov(2, 2) = cov(3, 3) = 1e-6;
428  cov(4, 4) = 1e-3 / truthParticle.p4().P();
429  for (unsigned int i = 0; i < parameters.size() - 1; ++i) {
430  const RecordPars& start_pars = parameters[i];
431  const RecordPars& end_pars = parameters[i+1];
433  if ( (!start_pars.record_name.empty() && !start_pars.volume) || !end_pars.volume) continue;
434  Trk::CurvilinearParameters pars(start_pars.pos, start_pars.mom, truthParticle.charge(), cov);
435 
436  const Trk::TrackingVolume* volume = end_pars.volume;
437  const std::string& r_name = end_pars.record_name;
438  SG::Accessor<float> exAcc (r_name + "_x_extr");
439  SG::Accessor<float> eyAcc (r_name + "_y_extr");
440  SG::Accessor<float> ezAcc (r_name + "_z_extr");
441  SG::Accessor<float> epxAcc (r_name + "_px_extr");
442  SG::Accessor<float> epyAcc (r_name + "_py_extr");
443  SG::Accessor<float> epzAcc (r_name + "_pz_extr");
444  float& ex = exAcc(truthParticle);
445  float& ey = eyAcc(truthParticle);
446  float& ez = ezAcc(truthParticle);
447  float& epx = epxAcc(truthParticle);
448  float& epy = epyAcc(truthParticle);
449  float& epz = epzAcc(truthParticle);
450 
451  SG::Accessor<std::vector<float> > ecovAcc (r_name + "_cov_extr");
452  std::vector<float>& covMat = ecovAcc(truthParticle);
453 
454  std::unique_ptr<Trk::TrackParameters> exPars{
455  m_extrapolator->extrapolateToVolume(ctx, pars, *volume, Trk::alongMomentum, Trk::muon)};
456  if (! exPars || !exPars->covariance() || !Amg::hasPositiveDiagElems(*exPars->covariance())) {
457  ATH_MSG_VERBOSE("Extrapolation to "<<r_name<<" failed. ");
458  continue;
459  }
460  SG::Accessor<bool> eisAcc (r_name+"_is_extr");
461  eisAcc(truthParticle) = true;
462  ex = exPars->position().x();
463  ey = exPars->position().y();
464  ez = exPars->position().z();
465  epx = exPars->momentum().x();
466  epy = exPars->momentum().y();
467  epz = exPars->momentum().z();
468  Amg::compress(*exPars->covariance(), covMat);
469 
470  const double errorp = Amg::error(*exPars->covariance(), Trk::qOverP);
471  ATH_MSG_VERBOSE( " Extrapolated to " << r_name << std::endl
472  << " truth: r " << end_pars.pos.perp() << " z "
473  << end_pars.pos.z() << " p "
474  << end_pars.mom.mag() << std::endl
475  << " extrp: r " << exPars->position().perp() << " z "
476  << exPars->position().z() << " p "
477  << exPars->momentum().mag() << " res p "
478  << (end_pars.mom.mag() -
479  exPars->momentum().mag())
480  << " error " << errorp << " cov "
481  << (*exPars->covariance())(Trk::qOverP, Trk::qOverP)
482  << " pull p "
483  << (end_pars.mom.mag() -
484  exPars->momentum().mag()) /
485  errorp);
486  }
487  return StatusCode::SUCCESS;
488  }
489 
491  xAOD::TruthParticle& truthParticle,
492  ChamberIdMap& ids) const {
493 
494  std::vector<unsigned int> nprecHitsPerChamberLayer;
495  nprecHitsPerChamberLayer.resize(Muon::MuonStationIndex::ChIndexMax);
496  std::vector<unsigned int> nphiHitsPerChamberLayer;
497  nphiHitsPerChamberLayer.resize(Muon::MuonStationIndex::PhiIndexMax);
498  std::vector<unsigned int> ntrigEtaHitsPerChamberLayer;
499  ntrigEtaHitsPerChamberLayer.resize(Muon::MuonStationIndex::PhiIndexMax);
500  ATH_MSG_DEBUG("addHitCounts: barcode " << HepMC::barcode(truthParticle)); // FIXME barcode-based
501  auto truthParticleHistory = HepMC::simulation_history(&truthParticle, -1); // Returns a list of uniqueIDs (currently for xAOD::TruthParticle these would be barcodes)
502  // loop over detector technologies
504  if (!col.isPresent()) {
505  ATH_MSG_FATAL("PRD_MultiTruthCollection " << col.name() << " not in StoreGate");
506  return StatusCode::FAILURE;
507  }
508  // loop over trajectories
509  for (const auto& trajectory : *col) {
510  // check if gen particle same as input
511  if (std::find(truthParticleHistory.begin(),truthParticleHistory.end(), HepMC::barcode(trajectory.second)) == truthParticleHistory.end()) continue; // FIXME barcode-based - TrackRecords read in from existing inputs will not have valid id values.
512 
513  const Identifier& id = trajectory.first;
514  bool measPhi = m_idHelperSvc->measuresPhi(id);
515  bool isTgc = m_idHelperSvc->isTgc(id);
517  // add identifier to map
518  if (isTgc) { // TGCS should be added to both EIL and EIS
521  ids[Muon::MuonStationIndex::EIS].push_back(id);
522  ids[Muon::MuonStationIndex::EIL].push_back(id);
523  } else {
524  ids[Muon::MuonStationIndex::EMS].push_back(id);
525  ids[Muon::MuonStationIndex::EML].push_back(id);
526  }
527  } else {
528  ids[chIndex].push_back(id);
529  }
530 
531  if (m_idHelperSvc->issTgc(id)) {
532  if (measPhi) {
533  int index = m_idHelperSvc->phiIndex(id);
534  ++nphiHitsPerChamberLayer.at(index);
535  } else {
536  ++nprecHitsPerChamberLayer.at(chIndex);
537  }
538  } else if (m_idHelperSvc->isMM(id)) {
539  ++nprecHitsPerChamberLayer.at(chIndex);
540  } else if (m_idHelperSvc->isTrigger(id)) {
541  int index = m_idHelperSvc->phiIndex(id);
542  if (index >= 0) {
543  if (measPhi)
544  ++nphiHitsPerChamberLayer.at(index);
545  else
546  ++ntrigEtaHitsPerChamberLayer.at(index);
547  }
548  } else {
549  if (measPhi) {
551  ++nphiHitsPerChamberLayer.at(index);
552 
553  } else {
554  ++nprecHitsPerChamberLayer.at(chIndex);
555  }
556  }
557  }
558  }
559 
560  uint8_t innerSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BIS] +
561  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EIS] +
562  nprecHitsPerChamberLayer[Muon::MuonStationIndex::CSS];
563 
564  uint8_t innerLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BIL] +
565  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EIL] +
566  nprecHitsPerChamberLayer[Muon::MuonStationIndex::CSL];
567 
568  uint8_t middleSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BMS] +
569  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EMS];
570 
571  uint8_t middleLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] +
572  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EML];
573 
574  uint8_t outerSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BOS] +
575  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EOS];
576 
577  uint8_t outerLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] +
578  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EOL];
579 
580  uint8_t extendedSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::EES] +
581  nprecHitsPerChamberLayer[Muon::MuonStationIndex::BEE];
582 
583  uint8_t extendedLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::EEL];
584 
585  uint8_t phiLayer1Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM1] +
586  nphiHitsPerChamberLayer[Muon::MuonStationIndex::T4] +
587  nphiHitsPerChamberLayer[Muon::MuonStationIndex::CSC] +
588  nphiHitsPerChamberLayer[Muon::MuonStationIndex::STGC1] +
589  nphiHitsPerChamberLayer[Muon::MuonStationIndex::STGC2];
590 
591  uint8_t phiLayer2Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM2] +
592  nphiHitsPerChamberLayer[Muon::MuonStationIndex::T1];
593 
594  uint8_t phiLayer3Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO1] +
595  nphiHitsPerChamberLayer[Muon::MuonStationIndex::T2];
596 
597  uint8_t phiLayer4Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO2] +
598  nphiHitsPerChamberLayer[Muon::MuonStationIndex::T3];
599 
600  uint8_t etaLayer1Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM1] +
601  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T4] +
602  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::CSC] +
603  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::STGC1] +
604  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::STGC2];
605 
606  uint8_t etaLayer2Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM2] +
607  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T1];
608 
609  uint8_t etaLayer3Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO1] +
610  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T2];
611 
612  uint8_t etaLayer4Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO2] +
613  ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T3];
614 
615  uint8_t nprecLayers = 0;
616  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::BIS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::BIL] > 3)
617  ++nprecLayers;
618  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::BMS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] > 2)
619  ++nprecLayers;
620  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::BOS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::BOL] > 2)
621  ++nprecLayers;
622  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::EIS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::EIL] > 3)
623  ++nprecLayers;
624  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::EMS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::EML] > 2)
625  ++nprecLayers;
626  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::EOS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::EOL] > 2)
627  ++nprecLayers;
628  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::EES] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::EEL] > 3)
629  ++nprecLayers;
630  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::CSS] + nprecHitsPerChamberLayer[Muon::MuonStationIndex::CSL] > 2)
631  ++nprecLayers;
632  if (nprecHitsPerChamberLayer[Muon::MuonStationIndex::BEE] > 3) ++nprecLayers;
633 
634  uint8_t nphiLayers = 0;
635  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM1] > 0) ++nphiLayers;
636  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM2] > 0) ++nphiLayers;
637  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO1] > 0) ++nphiLayers;
638  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO2] > 0) ++nphiLayers;
639  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::T1] > 0) ++nphiLayers;
640  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::T2] > 0) ++nphiLayers;
641  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::T3] > 0) ++nphiLayers;
642  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::T4] > 0) ++nphiLayers;
643  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::CSC] > 2) ++nphiLayers;
644  if (nphiHitsPerChamberLayer[Muon::MuonStationIndex::STGC1] + nphiHitsPerChamberLayer[Muon::MuonStationIndex::STGC2] > 3)
645  ++nphiLayers;
646 
647  uint8_t ntrigEtaLayers = 0;
648  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM1] > 0) ++ntrigEtaLayers;
649  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM2] > 0) ++ntrigEtaLayers;
650  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO1] > 0) ++ntrigEtaLayers;
651  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO2] > 0) ++ntrigEtaLayers;
652  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T1] > 0) ++ntrigEtaLayers;
653  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T2] > 0) ++ntrigEtaLayers;
654  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T3] > 0) ++ntrigEtaLayers;
655  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T4] > 0) ++ntrigEtaLayers;
656  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::CSC] > 2) ++ntrigEtaLayers;
657  if (ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::STGC1] + ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::STGC2] > 3)
658  ++ntrigEtaLayers;
659 
660  // copy hit counts onto TruthParticle
661  static const SG::Accessor<uint8_t> nprecLayersAcc("nprecLayers");
662  static const SG::Accessor<uint8_t> nphiLayersAcc("nphiLayers");
663  static const SG::Accessor<uint8_t> ntrigEtaLayersAcc("ntrigEtaLayers");
664  static const SG::Accessor<uint8_t> innerSmallHitsAcc("innerSmallHits");
665  static const SG::Accessor<uint8_t> innerLargeHitsAcc("innerLargeHits");
666  static const SG::Accessor<uint8_t> middleSmallHitsAcc("middleSmallHits");
667  static const SG::Accessor<uint8_t> middleLargeHitsAcc("middleLargeHits");
668  static const SG::Accessor<uint8_t> outerSmallHitsAcc("outerSmallHits");
669  static const SG::Accessor<uint8_t> outerLargeHitsAcc("outerLargeHits");
670  static const SG::Accessor<uint8_t> extendedSmallHitsAcc("extendedSmallHits");
671  static const SG::Accessor<uint8_t> extendedLargeHitsAcc("extendedLargeHits");
672  nprecLayersAcc(truthParticle) = nprecLayers;
673  nphiLayersAcc(truthParticle) = nphiLayers;
674  ntrigEtaLayersAcc(truthParticle) = ntrigEtaLayers;
675  innerSmallHitsAcc(truthParticle) = innerSmallHits;
676  innerLargeHitsAcc(truthParticle) = innerLargeHits;
677  middleSmallHitsAcc(truthParticle) = middleSmallHits;
678  middleLargeHitsAcc(truthParticle) = middleLargeHits;
679  outerSmallHitsAcc(truthParticle) = outerSmallHits;
680  outerLargeHitsAcc(truthParticle) = outerLargeHits;
681  extendedSmallHitsAcc(truthParticle) = extendedSmallHits;
682  extendedLargeHitsAcc(truthParticle) = extendedLargeHits;
683 
684  static const SG::Accessor<uint8_t> phiLayer1HitsAcc("phiLayer1Hits");
685  static const SG::Accessor<uint8_t> phiLayer2HitsAcc("phiLayer2Hits");
686  static const SG::Accessor<uint8_t> phiLayer3HitsAcc("phiLayer3Hits");
687  static const SG::Accessor<uint8_t> phiLayer4HitsAcc("phiLayer4Hits");
688  phiLayer1HitsAcc(truthParticle) = phiLayer1Hits;
689  phiLayer2HitsAcc(truthParticle) = phiLayer2Hits;
690  phiLayer3HitsAcc(truthParticle) = phiLayer3Hits;
691  phiLayer4HitsAcc(truthParticle) = phiLayer4Hits;
692 
693  static const SG::Accessor<uint8_t> etaLayer1HitsAcc("etaLayer1Hits");
694  static const SG::Accessor<uint8_t> etaLayer2HitsAcc("etaLayer2Hits");
695  static const SG::Accessor<uint8_t> etaLayer3HitsAcc("etaLayer3Hits");
696  static const SG::Accessor<uint8_t> etaLayer4HitsAcc("etaLayer4Hits");
697  etaLayer1HitsAcc(truthParticle) = etaLayer1Hits;
698  etaLayer2HitsAcc(truthParticle) = etaLayer2Hits;
699  etaLayer3HitsAcc(truthParticle) = etaLayer3Hits;
700  etaLayer4HitsAcc(truthParticle) = etaLayer4Hits;
701 
702  if (msgLvl(MSG::DEBUG)) {
703  ATH_MSG_DEBUG("Precision layers " << static_cast<int>(nprecLayers) << " phi layers " << static_cast<int>(nphiLayers)
704  << " triggerEta layers " << static_cast<int>(ntrigEtaLayers));
705 
706  if (nprecLayers > 0) {
707  msg(MSG::VERBOSE) << " Precision chambers ";
708 
709  for (int index = 0; index < static_cast<int>(nprecHitsPerChamberLayer.size()); ++index) {
710  if (nprecHitsPerChamberLayer[index] > 0)
712  << " hits " << nprecHitsPerChamberLayer[index];
713  }
714  }
715  if (nphiLayers > 0) {
716  msg(MSG::VERBOSE) << endmsg << " Phi chambers ";
717  for (int index = 0; index < static_cast<int>(nphiHitsPerChamberLayer.size()); ++index) {
718  if (nphiHitsPerChamberLayer[index] > 0)
720  << " hits " << nphiHitsPerChamberLayer[index];
721  }
722  }
723 
724  if (ntrigEtaLayers > 0) {
725  msg(MSG::VERBOSE) << endmsg << " Trigger Eta ";
726  for (int index = 0; index < static_cast<int>(ntrigEtaHitsPerChamberLayer.size()); ++index) {
727  if (ntrigEtaHitsPerChamberLayer[index] > 0)
729  << " hits " << ntrigEtaHitsPerChamberLayer[index];
730  }
731  }
732  msg(MSG::VERBOSE) << endmsg;
733  }
734  return StatusCode::SUCCESS;
735  }
736 
738  const ChamberIdMap& ids) const {
739 
741  truthMdtHitsAcc("truthMdtHits");
743  truthTgcHitsAcc("truthTgcHits");
745  truthRpcHitsAcc("truthRpcHits");
746  std::vector<unsigned long long>& mdtTruthHits = truthMdtHitsAcc(truthParticle);
747  std::vector<unsigned long long>& tgcTruthHits = truthTgcHitsAcc(truthParticle);
748  std::vector<unsigned long long>& rpcTruthHits = truthRpcHitsAcc(truthParticle);
749 
750  std::vector<unsigned long long> stgcTruthHits;
751  std::vector<unsigned long long> cscTruthHits;
752  std::vector<unsigned long long> mmTruthHits;
753 
754  // loop over chamber layers
755  int nEI = 0, nEM = 0;
756  for (const auto& lay : ids) {
757  // loop over hits
758  if (lay.first == Muon::MuonStationIndex::EIS || lay.first == Muon::MuonStationIndex::EIL) nEI++;
759  if (lay.first == Muon::MuonStationIndex::EMS || lay.first == Muon::MuonStationIndex::EML) nEM++;
760  for (const auto& id : lay.second) {
761  if (m_idHelperSvc->isMdt(id))
762  mdtTruthHits.push_back(id.get_compact());
763  else if (m_idHelperSvc->isCsc(id))
764  cscTruthHits.push_back(id.get_compact());
765  else if (m_idHelperSvc->isTgc(id)) {
766  if ((lay.first == Muon::MuonStationIndex::EIS || lay.first == Muon::MuonStationIndex::EIL) && nEI > 1)
767  continue; // otherwise we double-count
768  if ((lay.first == Muon::MuonStationIndex::EMS || lay.first == Muon::MuonStationIndex::EML) && nEM > 1)
769  continue; // otherwise we double-count
770  tgcTruthHits.push_back(id.get_compact());
771  } else if (m_idHelperSvc->issTgc(id))
772  stgcTruthHits.push_back(id.get_compact());
773  else if (m_idHelperSvc->isRpc(id))
774  rpcTruthHits.push_back(id.get_compact());
775  else if (m_idHelperSvc->isMM(id))
776  mmTruthHits.push_back(id.get_compact());
777  }
778  }
779  if (m_idHelperSvc->hasCSC()) {
781  truthCscHitsAcc("truthCscHits");
782  truthCscHitsAcc(truthParticle) = std::move(cscTruthHits);
783  }
784  if (m_idHelperSvc->hasSTGC()) {
786  truthStgcHitsAcc("truthStgcHits");
787  truthStgcHitsAcc(truthParticle) = std::move(stgcTruthHits);
788  }
789  if (m_idHelperSvc->hasMM()) {
791  truthMMHitsAcc("truthMMHits");
792  truthMMHitsAcc(truthParticle) = std::move(mmTruthHits);
793  }
794  ATH_MSG_VERBOSE("Added " << mdtTruthHits.size() << " mdt truth hits, " << cscTruthHits.size() << " csc truth hits, "
795  << rpcTruthHits.size() << " rpc truth hits, and " << tgcTruthHits.size() << " tgc truth hits");
796  }
797 
798 } // namespace Muon
Muon::MuonTruthDecorationAlg::m_detMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
Definition: MuonTruthDecorationAlg.h:90
Muon::MuonStationIndex::BIS
@ BIS
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::chName
static const std::string & chName(ChIndex index)
convert ChIndex into a string
Definition: MuonStationIndex.cxx:157
xAOD::phiLayer1Hits
@ phiLayer1Hits
number of phi hits in the first trigger layer (BML1 ot T4)
Definition: TrackingPrimitives.h:348
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
xAOD::TruthParticle_v1::setStatus
void setStatus(int value)
Set status code.
Muon::MuonStationIndex::CSS
@ CSS
Definition: MuonStationIndex.h:18
Muon::MuonTruthDecorationAlg::addTrackRecords
StatusCode addTrackRecords(const EventContext &ctx, xAOD::TruthParticle &truthParticle) const
Definition: MuonTruthDecorationAlg.cxx:331
xAOD::etaLayer1Hits
@ etaLayer1Hits
number of eta hits in the first trigger layer (BML1 ot T4)
Definition: TrackingPrimitives.h:353
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Muon::MuonTruthDecorationAlg::m_SDO_TruthNames
SG::ReadHandleKeyArray< MuonSimDataCollection > m_SDO_TruthNames
Definition: MuonTruthDecorationAlg.h:78
Amg::hasPositiveDiagElems
bool hasPositiveDiagElems(const AmgSymMatrix(N) &mat)
Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above defin...
Definition: EventPrimitivesCovarianceHelpers.h:96
StrangeMeson
@ StrangeMeson
Definition: TruthClasses.h:80
test_pyathena.px
px
Definition: test_pyathena.py:18
xAOD::phiLayer3Hits
@ phiLayer3Hits
number of phi hits in the third trigger layer (BOL1 ot T2)
Definition: TrackingPrimitives.h:350
Amg::compress
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
Definition: EventPrimitivesHelpers.h:56
TrackParameters.h
xAOD::phiLayer4Hits
@ phiLayer4Hits
number of phi hits in the fourth trigger layer (T3)
Definition: TrackingPrimitives.h:351
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Muon::MuonStationIndex::STGC1
@ STGC1
Definition: MuonStationIndex.h:33
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
Muon::MuonStationIndex::T1
@ T1
Definition: MuonStationIndex.h:33
xAOD::TruthParticle_v1::pz
float pz() const
The z component of the particle's momentum.
Muon::MuonStationIndex::EEL
@ EEL
Definition: MuonStationIndex.h:18
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
Muon::MuonTruthDecorationAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonTruthDecorationAlg.h:82
PionDecay
@ PionDecay
Definition: TruthClasses.h:90
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
xAOD::TruthParticle_v1::setE
void setE(float value)
Set the energy of the particle.
Definition: TruthParticle_v1.cxx:235
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
CscSimDataCollection.h
Muon::MuonStationIndex::BO1
@ BO1
Definition: MuonStationIndex.h:33
xAOD::TruthParticle_v1::setBarcode
void setBarcode(int value)
Set barcode.
MuonSegmentAuxContainer.h
Muon::MuonStationIndex::BML
@ BML
Definition: MuonStationIndex.h:17
TruthParticleContainer.h
EventPrimitivesHelpers.h
MuonSegment.h
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
xAOD::TruthParticle_v1::px
float px() const
The x component of the particle's momentum.
Muon::MuonTruthDecorationAlg::m_muonTruthSegmentContainerName
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_muonTruthSegmentContainerName
Definition: MuonTruthDecorationAlg.h:69
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
xAOD::TruthParticle_v1::setPx
void setPx(float value)
Set the x component of the particle's momentum.
Trk::alongMomentum
@ alongMomentum
Definition: PropDirection.h:20
xAOD::TruthParticle_v1::py
float py() const
The y component of the particle's momentum.
Muon::MuonStationIndex::BOS
@ BOS
Definition: MuonStationIndex.h:17
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
Muon::MuonStationIndex::T4
@ T4
Definition: MuonStationIndex.h:33
Muon::MuonTruthDecorationAlg::m_trackRecordCollectionNames
SG::ReadHandleKeyArray< TrackRecordCollection > m_trackRecordCollectionNames
Definition: MuonTruthDecorationAlg.h:71
Muon::MuonStationIndex::BMS
@ BMS
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::PhiIndexMax
@ PhiIndexMax
Definition: MuonStationIndex.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::ReadHandleKey< MuonSimDataCollection >
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
x
#define x
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition: MuonStationIndex.h:31
Muon::MuonTruthDecorationAlg::createSegments
StatusCode createSegments(const EventContext &ctx, const ElementLink< xAOD::TruthParticleContainer > &truthLink, SG::WriteHandle< xAOD::MuonSegmentContainer > &segmentContainer, const ChamberIdMap &ids) const
Definition: MuonTruthDecorationAlg.cxx:168
Muon::MuonTruthDecorationAlg::ChamberIdMap
std::map< Muon::MuonStationIndex::ChIndex, std::vector< Identifier > > ChamberIdMap
Definition: MuonTruthDecorationAlg.h:41
Muon::MuonStationIndex::EIS
@ EIS
Definition: MuonStationIndex.h:18
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
xAOD::innerLargeHits
@ innerLargeHits
number of precision hits in the inner large layer
Definition: TrackingPrimitives.h:331
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Muon::MuonStationIndex::T2
@ T2
Definition: MuonStationIndex.h:33
Muon::MuonStationIndex::EOS
@ EOS
Definition: MuonStationIndex.h:18
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
xAOD::etaLayer3Hits
@ etaLayer3Hits
number of eta hits in the third trigger layer (BOL1 ot T2)
Definition: TrackingPrimitives.h:355
xAOD::middleLargeHits
@ middleLargeHits
number of precision hits in the middle large layer
Definition: TrackingPrimitives.h:333
TruthParticleAuxContainer.h
Muon::MuonStationIndex::T3
@ T3
Definition: MuonStationIndex.h:33
xAOD::phiLayer2Hits
@ phiLayer2Hits
number of phi hits in the second trigger layer (BML2 ot T1)
Definition: TrackingPrimitives.h:349
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
xAOD::etaLayer2Hits
@ etaLayer2Hits
number of eta hits in the second trigger layer (BML2 ot T1)
Definition: TrackingPrimitives.h:354
xAOD::TruthParticle_v1::setM
void setM(float value)
Also store the mass.
Definition: TruthParticle_v1.cxx:241
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Muon::MuonTruthDecorationAlg::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: MuonTruthDecorationAlg.h:85
IMCTruthClassifier.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::MuonStationIndex::BM1
@ BM1
Definition: MuonStationIndex.h:33
SG::Decorator< int >
McEventCollection.h
Muon::MuonStationIndex::BO2
@ BO2
Definition: MuonStationIndex.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::extendedLargeHits
@ extendedLargeHits
number of precision hits in the extended large layer
Definition: TrackingPrimitives.h:337
Muon::MuonTruthDecorationAlg::addHitIDVectors
void addHitIDVectors(xAOD::TruthParticle &truthParticle, const MuonTruthDecorationAlg::ChamberIdMap &ids) const
Definition: MuonTruthDecorationAlg.cxx:737
z
#define z
Trk::TrackingGeometry
Definition: TrackingGeometry.h:67
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
PiZero
@ PiZero
Definition: TruthClasses.h:98
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
StrangeBaryon
@ StrangeBaryon
Definition: TruthClasses.h:87
LightMeson
@ LightMeson
Definition: TruthClasses.h:79
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
CscReadoutElement.h
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
xAOD::TruthParticle_v1::setPy
void setPy(float value)
Set the y component of the particle's momentum.
Muon::MuonStationIndex::STGC2
@ STGC2
Definition: MuonStationIndex.h:33
Muon::MuonStationIndex::phiName
static const std::string & phiName(PhiIndex index)
convert PhiIndex into a string
Definition: MuonStationIndex.cxx:124
HepMC::simulation_history
std::deque< int > simulation_history(const T &p, const int direction)
Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.
Definition: MagicNumbers.h:180
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
Trk::CurvilinearParametersT
Definition: CurvilinearParametersT.h:48
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
Muon::MuonTruthDecorationAlg::addHitCounts
StatusCode addHitCounts(const EventContext &ctx, xAOD::TruthParticle &truthParticle, ChamberIdMap &ids) const
Definition: MuonTruthDecorationAlg.cxx:490
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
Muon::MuonTruthDecorationAlg::m_PRD_TruthNames
SG::ReadHandleKeyArray< PRD_MultiTruthCollection > m_PRD_TruthNames
Definition: MuonTruthDecorationAlg.h:73
Muon::MuonTruthDecorationAlg::m_muonTruthParticleContainerName
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_muonTruthParticleContainerName
Definition: MuonTruthDecorationAlg.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Muon::MuonStationIndex::EES
@ EES
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::ChUnknown
@ ChUnknown
Definition: MuonStationIndex.h:16
xAOD::TruthParticle_v1::prodVtx
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Definition: TruthParticle_v1.cxx:80
MuonGM::CscReadoutElement::localToGlobalCoords
Amg::Vector3D localToGlobalCoords(const Amg::Vector3D &x, const Identifier &id) const
localToGlobalCoords and Transf connect the Gas Gap Frame (defined as a Sensitive Detector) to the Glo...
Definition: CscReadoutElement.cxx:97
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
Amg::py
@ py
Definition: GeoPrimitives.h:39
xAOD::TruthParticle_v1::setPdgId
void setPdgId(int pid)
Set PDG ID code.
xAOD::middleSmallHits
@ middleSmallHits
number of precision hits in the middle small layer
Definition: TrackingPrimitives.h:332
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition: EventPrimitivesHelpers.h:40
Muon::MuonTruthDecorationAlg::initialize
virtual StatusCode initialize() override
Definition: MuonTruthDecorationAlg.cxx:69
Accessor.h
Helper class to provide type-safe access to aux data.
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)
xAOD::outerSmallHits
@ outerSmallHits
number of precision hits in the outer small layer
Definition: TrackingPrimitives.h:334
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
NucReact
@ NucReact
Definition: TruthClasses.h:97
query_example.col
col
Definition: query_example.py:7
LightBaryon
@ LightBaryon
Definition: TruthClasses.h:86
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Muon::MuonStationIndex::ChIndexMax
@ ChIndexMax
Definition: MuonStationIndex.h:19
Muon::MuonStationIndex::EML
@ EML
Definition: MuonStationIndex.h:18
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
EventPrimitivesCovarianceHelpers.h
xAOD::outerLargeHits
@ outerLargeHits
number of precision hits in the outer large layer
Definition: TrackingPrimitives.h:335
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
DeMoScan.index
string index
Definition: DeMoScan.py:364
Muon::MuonTruthDecorationAlg::m_truthClassifier
ToolHandle< IMCTruthClassifier > m_truthClassifier
Definition: MuonTruthDecorationAlg.h:84
TrackingVolume.h
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
y
#define y
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::MuonStationIndex::BIL
@ BIL
Definition: MuonStationIndex.h:17
Muon::MuonTruthDecorationAlg::m_CSC_SDO_TruthNames
SG::ReadHandleKey< CscSimDataCollection > m_CSC_SDO_TruthNames
Definition: MuonTruthDecorationAlg.h:80
Muon::MuonStationIndex::BEE
@ BEE
Definition: MuonStationIndex.h:17
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
xAOD::TruthParticle_v1::setPz
void setPz(float value)
Set the z component of the particle's momentum.
DEBUG
#define DEBUG
Definition: page_access.h:11
Muon::MuonStationIndex::CSC
@ CSC
Definition: MuonStationIndex.h:33
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
Muon::MuonTruthDecorationAlg::MuonTruthDecorationAlg
MuonTruthDecorationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MuonTruthDecorationAlg.cxx:65
Trk::TrackingGeometry::trackingVolume
const TrackingVolume * trackingVolume(const std::string &name) const
return the tracking Volume by name, 0 if it doesn't exist
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
TrackingGeometry.h
xAOD::TruthParticle_v1::setProdVtxLink
void setProdVtxLink(const ElementLink< TruthVertexContainer > &link)
Set the production vertex of the particle.
Muon::MuonTruthDecorationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: MuonTruthDecorationAlg.cxx:85
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:394
HepMC::is_sim_descendant
bool is_sim_descendant(const T1 &p1, const T2 &p2)
Method to check if the first particle is a descendant of the second in the simulation,...
Definition: MagicNumbers.h:360
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
xAOD::extendedSmallHits
@ extendedSmallHits
number of precision hits in the extended small layer
Definition: TrackingPrimitives.h:336
Muon::MuonStationIndex::EMS
@ EMS
Definition: MuonStationIndex.h:18
xAOD::innerSmallHits
@ innerSmallHits
number of precision hits in the inner small layer
Definition: TrackingPrimitives.h:330
Muon::MuonStationIndex::EOL
@ EOL
Definition: MuonStationIndex.h:18
MuonSimDataCollection.h
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
Muon::MuonStationIndex::BOL
@ BOL
Definition: MuonStationIndex.h:17
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Muon::MuonStationIndex::BM2
@ BM2
Definition: MuonStationIndex.h:33
Muon::MuonTruthDecorationAlg::m_truthParticleContainerName
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerName
Definition: MuonTruthDecorationAlg.h:66
Decorator.h
Helper class to provide type-safe access to aux data.
MuonTruthDecorationAlg.h
xAOD::etaLayer4Hits
@ etaLayer4Hits
number of eta hits in the fourth trigger layer (T3)
Definition: TrackingPrimitives.h:356
SegmentCollection.h
xAOD::TruthParticle_v1::charge
double charge() const
Physical charge.
HepMCHelpers.h
Muon::MuonTruthDecorationAlg::m_createTruthSegment
Gaudi::Property< bool > m_createTruthSegment
Definition: MuonTruthDecorationAlg.h:87
Muon::MuonStationIndex::CSL
@ CSL
Definition: MuonStationIndex.h:18
fitman.k
k
Definition: fitman.py:528
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
Segment.h
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
Muon::MuonStationIndex::EIL
@ EIL
Definition: MuonStationIndex.h:18
Identifier
Definition: IdentifierFieldParser.cxx:14