ATLAS Offline Software
egammaMVACalibTool.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 #ifndef EGAMMAMVACALIB_EGAMMAMVACALIBTOOL_H
6 #define EGAMMAMVACALIB_EGAMMAMVACALIBTOOL_H
7 
8 // Package includes
10 #include "xAODEgamma/EgammaEnums.h"
11 #include "MVAUtils/BDT.h"
13 
14 // Framework includes
15 #include "AsgTools/AsgTool.h"
17 
18 //Root includes
19 #include "TH2Poly.h"
20 #include "TObject.h"
21 #include "TString.h"
22 #include "TFormula.h"
23 
24 // STL includes
25 #include <string>
26 #include <memory>
27 #include <functional>
28 
29 
66 class egammaMVACalibTool : public asg::AsgTool, virtual public IegammaMVACalibTool{
68 public:
69  egammaMVACalibTool(const std::string& type);
70  virtual ~egammaMVACalibTool() override = default;
71 
72  virtual StatusCode initialize() override;
73 
79 
84 
86  float getEnergy(const xAOD::CaloCluster& clus,
87  const xAOD::Egamma* eg) const override final;
88 
89 private:
90  Gaudi::Property<int> m_particleType {this,
92  "What type of particle do we use"};
93 
94  Gaudi::Property<int> m_shiftType {this,
95  "ShiftType", MEAN10TOTRUE,
96  "Shift corrections to apply to value"};
97 
98  Gaudi::Property<int> m_calibrationType {this,
99  "CalibrationType", correctEaccordion,
100  "What type of calibration to apply"};
101 
102  Gaudi::Property<bool> m_clusterEif0 {this,
103  "useClusterIf0", true,
104  "Use cluster energy if MVA response is 0"};
105 
107  Gaudi::Property<std::string> m_folder {this,
108  "folder", "",
109  "string with folder for weight files"};
110 
111  Gaudi::Property<bool> m_useLayerCorrected {this,
112  "use_layer_corrected", false,
113  "whether to use layer corrections"};
114 
116  std::unique_ptr<TH2Poly> m_hPoly;
117 
119  std::vector<MVAUtils::BDT> m_BDTs;
120 
122  std::vector<std::vector<std::function<float(const xAOD::Egamma*, const xAOD::CaloCluster*)> > > m_funcs;
123 
125  std::vector<TFormula> m_shifts;
126 
129  const std::string& fileName);
130 
132  static const TString& getString(TObject* obj) ;
133 
134 };
135 
136 #endif
egammaMVACalibTool::m_calibrationType
Gaudi::Property< int > m_calibrationType
Definition: egammaMVACalibTool.h:98
egammaMVACalibTool::m_particleType
Gaudi::Property< int > m_particleType
Definition: egammaMVACalibTool.h:90
IegammaMVACalibTool.h
egammaMVAFunctions::funcMap_t
std::unordered_map< std::string, std::function< float(const xAOD::Egamma *, const xAOD::CaloCluster *)> > funcMap_t
Define the map type since it's long.
Definition: egammaMVAFunctions.h:243
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
egammaMVACalibTool::MEAN10TOTRUE
@ MEAN10TOTRUE
Definition: egammaMVACalibTool.h:83
ParticleTest.eg
eg
Definition: ParticleTest.py:29
egammaMVACalibTool::setupBDT
StatusCode setupBDT(const egammaMVAFunctions::funcMap_t &funcLibrary, const std::string &fileName)
a function called by initialize to setup the BDT, funcs, and shifts.
Definition: egammaMVACalibTool.cxx:90
egammaMVACalibTool::m_folder
Gaudi::Property< std::string > m_folder
string with folder for weight files
Definition: egammaMVACalibTool.h:107
egammaMVACalibTool::ShiftType
ShiftType
shift to be applied after the BDT.
Definition: egammaMVACalibTool.h:83
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
egammaMVACalibTool
A tool used by the egammaMVASvc to help calibrate energy for one particle type.
Definition: egammaMVACalibTool.h:66
IegammaMVACalibTool
A tool used by the egammaMVASvc to help manage the MVAs.
Definition: IegammaMVACalibTool.h:17
egammaMVACalibTool::NOSHIFT
@ NOSHIFT
Definition: egammaMVACalibTool.h:83
xAOD::EgammaParameters::NumberOfEgammaTypes
@ NumberOfEgammaTypes
Definition: EgammaEnums.h:21
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
egammaMVACalibTool::getString
static const TString & getString(TObject *obj)
a utility to get a TString out of an TObjString pointer
Definition: egammaMVACalibTool.cxx:204
egammaMVACalibTool::m_useLayerCorrected
Gaudi::Property< bool > m_useLayerCorrected
Definition: egammaMVACalibTool.h:111
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
egammaMVACalibTool::correctEaccordion
@ correctEaccordion
Definition: egammaMVACalibTool.h:78
egammaMVACalibTool::~egammaMVACalibTool
virtual ~egammaMVACalibTool() override=default
egammaMVACalibTool::m_clusterEif0
Gaudi::Property< bool > m_clusterEif0
Definition: egammaMVACalibTool.h:102
BDT.h
egammaMVACalibTool::m_shifts
std::vector< TFormula > m_shifts
shifts formulas
Definition: egammaMVACalibTool.h:125
egammaMVACalibTool::m_funcs
std::vector< std::vector< std::function< float(const xAOD::Egamma *, const xAOD::CaloCluster *)> > > m_funcs
where the pointers to the funcs to calculate the vars per BDT
Definition: egammaMVACalibTool.h:122
egammaMVACalibTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: egammaMVACalibTool.cxx:33
egammaMVACalibTool::getEnergy
float getEnergy(const xAOD::CaloCluster &clus, const xAOD::Egamma *eg) const override final
returns the calibrated energy
Definition: egammaMVACalibTool.cxx:213
egammaMVAFunctions.h
egammaMVACalibTool::CalibrationType
CalibrationType
how the output of the BDT is used correctEaccordion: energy = raw energy * BDT fullCalibration: energ...
Definition: egammaMVACalibTool.h:78
EgammaEnums.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
egammaMVACalibTool::m_shiftType
Gaudi::Property< int > m_shiftType
Definition: egammaMVACalibTool.h:94
egammaMVACalibTool::fullCalibration
@ fullCalibration
Definition: egammaMVACalibTool.h:78
egammaMVACalibTool::m_hPoly
std::unique_ptr< TH2Poly > m_hPoly
A TH2Poly used to extract bin numbers. Note there is an offset of 1.
Definition: egammaMVACalibTool.h:116
AsgTool.h
python.PyAthena.obj
obj
Definition: PyAthena.py:132
readCCLHist.float
float
Definition: readCCLHist.py:83
egammaMVACalibTool::m_BDTs
std::vector< MVAUtils::BDT > m_BDTs
Where the BDTs are stored.
Definition: egammaMVACalibTool.h:119
egammaMVACalibTool::egammaMVACalibTool
egammaMVACalibTool(const std::string &type)
Definition: egammaMVACalibTool.cxx:28