Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Muon::MuonTrackTruthTool Class Reference

Tool to calculate track truth. More...

#include <MuonTrackTruthTool.h>

Inheritance diagram for Muon::MuonTrackTruthTool:
Collaboration diagram for Muon::MuonTrackTruthTool:

Classes

struct  SortResultByMatchedHits
 

Public Member Functions

 ~MuonTrackTruthTool ()=default
 destructor More...
 
StatusCode initialize ()
 AlgTool initilize. More...
 
ResultVec match (const TruthTree &truth_tree, const TrackCollection &tracks) const
 perform truth matching for a given set of tracks More...
 
SegmentResultVec match (const TruthTree &truth_tree, const std::vector< const MuonSegment * > &segments) const
 perform truth matching for a given set of segments More...
 
MuonTrackTruth getTruth (const TruthTree &truth_tree, const Trk::Track &track, bool restrictedTruth=false) const
 get track truth More...
 
MuonTrackTruth getTruth (const TruthTree &truth_tree, const std::vector< const MuonSegment * > &segments, bool restrictedTruth=false) const
 get segment truth for a list of segments, the segments will be considered to belong to the same muon More...
 
MuonTrackTruth getTruth (const TruthTree &truth_tree, const Muon::MuonSegment &segment) const
 get segment truth More...
 
MuonTrackTruth getTruth (const TruthTree &truth_tree, const std::vector< const Trk::MeasurementBase * > &measurements, bool restrictedTruth=false) const
 get truth for a give set of hits. More...
 
const TruthTree createTruthTree (const TrackRecordCollection *truthTrackCol, const McEventCollection *mcEventCollection, const std::vector< const MuonSimDataCollection * > &muonSimData, const CscSimDataCollection *cscSimDataMap) const
 create truth tree from sim data More...
 
HepMC::ConstGenParticlePtr getMother (const TruthTrajectory &traj, const int barcodeIn) const
 Returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory. More...
 
HepMC::ConstGenParticlePtr getAncestor (const TruthTrajectory &traj, const int barcodeIn) const
 Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory. More...
 
HepMC::ConstGenParticlePtr getInitial (const TruthTrajectory &traj, const int barcodeIn) const
 Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. More...
 
unsigned int getNumberOfScatters (const TruthTrajectory &traj, const int barcodeIn) const
 Returns the number of steps a particle took while maintaining its PDG ID. More...
 

Private Member Functions

MuonTrackTruth getTruth (const std::vector< const Trk::MeasurementBase * > &measurements, const TruthTreeEntry &truthEntry, bool restrictedTruth) const
 
void addSimDataToTree (TruthTree &truth_tree, std::map< int, int > &barcode_map, const MuonSimDataCollection *simDataCol) const
 
void addCscSimDataToTree (TruthTree &truth_tree, std::map< int, int > &barcode_map, const CscSimDataCollection *simDataCol) const
 
void addMdtTruth (MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const MuonSimDataCollection &simCol) const
 
void addClusterTruth (MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const MuonSimDataCollection &simCol) const
 
void addClusterTruth (MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const CscSimDataCollection &simCol) const
 
void addMissedHits (MuonTechnologyTruth &truth, const std::set< Identifier > &ids, const std::set< Identifier > &chids, const MuonSimDataCollection &simCol, bool restrictedTruth) const
 
void addMissedHits (MuonTechnologyTruth &truth, const std::set< Identifier > &ids, const std::set< Identifier > &chids, const CscSimDataCollection &simCol, bool restrictedTruth) const
 
int manipulateBarCode (int barcode) const
 
bool selectPdg (int pdg) const
 
const std::pair< HepMC::ConstGenParticlePtr, unsigned int > getInitialPair (const TruthTrajectory &traj, const int barcodeIn) const
 Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. More...
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
PublicToolHandle< Muon::MuonEDMPrinterToolm_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
 
ToolHandle< Trk::ITruthTrajectoryBuilderm_truthTrajectoryBuilder
 
Gaudi::Property< bool > m_manipulateBarCode {this, "ManipulateBarCode", false}
 
Gaudi::Property< bool > m_doSummary {this, "DoSummary", false}
 
Gaudi::Property< bool > m_matchAllParticles {this, "MatchAllParticles", true}
 
Gaudi::Property< unsigned int > m_minHits {this, "MinHits", 4}
 
Gaudi::Property< std::vector< int > > m_pdgsToBeConsidered {this, "ConsideredPDGs", {}}
 
std::set< int > m_selectedPdgs
 

Detailed Description

Tool to calculate track truth.

Definition at line 43 of file MuonTrackTruthTool.h.

Constructor & Destructor Documentation

◆ ~MuonTrackTruthTool()

Muon::MuonTrackTruthTool::~MuonTrackTruthTool ( )
default

destructor

Member Function Documentation

◆ addClusterTruth() [1/2]

void Muon::MuonTrackTruthTool::addClusterTruth ( MuonTechnologyTruth trackTruth,
const Identifier id,
const Trk::MeasurementBase meas,
const CscSimDataCollection simCol 
) const
private

Definition at line 616 of file MuonTrackTruthTool.cxx.

617  {
618  Identifier layid = m_idHelperSvc->layerId(id);
619  Identifier chid = m_idHelperSvc->chamberId(id);
620  // find SimData corresponding to identifier
621  CscSimDataCollection::const_iterator it = simCol.find(id);
622  if (it == simCol.end()) {
623  truth.wrongHits.insert(layid);
624  truth.wrongChambers.insert(chid);
625  return;
626  }
627 
628  std::vector<CscSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
629  std::vector<CscSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
630  for (; dit != dit_end; ++dit) {
631  truth.matchedHits.insert(layid);
632  truth.matchedChambers.insert(chid);
633  }
634  }

◆ addClusterTruth() [2/2]

void Muon::MuonTrackTruthTool::addClusterTruth ( MuonTechnologyTruth trackTruth,
const Identifier id,
const Trk::MeasurementBase meas,
const MuonSimDataCollection simCol 
) const
private

Definition at line 560 of file MuonTrackTruthTool.cxx.

561  {
562  Identifier layid = m_idHelperSvc->layerId(id);
563  Identifier chid = m_idHelperSvc->chamberId(id);
564 
565  MuonSimDataCollection::const_iterator it = simCol.end();
566 
567  bool goodCluster = false;
568  const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(&meas);
569  if (crot) {
570  for (unsigned int i = 0; i < crot->numberOfContainedROTs(); ++i) {
571  const MuonClusterOnTrack* cluster = &crot->rioOnTrack(i);
572  if (!cluster) continue;
573  // find SimData corresponding to identifier
574  it = simCol.find(cluster->identify());
575  if (it != simCol.end()) {
576  goodCluster = true;
577  break;
578  }
579  }
580  } else {
581  // Find SimData corresponding to identifier
582  const Trk::RIO_OnTrack* rot = nullptr;
583  Trk::RoT_Extractor::extract(rot, &meas);
584  const Trk::PrepRawData* prd = rot->prepRawData();
585  if (prd) {
586  // check if an identifier from the list of RDOs is matched to that in the SDO collection
587  const std::vector<Identifier> &rdoList = prd->rdoList();
588  std::vector<Identifier>::const_iterator rit = rdoList.begin();
589  std::vector<Identifier>::const_iterator rit_end = rdoList.end();
590  for (; rit != rit_end; ++rit) {
591  it = simCol.find(*rit);
592  if (it != simCol.end()) {
593  goodCluster = true;
594  break;
595  }
596  }
597  } else {
598  it = simCol.find(id);
599  if (it != simCol.end()) goodCluster = true;
600  }
601  }
602 
603  if (!goodCluster || it == simCol.end()) {
604  truth.wrongHits.insert(id);
605  return;
606  }
607 
608  std::vector<MuonSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
609  std::vector<MuonSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
610  for (; dit != dit_end; ++dit) {
611  truth.matchedHits.insert(layid);
612  truth.matchedChambers.insert(chid);
613  }
614  }

◆ addCscSimDataToTree()

void Muon::MuonTrackTruthTool::addCscSimDataToTree ( TruthTree &  truth_tree,
std::map< int, int > &  barcode_map,
const CscSimDataCollection simDataCol 
) const
private

Definition at line 319 of file MuonTrackTruthTool.cxx.

320  {
321  // loop over sim collection and check whether identifiers are on track
322  CscSimDataCollection::const_iterator it = simDataCol->begin();
323  CscSimDataCollection::const_iterator it_end = simDataCol->end();
324  for (; it != it_end; ++it) {
325  Identifier id = it->first;
326 
327  // loop over deposits
328  std::vector<CscSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
329  std::vector<CscSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
330  for (; dit != dit_end; ++dit) {
331  int barcodeIn = manipulateBarCode(dit->first.barcode());
332  std::map<int, int>::const_iterator bit = barcode_map.find(barcodeIn);
333  if (bit == barcode_map.end()) {
334  ATH_MSG_VERBOSE(" discarding "
335  << " " << m_idHelperSvc->toString(id) << " barcode " << barcodeIn);
336  continue;
337  }
338  // replace barcode with barcode from map
339  int barcode = bit->second;
340 
341  TruthTreeIt eit = truth_tree.find(barcode);
342  if (eit == truth_tree.end()) {
343  ATH_MSG_VERBOSE(" discarding "
344  << " " << m_idHelperSvc->toString(id) << " barcode " << barcode);
345  continue;
346  }
347 
348  if (msgLvl(MSG::VERBOSE)) {
349  ATH_MSG_VERBOSE(" adding hit " << m_idHelperSvc->toString(id) << " barcode " << barcode);
350  if (barcode != barcodeIn) ATH_MSG_VERBOSE(" hit barcode " << barcodeIn);
351  }
352  eit->second.cscHits.insert(*it);
353  }
354  }
355  }

◆ addMdtTruth()

void Muon::MuonTrackTruthTool::addMdtTruth ( MuonTechnologyTruth trackTruth,
const Identifier id,
const Trk::MeasurementBase meas,
const MuonSimDataCollection simCol 
) const
private

Definition at line 525 of file MuonTrackTruthTool.cxx.

526  {
527  const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(&meas);
528  if (!mdt) {
529  ATH_MSG_WARNING(" dynamic_cast to MdtDriftCircleOnTrack failed for measurement with id " << m_idHelperSvc->toString(id));
530  return;
531  }
532 
533  Identifier chid = m_idHelperSvc->chamberId(id);
534 
535  // find SimData corresponding to identifier
536  MuonSimDataCollection::const_iterator it = simCol.find(id);
537  if (it == simCol.end()) {
538  truth.wrongHits.insert(id);
539  truth.wrongChambers.insert(chid);
540  return;
541  }
542 
543  std::vector<MuonSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
544  std::vector<MuonSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
545  for (; dit != dit_end; ++dit) {
546  double radius = dit->second.firstEntry();
547 
548  // check whether SDO and hit have same sign, don't check sign if drift radius < 0.3 mm as it will be badly determined
549  double checkSign = fabs(mdt->driftRadius()) > 0.3 ? radius * mdt->driftRadius() : 1;
550  if (checkSign >= 0) {
551  truth.matchedHits.insert(id);
552  truth.matchedChambers.insert(chid);
553  } else {
554  truth.wrongHits.insert(id);
555  truth.wrongChambers.insert(chid);
556  }
557  }
558  }

◆ addMissedHits() [1/2]

void Muon::MuonTrackTruthTool::addMissedHits ( MuonTechnologyTruth truth,
const std::set< Identifier > &  ids,
const std::set< Identifier > &  chids,
const CscSimDataCollection simCol,
bool  restrictedTruth 
) const
private

Definition at line 498 of file MuonTrackTruthTool.cxx.

499  {
500  // loop over sim collection and check whether identifiers are on track
501  CscSimDataCollection::const_iterator it = simCol.begin();
502  CscSimDataCollection::const_iterator it_end = simCol.end();
503  for (; it != it_end; ++it) {
504  Identifier id = m_idHelperSvc->layerId(it->first);
505 
506  int isOnTrack = ids.count(id);
507  if (isOnTrack) continue;
508 
509  // if restricted truth mode, skip if chamber has not hits
510  Identifier chid = m_idHelperSvc->chamberId(id);
511  bool chamberHasHits = chids.count(chid);
512  if (restrictedTruth && !chamberHasHits) continue;
513 
514  // loop over deposits
515  std::vector<CscSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
516  std::vector<CscSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
517  for (; dit != dit_end; ++dit) {
518  truth.missedHits.insert(id);
519  // only fill a missed chamber if the chamber had no hits
520  if (!chamberHasHits) truth.missedChambers.insert(chid);
521  }
522  }
523  }

◆ addMissedHits() [2/2]

void Muon::MuonTrackTruthTool::addMissedHits ( MuonTechnologyTruth truth,
const std::set< Identifier > &  ids,
const std::set< Identifier > &  chids,
const MuonSimDataCollection simCol,
bool  restrictedTruth 
) const
private

Definition at line 469 of file MuonTrackTruthTool.cxx.

470  {
471  // loop over sim collection and check whether identifiers are on track
472  MuonSimDataCollection::const_iterator it = simCol.begin();
473  MuonSimDataCollection::const_iterator it_end = simCol.end();
474  for (; it != it_end; ++it) {
475  Identifier id = it->first;
476  // for trigger chambers use layer id
477  if (m_idHelperSvc->isTrigger(id) || m_idHelperSvc->isCsc(id)) id = m_idHelperSvc->layerId(id);
478 
479  int isOnTrack = ids.count(id);
480  if (isOnTrack) continue;
481 
482  // if restricted truth mode, skip if chamber has not hits
483  Identifier chid = m_idHelperSvc->chamberId(id);
484  bool chamberHasHits = chids.count(chid);
485  if (restrictedTruth && !chamberHasHits) continue;
486 
487  // loop over deposits
488  std::vector<MuonSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
489  std::vector<MuonSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
490  for (; dit != dit_end; ++dit) {
491  truth.missedHits.insert(id);
492  // only fill a missed chamber if the chamber had no hits
493  if (!chamberHasHits) truth.missedChambers.insert(chid);
494  }
495  }
496  }

◆ addSimDataToTree()

void Muon::MuonTrackTruthTool::addSimDataToTree ( TruthTree &  truth_tree,
std::map< int, int > &  barcode_map,
const MuonSimDataCollection simDataCol 
) const
private

Definition at line 266 of file MuonTrackTruthTool.cxx.

267  {
268  // loop over sim collection and check whether identifiers are on track
269  MuonSimDataCollection::const_iterator it = simDataCol->begin();
270  MuonSimDataCollection::const_iterator it_end = simDataCol->end();
271  for (; it != it_end; ++it) {
272  Identifier id = it->first;
273 
274  // loop over deposits
275  std::vector<MuonSimData::Deposit>::const_iterator dit = it->second.getdeposits().begin();
276  std::vector<MuonSimData::Deposit>::const_iterator dit_end = it->second.getdeposits().end();
277  for (; dit != dit_end; ++dit) {
278  int barcodeIn = dit->first.barcode();
279  std::map<int, int>::const_iterator bit = barcode_map.find(barcodeIn);
280  if (bit == barcode_map.end()) {
281  ATH_MSG_VERBOSE(" discarding "
282  << " " << m_idHelperSvc->toString(id) << " barcode " << barcodeIn);
283  continue;
284  }
285  // replace barcode with barcode from map
286  int barcode = bit->second;
287 
288  TruthTreeIt eit = truth_tree.find(barcode);
289  if (eit == truth_tree.end()) {
290  ATH_MSG_VERBOSE(" discarding "
291  << " " << m_idHelperSvc->toString(id) << " barcode " << barcode);
292  continue;
293  }
294 
295  if (m_idHelperSvc->isMdt(id)) {
296  eit->second.mdtHits.insert(*it);
297  } else if (m_idHelperSvc->isRpc(id)) {
298  if (m_idHelperSvc->stationIndex(id) == MuonStationIndex::BO && m_idHelperSvc->rpcIdHelper().doubletR(id) == 2) {
299  ATH_MSG_VERBOSE(" Discarding non existing RPC hit " << m_idHelperSvc->toString(id));
300  continue;
301  }
302 
303  eit->second.rpcHits.insert(*it);
304  } else if (m_idHelperSvc->isTgc(id)) {
305  eit->second.tgcHits.insert(*it);
306  } else if (m_idHelperSvc->issTgc(id)) {
307  eit->second.stgcHits.insert(*it);
308  } else if (m_idHelperSvc->isMM(id)) {
309  eit->second.mmHits.insert(*it);
310  }
311  if (msgLvl(MSG::VERBOSE)) {
312  ATH_MSG_VERBOSE(" adding hit " << m_idHelperSvc->toString(id) << " barcode " << barcode);
313  if (barcode != barcodeIn) ATH_MSG_VERBOSE(" hit barcode " << barcodeIn);
314  }
315  }
316  }
317  }

◆ createTruthTree()

const MuonTrackTruthTool::TruthTree Muon::MuonTrackTruthTool::createTruthTree ( const TrackRecordCollection truthTrackCol,
const McEventCollection mcEventCollection,
const std::vector< const MuonSimDataCollection * > &  muonSimData,
const CscSimDataCollection cscSimDataMap 
) const

create truth tree from sim data

Definition at line 110 of file MuonTrackTruthTool.cxx.

113  {
114  std::map<int, int> barcode_map;
115  MuonTrackTruthTool::TruthTree truth_tree;
116  if (truthTrackCol->empty()) {
117  ATH_MSG_WARNING(" TrackRecordCollection is empty ");
118  return truth_tree;
119  }
120 
121  const HepMC::GenEvent* genEvent = nullptr;
122  if (!mcEventCollection->empty()) {
123  ATH_MSG_VERBOSE("McEventCollection size " << mcEventCollection->size());
124  if (mcEventCollection->size() == 1) genEvent = mcEventCollection->front();
125  }
126 
127  ATH_MSG_VERBOSE(" creating truth tree from track record " << truthTrackCol->size());
128 
129  TrackRecordConstIterator tr_it = truthTrackCol->begin();
130  TrackRecordConstIterator tr_it_end = truthTrackCol->end();
131  for (; tr_it != tr_it_end; ++tr_it) {
132  int PDGCode((*tr_it).GetPDGCode());
133  int barcode = (*tr_it).barcode(); // FIXME barcode-based
134  if (!m_matchAllParticles && !selectPdg(PDGCode)) {
135  ATH_MSG_VERBOSE(" discarding truth track: pdg " << PDGCode << " barcode " << barcode);
136  continue;
137  }
138 
139  // check whether barcode is already in, skip if that is the case
140  if (barcode_map.count(barcode)) {
141  ATH_MSG_VERBOSE(" barcode " << barcode << " already in map, final state barcode " << barcode_map[barcode]);
142  continue;
143  }
144  ATH_MSG_VERBOSE(" found new particle with pdgid " << PDGCode << " in truth record, barcode " << barcode);
145 
146  std::unique_ptr<TruthTrajectory> truthTrajectory;
147  // associate the muon truth with the gen event info
148  if (genEvent) {
149  HepMC::ConstGenParticlePtr genParticle = HepMC::barcode_to_particle(genEvent, (*tr_it).barcode()); // FIXME barcode-based
150  if (genParticle) {
151  truthTrajectory = std::make_unique<TruthTrajectory>();
152  m_truthTrajectoryBuilder->buildTruthTrajectory(truthTrajectory.get(), genParticle);
153  if (!truthTrajectory->empty()) {
154  // always use barcode of the 'final' particle in chain in map
155  barcode = truthTrajectory->front().barcode();
156 
157  if (msgLvl(MSG::VERBOSE)) {
158  auto particle = truthTrajectory->front().cptr();
159  ATH_MSG_VERBOSE(" found GenParticle: size " << truthTrajectory->size() << " fs barcode " << barcode << "particle "<< particle);
160  if (particle->production_vertex()) {
161  ATH_MSG_VERBOSE(" vertex: r " << particle->production_vertex()->position().perp() << " z "
162  << particle->production_vertex()->position().z());
163  }
164  }
165 
166  // now collect all barcodes beloning to this TruthTrajectory
167  std::vector<HepMcParticleLink>::const_iterator pit = truthTrajectory->begin();
168  std::vector<HepMcParticleLink>::const_iterator pit_end = truthTrajectory->end();
169  for (; pit != pit_end; ++pit) {
170  int code = (*pit).barcode();
171 
172  if (msgLvl(MSG::VERBOSE) && code != barcode) {
173  auto particle = (*pit).cptr();
174  ATH_MSG_VERBOSE(" secondary barcode: " << code << "particle "<< particle);
175  if (particle->production_vertex())
176  ATH_MSG_VERBOSE(" vertex: r " <<particle->production_vertex()->position().perp() << " z "
177  << particle->production_vertex()->position().z());
178  // sanity check
179  if (barcode_map.count(code)) ATH_MSG_VERBOSE(" pre-existing barcode " << code);
180  }
181 
182  // enter barcode
183  barcode_map[code] = barcode;
184  }
185  } else {
186  ATH_MSG_WARNING(" empty truth trajectory " << barcode);
187  }
188  }
189  } else {
190  // add one to one relation
191  barcode_map[barcode] = barcode;
192  }
193 
194  if (truth_tree.count(barcode)) {
195  ATH_MSG_WARNING(" found muon barcode twice in truth record: " << barcode);
196  continue;
197  }
198 
199  TruthTreeEntry& entry = truth_tree[barcode];
200  entry.truthTrack = &(*tr_it);
201  // entry.truthTrajectory = truthTrajectory.get();
202  entry.truthTrajectory = std::move(truthTrajectory);
203  // m_truthTrajectoriesToBeDeleted.push_back(std::move(truthTrajectory));
204  }
205 
206  // add sim data collections
207  for (const MuonSimDataCollection* simDataMap : muonSimData) { addSimDataToTree(truth_tree, barcode_map, simDataMap); }
208  if (cscSimDataMap) { addCscSimDataToTree(truth_tree, barcode_map, cscSimDataMap); }
209 
210  unsigned int ngood(0);
211  std::vector<int> badBarcodes;
212  // erase entries with too few hits or no track record
213  TruthTreeIt it = truth_tree.begin();
214  for (; it != truth_tree.end(); ++it) {
215  bool erase = false;
216  unsigned int nhits = it->second.mdtHits.size() + it->second.rpcHits.size() + it->second.tgcHits.size() +
217  it->second.cscHits.size() + it->second.stgcHits.size() + it->second.mmHits.size();
218  if (!it->second.truthTrack) erase = true;
219  if (nhits < m_minHits) erase = true;
220 
221  if (erase) {
222  ATH_MSG_VERBOSE(" Erasing entry: barcode " << it->second.truthTrack->barcode() << " manip "
223  << manipulateBarCode(it->second.truthTrack->barcode()) << " hits " << nhits); // FIXME barcode-based
224  badBarcodes.push_back(it->first);
225  } else {
226  ++ngood;
227  ATH_MSG_VERBOSE(" Keeping entry: barcode " << it->second.truthTrack->barcode() << " manip "
228  << manipulateBarCode(it->second.truthTrack->barcode()) << " hits " << nhits); // FIXME barcode-based
229  }
230  }
231 
232  std::vector<int>::iterator badIt = badBarcodes.begin();
233  std::vector<int>::iterator badIt_end = badBarcodes.end();
234  for (; badIt != badIt_end; ++badIt) truth_tree.erase(*badIt);
235 
236  if (ngood != truth_tree.size()) {
237  ATH_MSG_WARNING(" Problem cleaning map: size " << truth_tree.size() << " accepted entries " << ngood);
238  }
239 
240  if (m_doSummary || msgLvl(MSG::DEBUG)) {
241  ATH_MSG_INFO(" summarizing truth tree: number of particles " << truth_tree.size());
242  TruthTreeIt it = truth_tree.begin();
243  TruthTreeIt it_end = truth_tree.end();
244  for (; it != it_end; ++it) {
245  if (!it->second.truthTrack)
246  ATH_MSG_INFO(" no TrackRecord ");
247  else {
248  ATH_MSG_INFO(" PDG " << it->second.truthTrack->GetPDGCode() << " barcode " << it->second.truthTrack->barcode()
249  << " manip " << manipulateBarCode(it->second.truthTrack->barcode())); // FIXME barcode-based
250  }
251  if (!it->second.mdtHits.empty()) ATH_MSG_INFO(" mdt " << it->second.mdtHits.size());
252  if (!it->second.rpcHits.empty()) ATH_MSG_INFO(" rpc " << it->second.rpcHits.size());
253  if (!it->second.tgcHits.empty()) ATH_MSG_INFO(" tgc " << it->second.tgcHits.size());
254  if (!it->second.cscHits.empty()) ATH_MSG_INFO(" csc " << it->second.cscHits.size());
255  if (!it->second.stgcHits.empty()) ATH_MSG_INFO(" stgc " << it->second.stgcHits.size());
256  if (!it->second.mmHits.empty()) ATH_MSG_INFO(" mm " << it->second.mmHits.size());
257  if (it->second.mdtHits.empty() && it->second.rpcHits.empty() && it->second.tgcHits.empty() && it->second.cscHits.empty() &&
258  it->second.stgcHits.empty() && it->second.mmHits.empty())
259  ATH_MSG_INFO(" no hits ");
260  }
261  }
262 
263  return truth_tree;
264  }

◆ getAncestor()

HepMC::ConstGenParticlePtr Muon::MuonTrackTruthTool::getAncestor ( const TruthTrajectory traj,
const int  barcodeIn 
) const

Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory.

Ancestor here means the last particle at generator level that has a status code different from final state, e.g. Z

Definition at line 658 of file MuonTrackTruthTool.cxx.

658  {
659  bool foundBC = false;
660  for (const auto& pit : traj) {
661  if (!pit) continue;
662  if (pit.barcode() == barcodeIn || foundBC) {
663  foundBC = true;
664 #ifdef HEPMC3
665  auto particle = pit.scptr();
666 #else
667  auto particle = pit.cptr();
668 #endif
669  if (!MC::isStable(particle)) { // first non final state particle
670  return particle;
671  }
672  }
673  }
674  return nullptr;
675  }

◆ getInitial()

HepMC::ConstGenParticlePtr Muon::MuonTrackTruthTool::getInitial ( const TruthTrajectory traj,
const int  barcodeIn 
) const

Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory.

For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. This interface calls the method getInitialPair.

Definition at line 737 of file MuonTrackTruthTool.cxx.

737  {
738  return getInitialPair(traj, barcodeIn).first;
739  }

◆ getInitialPair()

const std::pair< HepMC::ConstGenParticlePtr, unsigned int > Muon::MuonTrackTruthTool::getInitialPair ( const TruthTrajectory traj,
const int  barcodeIn 
) const
private

Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory.

For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. The number of such scatters is returned in the .second.

Definition at line 677 of file MuonTrackTruthTool.cxx.

678  {
679  std::pair<HepMC::ConstGenParticlePtr, unsigned int> thePair(nullptr, 0);
680  unsigned int scat = 0;
681  ATH_MSG_DEBUG("getFirst() : size = " << traj.size());
682  bool foundBC = false;
683  int pdgFinal = 0;
684  double ePrev = 0.;
685  HepMC::ConstGenParticlePtr theFirst{nullptr};
686  for (auto pit = traj.begin(); pit != traj.end(); ++pit) {
687  if ((*pit).barcode() == barcodeIn || foundBC) {
688  auto particle = (*pit).scptr();
689 #ifdef HEPMC3
690  if (!foundBC) {
691  foundBC = true;
692  theFirst = particle;
693  pdgFinal = particle->pdg_id();
694  } else {
695  if (particle->pdg_id() == pdgFinal) {
696  const auto& pit_p = *pit;
697  if ((theFirst != pit_p.scptr()) && (particle->momentum().t() != ePrev))
698  ++scat; // if the particle has not changed pdgid after the first step count as scatter. also avoid counting
699  // pure interface changes as scatter
700  } else { // the first time this particle appears
701  --pit; // AV This is confusing
702  theFirst = (*pit).scptr();
703  break;
704  }
705  }
706 #else
707  if (!foundBC) {
708  foundBC = true;
709  theFirst = (*pit).cptr();
710  pdgFinal = (*pit)->pdg_id();
711  } else {
712  if ((*pit)->pdg_id() == pdgFinal) {
713  auto pit_p = *pit;
714  if ((theFirst != pit_p.cptr()) && ((*pit).cptr()->momentum().t() != ePrev))
715  ++scat; // if the particle has not changed pdgid after the first step count as scatter. also avoid counting
716  // pure interface changes as scatter
717  } else { // the first time this particle appears
718  --pit;
719  theFirst = (*pit).cptr();
720  break;
721  }
722  }
723 #endif
724  ATH_MSG_DEBUG("getFirst() : pt = " << particle->momentum().perp() << " scat = " << scat);
725  ePrev = particle->momentum().t(); // prepare for comparing this entry with the next one
726  }
727  }
728  // sanity check
729  if (theFirst && theFirst->pdg_id() != pdgFinal) ATH_MSG_ERROR("Wrong pdgId association in getFirst()");
730  ATH_MSG_DEBUG("Number of scatters = " << scat << " pdgId = " << pdgFinal);
731 
732  thePair.first = theFirst;
733  thePair.second = scat;
734  return thePair;
735  }

◆ getMother()

HepMC::ConstGenParticlePtr Muon::MuonTrackTruthTool::getMother ( const TruthTrajectory traj,
const int  barcodeIn 
) const

Returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory.

It traces the decay chain until if finds the first particle that is different flavor from the starting one.

Definition at line 636 of file MuonTrackTruthTool.cxx.

636  {
637  ATH_MSG_DEBUG("getMother() : size = " << traj.size());
638  int pdgFinal = ((traj.empty()) ? -999 : traj.front().cptr()->pdg_id());
639  bool foundBC = false;
640  for (const auto& pit : traj) {
641  if (!pit) continue;
642  if (pit.barcode() == barcodeIn || foundBC) {
643  foundBC = true;
644  ATH_MSG_DEBUG("getMother() : " << pit );
645 #ifdef HEPMC3
646  auto particle = pit.scptr();
647 #else
648  auto particle = pit.cptr();
649 #endif
650  if (particle->pdg_id() != pdgFinal) { // the first case a track had a different flavour
651  break;
652  }
653  }
654  }
655  return nullptr;
656  }

◆ getNumberOfScatters()

unsigned int Muon::MuonTrackTruthTool::getNumberOfScatters ( const TruthTrajectory traj,
const int  barcodeIn 
) const

Returns the number of steps a particle took while maintaining its PDG ID.

This method calls getInitialPair for calculating this number.

Definition at line 741 of file MuonTrackTruthTool.cxx.

741  {
742  return (getInitialPair(traj, barcodeIn)).second;
743  }

◆ getTruth() [1/5]

MuonTrackTruth Muon::MuonTrackTruthTool::getTruth ( const std::vector< const Trk::MeasurementBase * > &  measurements,
const TruthTreeEntry &  truthEntry,
bool  restrictedTruth 
) const
private

Definition at line 421 of file MuonTrackTruthTool.cxx.

422  {
423  MuonTrackTruth trackTruth;
424  trackTruth.truthTrack = truthEntry.truthTrack;
425  trackTruth.truthTrajectory = truthEntry.truthTrajectory;
426 
427  std::vector<const Trk::MeasurementBase*>::const_iterator mit = measurements.begin();
428  std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = measurements.end();
429  for (; mit != mit_end; ++mit) {
430  // check whether state is a measurement
431  const Trk::MeasurementBase* meas = *mit;
432  if (!meas) { continue; }
433 
434  const Trk::RIO_OnTrack* rot = nullptr;
435  Trk::RoT_Extractor::extract(rot, meas);
436  if (!rot) {
437  if (!dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(meas)) ATH_MSG_WARNING(" Could not get rot from measurement ");
438  continue;
439  }
440  Identifier id = rot->identify();
441  if (!id.is_valid() || !m_idHelperSvc->mdtIdHelper().is_muon(id)) continue;
442 
443  if (m_idHelperSvc->isMdt(id)) {
444  addMdtTruth(trackTruth.mdts, id, *meas, truthEntry.mdtHits);
445  } else if (m_idHelperSvc->isCsc(id)) {
446  addClusterTruth(trackTruth.cscs, id, *meas, truthEntry.cscHits);
447  } else if (m_idHelperSvc->isRpc(id)) {
448  addClusterTruth(trackTruth.rpcs, id, *meas, truthEntry.rpcHits);
449  } else if (m_idHelperSvc->isTgc(id)) {
450  addClusterTruth(trackTruth.tgcs, id, *meas, truthEntry.tgcHits);
451  } else if (m_idHelperSvc->issTgc(id)) {
452  addClusterTruth(trackTruth.stgcs, id, *meas, truthEntry.stgcHits);
453  } else if (m_idHelperSvc->isMM(id)) {
454  addClusterTruth(trackTruth.mms, id, *meas, truthEntry.mmHits);
455  }
456  }
457 
458  addMissedHits(trackTruth.mdts, trackTruth.mdts.matchedHits, trackTruth.mdts.matchedChambers, truthEntry.mdtHits, restrictedTruth);
459  addMissedHits(trackTruth.cscs, trackTruth.cscs.matchedHits, trackTruth.cscs.matchedChambers, truthEntry.cscHits, restrictedTruth);
460  addMissedHits(trackTruth.rpcs, trackTruth.rpcs.matchedHits, trackTruth.rpcs.matchedChambers, truthEntry.rpcHits, restrictedTruth);
461  addMissedHits(trackTruth.tgcs, trackTruth.tgcs.matchedHits, trackTruth.tgcs.matchedChambers, truthEntry.tgcHits, restrictedTruth);
462  addMissedHits(trackTruth.stgcs, trackTruth.stgcs.matchedHits, trackTruth.stgcs.matchedChambers, truthEntry.stgcHits,
463  restrictedTruth);
464  addMissedHits(trackTruth.mms, trackTruth.mms.matchedHits, trackTruth.mms.matchedChambers, truthEntry.mmHits, restrictedTruth);
465 
466  return trackTruth;
467  }

◆ getTruth() [2/5]

MuonTrackTruth Muon::MuonTrackTruthTool::getTruth ( const TruthTree &  truth_tree,
const Muon::MuonSegment segment 
) const

get segment truth

Definition at line 357 of file MuonTrackTruthTool.cxx.

357  {
358  return getTruth(truth_tree, segment.containedMeasurements(), true);
359  }

◆ getTruth() [3/5]

MuonTrackTruth Muon::MuonTrackTruthTool::getTruth ( const TruthTree &  truth_tree,
const std::vector< const MuonSegment * > &  segments,
bool  restrictedTruth = false 
) const

get segment truth for a list of segments, the segments will be considered to belong to the same muon

Definition at line 366 of file MuonTrackTruthTool.cxx.

367  {
368  std::set<Identifier> ids;
369  std::vector<const Trk::MeasurementBase*> measurements;
370  std::vector<const MuonSegment*>::const_iterator sit = segments.begin();
371  std::vector<const MuonSegment*>::const_iterator sit_end = segments.end();
372  for (; sit != sit_end; ++sit) {
373  std::vector<const Trk::MeasurementBase*>::const_iterator mit = (*sit)->containedMeasurements().begin();
374  std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = (*sit)->containedMeasurements().end();
375  for (; mit != mit_end; ++mit) {
376  const Trk::MeasurementBase* meas = *mit;
377  const Trk::RIO_OnTrack* rot = nullptr;
378  Trk::RoT_Extractor::extract(rot, meas);
379  if (!rot) {
380  if (!dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(meas)) ATH_MSG_WARNING(" Could not get rot from measurement ");
381  continue;
382  }
383  Identifier id = rot->identify();
384  if (!id.is_valid() || !m_idHelperSvc->mdtIdHelper().is_muon(id)) continue;
385  if (ids.count(id)) continue;
386  measurements.push_back(meas);
387  ids.insert(id);
388  }
389  }
390  return getTruth(truth_tree, measurements, restrictedTruth);
391  }

◆ getTruth() [4/5]

MuonTrackTruth Muon::MuonTrackTruthTool::getTruth ( const TruthTree &  truth_tree,
const std::vector< const Trk::MeasurementBase * > &  measurements,
bool  restrictedTruth = false 
) const

get truth for a give set of hits.

If restrictedTruth is set to true only missed hits in chambers with hits will be counted.

Definition at line 393 of file MuonTrackTruthTool.cxx.

394  {
395  MuonTrackTruth bestMatch;
396  bestMatch.truthTrack = nullptr;
397  bestMatch.truthTrajectory = nullptr;
398 
399  unsigned int nmatchedHitsBest = 0;
400  // loop over muons and match hits
401  TruthTreeConstIt tit = truth_tree.begin();
402  TruthTreeConstIt tit_end = truth_tree.end();
403  for (; tit != tit_end; ++tit) {
404  unsigned int nhits = tit->second.mdtHits.size() + tit->second.cscHits.size() + tit->second.rpcHits.size() +
405  tit->second.tgcHits.size() + tit->second.stgcHits.size() + tit->second.mmHits.size();
406  if (nhits == 0) continue;
407 
408  MuonTrackTruth trackTruth = getTruth(measurements, tit->second, restrictedTruth);
409  unsigned int nmatchedHits = trackTruth.numberOfMatchedHits();
410  ATH_MSG_DEBUG(" performed truth match for particle with barcode: " << tit->first << " overlap " << nmatchedHits << " fraction "
411  << (double)nmatchedHits / (double)nhits);
412  if (nmatchedHits > 0 && nmatchedHits > nmatchedHitsBest) {
413  bestMatch = trackTruth;
414  nmatchedHitsBest = nmatchedHits;
415  }
416  }
417 
418  return bestMatch;
419  }

◆ getTruth() [5/5]

MuonTrackTruth Muon::MuonTrackTruthTool::getTruth ( const TruthTree &  truth_tree,
const Trk::Track track,
bool  restrictedTruth = false 
) const

get track truth

Definition at line 361 of file MuonTrackTruthTool.cxx.

361  {
362  if (track.measurementsOnTrack()) return getTruth(truth_tree, track.measurementsOnTrack()->stdcont(), restrictedTruth);
363  return {};
364  }

◆ initialize()

StatusCode Muon::MuonTrackTruthTool::initialize ( )

AlgTool initilize.

Definition at line 26 of file MuonTrackTruthTool.cxx.

26  {
27  ATH_CHECK(m_idHelperSvc.retrieve());
28  ATH_CHECK(m_printer.retrieve());
30 
31  // add muons
32  if (m_pdgsToBeConsidered.value().empty()) {
33  m_selectedPdgs.insert(13);
34  m_selectedPdgs.insert(-13);
35  } else {
36  // add pdgs
37  for (auto pdg : m_pdgsToBeConsidered.value()) { m_selectedPdgs.insert(pdg); }
38  ATH_MSG_DEBUG(" PDG codes used for matching");
39  for (auto val : m_selectedPdgs) { ATH_MSG_DEBUG(" " << val); }
40  }
41  return StatusCode::SUCCESS;
42  }

◆ manipulateBarCode()

int Muon::MuonTrackTruthTool::manipulateBarCode ( int  barcode) const
private

Definition at line 44 of file MuonTrackTruthTool.cxx.

44  {
45  if (m_manipulateBarCode) return barcode % 10000;
46  return barcode;
47  }

◆ match() [1/2]

MuonTrackTruthTool::SegmentResultVec Muon::MuonTrackTruthTool::match ( const TruthTree &  truth_tree,
const std::vector< const MuonSegment * > &  segments 
) const

perform truth matching for a given set of segments

Definition at line 91 of file MuonTrackTruthTool.cxx.

92  {
93  SegmentResultVec result;
94  result.reserve(segments.size());
95 
96  // loop over tracks and match each of them with truth
97  std::vector<const MuonSegment*>::const_iterator sit = segments.begin();
98  std::vector<const MuonSegment*>::const_iterator sit_end = segments.end();
99  for (; sit != sit_end; ++sit) {
100  // create truth association
101  result.emplace_back(*sit, getTruth(truth_tree, **sit));
102  }
103 
104  // sort result per muon and per number of matched hits
105  std::stable_sort(result.begin(), result.end(), SortResultByMatchedHits());
106 
107  return result;
108  }

◆ match() [2/2]

MuonTrackTruthTool::ResultVec Muon::MuonTrackTruthTool::match ( const TruthTree &  truth_tree,
const TrackCollection tracks 
) const

perform truth matching for a given set of tracks

Definition at line 68 of file MuonTrackTruthTool.cxx.

68  {
69  ResultVec result;
70  result.reserve(tracks.size());
71 
72  // loop over tracks and match each of them with truth
74  TrackCollection::const_iterator tit_end = tracks.end();
75  for (; tit != tit_end; ++tit) {
76  MuonTrackTruth match = getTruth(truth_tree, **tit);
77  if (!match.truthTrack) continue;
78 
79  if (match.numberOfMatchedHits() == 0) continue;
80 
81  // create truth association
82  result.emplace_back(*tit, match);
83  }
84 
85  // sort result per muon and per number of matched hits
86  std::stable_sort(result.begin(), result.end(), SortResultByMatchedHits());
87 
88  return result;
89  }

◆ selectPdg()

bool Muon::MuonTrackTruthTool::selectPdg ( int  pdg) const
inlineprivate

Definition at line 127 of file MuonTrackTruthTool.h.

127 { return m_selectedPdgs.count(pdg); }

Member Data Documentation

◆ m_doSummary

Gaudi::Property<bool> Muon::MuonTrackTruthTool::m_doSummary {this, "DoSummary", false}
private

Definition at line 141 of file MuonTrackTruthTool.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MuonTrackTruthTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 134 of file MuonTrackTruthTool.h.

◆ m_manipulateBarCode

Gaudi::Property<bool> Muon::MuonTrackTruthTool::m_manipulateBarCode {this, "ManipulateBarCode", false}
private

Definition at line 140 of file MuonTrackTruthTool.h.

◆ m_matchAllParticles

Gaudi::Property<bool> Muon::MuonTrackTruthTool::m_matchAllParticles {this, "MatchAllParticles", true}
private

Definition at line 142 of file MuonTrackTruthTool.h.

◆ m_minHits

Gaudi::Property<unsigned int> Muon::MuonTrackTruthTool::m_minHits {this, "MinHits", 4}
private

Definition at line 143 of file MuonTrackTruthTool.h.

◆ m_pdgsToBeConsidered

Gaudi::Property<std::vector<int> > Muon::MuonTrackTruthTool::m_pdgsToBeConsidered {this, "ConsideredPDGs", {}}
private

Definition at line 144 of file MuonTrackTruthTool.h.

◆ m_printer

PublicToolHandle<Muon::MuonEDMPrinterTool> Muon::MuonTrackTruthTool::m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
private

Definition at line 136 of file MuonTrackTruthTool.h.

◆ m_selectedPdgs

std::set<int> Muon::MuonTrackTruthTool::m_selectedPdgs
private

Definition at line 146 of file MuonTrackTruthTool.h.

◆ m_truthTrajectoryBuilder

ToolHandle<Trk::ITruthTrajectoryBuilder> Muon::MuonTrackTruthTool::m_truthTrajectoryBuilder
private
Initial value:
{
this, "TruthTrajectoryBuilder", "Muon::MuonDecayTruthTrajectoryBuilder/MuonDecayTruthTrajectoryBuilder"}

Definition at line 137 of file MuonTrackTruthTool.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
get_generator_info.result
result
Definition: get_generator_info.py:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Muon::MuonTrackTruthTool::m_selectedPdgs
std::set< int > m_selectedPdgs
Definition: MuonTrackTruthTool.h:146
skel.it
it
Definition: skel.GENtoEVGEN.py:407
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Muon::MuonTrackTruthTool::addClusterTruth
void addClusterTruth(MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const MuonSimDataCollection &simCol) const
Definition: MuonTrackTruthTool.cxx:560
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TrackRecordConstIterator
AtlasHitsVector< TrackRecord >::const_iterator TrackRecordConstIterator
Definition: TrackRecordCollection.h:14
Muon::MuonTrackTruthTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonTrackTruthTool.h:134
AtlasHitsVector::begin
const_iterator begin() const
Definition: AtlasHitsVector.h:131
std::stable_sort
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
Definition: DVL_algorithms.h:711
Trk::RoT_Extractor::extract
static void extract(std::vector< const RIO_OnTrack * > &rots, const std::vector< const MeasurementBase * > &measurements)
AtlasHitsVector::empty
bool empty() const
Definition: AtlasHitsVector.h:129
inspect_truth_file.truth_tree
truth_tree
Definition: inspect_truth_file.py:75
Trk::PseudoMeasurementOnTrack
Class to handle pseudo-measurements in fitters and on track objects.
Definition: PseudoMeasurementOnTrack.h:44
TileDCSDataPlotter.tit
tit
Definition: TileDCSDataPlotter.py:890
histSizes.code
code
Definition: histSizes.py:129
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
columnar::ContainerId::cluster
@ cluster
HepMC::barcode_to_particle
GenParticle * barcode_to_particle(const GenEvent *e, int id)
Definition: GenEvent.h:628
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
MuonSimDataCollection
Definition: MuonSimDataCollection.h:21
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
Muon::MuonTrackTruthTool::m_manipulateBarCode
Gaudi::Property< bool > m_manipulateBarCode
Definition: MuonTrackTruthTool.h:140
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::MuonTrackTruthTool::getTruth
MuonTrackTruth getTruth(const TruthTree &truth_tree, const Trk::Track &track, bool restrictedTruth=false) const
get track truth
Definition: MuonTrackTruthTool.cxx:361
Muon::MuonTrackTruthTool::m_truthTrajectoryBuilder
ToolHandle< Trk::ITruthTrajectoryBuilder > m_truthTrajectoryBuilder
Definition: MuonTrackTruthTool.h:137
Muon::MuonTrackTruthTool::m_matchAllParticles
Gaudi::Property< bool > m_matchAllParticles
Definition: MuonTrackTruthTool.h:142
Muon::MuonTrackTruthTool::addSimDataToTree
void addSimDataToTree(TruthTree &truth_tree, std::map< int, int > &barcode_map, const MuonSimDataCollection *simDataCol) const
Definition: MuonTrackTruthTool.cxx:266
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::MeasurementBase
Definition: MeasurementBase.h:58
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
Muon::MuonTrackTruthTool::m_pdgsToBeConsidered
Gaudi::Property< std::vector< int > > m_pdgsToBeConsidered
Definition: MuonTrackTruthTool.h:144
Muon::MuonTrackTruthTool::m_minHits
Gaudi::Property< unsigned int > m_minHits
Definition: MuonTrackTruthTool.h:143
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
Muon::MuonTrackTruthTool::selectPdg
bool selectPdg(int pdg) const
Definition: MuonTrackTruthTool.h:127
Muon::MuonTrackTruthTool::addMissedHits
void addMissedHits(MuonTechnologyTruth &truth, const std::set< Identifier > &ids, const std::set< Identifier > &chids, const MuonSimDataCollection &simCol, bool restrictedTruth) const
Definition: MuonTrackTruthTool.cxx:469
Muon::MuonTrackTruthTool::manipulateBarCode
int manipulateBarCode(int barcode) const
Definition: MuonTrackTruthTool.cxx:44
Trk::RIO_OnTrack::prepRawData
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
Muon::MuonTrackTruthTool::getInitialPair
const std::pair< HepMC::ConstGenParticlePtr, unsigned int > getInitialPair(const TruthTrajectory &traj, const int barcodeIn) const
Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory.
Definition: MuonTrackTruthTool.cxx:677
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Muon::MuonTrackTruthTool::m_printer
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
Definition: MuonTrackTruthTool.h:136
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
Muon::MuonStationIndex::BO
@ BO
Definition: MuonStationIndex.h:25
Muon::MuonTrackTruthTool::match
ResultVec match(const TruthTree &truth_tree, const TrackCollection &tracks) const
perform truth matching for a given set of tracks
Definition: MuonTrackTruthTool.cxx:68
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AtlasHitsVector::end
const_iterator end() const
Definition: AtlasHitsVector.h:134
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Muon::MuonTrackTruthTool::m_doSummary
Gaudi::Property< bool > m_doSummary
Definition: MuonTrackTruthTool.h:141
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
DEBUG
#define DEBUG
Definition: page_access.h:11
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
Muon::MuonTrackTruthTool::addCscSimDataToTree
void addCscSimDataToTree(TruthTree &truth_tree, std::map< int, int > &barcode_map, const CscSimDataCollection *simDataCol) const
Definition: MuonTrackTruthTool.cxx:319
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
Muon::MuonTrackTruthTool::addMdtTruth
void addMdtTruth(MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const MuonSimDataCollection &simCol) const
Definition: MuonTrackTruthTool.cxx:525
Identifier
Definition: IdentifierFieldParser.cxx:14