ATLAS Offline Software
Loading...
Searching...
No Matches
ElectronChargeEfficiencyCorrectionTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
13// Include this class's header
16// xAOD includes
18#include "xAODEgamma/Electron.h"
21
22// ROOT includes
23#include "TFile.h"
24
25// STL includes
26#include <cstdlib> /* atoi */
27
28// =============================================================================
29// Standard constructor
30// =============================================================================
31CP::ElectronChargeEfficiencyCorrectionTool::
32 ElectronChargeEfficiencyCorrectionTool(const std::string& name)
33 : AsgTool(name)
34 , m_dataTypeOverwrite(-1)
35 , m_eventInfoCollectionName("EventInfo")
36 , m_SF_SS()
37 , m_SF_OS()
38 , m_RunNumbers()
39 , m_useRandomRunNumber(true)
40 , m_defaultRandomRunNumber(999999)
41 , m_filename("")
42 , m_workingPoint("")
43 , m_eta_lowlimit(0.0)
44 , m_eta_uplimit(0.0)
45 , m_pt_lowlimit(0.0)
46 , m_pt_uplimit(0.0)
47 , m_gevmev(0.0)
48 , m_filtered_sys_sets()
49 , m_mySysConf()
50 , m_affectingSys()
51 , m_appliedSystematics(nullptr)
52 , m_sf_decoration_name("chargeIDEffiSF")
53 , m_sfDec(nullptr)
54{
55 // Declare the needed properties
56 declareProperty("CorrectionFileName",
57 m_filename,
58 "Name of the file with charge flipping rates");
59 declareProperty(
60 "WorkingPoint", m_workingPoint, "Name of working point folder in the file");
61 declareProperty("ScaleFactorDecorationName", m_sf_decoration_name);
62 declareProperty("ForceDataType",
63 m_dataTypeOverwrite,
64 "Force the DataType of the electron to specified value (to "
65 "circumvent problem of incorrect DataType for forward "
66 "electrons in some old releases)");
67 declareProperty("EventInfoCollectionName",
68 m_eventInfoCollectionName,
69 "The EventInfo Collection Name");
70 declareProperty("UseRandomRunNumber", m_useRandomRunNumber);
71 declareProperty("DefaultRandomRunNumber", m_defaultRandomRunNumber);
72}
73
74// =============================================================================
75// Standard destructor
76// =============================================================================
83
84// =============================================================================
85// Athena initialize method
86// =============================================================================
87StatusCode
89{
90 ATH_MSG_DEBUG("initializing");
91
92 // initialize the random number generator (used in case of charge flip
93 // approach)
94 // m_Rndm = new TRandom3(1);
95
96 if (m_sfDec)
97 delete m_sfDec;
99
100 // Resolve the path to the input file for the charge flip rates
101 const std::string rootfilename = PathResolverFindCalibFile(m_filename);
102 if (m_filename.empty()) {
103 ATH_MSG_ERROR(" PathResolver was not able to find the file ... aborting");
104 return StatusCode::FAILURE;
105 }
106
107 // Getting the root file and histograms
108 TFile* rootFile = TFile::Open(rootfilename.c_str());
109
110 // protection against bad file
111 if (rootFile == nullptr) {
112 ATH_MSG_ERROR(" Was not able to open file: " << rootfilename
113 << " ...... aborting");
114 return StatusCode::FAILURE;
115 }
116
118 //
119 // explanation: attempt to loop generally over a file
120 // -- if certain SINGALWORD is present -- then this is taken as a signal,
121 // that this is another dimension... can be dynamically added.
122 // e.g.
123 // SFSyst<number>_RunNumber<minRN>-<maxRN>_Nvtx<minNvtx>-<maxNvtx>
124 // SFStat_RunNumber<minRN>-<maxRN>_Nvtx<minNvtx>-<maxNvtx>
125 // SFCentral_RunNumber<minRN>-<maxRN>_Nvtx<minNvtx>-<maxNvtx>
126
127 // Then can create a key that will dynamically give us access to a map:
128 // std::map<std::string key, std::vector<TH2 *>> m_SF_SS; // keys (e.g.
129 // RunNumber223333_319200_Nvtx0_10_Phi1.5_1.6) mapping to vector of SF
130 // histograms --> vector m_SF: 0=nominal, 1=stat, 2,3,4...n=syst
131 // std::map<std::string key, std::vector<TH2 *>> m_SF_OS; // keys
132 // (e.g. RunNumber223333_319200_Nvtx0_10_Phi1.5_1.6) mapping to vector of
133 // SF histograms --> vector m_SF: 0=nominal, 1=stat, 2,3,4...n=syst
134 // TFile* data/ChMisIDSF_TightLL_FixedCutTight.root
135 // KEY: TH2F SFCentral_RunNumber296939_311481_SS;1
136 // SFCentral_RunNumber296939_311481_SS KEY: TH2F
137 // SFCentral_RunNumber296939_311481_OS;1 SFCentral_RunNumber296939_311481_OS
138 // KEY: TH2F STAT_RunNumber296939_311481_SS;1
139 // STAT_RunNumber296939_311481_SS KEY: TH2F STAT_RunNumber296939_311481_OS;1
140 // STAT_RunNumber296939_311481_OS KEY: TH2F
141 // SYST_RunNumber296939_311481_total_SS;1 SYST_RunNumber296939_311481_SS:
142 // total KEY: TH2F SYST_RunNumber296939_311481_total_OS;1
143 // SYST_RunNumber296939_311481_OS: total
144
145 m_SF_SS.clear();
146 m_SF_OS.clear();
147 TList* keyListfolder = rootFile->GetListOfKeys();
148 std::vector<std::string> names;
149 std::set<std::string> set_systematics;
150
151 names.reserve(keyListfolder->GetEntries());
152 for (int j = 0; j < keyListfolder->GetEntries(); j++) {
153 names.emplace_back((keyListfolder->At(j)->GetName()));
154 }
155 std::sort(names.begin(), names.end());
156
157 for (unsigned int j = 0; j < names.size(); j++) {
158
159 std::string name = names.at(j);
160 ATH_MSG_DEBUG("Got ROOT object with name: " << name);
161 if (name.find(Form("SFCentral_")) != std::string::npos) {
162 ATH_MSG_VERBOSE("Found name 'SFCentral_' in ROOT object name");
163 // Check for opposite-sign (=opposite-charge)
164 bool isOS = false;
165 if (name.find(Form("_OS")) != std::string::npos) {
166 isOS = true;
167 ATH_MSG_VERBOSE("Found name '_OS' in ROOT object name");
168 }
169 if (isOS) {
170 std::string histid = (names.at(j));
171 histid.erase(0, 10);
172 histid.erase(histid.size() - 3, 3); // remove _SS, _OS
173 ATH_MSG_VERBOSE("Using histid: " << histid);
174
175 if (histid.find("RunNumber") != std::string::npos) {
176 ATH_MSG_VERBOSE("Found name 'RunNumber' in histid");
177 std::string runlow = histid;
178 runlow.erase(histid.find(Form("RunNumber")), 9);
179 runlow.erase(runlow.find('_'), runlow.size());
180 m_RunNumbers.push_back(
181 static_cast<unsigned int>(atoi(runlow.c_str())));
182 std::string runhigh = histid;
183 runhigh.erase(histid.find(Form("RunNumber")), 9);
184 runhigh.erase(0, runhigh.find('_') + 1);
185 m_RunNumbers.push_back(
186 static_cast<unsigned int>(atoi(runhigh.c_str())));
187 }
188 ATH_MSG_VERBOSE("Using histid (OS hid): " << histid);
189 m_SF_OS[histid].push_back((TH2*)rootFile->Get(names.at(j).c_str()));
190 } else {
191 std::string histid = (names.at(j));
192 histid.erase(0, 10);
193 histid.erase(histid.size() - 3, 3); // remove _SS, _OS
194 ATH_MSG_VERBOSE("Using histid (do we this in ? SS): " << histid);
195 m_SF_SS[histid].push_back((TH2*)rootFile->Get(names.at(j).c_str()));
196 }
197 }
198
200 if (name.find(Form("STAT_")) != std::string::npos) {
201 ATH_MSG_VERBOSE("Found name 'STAT_' in ROOT object name");
202 bool isOS = false;
203 if (name.find(Form("_OS")) != std::string::npos) {
204 isOS = true;
205 ATH_MSG_VERBOSE("Found name '_OS' in ROOT object name");
206 }
207 if (isOS) {
208 std::string histid = (names.at(j));
209 histid.erase(0, 5);
210 histid.erase(histid.size() - 3, 3); // remove _SS, _OS
211 ATH_MSG_VERBOSE("Using histid: " << histid);
212
213 if (histid.find("RunNumber") != std::string::npos) {
214 ATH_MSG_VERBOSE("Found name 'RunNumber' in histid");
215 std::string runlow = histid;
216 runlow.erase(histid.find(Form("RunNumber")), 9);
217 runlow.erase(runlow.find('_'), runlow.size());
218 // m_RunNumbers.push_back( static_cast<unsigned
219 // int>(atoi(runlow.c_str())) );
220 std::string runhigh = histid;
221 runhigh.erase(histid.find(Form("RunNumber")), 9);
222 runhigh.erase(0, runhigh.find('_') + 1);
223 // m_RunNumbers.push_back( static_cast<unsigned
224 // int>(atoi(runhigh.c_str())) );
225 }
226 ATH_MSG_VERBOSE("Using histid (OS hid): " << histid);
227 m_SF_OS[histid].push_back((TH2*)rootFile->Get(names.at(j).c_str()));
228 } else {
229 std::string histid = (names.at(j));
230 ATH_MSG_VERBOSE("Found histid: " << histid);
231 histid.erase(0, 5);
232 histid.erase(histid.size() - 3, 3); // remove _SS, _OS
233 ATH_MSG_VERBOSE("Using histid (do we this in ? SS): " << histid);
234 m_SF_SS[histid].push_back((TH2*)rootFile->Get(names.at(j).c_str()));
235 }
236
237 }
238
240 if (name.find(Form("SYST")) != std::string::npos) {
241 ATH_MSG_VERBOSE("Found name 'SYST' in ROOT object name");
242 bool isOS = false;
243 if (name.find(Form("_OS")) != std::string::npos) {
244 isOS = true;
245 ATH_MSG_VERBOSE("Found name '_OS' in ROOT object name");
246 }
247 if (isOS) {
248 std::string histid = (names.at(j));
249 histid.erase(0, 4);
250 histid.erase(histid.size() - 3, 3); // remove _SS, _OS
251
252 std::string sysname = histid;
253 sysname.erase(sysname.find('_'), sysname.size());
254 set_systematics.insert(sysname);
255
256 histid.erase(0, histid.find('_') + 1); // remove _SS, _OS
257 ATH_MSG_VERBOSE("Using syst histid: " << histid);
258
259 if (histid.find("RunNumber") != std::string::npos) {
260 std::string runlow = histid;
261 runlow.erase(histid.find(Form("RunNumber")), 9);
262 runlow.erase(runlow.find('_'), runlow.size());
263 // m_RunNumbers.push_back( static_cast<unsigned
264 // int>(atoi(runlow.c_str())) );
265 std::string runhigh = histid;
266 runhigh.erase(histid.find(Form("RunNumber")), 9);
267 runhigh.erase(0, runhigh.find('_') + 1);
268 // m_RunNumbers.push_back( static_cast<unsigned
269 // int>(atoi(runhigh.c_str())) );
270 }
271 ATH_MSG_VERBOSE("Using histid (OS hid): " << histid);
272 m_SF_OS[histid].push_back((TH2*)rootFile->Get(names.at(j).c_str()));
273 } else {
274 std::string histid = (names.at(j));
275 histid.erase(0, 4);
276 histid.erase(histid.size() - 3, 3); // remove _SS, _OS
277 histid.erase(0, histid.find('_') + 1); // remove _SS, _OS
278 ATH_MSG_VERBOSE("Using histid (sys ? SS): " << histid);
279 m_SF_SS[histid].push_back((TH2*)rootFile->Get(names.at(j).c_str()));
280 }
281
282 }
283 }
284
286
287 if (m_SF_OS.empty() || m_SF_SS.empty() || m_SF_SS.size() != m_SF_OS.size()) {
289 "OS/SS SF vectors not filled or of different size. -- Problem with "
290 "files. -- Report to <hn-atlas-EGammaWG@cern.ch>");
291 return StatusCode::FAILURE;
292 }
293
294 m_systematics.insert(m_systematics.end(), set_systematics.begin(), set_systematics.end());
295
296 std::sort(m_RunNumbers.begin(), m_RunNumbers.end());
298 // Determine the limits of validity
299
301 ATH_MSG_DEBUG("Having m_SF_OS.size() = " << m_SF_OS.size());
302 std::map<std::string, std::vector<TH2*>>::iterator it = m_SF_OS.begin();
303
304 // Get the kinematic limits
305 m_eta_lowlimit = (*it).second.at(0)->GetYaxis()->GetXmin();
306 m_eta_uplimit = (*it).second.at(0)->GetYaxis()->GetXmax();
307 ATH_MSG_VERBOSE("|eta| limits " << m_eta_lowlimit << ", " << m_eta_uplimit);
308
309 m_pt_lowlimit = (*it).second.at(0)->GetXaxis()->GetXmin();
310 m_pt_uplimit = (*it).second.at(0)->GetXaxis()->GetXmax();
311 ATH_MSG_VERBOSE("pt limits " << m_pt_lowlimit << ", " << m_pt_uplimit);
312
313 ATH_MSG_VERBOSE("Rates in input file are in GeV");
314 m_gevmev = 0.001;
315
316 // Systematics // dynamic too?
318
319 // Add the recommended systematics to the registry
320 if (registerSystematics() != StatusCode::SUCCESS) {
321 ATH_MSG_ERROR("(registerSystematics() != CP::SystematicCode::Ok)");
322 return StatusCode::FAILURE;
323 }
324
325 return StatusCode::SUCCESS;
326}
327
328
329//---------------------------------------------------------------------------------------
330// Get the scale factor for the electron
331//---------------------------------------------------------------------------------------
332
333//
334
337 const xAOD::Electron& ele,
338 double& sf) const
339{
340
341 // initialize the SF at 1
342 sf = 1.0;
343
344 // checking on the truth electron: up to now if this is not a good ele it's
345 // returning
346 bool goodEle = false;
347 CP::CorrectionCode goodEle_result =
349 if (goodEle_result != CP::CorrectionCode::Ok) {
350 sf = -999.0;
351 ATH_MSG_DEBUG("This is the check of goodeleCC in getscalefactor. Scale "
352 "factor set to -999");
353 return goodEle_result;
354 }
355
356 if (!goodEle) {
357 // electron is background electron and should not be corrected
359 ATH_MSG_DEBUG("Here goodele is false but CC ok");
360 }
361
362 // taking reconstructed variables
363 int reco_ele_charge = ele.charge();
364 const double ele_pt = ele.pt() * m_gevmev;
365 const double ele_eta = std::abs(ele.caloCluster()->etaBE(2));
366
367 // getting the truth charge
368 int truth_ele_charge = 9999;
369 CP::CorrectionCode charge_result =
370 ElectronEfficiencyHelpers::getEleTruthCharge( ele, truth_ele_charge);
371 if (charge_result != CP::CorrectionCode::Ok) {
372 sf = -9999.0;
373 ATH_MSG_VERBOSE("This is check of geteletruthchargeCC in getscalefactor. "
374 "Scale factor set to -9999");
375 return charge_result;
376 }
377
378 if (truth_ele_charge == 0) {
379 ATH_MSG_DEBUG("Here truth charge is =0!!");
381 }
382
383 ATH_MSG_DEBUG("Reco charge = " << reco_ele_charge
384 << "; Truth charge = " << truth_ele_charge);
385
386 // getting the rates from file....
387 float retVal(0.0);
388
390 // here determine, WHICH of the [histid] to choose (after cuuts on runnumber
391 // etc....)
392 std::string cutRunNumber = "all";
393
394 if (!m_RunNumbers.empty()) {
395 unsigned int runnumber = m_defaultRandomRunNumber;
396 ATH_MSG_DEBUG("RandomRunNumber: " << runnumber << " "
399 const xAOD::EventInfo* eventInfo =
401 if (!eventInfo) {
402 ATH_MSG_ERROR("Could not retrieve EventInfo object!");
403 sf = 1.0;
405 }
406 static const SG::AuxElement::Accessor<unsigned int> randomrunnumber(
407 "RandomRunNumber");
408 if (!randomrunnumber.isAvailable(*eventInfo)) {
409 sf = 1.0;
411 "Pileup tool not run before using ElectronEfficiencyTool! SFs do not "
412 "reflect PU distribution in data");
414 }
415 runnumber = randomrunnumber(*(eventInfo));
416 }
417 ATH_MSG_DEBUG("Number of RunNumbers in file: " << m_RunNumbers.size());
418 for (std::size_t r = 0; r < m_RunNumbers.size(); r++) {
419 ATH_MSG_DEBUG( " - " << m_RunNumbers.at(r));
420 }
421 ATH_MSG_VERBOSE("DONE");
422
423 bool isInRunNumberRange = false;
424 for ( std::size_t r=0; r<m_RunNumbers.size()-1; r+=2 ){
425 // increment by two, run numbers always come in pairs (upper and lower bound specified in the histogram name)
426
427 if ( runnumber >= (unsigned int)m_RunNumbers.at(r) &&
428 runnumber <= (unsigned int)m_RunNumbers.at(r+1) ) {
429 cutRunNumber.clear();
430 cutRunNumber =
431 Form("RunNumber%d_%d", m_RunNumbers.at(r), m_RunNumbers.at(r + 1));
432 ATH_MSG_DEBUG("Random run number lies in range " << m_RunNumbers.at(r) << " " << m_RunNumbers.at(r+1));
433 isInRunNumberRange = true;
434 }
435 }
436
437 if (runnumber < m_RunNumbers.at(0) ||
438 (runnumber > m_RunNumbers.at(m_RunNumbers.size() - 1))) {
439 ATH_MSG_DEBUG("RunNumber " << runnumber << " is not in valid RunNumber Range ");
440 sf = 1.0;
442 }
443
444 if ( !isInRunNumberRange ) {
446 }
447 }
448
449 // check if electron is within recommendations in eta/Et
450 if ( ele_eta < m_eta_lowlimit || ele_eta > m_eta_uplimit ) {
451
452 ATH_MSG_DEBUG("Got an electron outside of the range of eta validity " << ele_eta);
454 }
455
456 if ( ele_pt < m_pt_lowlimit ) {
457
458 ATH_MSG_DEBUG("Got an electron outside of the range of pt validity: pt lower than lower limit");
460 }
461
462 // Determine WHICH histograms to use here
463 const std::vector<TH2*>& SShistograms = m_SF_SS.at(cutRunNumber.c_str());
464 const std::vector<TH2*>& OShistograms = m_SF_OS.at(cutRunNumber.c_str());
465
466 // here check OS or SS
467 bool isOS = false;
468
469 if (truth_ele_charge * reco_ele_charge > 0)
470 isOS = true;
471
472 if (isOS) {
473 retVal = this->getChargeFlipRate(ele_eta, ele_pt, OShistograms.at(0), sf);
474 if (retVal != 0) {
475 sf = -9999.0;
477 }
478 } else {
479 ATH_MSG_DEBUG("Get SS his");
480 retVal = this->getChargeFlipRate(ele_eta, ele_pt, SShistograms.at(0), sf);
481 if (retVal != 0) {
482 sf = -9999.0;
484 }
485 }
486
487 ATH_MSG_DEBUG("eta: " << ele_eta << " pt: " << ele_pt);
488 ATH_MSG_DEBUG("SF Rates---- . SF: " << sf);
489
490 // Systematics
491 // ------------------------------------------------------------------------------------------------------
492 double val_stat;
493
495 if (isOS) {
496 retVal =
497 this->getChargeFlipRate(ele_eta, ele_pt, OShistograms.at(1), val_stat);
498 if (retVal != 0) {
499 sf = -9999.0;
501 }
502 } else {
503 ATH_MSG_DEBUG("Get SS his");
504 retVal =
505 this->getChargeFlipRate(ele_eta, ele_pt, SShistograms.at(1), val_stat);
506 if (retVal != 0) {
507 sf = -9999.0;
509 }
510 }
511
512 std::vector<float> systs;
513 double val_sys{ 0.0 };
515 for (unsigned int s = 2; s < OShistograms.size(); s++) {
516 if (isOS) {
517 retVal =
518 this->getChargeFlipRate(ele_eta, ele_pt, OShistograms.at(s), val_sys);
519 if (retVal != 0) {
520 val_sys = -9999.0;
522 }
523 } else {
524 ATH_MSG_DEBUG("Get SS his");
525 retVal =
526 this->getChargeFlipRate(ele_eta, ele_pt, SShistograms.at(s), val_sys);
527 if (retVal != 0) {
528 val_sys = -9999.0;
530 }
531 }
532 systs.push_back(static_cast<float>(val_sys));
533 }
534
535 ATH_MSG_DEBUG(" ... nominal SF: " << sf);
536
537 if (m_mySysConf.empty()) {
538 ATH_MSG_DEBUG(" ... nominal SF: " << sf);
539 } else if (*(m_mySysConf.begin()) ==
540 SystematicVariation("EL_CHARGEID_STAT", 1)) {
541 sf = (sf + (val_stat));
542 ATH_MSG_DEBUG("SF after STATup = " << sf);
543 } else if (*(m_mySysConf.begin()) ==
544 SystematicVariation("EL_CHARGEID_STAT", -1)) {
545 sf = (sf - (val_stat));
546 ATH_MSG_DEBUG("SF after STATdown = " << sf);
547 } else {
548
549 for (unsigned int i = 0; i < m_systematics.size(); i++) {
550 if (*(m_mySysConf.begin()) ==
552 Form("EL_CHARGEID_SYS%s", m_systematics.at(i).c_str()), 1)) {
553 sf = (sf + (val_sys));
554 ATH_MSG_DEBUG("SF after SYSup = " << sf);
555 }
556
557 if (*(m_mySysConf.begin()) ==
559 Form("EL_CHARGEID_SYS%s", m_systematics.at(i).c_str()), -1)) {
560 sf = (sf - (val_sys));
561 ATH_MSG_DEBUG("SF after SYSdown = " << sf);
562 }
563 }
564
565 }
566
568}
569
570//---------------------------------------------------------------------------------------
571// Decorate the electron with the scale factor
572//---------------------------------------------------------------------------------------
573
576 const xAOD::Electron& part) const
577{
579 "In "
580 "CP::ElectronChargeEfficiencyCorrectionTool::applyEfficiencyScaleFactor("
581 "const xAOD::IParticle& part) const");
582 double sf = 0.0;
584 // Decorate the electron
585 (*m_sfDec)(part) = static_cast<float>(sf);
586 return result;
587}
588
589// Get the correction rate given pt (E), eta, histogram
590float
592 double eta,
593 double pt,
594 TH2* hrates,
595 double& flipRate) const
596{
597 ATH_MSG_VERBOSE(" -> in: getChargeFlipRate(" << pt << ", " << eta
598 << " TH2, double&)");
599
600 if (pt > m_pt_uplimit)
601 pt = m_pt_uplimit * 0.999;
602
603 int bin2D = hrates->FindBin(pt, eta);
604 flipRate = hrates->GetBinContent(bin2D);
605
606 ATH_MSG_VERBOSE(" -> flipRate is " << flipRate << ", for histogram "
607 << hrates->GetName());
608
609 return 0;
610}
611
613// returns whether this tool is affected by the given systematics
614bool
616 const SystematicVariation& systematic) const
617{
618
620 return sys.find(systematic) != sys.end();
621}
622
624// returns the list of all systematics this tool can be affected by
625
628{
630 result.insert(SystematicVariation("EL_CHARGEID_STAT", 1));
631 result.insert(SystematicVariation("EL_CHARGEID_STAT", -1));
632
633 for (unsigned int i = 0; i < m_systematics.size(); i++) {
635 Form("EL_CHARGEID_SYS%s", m_systematics.at(i).c_str()), 1));
637 Form("EL_CHARGEID_SYS%s", m_systematics.at(i).c_str()), -1));
638 }
639 return result;
640}
641
643// returns the list of all systematics this tool recommends to use
650
652// Gets a SystematicSet and filters it
653StatusCode
655 const SystematicSet& systConfig)
656{
657
659 systConfig, m_affectingSys, m_mySysConf)) {
661 "Unsupported combination of systematics passed to the tool! ");
662 return StatusCode::FAILURE;
663 }
664
665 return StatusCode::SUCCESS;
666}
667
668// Register the systematics with the registry and add them to the recommended list
671
672 if (registry.registerSystematics(*this) != StatusCode::SUCCESS) {
673 ATH_MSG_ERROR("Failed to add systematic to list of recommended systematics.");
674 return StatusCode::FAILURE;
675 }
676
677 return StatusCode::SUCCESS;
678}
679
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
ServiceHandle< StoreGateSvc > & evtStore()
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
std::map< std::string, std::vector< TH2 * > > m_SF_OS
std::string m_filename
The name of the input file that contains the histograms.
virtual ASG_TOOL_CLASS(ElectronChargeEfficiencyCorrectionTool, IAsgElectronEfficiencyCorrectionTool) public ~ElectronChargeEfficiencyCorrectionTool()
Standard destructor.
double m_pt_lowlimit
Lower limit of pt range where corrections are available; taken from histogram.
std::map< std::string, std::vector< TH2 * > > m_SF_SS
Histogram that holds the correction rates for Monte Carlo.
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const override final
Returns whether this tool is affected by the given systematics.
virtual CP::SystematicSet recommendedSystematics() const override final
Returns the list of all systematics this tool recommends to use.
double m_eta_uplimit
Upper limit of eta range where corrections are available; taken from histogram.
virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::Electron &inputObject) const override final
Decorate the electron.
float getChargeFlipRate(double eta, double pt, TH2 *hrates, double &flipRate) const
Get the charge flip rate rate given pt, eta, histogram.
virtual StatusCode initialize() override final
Gaudi Service Interface method implementations.
std::string m_eventInfoCollectionName
The Event info collection name.
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig) override final
effects: configure this tool for the given list of systematic variations.
double m_eta_lowlimit
Lower limit of eta range where corrections are available; taken from histogram.
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Electron &inputObject, double &sf) const override final
Retrieve the Scale factor.
double m_pt_uplimit
Upper limit of pt range where corrections are available; taken from histogram.
virtual SystematicSet affectingSystematics() const override final
Returns the list of all systematics this tool can be affected by.
This module implements the central registry for handling systematic uncertainties with CP tools.
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode registerSystematics(const IReentrantSystematicsTool &tool)
effects: register all the systematics from the tool
Class to wrap a set of SystematicVariations.
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:576
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition Egamma_v1.cxx:66
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
float charge() const
Obtain the charge of the object.
int r
Definition globals.cxx:22
static std::vector< uint32_t > runnumber
Definition iLumiCalc.h:37
CP::CorrectionCode getEleTruthCharge(const xAOD::Electron &ele, int &truthcharge)
Get the charge of the original electron.
CP::CorrectionCode isGoodEle(const xAOD::Electron &ele, bool &goodEle)
Return true if it's good ele for charge flip measurements.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
setRcore setEtHad setFside pt
EventInfo_v1 EventInfo
Definition of the latest event info version.
static const SG::AuxElement::Accessor< std::vector< std::string > > names("thrNames")
Accessor for the names of the passed thresholds.
JetConstituentVector::iterator iterator
Electron_v1 Electron
Definition of the current "egamma version".