ATLAS Offline Software
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):
18 
19 // standard includes
20 #include<vector>
21 
23 
24  //Namespace for useful analysis things on the truth matching decorations applied to the VertexContainer
25 
26  //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
27  typedef std::tuple<ElementLink<xAOD::TruthVertexContainer>, float, float> VertexTruthMatchInfo;
28 
29  //type codes for vertex matching on all vertices
31  Matched=0, // > threshold (default 50%) from one truth interaction
32  Merged, // not matched
33  Split, // highest weight truth interaction contributes to >1 vtx (vtx with highest fraction of sumpT2 remains matched/merged)
34  Fake, // highest contribution is fake (if pile-up MC info not present those tracks end up as "fakes")
35  Other
36  };
37 
38  //type codes for truth vertices
39  //NOTE: types are subsets of subsequent types
41  Reconstructable=0, // fiducial cuts, >= 2 charged daughters
42  Accepted, // >= 2 reco tracks
43  Seeded, // tracks pass cuts
44  Reconstructed, // matched to reco vtx
45  ReconstructedSplit // matched to multiple vtx
46  };
47 
48  inline bool isMatched(int matchInfo) {
49  if (matchInfo & (0x1 << Matched)) return true;
50  return false;
51  }
52  inline bool isMerged(int matchInfo) {
53  if (matchInfo & (0x1 << Merged)) return true;
54  return false;
55  }
56  inline bool isSplit(int matchInfo) {
57  if (matchInfo & (0x1 << Split)) return true;
58  return false;
59  }
60  inline bool isFake(int matchInfo) {
61  if (matchInfo & (0x1 << Fake)) return true;
62  return false;
63  }
64  inline bool isOther(int matchInfo) {
65  if (matchInfo & (0x1 << Other)) return true;
66  return false;
67  }
68 
69  inline bool isReconstructable(int matchInfo) {
70  if (matchInfo & (0x1 << Reconstructable)) return true;
71  return false;
72  }
73  inline bool isAccepted(int matchInfo) {
74  if (matchInfo & (0x1 << Accepted)) return true;
75  return false;
76  }
77  inline bool isSeeded(int matchInfo) {
78  if (matchInfo & (0x1 << Seeded)) return true;
79  return false;
80  }
81  inline bool isReconstructed(int matchInfo) {
82  if (matchInfo & (0x1 << Reconstructed)) return true;
83  return false;
84  }
85  inline bool isReconstructedSplit(int matchInfo) {
86  if (matchInfo & (0x1 << ReconstructedSplit)) return true;
87  return false;
88  }
89 }
90 
96  public asg::AsgTool {
97 
99 
100  public:
101 
102  InDetSecVtxTruthMatchTool( const std::string & name );
103 
104  virtual StatusCode initialize() override final;
105 
106  // take collection of vertices, match them, and decorate with matching info
107  virtual StatusCode matchVertices( std::vector<const xAOD::Vertex*> recoVerticesToMatch, std::vector<const xAOD::TruthVertex*> truthVerticesToMatch, const xAOD::TrackParticleContainer* trackParticles ) override;
108 
109  private:
110 
111  Gaudi::Property<float> m_trkMatchProb{this, "trackMatchProb", 0.5, "Required MC match probability to consider track a good match" };
112  Gaudi::Property<float> m_vxMatchWeight{this, "vertexMatchWeight", 0.5, "Relative weight threshold to consider vertex matched"};
113  Gaudi::Property<float> m_trkPtCut{this, "trackPtCut", 1000., "pt cut to apply on tracks"};
114  Gaudi::Property<std::string> m_selectedTrackFlag{this, "selectedTrackFlag", "is_selected", "Aux decoration on tracks for seeding efficiencies"};
115 
116  //private methods to check if particles are good to use
117  //returns barcode of LLP production truth vertex
118  int checkProduction( const xAOD::TruthParticle& truthPart, std::vector<const xAOD::TruthVertex*> truthVerticesToMatch ) const;
119  void countReconstructibleDescendentParticles(const xAOD::TruthVertex& signalTruthVertex,
120  std::vector<const xAOD::TruthParticle*>& set, int counter) const;
121  std::vector<int> checkParticle( const xAOD::TruthParticle& part, const xAOD::TrackParticleContainer* tkCont ) const;
122 };
123 
124 #endif
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
InDetSecVtxTruthMatchUtils::VertexMatchType
VertexMatchType
Definition: InDetSecVtxTruthMatchTool.h:30
InDetSecVtxTruthMatchTool::m_selectedTrackFlag
Gaudi::Property< std::string > m_selectedTrackFlag
Definition: InDetSecVtxTruthMatchTool.h:114
InDetSecVtxTruthMatchUtils::ReconstructedSplit
@ ReconstructedSplit
Definition: InDetSecVtxTruthMatchTool.h:45
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
VertexContainerFwd.h
TruthParticleFwd.h
InDetSecVtxTruthMatchUtils::isFake
bool isFake(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:60
InDetSecVtxTruthMatchTool::initialize
virtual StatusCode initialize() override final
Dummy implementation of the initialisation function.
Definition: InDetSecVtxTruthMatchTool.cxx:14
InDetSecVtxTruthMatchUtils::isReconstructable
bool isReconstructable(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:69
TruthVertexContainer.h
TruthVertexFwd.h
IInDetSecVtxTruthMatchTool
Class for vertex truth matching.
Definition: IInDetSecVtxTruthMatchTool.h:22
InDetSecVtxTruthMatchTool::countReconstructibleDescendentParticles
void countReconstructibleDescendentParticles(const xAOD::TruthVertex &signalTruthVertex, std::vector< const xAOD::TruthParticle * > &set, int counter) const
Definition: InDetSecVtxTruthMatchTool.cxx:385
InDetSecVtxTruthMatchUtils::isMerged
bool isMerged(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:52
IInDetSecVtxTruthMatchTool.h
InDetSecVtxTruthMatchUtils::isMatched
bool isMatched(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:48
InDetSecVtxTruthMatchUtils::isSplit
bool isSplit(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:56
InDetSecVtxTruthMatchUtils::Fake
@ Fake
Definition: InDetSecVtxTruthMatchTool.h:34
InDetSecVtxTruthMatchTool::checkProduction
int checkProduction(const xAOD::TruthParticle &truthPart, std::vector< const xAOD::TruthVertex * > truthVerticesToMatch) const
Definition: InDetSecVtxTruthMatchTool.cxx:360
InDetSecVtxTruthMatchUtils::Split
@ Split
Definition: InDetSecVtxTruthMatchTool.h:33
InDetSecVtxTruthMatchTool::matchVertices
virtual StatusCode matchVertices(std::vector< const xAOD::Vertex * > recoVerticesToMatch, std::vector< const xAOD::TruthVertex * > truthVerticesToMatch, const xAOD::TrackParticleContainer *trackParticles) override
Definition: InDetSecVtxTruthMatchTool.cxx:37
InDetSecVtxTruthMatchUtils::Other
@ Other
Definition: InDetSecVtxTruthMatchTool.h:35
InDetSecVtxTruthMatchUtils::isOther
bool isOther(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:64
InDetSecVtxTruthMatchUtils::isReconstructed
bool isReconstructed(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:81
InDetSecVtxTruthMatchTool::m_vxMatchWeight
Gaudi::Property< float > m_vxMatchWeight
Definition: InDetSecVtxTruthMatchTool.h:112
InDetSecVtxTruthMatchUtils::isAccepted
bool isAccepted(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:73
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
InDetSecVtxTruthMatchTool
Class for vertex truth matching.
Definition: InDetSecVtxTruthMatchTool.h:96
InDetSecVtxTruthMatchUtils::Reconstructable
@ Reconstructable
Definition: InDetSecVtxTruthMatchTool.h:41
InDetSecVtxTruthMatchTool::m_trkMatchProb
Gaudi::Property< float > m_trkMatchProb
Definition: InDetSecVtxTruthMatchTool.h:111
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InDetSecVtxTruthMatchUtils::isReconstructedSplit
bool isReconstructedSplit(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:85
InDetSecVtxTruthMatchUtils::Reconstructed
@ Reconstructed
Definition: InDetSecVtxTruthMatchTool.h:44
InDetSecVtxTruthMatchUtils::Seeded
@ Seeded
Definition: InDetSecVtxTruthMatchTool.h:43
InDetSecVtxTruthMatchUtils::Merged
@ Merged
Definition: InDetSecVtxTruthMatchTool.h:32
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
InDetSecVtxTruthMatchUtils::VertexTruthMatchInfo
std::tuple< ElementLink< xAOD::TruthVertexContainer >, float, float > VertexTruthMatchInfo
Definition: InDetSecVtxTruthMatchTool.h:27
InDetSecVtxTruthMatchUtils::Matched
@ Matched
Definition: InDetSecVtxTruthMatchTool.h:31
InDetSecVtxTruthMatchTool::checkParticle
std::vector< int > checkParticle(const xAOD::TruthParticle &part, const xAOD::TrackParticleContainer *tkCont) const
Definition: InDetSecVtxTruthMatchTool.cxx:318
InDetSecVtxTruthMatchTool::InDetSecVtxTruthMatchTool
InDetSecVtxTruthMatchTool(const std::string &name)
Definition: InDetSecVtxTruthMatchTool.cxx:12
InDetSecVtxTruthMatchUtils::TruthVertexMatchType
TruthVertexMatchType
Definition: InDetSecVtxTruthMatchTool.h:40
AsgTool.h
InDetSecVtxTruthMatchUtils::isSeeded
bool isSeeded(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:77
test_pyathena.counter
counter
Definition: test_pyathena.py:15
readCCLHist.float
float
Definition: readCCLHist.py:83
InDetSecVtxTruthMatchUtils::Accepted
@ Accepted
Definition: InDetSecVtxTruthMatchTool.h:42
InDetSecVtxTruthMatchUtils
Definition: InDetSecVtxTruthMatchTool.h:22
InDetSecVtxTruthMatchTool::m_trkPtCut
Gaudi::Property< float > m_trkPtCut
Definition: InDetSecVtxTruthMatchTool.h:113