ATLAS Offline Software
Loading...
Searching...
No Matches
IMuonTrackTruthTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUON_IMUONTRACKTRUTHTOOL_H
6#define MUON_IMUONTRACKTRUTHTOOL_H
7
8#include <map>
9#include <set>
10#include <vector>
11
12#include "GaudiKernel/IAlgTool.h"
14#include "Identifier/Identifier.h"
19
20static const InterfaceID IID_IMuonTrackTruthTool("Muon::IMuonTrackTruthTool", 1, 0);
21
22class TruthTrajectory;
23
24namespace Muon {
25 class MuonSegment;
26}
27
28namespace Muon {
29
31 public:
32 std::set<Identifier> matchedHits;
33 std::set<Identifier> matchedChambers;
34 std::set<Identifier> missedHits;
35 std::set<Identifier> missedChambers;
36 std::set<Identifier> wrongHits;
37 std::set<Identifier> wrongChambers;
38 };
39
41 public:
43 std::shared_ptr<const TruthTrajectory> truthTrajectory;
52 unsigned int numberOfMatchedHits() const {
53 return mdts.matchedHits.size() + tgcs.matchedHits.size() + rpcs.matchedHits.size() + cscs.matchedHits.size() +
54 stgcs.matchedHits.size() + mms.matchedHits.size();
55 }
57 };
58
71
73 class IMuonTrackTruthTool : virtual public IAlgTool {
74 public:
85
86 typedef std::pair<const Trk::Track*, MuonTrackTruth> MatchResult;
87 typedef std::vector<MatchResult> ResultVec;
88
89 typedef std::pair<const Muon::MuonSegment*, MuonTrackTruth> SegmentMatchResult;
90 typedef std::vector<SegmentMatchResult> SegmentResultVec;
91
92 // collect track record entries per barcode
93 typedef std::map<int, TruthTreeEntry> TruthTree;
94 typedef TruthTree::iterator TruthTreeIt;
95 typedef TruthTree::const_iterator TruthTreeConstIt;
96
97 public:
99 static const InterfaceID& interfaceID();
100
102 virtual ResultVec match(const TruthTree& truth_tree, const TrackCollection& tracks) const = 0;
103
105 virtual SegmentResultVec match(const TruthTree& truth_tree, const std::vector<const MuonSegment*>& segments) const = 0;
106
108 virtual const TruthTree createTruthTree(const TrackRecordCollection* truthTrackCol, const McEventCollection* mcEventCollection,
109 const std::vector<const MuonSimDataCollection*>& muonSimData,
110 const CscSimDataCollection* cscSimDataMap) const = 0;
111
113 virtual MuonTrackTruth getTruth(const TruthTree& truth_tree, const Trk::Track& track, bool restrictedTruth = false) const = 0;
114
116 virtual MuonTrackTruth getTruth(const TruthTree& truth_tree, const std::vector<const MuonSegment*>& segments,
117 bool restrictedTruth = false) const = 0;
118
120 virtual MuonTrackTruth getTruth(const TruthTree& truth_tree, const Muon::MuonSegment& segment) const = 0;
121
125 virtual MuonTrackTruth getTruth(const TruthTree& truth_tree, const std::vector<const Trk::MeasurementBase*>& measurements,
126 bool restrictedTruth = false) const = 0;
127
130 virtual HepMC::ConstGenParticlePtr getMother(const TruthTrajectory& traj, const int barcodeIn) const = 0;
131
134 virtual HepMC::ConstGenParticlePtr getAncestor(const TruthTrajectory& traj, const int barcodeIn) const = 0;
135
138 virtual HepMC::ConstGenParticlePtr getInitial(const TruthTrajectory& traj, const int barcodeIn) const = 0;
139
141 virtual unsigned int getNumberOfScatters(const TruthTrajectory& traj, const int barcodeIn) const = 0;
142 };
143
144 inline const InterfaceID& IMuonTrackTruthTool::interfaceID() { return IID_IMuonTrackTruthTool; }
145
146} // namespace Muon
147
148#endif
static const InterfaceID IID_IMuonTrackTruthTool("Muon::IMuonTrackTruthTool", 1, 0)
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
AtlasHitsVector< TrackRecord > TrackRecordCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
This is the common class for 3D segments used in the muon spectrometer.
The IMuonTrackTruthTool is a pure virtual interface for tools that recover hole on a track.
virtual HepMC::ConstGenParticlePtr getInitial(const TruthTrajectory &traj, const int barcodeIn) const =0
Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory.
virtual unsigned int getNumberOfScatters(const TruthTrajectory &traj, const int barcodeIn) const =0
Returns the number of steps a particle took while maintaining its PDG ID.
static const InterfaceID & interfaceID()
access to tool interface
virtual MuonTrackTruth getTruth(const TruthTree &truth_tree, const std::vector< const Trk::MeasurementBase * > &measurements, bool restrictedTruth=false) const =0
get truth for a give set of hits.
TruthTree::const_iterator TruthTreeConstIt
std::pair< const Muon::MuonSegment *, MuonTrackTruth > SegmentMatchResult
virtual MuonTrackTruth getTruth(const TruthTree &truth_tree, const Trk::Track &track, bool restrictedTruth=false) const =0
get track truth
std::map< int, TruthTreeEntry > TruthTree
virtual MuonTrackTruth getTruth(const TruthTree &truth_tree, const Muon::MuonSegment &segment) const =0
get segment truth
virtual const TruthTree createTruthTree(const TrackRecordCollection *truthTrackCol, const McEventCollection *mcEventCollection, const std::vector< const MuonSimDataCollection * > &muonSimData, const CscSimDataCollection *cscSimDataMap) const =0
create truth tree from sim data
std::vector< SegmentMatchResult > SegmentResultVec
virtual HepMC::ConstGenParticlePtr getMother(const TruthTrajectory &traj, const int barcodeIn) const =0
returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory It ...
virtual HepMC::ConstGenParticlePtr getAncestor(const TruthTrajectory &traj, const int barcodeIn) const =0
Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory.
virtual ResultVec match(const TruthTree &truth_tree, const TrackCollection &tracks) const =0
perform truth matching for a given set of tracks
virtual SegmentResultVec match(const TruthTree &truth_tree, const std::vector< const MuonSegment * > &segments) const =0
perform truth matching for a given set of segments
std::vector< MatchResult > ResultVec
TruthTree::iterator TruthTreeIt
std::pair< const Trk::Track *, MuonTrackTruth > MatchResult
virtual MuonTrackTruth getTruth(const TruthTree &truth_tree, const std::vector< const MuonSegment * > &segments, bool restrictedTruth=false) const =0
get segment truth for a list of segments, the segments will be considered to belong to the same muon
MuonTechnologyTruth stgcs
const TrackRecord * truthTrack
MuonTechnologyTruth mdts
MuonTechnologyTruth rpcs
MuonTechnologyTruth cscs
MuonTechnologyTruth tgcs
This is the common class for 3D segments used in the muon spectrometer.
std::set< Identifier > wrongHits
std::set< Identifier > matchedHits
std::set< Identifier > missedChambers
std::set< Identifier > wrongChambers
std::set< Identifier > missedHits
std::set< Identifier > matchedChambers
MuonTechnologyTruth cscs
const TrackRecord * truthTrack
MuonTechnologyTruth mms
MuonTechnologyTruth tgcs
std::shared_ptr< const TruthTrajectory > truthTrajectory
MuonTechnologyTruth stgcs
MuonTechnologyTruth rpcs
MuonTechnologyTruth mdts
unsigned int numberOfMatchedHits() const
A TruthTrajectory is a chain of charged MC particles connected through the mother-daughter relationsh...
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::shared_ptr< const TruthTrajectory > truthTrajectory