 |
ATLAS Offline Software
|
Go to the documentation of this file.
44 m_rootTool_unc(nullptr),
45 m_rootTool_con(nullptr),
46 m_appliedSystematics(nullptr),
56 "File that stores the correction factors for simulation for converted photons");
59 "File that stores the correction factors for simulation for unconverted photons");
61 declareProperty(
"MapFilePath",
m_mapFile =
"PhotonEfficiencyCorrection/2015_2025/rel22.2/2024_FinalRun2_Recommendation_v1/map1.txt",
62 "Full path to the map file");
65 "Force the DataType of the Photon to specified value");
71 declareProperty(
"IsoKey",
m_isoWP=
"",
"Set isolation WP, if this string is empty the tool will return ID SF");
78 "Set if use RandomRunNumber from eventinfo");
80 "Set default run number manually");
82 "boolean to treat barrel standalone TRT conversion as unconverted for Run3 ");
102 std::vector < std::string > corrFileNameList;
114 ATH_MSG_ERROR (
"Fail to resolve input file name, check if you set MapFilePath or CorrectionFileName properly" );
115 return StatusCode::FAILURE ;
119 for (
auto &
i : corrFileNameList){
126 return StatusCode::FAILURE ;
153 ATH_MSG_ERROR(
"Could not initialize the TElectronEfficiencyCorrectionTool!");
154 return StatusCode::FAILURE;
160 std::map<float, std::vector<float>> pteta_bins_unc;
165 for (
const auto& [pt_unc, eta_unc]: pteta_bins_unc) {
171 return StatusCode::FAILURE;
174 return StatusCode::SUCCESS ;
194 const double energy = cluster(
acc.clusterEAcc);
196 if ( std::abs(egam(
acc.etaAcc)) < 999.) {
197 const double cosheta = std::cosh(egam(
acc.etaAcc));
198 et = (cosheta != 0.) ?
energy / cosheta : 0.;
202 double eta2 = cluster(
acc.clusterEtaBEAcc,2);
207 std::map<float, std::vector<float>>::const_iterator itr_pt =
m_pteta_bins.begin();
217 <<
eta2 <<
" Returning SF = 1 + / - 1");
224 <<
et <<
" Returning SF = 1 + / - 1");
231 <<
et / 1
e3 <<
"GeV Returning SF = 1 + / - 1");
238 if (!
acc.randomRunNumberAcc.isAvailable(eventInfo)) {
240 "Pileup tool not run before using PhotonEfficiencyTool! SFs do not "
241 "reflect PU distribution in data");
257 bool excludeTRT =
false;
260 const auto [isConv, missingLinks] =
acc.isConvertedPhotonAcc(egam, excludeTRT);
263 ATH_MSG_ERROR(
"Missing vertex or track links when trying to calculate the conversion type. missingLinks=" << std::hex << missingLinks);
266 static std::atomic<bool> warned {
false};
267 if (warned.exchange(
true) ==
false) {
268 ATH_MSG_WARNING(
"Missing vertex or track links when trying to calculate the conversion type. missingLinks=" << std::hex << missingLinks);
269 ATH_MSG_WARNING(
"This may indicate that the DAOD is incorrectly missing some conversion vertices.");
270 ATH_MSG_WARNING(
"This is your only warning, repeat occurrences will be reported at the DEBUG level.");
272 ATH_MSG_DEBUG(
"Missing vertex or track links when trying to calculate the conversion type. missingLinks=" << std::hex << missingLinks);
319 efficiencyScaleFactor=sfresult.
SF;
352 efficiencyScaleFactorError=sfresult.
Total;
358 double efficiencyScaleFactor = 1.0;
361 dec(inputObject) = efficiencyScaleFactor;
369 if(!systematic.
empty()){
371 return sys.find(systematic) !=
sys.end();
391 if (
registry.registerSystematics(*
this) != StatusCode::SUCCESS) {
392 ATH_MSG_ERROR(
"Failed to add systematic to list of recommended systematics.");
393 return StatusCode::FAILURE;
395 return StatusCode::SUCCESS;
420 ATH_MSG_ERROR(
"Unsupported combination of systematics passed to the tool!");
421 return StatusCode::FAILURE;
424 itr =
m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first;
429 return StatusCode::SUCCESS;
440 if(mapFileName.empty()){
446 std::string correction_type =
"ID_Tight";
447 if(!trigWP.empty()) correction_type =
"Trigger_"+trigWP+
"_"+isoWP;
448 else if(!isoWP.empty()) correction_type =
"ISO_"+isoWP;
451 if(trigWP.empty()) {correction_type += isConv ?
"_Converted" :
"_Unconverted";}
456 std::ifstream is(mapFileName);
465 int nPos = strLine.find(
'=');
467 if ((
signed int)std::string::npos == nPos)
continue;
468 std::string strKey = strLine.substr(0,nPos);
469 std::string strVal = strLine.substr(nPos + 1, strLine.length() - nPos + 1);
472 if(0==correction_type.compare(strKey)) {
value=strVal;
break;}
482 for (
auto photon : photons)
492 case OutOfValidityRange:
497 throw std::runtime_error(
"Error in getEfficiencyScaleFactor");
507 auto eventInfo =
acc.eventInfoAcc(
event);
Extra patterns decribing particle interation process.
std::string find(const std::string &s)
return a remapped string
Class to wrap a set of SystematicVariations.
a class representing a continuous sequence of objects (a.k.a. a container)
float getParameterByBaseName(const std::string &basename) const
returns: the parameter value for the given basename
ErrorCode
Possible values for the correction code.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
@ OutOfValidityRange
Input object is out of validity range.
@ Error
Some error happened during the object correction.
POOL::TEvent event(POOL::TEvent::kClassAccess)
Helper class to provide type-safe access to aux data.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
MsgStream & msg() const
The standard message stream.
a class representing a single object (electron, muons, etc.)
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Class describing the basic event information.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
@ Ok
The correction was done successfully.
#define ATH_MSG_WARNING(x)
bool empty() const
returns: whether this is an empty systematic, i.e.
This module implements the central registry for handling systematic uncertainties with CP tools.
Return value from object correction CP tools.
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.