ATLAS Offline Software
Loading...
Searching...
No Matches
AsgElectronChargeIDSelectorTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Dear emacs, this is -*-c++-*-
6#ifndef __ASGELECTRONCHARGEIDSELECTORTOOL__
7#define __ASGELECTRONCHARGEIDSELECTORTOOL__
8
9// Atlas includes
11#include "AsgTools/AsgTool.h"
14#include "MVAUtils/BDT.h"
15#include "PATCore/AcceptData.h"
16#include <unordered_map>
17
19 : public asg::AsgTool
20 , virtual public IAsgElectronLikelihoodTool
21{
25
26public:
28 AsgElectronChargeIDSelectorTool(const std::string& myname);
29
32
33public: // /** Gaudi Service
35 // Interface method
36 // implementations */
37 virtual StatusCode initialize() override; // virtual StatusCode finalize();
38
39 // Main methods for IAsgSelectorTool interface
40
45 // virtual const asg::AcceptInfo& getAcceptInfo() const override; KM: inlined
46 // blow
47
49 virtual asg::AcceptData accept(
50 const xAOD::IParticle* part) const override final;
51 virtual asg::AcceptData accept(
52 const EventContext& ctx,
53 const xAOD::IParticle* part) const override final;
54
55 virtual asg::AcceptData accept(const EventContext& ctx,
56 const xAOD::Electron* eg) const override final
57 {
58 return accept(ctx, eg, -99); // mu = -99 as input will force accept to grab
59 // the pileup variable from the xAOD object
60 }
61
62 virtual asg::AcceptData accept(const EventContext& ctx,
63 const xAOD::Egamma* eg) const override final
64 {
65 return accept(ctx, eg, -99); // mu = -99 as input will force accept to grab
66 // the pileup variable from the xAOD object
67 }
68
70 virtual asg::AcceptData accept(const EventContext& ctx,
71 const xAOD::Electron* eg,
72 double mu) const override final;
73
75 virtual asg::AcceptData accept(const EventContext& ctx,
76 const xAOD::Egamma* eg,
77 double mu) const override final;
78
79 // Main methods for IAsgCalculatorTool interface
80public:
82 virtual double calculate(const EventContext& ctx,
83 const xAOD::IParticle* part) const override final;
84
85 virtual double calculate(const EventContext& ctx,
86 const xAOD::Electron* eg) const override final
87 {
88 return calculate(
89 ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup
90 // variable from the xAOD object
91 }
92 virtual double calculate(const EventContext& ctx,
93 const xAOD::Egamma* eg) const override final
94 {
95 return calculate(
96 ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup
97 // variable from the xAOD object
98 }
99
101 virtual double calculate(const EventContext& ctx,
102 const xAOD::Electron* eg,
103 double mu) const override final;
104
106 virtual double calculate(const EventContext& ctx,
107 const xAOD::Egamma* eg,
108 double mu) const override final;
109
112 virtual std::vector<float> calculateMultipleOutputs(const EventContext &ctx,
113 const xAOD::Electron *eg,
114 double mu = -99) const override final
115 {
116 return {static_cast<float>(calculate(ctx, eg, mu))};
117 }
118
119 //===========================================================================================
120 // same until here
121 inline virtual std::string getOperatingPointName() const override final
122 {
123 return m_WorkingPoint;
124 };
125
126 inline virtual const asg::AcceptInfo& getAcceptInfo() const override final
127 {
128 return m_acceptInfo;
129 };
130
131 // Private methods
132private:
134 unsigned int getNPrimVertices(const EventContext& ctx) const;
135
136 // BDT instances for different ID operating points (Tight, Medium, Loose) and
137 // the vector corresponds to n-fold
138 std::vector<MVAUtils::BDT*> m_v_bdts;
139
140 TString m_pid_name;
142
145
146 // Private member variables
147private:
149 std::string m_WorkingPoint;
150
153
155 unsigned int m_nPVdefault;
156
159 this,
160 "primaryVertexContainer",
161 "PrimaryVertices",
162 "The primary vertex container name"
163 };
164
166 std::string m_trainingFile;
167
168 // BDT input variables
169 std::vector<std::string> m_inputVars;
170
171}; // End: class definition
172
173#endif
174
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Property holding a SG store/key/clid from which a ReadHandle is made.
Electron selector tool to select objects in Asgena using an underlying pure ROOT tool.
virtual asg::AcceptData accept(const EventContext &ctx, const xAOD::Electron *eg) const override final
accept method with pointer to electron
SG::ReadHandleKey< xAOD::VertexContainer > m_primVtxContKey
The primary vertex container name.
bool m_usePVCont
Whether to use the PV (not available for trigger)
virtual double calculate(const EventContext &ctx, const xAOD::IParticle *part) const override final
The main result method: the actual likelihood is calculated here.
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override final
Method to get the plain AcceptInfo.
virtual std::vector< float > calculateMultipleOutputs(const EventContext &ctx, const xAOD::Electron *eg, double mu=-99) const override final
The result method for multiple outputs: only one output is used so return vector of that output.
virtual asg::AcceptData accept(const EventContext &ctx, const xAOD::Egamma *eg) const override final
accept method with pointer to egamma
unsigned int m_nPVdefault
defualt nPV (when not using PVCont)
virtual ASG_TOOL_CLASS2(AsgElectronChargeIDSelectorTool, IAsgElectronLikelihoodTool, IAsgSelectionTool) public ~AsgElectronChargeIDSelectorTool()
Standard constructor.
virtual double calculate(const EventContext &ctx, const xAOD::Electron *eg) const override final
calculate method: for pointer to electron
virtual std::string getOperatingPointName() const override final
Method to get the operating point.
virtual double calculate(const EventContext &ctx, const xAOD::Egamma *eg) const override final
calculate method: for pointer to egamma
virtual StatusCode initialize() override
Gaudi Service Interface method implementations.
std::string m_trainingFile
The input ROOT file name that holds the PDFs.
unsigned int getNPrimVertices(const EventContext &ctx) const
Get the number of primary vertices.
virtual const asg::AcceptInfo & getAcceptInfo() const override final
Declare the interface ID for this pure-virtual interface class to the Athena framework.
Interface to tool to select electrons.
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
Class providing the definition of the 4-vector interface.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
Electron_v1 Electron
Definition of the current "egamma version".