ATLAS Offline Software
Loading...
Searching...
No Matches
AsgElectronEfficiencyCorrectionTool.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

namespace ADD_CMODE (CP)

Function Documentation

◆ ADD_CMODE()

namespace ADD_CMODE ( CP )

Standard constructor

Standard destructor

Gaudi Service Interface method implementations

returns: the list of all systematics this tool can be affected by

returns: the list of all systematics this tool recommends to use

returns: whether this tool is affected by the given systematis

Configure this tool for the given systematics

print available/implemented correlation models

returns: the currently applied systematics

initialize the systematics

To check if the metadata can be retrieved

Pointer to the underlying ROOT based tool

Systematics filter map

Affected systematic, should be done only once

Currently applied systematics

The list of file names

The prefix string for the result

The string for the result

The Event info collection name

Force the data type to a given value

Definition at line 1 of file AsgElectronEfficiencyCorrectionTool.h.

42{
43
44class AsgElectronEfficiencyCorrectionTool final
47 , public columnar::ColumnarTool<>
48{
49 ASG_TOOL_CLASS(AsgElectronEfficiencyCorrectionTool,
50 IAsgElectronEfficiencyCorrectionTool)
51
52public:
54 AsgElectronEfficiencyCorrectionTool(const std::string& myname);
56 virtual ~AsgElectronEfficiencyCorrectionTool() override final;
58 virtual StatusCode initialize() override final;
59
60 /*
61 * Metadata tool methods
62 */
63 virtual StatusCode beginInputFile() override final;
64 virtual StatusCode beginEvent() override final;
65
66 /*
67 * ISystematic tool methods
68 */
70 virtual CP::SystematicSet affectingSystematics() const override final;
72 virtual CP::SystematicSet recommendedSystematics() const override final;
74 virtual bool isAffectedBySystematic(
75 const CP::SystematicVariation& systematic) const override final;
77 virtual StatusCode applySystematicVariation(
78 const CP::SystematicSet& systConfig) override final;
79
80 /*
81 * IAsgElectronEfficiencyCorrectionTool methods
82 */
83 virtual CP::CorrectionCode getEfficiencyScaleFactor(
84 const xAOD::Electron& inputObject,
85 double& efficiencyScaleFactor) const override final;
86 CP::CorrectionCode getEfficiencyScaleFactor(
87 columnar::ElectronId inputObject,
88 double& efficiencyScaleFactor,
89 columnar::EventInfoId info) const;
90 //
91 virtual CP::CorrectionCode getEfficiencyScaleFactor(
92 const double et, /*in MeV*/
93 const double cluster_eta, /*cluster*/
94 const unsigned int runNumber,
95 double& efficiencyScaleFactor) const override final;
96 //
97 virtual CP::CorrectionCode applyEfficiencyScaleFactor(
98 const xAOD::Electron& inputObject) const override final;
99 //
100 virtual int getNumberOfToys() const override final
101 {
102 return m_number_of_toys;
103 };
105 virtual void printCorrelationModels() const override final
106 {
108 " Available Correlation Models for the ElectronEfficiencyCorrectionTool");
109 ATH_MSG_INFO("FULL");
110 ATH_MSG_INFO("SIMPLIFIED");
111 ATH_MSG_INFO("MCTOYS");
112 ATH_MSG_INFO("SYST");
113 ATH_MSG_INFO("COMBMCTOYS");
114 ATH_MSG_INFO("TOTAL");
115 };
116
118 virtual const CP::SystematicSet& appliedSystematics() const override final
119 {
120 return *m_appliedSystematics;
121 }
122
123 virtual int systUncorrVariationIndex(
124 const xAOD::Electron& inputObject) const override final;
126 columnar::ElectronId inputObject) const;
127
128private:
129 StatusCode registerSystematics();
130
131 int currentSimplifiedUncorrSystRegion(const double cluster_eta,
132 const double et) const;
133 int currentUncorrSystRegion(const double cluster_eta, const double et) const;
134
136 StatusCode InitSystematics();
137
138 // Gets the correction filename from map
139 StatusCode getFile(const std::string& recokey,
140 const std::string& idkey,
141 const std::string& isokey,
142 const std::string& trigkey);
143 // Get the simulation type from metadata
144 StatusCode get_simType_from_metadata(
146
147 // struct for toys
148 struct SystConf
149 {
150 float m_total;
151 unsigned m_toy_index;
152 float m_toy_scale;
153 };
154
156 bool m_metadata_retrieved = false;
157
159 std::unique_ptr<Root::TElectronEfficiencyCorrectionTool> m_rootTool = nullptr;
160
162 std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
163
165 CP::SystematicSet m_affectedSys;
166
168 CP::SystematicSet* m_appliedSystematics;
169
170 // Correlation Model
171 std::string m_correlation_model_name;
172 int m_correlation_model;
173
174 // Map-key properties
175 std::string m_mapFile;
176
177 // Four SF key Properties
178 std::string m_recoKey;
179 std::string m_idKey;
180 std::string m_isoKey;
181 std::string m_trigKey;
182
184 std::vector<std::string> m_corrFileNameList;
185
187 std::string m_resultPrefix;
188
190 std::string m_resultName;
191
192 // The prefix for the systematic name
193 std::string m_sysSubstring;
194
196 std::string m_eventInfoCollectionName;
197
198 // use RandomRun Number
199 bool m_useRandomRunNumber;
200 int m_defaultRandomRunNumber;
201
202 // The data type
204
206 int m_dataTypeOverwrite;
207
208 // Number of toys:
209 int m_number_of_toys;
210
211 // seed for toys:
212 int m_seed_toys;
213
214 // scale for toy uncertainty:
215 double m_scale_toys;
216
217 // number of systematic uncertainties
218 int m_nCorrSyst;
219 int m_nUncorrSyst;
220 std::vector<std::pair<float, std::vector<float>>> m_pteta_bins;
221
222 // custom binning for SIMPLIFIED model
223 std::vector<float> m_uncorrSimplfEtaBinsUser;
224 std::vector<float> m_uncorrSimplfEtBinsUser;
225
226 // simplified uncorrelation regions
227 TH2F* m_UncorrRegions;
228 int m_nSimpleUncorrSyst;
229
230 // Caching of variations we know after initialize
231 std::string m_toysBasename;
232 std::vector<CP::SystematicVariation> m_corrVarUp;
233 std::vector<CP::SystematicVariation> m_corrVarDown;
234 std::vector<CP::SystematicVariation> m_uncorrVarUp;
235 std::vector<CP::SystematicVariation> m_uncorrVarDown;
236
237public:
238
239 struct Accessors : public columnar::ColumnarTool<>
240 {
241 Accessors(AsgElectronEfficiencyCorrectionTool& tool) : columnar::ColumnarTool<>(&tool) {}
242
243 columnar::EventInfoAccessor<columnar::ObjectColumn> m_eventInfo {*this, "EventInfo", {.addMTDependency=true}};
245
246 columnar::ElectronAccessor<columnar::ObjectColumn> m_electrons {*this, "Electrons"};
247 columnar::ElectronAccessor<float> m_eta{*this,"eta"};
248 columnar::ElectronAccessor<float> m_pt{*this,"pt"};
249 columnar::ElectronAccessor<uint16_t> accAuthor{*this,"author"};
250 columnar::ElectronDecorator<float> m_sfDec{*this,"sfOut"};
251 columnar::ElectronDecorator<char> m_validDec{*this,"validOut"};
252
253 columnar::ClusterAccessor<columnar::ObjectColumn> m_clusterHandle {*this, "egammaClusters"};
254 columnar::ElectronAccessor<std::vector<columnar::OptClusterId>> caloClusterAcc {*this, "caloClusterLinks"};
255 columnar::ClusterAccessor<float> clusterEAcc {*this, "calE"};
256 columnar::ClusterAccessor<float> clusterEtaAcc {*this, "calEta"};
257 columnar::ClusterHelpers::EtaBEAccessor<> clusterEtaBEAcc {*this};
258 };
259 std::unique_ptr<Accessors> m_accessors;
260
261 void callSingleEvent (columnar::ElectronRange electrons, columnar::EventInfoId event) const;
262 void callEvents (columnar::EventContextRange events) const override;
263
264}; // End: class definition
265
266} // namespace ADD_CMODE(CP)
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
#define ATH_MSG_INFO(x,...)
float et(const xAOD::jFexSRJetRoI *j)
virtual void printCorrelationModels() const =0
print available/implemented correlation models
virtual const CP::SystematicSet & appliedSystematics() const =0
virtual int systUncorrVariationIndex(const xAOD::Electron &inputObject) const =0
Base class for dual-use tools that provide file metadata access.
the base class for all columnar components
::StatusCode StatusCode
StatusCode definition for legacy code.
AccessorTemplate< ClusterDef, CT, ColumnAccessMode::input, CM > ClusterAccessor
Definition ClusterDef.h:25
ObjectId< ElectronDef > ElectronId
Definition EgammaDef.h:35
ObjectRange< EventContextDef > EventContextRange
AccessorTemplate< ElectronDef, CT, ColumnAccessMode::output, CM > ElectronDecorator
Definition EgammaDef.h:38
ObjectRange< ElectronDef > ElectronRange
Definition EgammaDef.h:34
AccessorTemplate< ElectronDef, CT, ColumnAccessMode::input, CM > ElectronAccessor
Definition EgammaDef.h:37
ObjectId< EventInfoDef > EventInfoId
AccessorTemplate< EventInfoDef, CT, ColumnAccessMode::input, CM > EventInfoAccessor
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Electron_v1 Electron
Definition of the current "egamma version".
Definition Electron.h:17
void initialize()