ATLAS Offline Software
PhotonVertexSelectionTool.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 PhotonVertexSelection_PhotonVertexSelectionTool_h
6 #define PhotonVertexSelection_PhotonVertexSelectionTool_h
7 
8 // Framework includes
9 #include "AsgTools/AsgTool.h"
10 #include "AsgTools/ToolHandle.h"
12 
13 // EDM includes
17 
18 // Local includes
20 
21 // Forward declarations
22 namespace TMVA { class Reader; }
23 
24 namespace CP {
25 
35  public asg::AsgTool {
36 
39 
40  private:
42  std::string m_configFileCase1;
43  std::string m_configFileCase2;
44  float m_convPtCut;
45  std::string m_vertexContainerName;
46  std::string m_derivationPrefix;
47 
48  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
49  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainer {this, "VertexContainer", "PrimaryVertices", "Vertex container name"};
50 
52  // Ideally these would be const but the main method called, EvaluateMVA, is non const.
53  std::unique_ptr<TMVA::Reader> m_mva1;
54  std::unique_ptr<TMVA::Reader> m_mva2;
55 
56  private:
58  TLorentzVector getEgammaVector(const xAOD::EgammaContainer *egammas, FailType& failType) const;
59 
61  static bool sortMLP(const std::pair<const xAOD::Vertex*, float> &a, const std::pair<const xAOD::Vertex*, float> &b);
62 
63 
65  StatusCode getVertexImp(const xAOD::EgammaContainer &egammas, const xAOD::Vertex* &vertex, bool ignoreConv, bool noDecorate, std::vector<std::pair<const xAOD::Vertex*, float> >&, yyVtxType& , FailType& ) const;
66 
67 
68  public:
69  PhotonVertexSelectionTool(const std::string &name);
71 
74 
76  virtual StatusCode initialize();
77 
79 
82 
84  StatusCode decorateInputs(const xAOD::EgammaContainer &egammas, FailType* failType = nullptr) const;
85 
87  StatusCode getVertex(const xAOD::EgammaContainer &egammas, const xAOD::Vertex* &vertex, bool ignoreConv = false) const;
88 
90  std::vector<std::pair<const xAOD::Vertex*, float> > getVertex(const xAOD::EgammaContainer &egammas, bool ignoreConv = false, bool noDecorate = false, yyVtxType* vtxCase = nullptr, FailType* failType = nullptr) const;
91 
93  // Deprecated no longer use this function
94  int getCase() const { return -1; }
95 
97  const xAOD::Vertex* getPrimaryVertexFromConv(const xAOD::PhotonContainer *photons) const;
98 
100 
101  }; // class PhotonVertexSelectionTool
102 
103 } // namespace CP
104 
105 
106 #endif // PhotonVertexSelection_PhotonVertexSelectionTool_h
CP::PhotonVertexSelectionTool::PhotonVertexSelectionTool
PhotonVertexSelectionTool(const std::string &name)
Definition: PhotonVertexSelectionTool.cxx:54
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
CP::PhotonVertexSelectionTool::m_configFileCase2
std::string m_configFileCase2
Definition: PhotonVertexSelectionTool.h:43
CP::PhotonVertexSelectionTool::m_derivationPrefix
std::string m_derivationPrefix
Definition: PhotonVertexSelectionTool.h:46
CP::PhotonVertexSelectionTool::getPrimaryVertexFromConv
const xAOD::Vertex * getPrimaryVertexFromConv(const xAOD::PhotonContainer *photons) const
Get possible vertex directly associated with photon conversions.
Definition: PhotonVertexSelectionTool.cxx:306
CP::PhotonVertexSelectionTool::getEgammaVector
TLorentzVector getEgammaVector(const xAOD::EgammaContainer *egammas, FailType &failType) const
Get combined 4-vector of photon container.
Definition: PhotonVertexSelectionTool.cxx:360
CP::PhotonVertexSelectionTool::m_vertexContainer
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer
Definition: PhotonVertexSelectionTool.h:49
CP::PhotonVertexSelectionTool::m_mva1
std::unique_ptr< TMVA::Reader > m_mva1
MVA readers.
Definition: PhotonVertexSelectionTool.h:53
SG::ReadHandleKey< xAOD::EventInfo >
CP::PhotonVertexSelectionTool::sortMLP
static bool sortMLP(const std::pair< const xAOD::Vertex *, float > &a, const std::pair< const xAOD::Vertex *, float > &b)
Sort MLP results.
Definition: PhotonVertexSelectionTool.cxx:301
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::PhotonVertexSelectionTool::m_configFileCase1
std::string m_configFileCase1
Create a proper constructor for Athena.
Definition: PhotonVertexSelectionTool.h:42
CP::PhotonVertexSelectionTool::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: PhotonVertexSelectionTool.h:48
CP::IPhotonVertexSelectionTool
Definition: IPhotonVertexSelectionTool.h:26
CP::PhotonVertexSelectionTool
Implementation for the photon vertex selection tool.
Definition: PhotonVertexSelectionTool.h:35
CP::PhotonVertexSelectionTool::initialize
virtual StatusCode initialize()
Function initialising the tool.
Definition: PhotonVertexSelectionTool.cxx:70
CP::IPhotonVertexSelectionTool::yyVtxType
yyVtxType
Definition: IPhotonVertexSelectionTool.h:44
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::PhotonVertexSelectionTool::m_vertexContainerName
std::string m_vertexContainerName
Definition: PhotonVertexSelectionTool.h:45
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
CP::PhotonVertexSelectionTool::m_convPtCut
float m_convPtCut
Definition: PhotonVertexSelectionTool.h:44
CP::PhotonVertexSelectionTool::getCase
int getCase() const
Return the last case treated:
Definition: PhotonVertexSelectionTool.h:94
CP::PhotonVertexSelectionTool::~PhotonVertexSelectionTool
virtual ~PhotonVertexSelectionTool()
CP::IPhotonVertexSelectionTool::FailType
FailType
Declare the interface that the class provides.
Definition: IPhotonVertexSelectionTool.h:33
LHEF::Reader
Pythia8::Reader Reader
Definition: Prophecy4fMerger.cxx:11
IPhotonVertexSelectionTool.h
CP::PhotonVertexSelectionTool::getVertexImp
StatusCode getVertexImp(const xAOD::EgammaContainer &egammas, const xAOD::Vertex *&vertex, bool ignoreConv, bool noDecorate, std::vector< std::pair< const xAOD::Vertex *, float > > &, yyVtxType &, FailType &) const
Given a list of photons, return the MLPs of all vertices in the event.
Definition: PhotonVertexSelectionTool.cxx:178
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CP::PhotonVertexSelectionTool::getVertex
StatusCode getVertex(const xAOD::EgammaContainer &egammas, const xAOD::Vertex *&vertex, bool ignoreConv=false) const
Given a list of photons, return the most likely vertex based on MVA likelihood.
Definition: PhotonVertexSelectionTool.cxx:168
CP::PhotonVertexSelectionTool::m_mva2
std::unique_ptr< TMVA::Reader > m_mva2
Definition: PhotonVertexSelectionTool.h:54
EventInfo.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
VertexContainer.h
a
TList * a
Definition: liststreamerinfos.cxx:10
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
CP::PhotonVertexSelectionTool::decorateInputs
StatusCode decorateInputs(const xAOD::EgammaContainer &egammas, FailType *failType=nullptr) const
Given a list of photons, decorate vertex container with MVA variables.
Definition: PhotonVertexSelectionTool.cxx:99
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
ToolHandle.h
AsgTool.h
PhotonContainer.h
TMVA
Definition: PhotonVertexSelectionTool.h:22