ATLAS Offline Software
ElectronChargeEfficiencyCorrectionTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ELECTRONCHARGECORRECTION__ELECTRONCHARGECORRECTIONTOOL__H
6 #define ELECTRONCHARGECORRECTION__ELECTRONCHARGECORRECTIONTOOL__H
7 
8 #include "AsgTools/AsgTool.h"
11 #include "TH2.h"
13 #include "xAODEgamma/ElectronFwd.h"
14 
15 #include <map>
16 #include <string>
17 #include <vector>
18 
19 // Forward declaration(s):
20 namespace xAOD {
21 class IParticle;
22 }
23 
24 namespace CP {
25 
28  , public asg::AsgTool
29 {
32 
33 public:
35  ElectronChargeEfficiencyCorrectionTool(const std::string& name);
36 
39 
40 public:
42  virtual StatusCode initialize() override final;
43 
44 
47  const xAOD::Electron& inputObject,
48  double& sf) const override final;
49 
52  const xAOD::Electron& inputObject) const override final;
53 
55  virtual bool isAffectedBySystematic(
56  const SystematicVariation& systematic) const override final;
57 
59  virtual SystematicSet affectingSystematics() const override final;
60 
62  virtual CP::SystematicSet recommendedSystematics() const override final;
63 
64  virtual StatusCode applySystematicVariation(const SystematicSet& systConfig) override final;
65 
66 
68  virtual const CP::SystematicSet& appliedSystematics() const override final
69  {
70  return *m_appliedSystematics;
71  }
72 
73  virtual int systUncorrVariationIndex(const xAOD::Electron&) const override final
74  {
76  "systUncorrVariationIndex is not implemented in "
77  "ElectronChargeEfficiencyCorrectionTool");
78  return -999;
79  }
80 
82  const double, const double, const unsigned int,
83  double&) const override final{
85  "No toysimplemented in "
86  "ElectronChargeEfficiencyCorrectionTool");
88  }
89  //
90  virtual int getNumberOfToys() const override final
91  {
93  "No toysimplemented in "
94  "ElectronChargeEfficiencyCorrectionTool");
95  return -1;
96  };
98  virtual void printCorrelationModels() const override final
99  {
100  ATH_MSG_INFO(
101  "ONLY A DEFAULT Correlation model available for now");
102  };
103 
104 
105 private:
108  float getChargeFlipRate(double eta,
109  double pt,
110  TH2* hrates,
111  double& flipRate) const;
112 
115  //
116  //
119 
121  std::map<std::string, std::vector<TH2*>>
122  m_SF_SS; // keys (e.g. RunNumber223333_319200_Nvtx0_10_Phi1.5_1.6) mapping
123  // to vector of SF histograms --> vector m_SF: 0=nominal, 1=stat,
124  // 2,3,4...n=syst
125  std::map<std::string, std::vector<TH2*>>
126  m_SF_OS; // keys (e.g. RunNumber223333_319200_Nvtx0_10_Phi1.5_1.6) mapping
127  // to vector of SF histograms --> vector m_SF: 0=nominal, 1=stat,
128  // 2,3,4...n=syst
129 
130  // cuts // further variables to bin in
131  std::vector<unsigned int> m_RunNumbers;
134 
136  std::string m_filename;
137 
139  std::string m_workingPoint;
140 
144 
148 
152 
155  double m_pt_uplimit;
156 
158  float m_gevmev;
159 
160  // Systematics
161  std::vector<std::string> m_systematics;
162 
163  std::map<CP::SystematicSet, CP::SystematicSet> m_filtered_sys_sets;
164  // boost::unordered_map<SystematicSet,EffiCollection*> m_sf_sets;
167 
170 
172  std::string m_sf_decoration_name;
174 };
175 
176 } // End namespace CP
177 
178 #endif
CP::ElectronChargeEfficiencyCorrectionTool::getEfficiencyScaleFactor
virtual CP::CorrectionCode getEfficiencyScaleFactor(const double, const double, const unsigned int, double &) const override final
Definition: ElectronChargeEfficiencyCorrectionTool.h:81
CP::ElectronChargeEfficiencyCorrectionTool::m_eventInfoCollectionName
std::string m_eventInfoCollectionName
The Event info collection name.
Definition: ElectronChargeEfficiencyCorrectionTool.h:118
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
CP::ElectronChargeEfficiencyCorrectionTool::affectingSystematics
virtual SystematicSet affectingSystematics() const override final
Returns the list of all systematics this tool can be affected by.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:633
CP::ElectronChargeEfficiencyCorrectionTool::getNumberOfToys
virtual int getNumberOfToys() const override final
Definition: ElectronChargeEfficiencyCorrectionTool.h:90
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::ElectronChargeEfficiencyCorrectionTool::initialize
virtual StatusCode initialize() override final
Gaudi Service Interface method implementations.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:88
IAsgElectronEfficiencyCorrectionTool.h
CP::ElectronChargeEfficiencyCorrectionTool::m_dataTypeOverwrite
int m_dataTypeOverwrite
Force the data type to a given value.
Definition: ElectronChargeEfficiencyCorrectionTool.h:114
CP::ElectronChargeEfficiencyCorrectionTool::m_eta_lowlimit
double m_eta_lowlimit
Lower limit of eta range where corrections are available; taken from histogram.
Definition: ElectronChargeEfficiencyCorrectionTool.h:143
test_pyathena.pt
pt
Definition: test_pyathena.py:11
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::ElectronChargeEfficiencyCorrectionTool::m_mySysConf
CP::SystematicSet m_mySysConf
Definition: ElectronChargeEfficiencyCorrectionTool.h:165
CP::ElectronChargeEfficiencyCorrectionTool::m_pt_lowlimit
double m_pt_lowlimit
Lower limit of pt range where corrections are available; taken from histogram.
Definition: ElectronChargeEfficiencyCorrectionTool.h:151
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
CP::ElectronChargeEfficiencyCorrectionTool::m_affectingSys
CP::SystematicSet m_affectingSys
Definition: ElectronChargeEfficiencyCorrectionTool.h:166
CP::ElectronChargeEfficiencyCorrectionTool::registerSystematics
StatusCode registerSystematics()
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:675
CP::ElectronChargeEfficiencyCorrectionTool::getEfficiencyScaleFactor
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Electron &inputObject, double &sf) const override final
Retrieve the Scale factor.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:342
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CP::SystematicVariation
Definition: SystematicVariation.h:47
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
ISystematicsTool.h
CP::ElectronChargeEfficiencyCorrectionTool::m_eta_uplimit
double m_eta_uplimit
Upper limit of eta range where corrections are available; taken from histogram.
Definition: ElectronChargeEfficiencyCorrectionTool.h:147
CP::ElectronChargeEfficiencyCorrectionTool::m_filtered_sys_sets
std::map< CP::SystematicSet, CP::SystematicSet > m_filtered_sys_sets
Definition: ElectronChargeEfficiencyCorrectionTool.h:163
CP::ElectronChargeEfficiencyCorrectionTool::m_gevmev
float m_gevmev
Factor for GeV <-> MeV switching.
Definition: ElectronChargeEfficiencyCorrectionTool.h:158
CP::ElectronChargeEfficiencyCorrectionTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override final
Returns the list of all systematics this tool recommends to use.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:651
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
CP::ElectronChargeEfficiencyCorrectionTool
Definition: ElectronChargeEfficiencyCorrectionTool.h:29
CP::ElectronChargeEfficiencyCorrectionTool::m_SF_OS
std::map< std::string, std::vector< TH2 * > > m_SF_OS
Definition: ElectronChargeEfficiencyCorrectionTool.h:126
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::ElectronChargeEfficiencyCorrectionTool::m_RunNumbers
std::vector< unsigned int > m_RunNumbers
Definition: ElectronChargeEfficiencyCorrectionTool.h:131
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::ElectronChargeEfficiencyCorrectionTool::m_pt_uplimit
double m_pt_uplimit
Upper limit of pt range where corrections are available; taken from histogram.
Definition: ElectronChargeEfficiencyCorrectionTool.h:155
CP::ElectronChargeEfficiencyCorrectionTool::m_sf_decoration_name
std::string m_sf_decoration_name
Decorator.
Definition: ElectronChargeEfficiencyCorrectionTool.h:172
CP::ElectronChargeEfficiencyCorrectionTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig) override final
effects: configure this tool for the given list of systematic variations.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:660
ElectronFwd.h
CP::ElectronChargeEfficiencyCorrectionTool::m_useRandomRunNumber
bool m_useRandomRunNumber
Definition: ElectronChargeEfficiencyCorrectionTool.h:132
CP::ElectronChargeEfficiencyCorrectionTool::m_sfDec
SG::AuxElement::Decorator< float > * m_sfDec
Definition: ElectronChargeEfficiencyCorrectionTool.h:173
CP::ElectronChargeEfficiencyCorrectionTool::printCorrelationModels
virtual void printCorrelationModels() const override final
print available/implemented correlation models
Definition: ElectronChargeEfficiencyCorrectionTool.h:98
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CP::ElectronChargeEfficiencyCorrectionTool::m_systematics
std::vector< std::string > m_systematics
Definition: ElectronChargeEfficiencyCorrectionTool.h:161
CP::ElectronChargeEfficiencyCorrectionTool::systUncorrVariationIndex
virtual int systUncorrVariationIndex(const xAOD::Electron &) const override final
Definition: ElectronChargeEfficiencyCorrectionTool.h:73
CP::ElectronChargeEfficiencyCorrectionTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const override final
Returns whether this tool is affected by the given systematics.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:621
CP::ElectronChargeEfficiencyCorrectionTool::m_workingPoint
std::string m_workingPoint
The name of the folder defining the LH/iso working point.
Definition: ElectronChargeEfficiencyCorrectionTool.h:139
CP::ElectronChargeEfficiencyCorrectionTool::applyEfficiencyScaleFactor
virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::Electron &inputObject) const override final
Decorate the electron.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:581
xAOD::Electron_v1
Definition: Electron_v1.h:34
CP::ElectronChargeEfficiencyCorrectionTool::appliedSystematics
virtual const CP::SystematicSet & appliedSystematics() const override final
returns: the currently applied systematics
Definition: ElectronChargeEfficiencyCorrectionTool.h:68
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
CP::ElectronChargeEfficiencyCorrectionTool::~ElectronChargeEfficiencyCorrectionTool
virtual ASG_TOOL_CLASS(ElectronChargeEfficiencyCorrectionTool, IAsgElectronEfficiencyCorrectionTool) public ~ElectronChargeEfficiencyCorrectionTool()
Standard destructor.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:78
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
CP::ElectronChargeEfficiencyCorrectionTool::m_SF_SS
std::map< std::string, std::vector< TH2 * > > m_SF_SS
Histogram that holds the correction rates for Monte Carlo.
Definition: ElectronChargeEfficiencyCorrectionTool.h:122
CP::ElectronChargeEfficiencyCorrectionTool::getChargeFlipRate
float getChargeFlipRate(double eta, double pt, TH2 *hrates, double &flipRate) const
Get the charge flip rate rate given pt, eta, histogram.
Definition: ElectronChargeEfficiencyCorrectionTool.cxx:597
CP::ElectronChargeEfficiencyCorrectionTool::m_filename
std::string m_filename
The name of the input file that contains the histograms.
Definition: ElectronChargeEfficiencyCorrectionTool.h:136
IAsgElectronEfficiencyCorrectionTool
Definition: IAsgElectronEfficiencyCorrectionTool.h:18
CP::ElectronChargeEfficiencyCorrectionTool::m_appliedSystematics
CP::SystematicSet * m_appliedSystematics
Currently applied systematics.
Definition: ElectronChargeEfficiencyCorrectionTool.h:169
AsgTool.h
IParticle
Definition: Event/EventKernel/EventKernel/IParticle.h:43
CP::ElectronChargeEfficiencyCorrectionTool::m_defaultRandomRunNumber
unsigned int m_defaultRandomRunNumber
Definition: ElectronChargeEfficiencyCorrectionTool.h:133
AuxElement.h
Base class for elements of a container that can have aux data.