ATLAS Offline Software
Loading...
Searching...
No Matches
MVATrackVertexAssociationTool.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 MVATRACKVERTEXASSOCIATIONTOOL_H
6#define MVATRACKVERTEXASSOCIATIONTOOL_H
7
8// Includes from this package
11
12// FrameWork includes
13#include "AsgTools/AsgTool.h"
15#include "AthLinks/ElementLink.h"
18
19// EDM includes
25
26// lwtnn includes
27#include "lwtnn/LightweightNeuralNetwork.hh"
28#include "lwtnn/LightweightGraph.hh"
29
30// STL includes
31#include <map>
32#include <memory>
33
34namespace CP {
35
37{
39
40
41 // Public methods:
43public:
44
45 MVATrackVertexAssociationTool(const std::string& name);
46
47 virtual StatusCode initialize() override;
48
49 virtual bool isCompatible(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx) const override;
50 virtual bool isCompatible(const xAOD::TrackParticle& trk) const override;
51
52 virtual xAOD::TrackVertexAssociationMap getMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const override;
53 virtual xAOD::TrackVertexAssociationMap getMatchMap(const xAOD::TrackParticleContainer& trk_cont, const xAOD::VertexContainer& vx_cont) const override;
54
56 virtual const xAOD::Vertex* getUniqueMatchVertex(const xAOD::TrackParticle& trk, std::vector<const xAOD::Vertex*>& vx_list) const override;
57
58 virtual xAOD::TrackVertexAssociationMap getUniqueMatchMap(std::vector<const xAOD::TrackParticle*>& trk_list, std::vector<const xAOD::Vertex*>& vx_list) const override;
60
62 // Private methods:
64private:
65
66 bool isMatch(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, float& mvaOutput, const xAOD::EventInfo* evtInfo = nullptr) const;
67
68 template <typename T, typename V>
69 xAOD::TrackVertexAssociationMap getMatchMapInternal(const T& trk_list, const V& vx_list) const;
70
71 template <typename T, typename V>
72 xAOD::TrackVertexAssociationMap getUniqueMatchMapInternal(const T& trk_list, const V& vx_list) const;
73
74 template <typename T>
75 const xAOD::Vertex* getUniqueMatchVertexInternal(const xAOD::TrackParticle& trk, const T& vx_list) const;
76
77 StatusCode initializeNetwork();
78 float evaluateNetwork(const xAOD::TrackParticle& trk, const xAOD::Vertex& vx, const xAOD::EventInfo& evt) const;
79
80
82 // Private data:
84private:
87
89 Gaudi::Property<std::string> m_fileName{this, "NetworkFileName", "" };
90
92 Gaudi::Property<std::vector<std::string>> m_inputNames{this, "InputNames", {},
93 "Vector of the network's input variable names (std::vector<std::string>)." };
94
96 Gaudi::Property<std::vector<int>> m_inputTypes{this,"InputTypes", {},
97 "Vector of the network's input variable evaluator types (std::vector<CP::MVAEvaluatorInput::Input>)."};
98
100 Gaudi::Property<std::string> m_outputName{this, "OutputNodeName", "",
101 "Name of the output node to cut on for TVA."} ;
102
104 Gaudi::Property<bool> m_isSequential{this, "IsSequential", true,
105 "Is the network sequential (true) or functional (false)."};
106
108 Gaudi::Property<std::string> m_wp{this, "WorkingPoint", "Tight", "TVA working point to apply."};
109
111 Gaudi::Property<float> m_cut{this, "OutputCut" , -1.0,
112 "TVA cut value on the output value (set manually with \"Custom\" WP)."};
113
115 Gaudi::Property<bool> m_usePathResolver{this, "UsePathResolver", true,
116 "Use the PathResolver for finding the input lwtnn network file."};
117
119 Gaudi::Property<std::string> m_hardScatterDeco{this, "HardScatterLinkDeco", "hardScatterVertexLink",
120 "The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)"};
121
123
124private:
125
128
131
134
136 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"};
137
140 "Overwrriten in the configuration step by the <HardScatterLinkDeco> property"};
141
143 std::string m_inputNodeName = "";
144
146 std::unique_ptr<lwt::LightweightNeuralNetwork> m_network;
147 std::unique_ptr<lwt::LightweightGraph> m_graph;
148
150
151};
152
153} // namespace CP
154
155#endif // MVATRACKVERTEXASSOCIATIONTOOL_H
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
std::map< std::string, Input > InputSelectionMap
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...
const xAOD::Vertex * getUniqueMatchVertexInternal(const xAOD::TrackParticle &trk, const T &vx_list) const
Gaudi::Property< std::string > m_wp
TVA working point.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
EventInfo key.
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
std::unique_ptr< lwt::LightweightGraph > m_graph
Gaudi::Property< std::vector< int > > m_inputTypes
Vector of input variable types.
Gaudi::Property< bool > m_usePathResolver
Use the PathResolver to find our input file.
float evaluateNetwork(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx, const xAOD::EventInfo &evt) const
Gaudi::Property< std::string > m_outputName
Name of the output node to cut on.
std::string m_inputNodeName
Name of the input node (for functional modes)
virtual xAOD::TrackVertexAssociationMap getMatchMap(std::vector< const xAOD::TrackParticle * > &trk_list, std::vector< const xAOD::Vertex * > &vx_list) const override
virtual const xAOD::Vertex * getUniqueMatchVertex(const xAOD::TrackParticle &trk, std::vector< const xAOD::Vertex * > &vx_list) const override
Gaudi::Property< std::string > m_hardScatterDeco
The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)
xAOD::TrackVertexAssociationMap getMatchMapInternal(const T &trk_list, const V &vx_list) const
Gaudi::Property< std::vector< std::string > > m_inputNames
Vector of input variable names.
Gaudi::Property< std::string > m_fileName
Input lwtnn network file.
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...
Gaudi::Property< bool > m_isSequential
Is the network sequential or functional.
MVAInputEvaluator m_inputEval
Input variable evaluator.
std::unique_ptr< lwt::LightweightNeuralNetwork > m_network
Network as implemented using lwtnn.
virtual ElementLink< xAOD::VertexContainer > getUniqueMatchVertexLink(const xAOD::TrackParticle &trk, const xAOD::VertexContainer &vx_cont) const override
This functions will return the best matched vertex.
Gaudi::Property< float > m_cut
TVA cut value on the output discriminant.
MVAInputEvaluator::InputSelectionMap m_inputMap
Input variable name/type map.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_hardScatterDecoKey
Hardscatter vertex link key.
xAOD::TrackVertexAssociationMap getUniqueMatchMapInternal(const T &trk_list, const V &vx_list) const
bool isMatch(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx, float &mvaOutput, const xAOD::EventInfo *evtInfo=nullptr) const
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
Select isolated Photons, Electrons and Muons.
EventInfo_v1 EventInfo
Definition of the latest event info version.
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".