ATLAS Offline Software
AsgPhotonEfficiencyCorrectionTool.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 
7 #ifndef PHOTONEFFICIENCYCORRECTION_ASGPHOTONEFFICIENCYCORRECTIONTOOL
8 #define PHOTONEFFICIENCYCORRECTION_ASGPHOTONEFFICIENCYCORRECTIONTOOL
9 
18 // STL includes
19 #include <vector>
20 #include <string>
21 #include <fstream>
22 #include <unordered_map>
23 
24 //xAOD includes
25 #include "AsgTools/AsgTool.h"
31 
32 #include "xAODEgamma/Egamma.h"
33 
35  : virtual public IAsgPhotonEfficiencyCorrectionTool,
36  virtual public CP::ISystematicsTool,
37  public asg::AsgTool
38 {
40 
41 public:
43  AsgPhotonEfficiencyCorrectionTool ( const std::string& myname );
44 
47 
49  virtual StatusCode initialize() override;
50 
51 
52 public:
54  virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Egamma& inputObject, double& efficiencyScaleFactor) const override;
55  virtual CP::CorrectionCode getEfficiencyScaleFactorError(const xAOD::Egamma& inputObject, double& efficiencyScaleFactorError) const override;
56  virtual CP::CorrectionCode applyEfficiencyScaleFactor(xAOD::Egamma& inputObject) const override;
57 
59 
61  virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const override;
62 
64  virtual CP::SystematicSet affectingSystematics() const override;
65 
67  virtual CP::SystematicSet recommendedSystematics() const override;
68 
71  assert (m_appliedSystematics != nullptr);
72  return *m_appliedSystematics;
73  }
74 
76  virtual StatusCode applySystematicVariation ( const CP::SystematicSet& systConfig ) override;
77 
79 
80  // Private member variables
81 private:
84  CP::CorrectionCode calculate( const xAOD::Egamma* egam, Result& result ) const;
85 
89 
91  std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
92 
95 
96  // The prefix for the systematic name
97  std::string m_sysSubstring;
98 
99  // Get the correction filename from the map
100  std::string getFileName(const std::string& isoWP, const std::string& trigWP, bool isConv);
101 
102  // Set prefix of the corresponding calibration filenames:
103  std::string m_file_prefix_ID="efficiencySF.offline.";
104  std::string m_file_prefix_ISO="efficiencySF.Isolation.";
105  std::string m_file_prefix_Trig="efficiencySF.";
106  std::string m_file_prefix_TrigEff="efficiency.";
107 
108  // Properties
109 
111  std::string m_corrFileNameConv;
112  std::string m_corrFileNameUnconv;
113 
115  std::string m_resultPrefix;
116 
118  std::string m_resultName;
119 
122 
124  std::string m_isoWP;
125 
127  std::string m_trigger;
128 
130  std::string m_mapFile;
131 
132  // bin boundaries of correction files
133  std::map<float, std::vector<float>> m_pteta_bins;
134 
135  //use RandomRun Number
138 
139  // remove TRT converted photon for Run-3
141 
142 
143 }; // End: class definition
144 
145 
146 #endif
147 
AsgPhotonEfficiencyCorrectionTool::getEfficiencyScaleFactorError
virtual CP::CorrectionCode getEfficiencyScaleFactorError(const xAOD::Egamma &inputObject, double &efficiencyScaleFactorError) const override
Get the "photon scale factor error" as a return value.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:325
AsgPhotonEfficiencyCorrectionTool::m_dataTypeOverwrite
int m_dataTypeOverwrite
Force the data type to a given value.
Definition: AsgPhotonEfficiencyCorrectionTool.h:121
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
AsgPhotonEfficiencyCorrectionTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
returns: the list of all systematics this tool can be affected by
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:360
get_generator_info.result
result
Definition: get_generator_info.py:21
AsgPhotonEfficiencyCorrectionTool::AsgPhotonEfficiencyCorrectionTool
AsgPhotonEfficiencyCorrectionTool(const std::string &myname)
Standard constructor.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:42
AsgPhotonEfficiencyCorrectionTool::m_defaultRandomRunNumber
int m_defaultRandomRunNumber
Definition: AsgPhotonEfficiencyCorrectionTool.h:137
IAsgPhotonEfficiencyCorrectionTool
Definition: IAsgPhotonEfficiencyCorrectionTool.h:23
AsgPhotonEfficiencyCorrectionTool::m_pteta_bins
std::map< float, std::vector< float > > m_pteta_bins
Definition: AsgPhotonEfficiencyCorrectionTool.h:133
AsgPhotonEfficiencyCorrectionTool::m_useRandomRunNumber
bool m_useRandomRunNumber
Definition: AsgPhotonEfficiencyCorrectionTool.h:136
AsgPhotonEfficiencyCorrectionTool::m_file_prefix_ID
std::string m_file_prefix_ID
Definition: AsgPhotonEfficiencyCorrectionTool.h:103
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AsgPhotonEfficiencyCorrectionTool::m_file_prefix_TrigEff
std::string m_file_prefix_TrigEff
Definition: AsgPhotonEfficiencyCorrectionTool.h:106
AsgPhotonEfficiencyCorrectionTool::getFileName
std::string getFileName(const std::string &isoWP, const std::string &trigWP, bool isConv)
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:418
AsgPhotonEfficiencyCorrectionTool::~AsgPhotonEfficiencyCorrectionTool
virtual ~AsgPhotonEfficiencyCorrectionTool()
Standard destructor.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:90
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
AsgPhotonEfficiencyCorrectionTool::m_rootTool_unc
Root::TElectronEfficiencyCorrectionTool * m_rootTool_unc
Pointer to the underlying ROOT based tool.
Definition: AsgPhotonEfficiencyCorrectionTool.h:87
IAsgPhotonEfficiencyCorrectionTool.h
AsgPhotonEfficiencyCorrectionTool::applyEfficiencyScaleFactor
virtual CP::CorrectionCode applyEfficiencyScaleFactor(xAOD::Egamma &inputObject) const override
Decorate the photon with its scale factor.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:338
CP::SystematicVariation
Definition: SystematicVariation.h:47
AsgPhotonEfficiencyCorrectionTool::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:99
AsgPhotonEfficiencyCorrectionTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const override
The methods below should notify the user of what is actually in the list , without him having to go i...
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:350
ISystematicsTool.h
AsgPhotonEfficiencyCorrectionTool::m_file_prefix_ISO
std::string m_file_prefix_ISO
Definition: AsgPhotonEfficiencyCorrectionTool.h:104
Egamma.h
Root::TElectronEfficiencyCorrectionTool::Result
Definition: TElectronEfficiencyCorrectionTool.h:42
AsgPhotonEfficiencyCorrectionTool::m_isoWP
std::string m_isoWP
Isolation working point.
Definition: AsgPhotonEfficiencyCorrectionTool.h:124
AsgPhotonEfficiencyCorrectionTool::m_resultName
std::string m_resultName
The string for the result.
Definition: AsgPhotonEfficiencyCorrectionTool.h:118
AsgPhotonEfficiencyCorrectionTool::m_resultPrefix
std::string m_resultPrefix
The prefix string for the result.
Definition: AsgPhotonEfficiencyCorrectionTool.h:115
AsgPhotonEfficiencyCorrectionTool::getEfficiencyScaleFactor
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Egamma &inputObject, double &efficiencyScaleFactor) const override
Add some method for now as a first step to move the tool to then new interface.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:304
SystematicRegistry.h
AsgPhotonEfficiencyCorrectionTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
returns: the list of all systematics this tool recommends to use
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:381
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AsgPhotonEfficiencyCorrectionTool::calculate
CP::CorrectionCode calculate(const xAOD::Egamma *egam, Result &result) const
I think these calculate methods are only used internally.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:194
AsgPhotonEfficiencyCorrectionTool::m_systFilter
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilter
Systematics filter map.
Definition: AsgPhotonEfficiencyCorrectionTool.h:91
AsgPhotonEfficiencyCorrectionTool
Definition: AsgPhotonEfficiencyCorrectionTool.h:38
AsgPhotonEfficiencyCorrectionTool::m_file_prefix_Trig
std::string m_file_prefix_Trig
Definition: AsgPhotonEfficiencyCorrectionTool.h:105
Root::TElectronEfficiencyCorrectionTool
Definition: TElectronEfficiencyCorrectionTool.h:36
AsgPhotonEfficiencyCorrectionTool::Result
Root::TElectronEfficiencyCorrectionTool::Result Result
Definition: AsgPhotonEfficiencyCorrectionTool.h:82
AsgPhotonEfficiencyCorrectionTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig) override
Configure this tool for the given systematics.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:391
AsgPhotonEfficiencyCorrectionTool::m_mapFile
std::string m_mapFile
map filename
Definition: AsgPhotonEfficiencyCorrectionTool.h:130
AsgPhotonEfficiencyCorrectionTool::registerSystematics
StatusCode registerSystematics()
Register the systematics with the registry and add them to the recommended list.
Definition: AsgPhotonEfficiencyCorrectionTool.cxx:371
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition: ISystematicsTool.h:32
AsgPhotonEfficiencyCorrectionTool::m_corrFileNameUnconv
std::string m_corrFileNameUnconv
Definition: AsgPhotonEfficiencyCorrectionTool.h:112
AsgPhotonEfficiencyCorrectionTool::m_rootTool_con
Root::TElectronEfficiencyCorrectionTool * m_rootTool_con
Definition: AsgPhotonEfficiencyCorrectionTool.h:88
AsgPhotonEfficiencyCorrectionTool::appliedSystematics
const CP::SystematicSet & appliedSystematics() const
returns: the currently applied systematics
Definition: AsgPhotonEfficiencyCorrectionTool.h:70
AsgPhotonEfficiencyCorrectionTool::m_appliedSystematics
CP::SystematicSet * m_appliedSystematics
Currently applied systematics.
Definition: AsgPhotonEfficiencyCorrectionTool.h:94
AsgPhotonEfficiencyCorrectionTool::m_trigger
std::string m_trigger
Trigger name for trigger SF.
Definition: AsgPhotonEfficiencyCorrectionTool.h:127
ASG_TOOL_CLASS3
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
Definition: AsgToolMacros.h:85
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
CP::IReentrantSystematicsTool
interface for all CP tools supporting systematic variations within a reentrant algorithm
Definition: IReentrantSystematicsTool.h:58
CorrectionCode.h
TElectronEfficiencyCorrectionTool.h
AsgPhotonEfficiencyCorrectionTool::m_sysSubstring
std::string m_sysSubstring
Definition: AsgPhotonEfficiencyCorrectionTool.h:97
AsgPhotonEfficiencyCorrectionTool::m_corrFileNameConv
std::string m_corrFileNameConv
The list of input file names.
Definition: AsgPhotonEfficiencyCorrectionTool.h:111
AsgTool.h
AsgPhotonEfficiencyCorrectionTool::m_removeTRTConversion
bool m_removeTRTConversion
Definition: AsgPhotonEfficiencyCorrectionTool.h:140