ATLAS Offline Software
Loading...
Searching...
No Matches
InDetSecVtxTruthMatchTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef InDetSecVtxTruthMatchTool_h
6#define InDetSecVtxTruthMatchTool_h
7
8// Framework include(s):
9#include "AsgTools/AsgTool.h"
11
12// EDM include(s):
19
20
21// standard includes
22#include<vector>
23#include <bitset>
24
26
27 //Namespace for useful analysis things on the truth matching decorations applied to the VertexContainer
28
29 //How the matching info is stored; link to the truth vertex, a float with its contribution to the relative track weight, and a float with its contribution to the track sumpt2 of the truth vertex
30 typedef std::tuple<ElementLink<xAOD::TruthVertexContainer>, float, float> VertexTruthMatchInfo;
31
32 //type codes for vertex matching on all vertices
34 Matched=0, // > threshold (default 50%) from one truth interaction
35 Merged, // not matched
36 Split, // highest weight truth interaction contributes to >1 vtx (vtx with highest fraction of sumpT2 remains matched/merged)
37 Fake, // highest contribution is fake (if pile-up MC info not present those tracks end up as "fakes")
39 };
40
41 //type codes for optional SM origin matching
42 //used to determine the content of "other" type vertices above for in-depth studies
43 //should only be used where extended truth info is available -- e.g when LLP1 has been run with saveFullTruth=True
44 //NOTE: types are NOT exclusive -- vertex can be both from B and D decay, signal and hadronic interation, etc
64
65 //type codes for truth vertices
66 //NOTE: types are subsets of subsequent types
68 Reconstructable=0, // fiducial cuts, >= 2 charged daughters
69 Accepted, // >= 2 reco tracks
70 Seeded, // tracks pass cuts
71 Reconstructed, // matched to reco vtx
72 ReconstructedSplit // matched to multiple vtx
73 };
74
75 inline bool isMatched(int matchInfo) {
76 if (matchInfo & (0x1 << Matched)) return true;
77 return false;
78 }
79 inline bool isMerged(int matchInfo) {
80 if (matchInfo & (0x1 << Merged)) return true;
81 return false;
82 }
83 inline bool isSplit(int matchInfo) {
84 if (matchInfo & (0x1 << Split)) return true;
85 return false;
86 }
87 inline bool isFake(int matchInfo) {
88 if (matchInfo & (0x1 << Fake)) return true;
89 return false;
90 }
91 inline bool isOther(int matchInfo) {
92 if (matchInfo & (0x1 << Other)) return true;
93 return false;
94 }
95
96 inline bool isReconstructable(int matchInfo) {
97 if (matchInfo & (0x1 << Reconstructable)) return true;
98 return false;
99 }
100 inline bool isAccepted(int matchInfo) {
101 if (matchInfo & (0x1 << Accepted)) return true;
102 return false;
103 }
104 inline bool isSeeded(int matchInfo) {
105 if (matchInfo & (0x1 << Seeded)) return true;
106 return false;
107 }
108 inline bool isReconstructed(int matchInfo) {
109 if (matchInfo & (0x1 << Reconstructed)) return true;
110 return false;
111 }
112 inline bool isReconstructedSplit(int matchInfo) {
113 if (matchInfo & (0x1 << ReconstructedSplit)) return true;
114 return false;
115 }
116
117 inline bool isOriginType(int matchInfo, VertexMatchOriginType type) {
118 if (type < 0 || type > Signal) { // Signal is the last valid value
119 return false;
120 }
121 return matchInfo & (0x1 << type);
122 }
123}
124
130 public asg::AsgTool {
131
133
134 public:
135
136 InDetSecVtxTruthMatchTool( const std::string & name );
137
138 virtual StatusCode initialize() override final;
139
140 // take collection of vertices, match them, and decorate with matching info
141 virtual StatusCode matchVertices( std::vector<const xAOD::Vertex*> recoVerticesToMatch, std::vector<const xAOD::TruthVertex*> truthVerticesToMatch, const xAOD::TrackParticleContainer* trackParticles ) override;
142
143 private:
144
145 Gaudi::Property<float> m_trkMatchProb{this, "trackMatchProb", 0.5, "Required MC match probability to consider track a good match" };
146 Gaudi::Property<float> m_vxMatchWeight{this, "vertexMatchWeight", 0.5, "Relative weight threshold to consider vertex matched"};
147 Gaudi::Property<float> m_trkPtCut{this, "trackPtCut", 1000., "pt cut to apply on tracks"};
148 Gaudi::Property<std::string> m_selectedTrackFlag{this, "selectedTrackFlag", "is_selected", "Aux decoration on tracks for seeding efficiencies"};
149 Gaudi::Property<bool> m_doMuSA{this, "doMuSA", false, "Combination flag for special MuSA logic" };
150 Gaudi::Property<bool> m_doSMOrigin{this, "doSMOrigin", false, "Enable decoration of SM origin types"};
151
152 ToolHandle<InDet::IInDetTrackTruthOriginTool> m_trackTruthOriginTool{this, "TrackTruthOriginTool", "InDet::InDetTrackTruthOriginTool/TrackTruthOriginTool"};
153
154 //private methods to check if particles are good to use
155 //returns barcode of LLP production truth vertex
156 int checkProduction( const xAOD::TruthParticle& truthPart, std::vector<const xAOD::TruthVertex*> truthVerticesToMatch ) const;
158 std::vector<const xAOD::TruthParticle*>& set, int counter) const;
159 std::vector<int> checkParticle( const xAOD::TruthParticle& part, const xAOD::TrackParticleContainer* tkCont ) const;
160 bool isFrom(const xAOD::TruthParticle& truth, int flav) const;
161 int checkSMProduction( const xAOD::TruthParticle& truthPart) const;
162};
163
164#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Class for vertex truth matching.
ToolHandle< InDet::IInDetTrackTruthOriginTool > m_trackTruthOriginTool
std::vector< int > checkParticle(const xAOD::TruthParticle &part, const xAOD::TrackParticleContainer *tkCont) const
Gaudi::Property< std::string > m_selectedTrackFlag
void countReconstructibleDescendentParticles(const xAOD::TruthVertex &signalTruthVertex, std::vector< const xAOD::TruthParticle * > &set, int counter) const
virtual StatusCode initialize() override final
Dummy implementation of the initialisation function.
virtual StatusCode matchVertices(std::vector< const xAOD::Vertex * > recoVerticesToMatch, std::vector< const xAOD::TruthVertex * > truthVerticesToMatch, const xAOD::TrackParticleContainer *trackParticles) override
Gaudi::Property< bool > m_doSMOrigin
InDetSecVtxTruthMatchTool(const std::string &name)
int checkProduction(const xAOD::TruthParticle &truthPart, std::vector< const xAOD::TruthVertex * > truthVerticesToMatch) const
int checkSMProduction(const xAOD::TruthParticle &truthPart) const
Gaudi::Property< float > m_trkPtCut
Gaudi::Property< float > m_vxMatchWeight
Gaudi::Property< float > m_trkMatchProb
bool isFrom(const xAOD::TruthParticle &truth, int flav) const
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
STL class.
std::tuple< ElementLink< xAOD::TruthVertexContainer >, float, float > VertexTruthMatchInfo
bool isOriginType(int matchInfo, VertexMatchOriginType type)
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".