ATLAS Offline Software
InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.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 TRACKVERTEXASSOCIATIONTOOL_H
6 #define TRACKVERTEXASSOCIATIONTOOL_H
7 
8 // Includes from this package
11 
12 // Framework includes
13 #include "AsgTools/AsgTool.h"
16 #include "AthLinks/ElementLink.h"
20 
21 // EDM includes
25 #include "xAODTracking/VertexFwd.h"
27 
28 // STL includes
29 #include <memory>
30 #include <string>
31 #include <vector>
32 
33 namespace CP {
34 
50 
52  : public asg::AsgTool, virtual public ITrackVertexAssociationTool
53  {
54 
56 
57 
58  // Public methods:
60  public:
61 
63 
66 
67  class WorkingPoint {
68  public:
69  virtual ~WorkingPoint() = default;
70  virtual bool apply(const xAOD::TrackParticle* trk, const xAOD::Vertex* vtx, const xAOD::EventInfo* evt,
71  const AMVFVerticesAcc& vtxDeco, const AMVFWeightsAcc& wgtDeco) const = 0;
72  };
73 
75 
76  TrackVertexAssociationTool(const std::string& name);
77 
78  virtual StatusCode initialize() override;
79 
80  virtual bool isCompatible(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx) const override;
81  virtual bool isCompatible(const xAOD::TrackParticle& trk) const override;
82 
83  virtual xAOD::TrackVertexAssociationMap getMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const override;
84  virtual xAOD::TrackVertexAssociationMap getMatchMap(const xAOD::TrackParticleContainer& trkCont, const xAOD::VertexContainer& vxCont) const override;
85 
87  virtual const xAOD::Vertex* getUniqueMatchVertex(const xAOD::TrackParticle& trk, std::vector<const xAOD::Vertex*>& vx_list) const override;
88 
89  virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const override;
90  virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap(const xAOD::TrackParticleContainer& trkCont , const xAOD::VertexContainer& vxCont) const override;
91 
93  // Private data:
95  private:
96 
97  bool isMatch(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo* evtInfo = nullptr) const;
98 
99  template <typename T, typename U>
100  xAOD::TrackVertexAssociationMap getMatchMapInternal(T& trk_list, U& vx_list) const;
101 
102  template <typename T, typename U>
103  xAOD::TrackVertexAssociationMap getUniqueMatchMapInternal(T& trk_list, U& vx_list) const;
104 
105  template <typename T>
106  const xAOD::Vertex* getUniqueMatchVertexInternal(const xAOD::TrackParticle& trk, T& vx_list) const;
107 
110  Gaudi::Property<std::string> m_wp{this, "WorkingPoint", "Old_Nominal",
111  "Working point to operate on."};
112 
113  Gaudi::Property<float> m_d0_cut{this, "d0_cut", -1.,
114  "Cut on d0. Not applied if set to -1."};
115 
116  Gaudi::Property<bool> m_use_d0sig{this, "use_d0sig", false,
117  "Flag to cut on d0sig instead of d0."};
118 
119  Gaudi::Property<float> m_d0sig_cut{this, "d0sig_cut", -1.,
120  "Cut on d0Sig. Not applied if set to -1."};
121 
122  Gaudi::Property<float> m_dzSinTheta_cut{this, "dzSinTheta_cut", -1.,
123  "Cut on |dz*sinTheta| (in mm). Not applied if set to -1." };
124 
126  Gaudi::Property<bool> m_doUsedInFit{this, "doUsedInFit", false,
127  "Control whether to allow for a MatchStatus of UsedInFit."};
128 
129  Gaudi::Property<bool> m_doPVPriority{this, "doPVPriority", false,
130  "Control whether to give priority to matching to PV instead of closest vertex."};
131 
132  Gaudi::Property<bool> m_requirePriVtx{this, "requirePriVtx", false,
133  "Control whether a vertex must be VxType::PriVtx in order for a track (not UsedInFit) to be uniquely matched to it."};
134 
136  Gaudi::Property<std::string> m_hardScatterDeco{this, "HardScatterLinkDeco", "hardScatterVertexLink"};
137 
139  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trkKey{this, "TrackContName", "InDetTrackParticles"};
140 
142 
143  private:
144 
147 
149  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"};
150 
152  Gaudi::Property<std::string> m_vtxDecoName{this, "AMVFVerticesDeco", "TTVA_AMVFVertices",
153  "The per-track decoration name of the vector of AMVF used-in-fit vertex ElementLinks."};
154  SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> m_vtxDecoKey{this, "AMVFVerticesKey", "" , "Overwritten with the <AMVFVerticesDeco> property"};
156  std::unique_ptr<AMVFVerticesAcc> m_vtxDecoAcc{nullptr};
157 
159  Gaudi::Property<std::string> m_wgtDecoName{this, "AMVFWeightsDeco", "TTVA_AMVFWeights",
160  "The per-track decoration name of the vector of AMVF used-in-fit annealing weights." };
161  SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> m_wgtDecoKey{this, "MVWeightKey", "" , "Overwritten with the <AMVFWeightsDeco> property"};
163  std::unique_ptr<AMVFWeightsAcc> m_wgtDecoAcc{nullptr};
164 
166  SG::ReadDecorHandleKey<xAOD::EventInfo> m_hardScatterDecoKey{this, "HardScatterLinkDecoKey" ,"" ,
167  "Will be overwritten with the <HardScatterLinkDeco> property"};
168 
170  std::unique_ptr<WorkingPoint> m_applicator{nullptr};
171 
173 
174  };
175 
176 } // namespace CP
177 
178 #endif // TRACKVERTEXASSOCIATIONTOOL_H
CP::TrackVertexAssociationTool::getUniqueMatchMapInternal
xAOD::TrackVertexAssociationMap getUniqueMatchMapInternal(T &trk_list, U &vx_list) const
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:467
CP::TrackVertexAssociationTool::m_requirePriVtx
Gaudi::Property< bool > m_requirePriVtx
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:132
CP::TrackVertexAssociationTool::m_use_d0sig
Gaudi::Property< bool > m_use_d0sig
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:116
CP::TrackVertexAssociationTool::TrackVertexAssociationTool
TrackVertexAssociationTool(const std::string &name)
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:240
CP::TrackVertexAssociationTool::m_trkKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkKey
The name of the xAOD::TrackParticleContainer to access the AMVF vertices+weights for (not actually re...
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:139
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
CP::TrackVertexAssociationTool::isCompatible
virtual bool isCompatible(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx) const override
This function just return the decision of whether the track is matched to the Vertex Not sure whether...
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:325
VertexContainerFwd.h
CP::TrackVertexAssociationTool::m_hardScatterDeco
Gaudi::Property< std::string > m_hardScatterDeco
The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:136
CP::ITrackVertexAssociationTool
Definition: ITrackVertexAssociationTool.h:24
CurrentContext.h
CP::TrackVertexAssociationTool::getUniqueMatchVertex
virtual const xAOD::Vertex * getUniqueMatchVertex(const xAOD::TrackParticle &trk, std::vector< const xAOD::Vertex * > &vx_list) const override
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:355
CP::TrackVertexAssociationTool
General track-vertex association tool.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:53
CP::TrackVertexAssociationTool::getUniqueMatchVertexInternal
const xAOD::Vertex * getUniqueMatchVertexInternal(const xAOD::TrackParticle &trk, T &vx_list) const
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:432
CP::TrackVertexAssociationTool::m_vtxDecoAcc
std::unique_ptr< AMVFVerticesAcc > m_vtxDecoAcc
AMVF vertices decoration accessor.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:156
CP::TrackVertexAssociationTool::getMatchMap
virtual xAOD::TrackVertexAssociationMap getMatchMap(std::vector< const xAOD::TrackParticle * > &trk_list, std::vector< const xAOD::Vertex * > &vx_list) const override
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:345
CP::TrackVertexAssociationTool::getUniqueMatchVertexLink
virtual ElementLink< xAOD::VertexContainer > getUniqueMatchVertexLink(const xAOD::TrackParticle &trk, const xAOD::VertexContainer &vxCont) const override
This functions will return the best matched vertex.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:360
CP::TrackVertexAssociationTool::m_vtxDecoName
Gaudi::Property< std::string > m_vtxDecoName
AMVF vertices decoration key.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:152
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
xAOD::TrackVertexAssociationMap
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
Definition: TrackVertexAssociationMap.h:19
SG::ReadHandleKey< xAOD::TrackParticleContainer >
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::TrackVertexAssociationTool::getMatchMapInternal
xAOD::TrackVertexAssociationMap getMatchMapInternal(T &trk_list, U &vx_list) const
CP::TrackVertexAssociationTool::m_vtxDecoKey
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_vtxDecoKey
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:154
TrackVertexAssociationMap.h
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
CP::TrackVertexAssociationTool::m_wp
Gaudi::Property< std::string > m_wp
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:110
CP::TrackVertexAssociationTool::m_wgtDecoAcc
std::unique_ptr< AMVFWeightsAcc > m_wgtDecoAcc
AMVF weights decoration accessor.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:163
CP::TrackVertexAssociationTool::getUniqueMatchMap
virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap(std::vector< const xAOD::TrackParticle * > &trk_list, std::vector< const xAOD::Vertex * > &vx_list) const override
This functions related to the previous functions, will return a 2D vector to store the best matched t...
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:370
CP::TrackVertexAssociationTool::AMVFVerticesAcc
SG::AuxElement::ConstAccessor< std::vector< ElementLink< xAOD::VertexContainer > > > AMVFVerticesAcc
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:64
CP::TrackVertexAssociationTool::m_doUsedInFit
Gaudi::Property< bool > m_doUsedInFit
Flag to cut on d0sig instead of d0.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:126
CP::TrackVertexAssociationTool::m_hardScatterDecoKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_hardScatterDecoKey
Hardscatter vertex link key.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:166
CP::TrackVertexAssociationTool::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
EventInfo key.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:149
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
CP::TrackVertexAssociationTool::m_d0_cut
Gaudi::Property< float > m_d0_cut
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:113
CP::TrackVertexAssociationTool::m_d0sig_cut
Gaudi::Property< float > m_d0sig_cut
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:119
CP::TrackVertexAssociationTool::AMVFWeightsAcc
SG::AuxElement::ConstAccessor< std::vector< float > > AMVFWeightsAcc
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:65
ITrackVertexAssociationTool.h
DataVector< xAOD::TrackParticle_v1 >
CP::TrackVertexAssociationTool::m_dzSinTheta_cut
Gaudi::Property< float > m_dzSinTheta_cut
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:122
CP::TrackVertexAssociationTool::m_applicator
std::unique_ptr< WorkingPoint > m_applicator
Stored WorkingPoint class.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:170
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
VertexFwd.h
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
ReadDecorHandle.h
Handle class for reading a decoration on an object.
CP::TrackVertexAssociationTool::m_doPVPriority
Gaudi::Property< bool > m_doPVPriority
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:129
CP::TrackVertexAssociationTool::m_wgtDecoName
Gaudi::Property< std::string > m_wgtDecoName
AMVF weights decoration key.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:159
CP::TrackVertexAssociationTool::isMatch
bool isMatch(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx, const xAOD::EventInfo *evtInfo=nullptr) const
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:384
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
CP::TrackVertexAssociationTool::WorkingPoint
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:67
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
AsgTool.h
CP::TrackVertexAssociationTool::WorkingPoint::~WorkingPoint
virtual ~WorkingPoint()=default
TrackParticleContainerFwd.h
TrackParticleContainer.h
CP::TrackVertexAssociationTool::m_wgtDecoKey
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_wgtDecoKey
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h:161
CP::TrackVertexAssociationTool::WorkingPoint::apply
virtual bool apply(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx, const xAOD::EventInfo *evt, const AMVFVerticesAcc &vtxDeco, const AMVFWeightsAcc &wgtDeco) const =0
CP::TrackVertexAssociationTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx:251