90 for (
auto& mEntry :
m_mSF)
110 std::unique_ptr<TFile> fSF( TFile::Open(sInputFilePath.c_str()) );
112 ATH_MSG_FATAL(
"Could not open file " << sInputFilePath.c_str());
113 return StatusCode::FAILURE;
123 return StatusCode::FAILURE;
133 return StatusCode::SUCCESS;
150 bool compatibility =
true;
157 accTESCompatibility(xTau) = char(compatibility);
177 double dCorrection = 1.;
182 tmpCorrectionCode =
getValue(
"sf"+sProng,
187 return tmpCorrectionCode;
194 double dTotalSystematic2 = 0.;
195 double dDirection = 0.;
202 double dUncertaintySyst = 0.;
203 tmpCorrectionCode =
getValue(it->second+sProng,
208 return tmpCorrectionCode;
211 dDirection = syst.parameter();
214 dUncertaintySyst *= dDirection;
217 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
221 dDirection = (dDirection > 0.) ? 1. : -1.;
224 dCorrection *= 1 + dDirection * std::sqrt(dTotalSystematic2);
231 xTau.
eta(), xTau.
phi(), xTau.
m());
248 "There's a possible memory leak!" );
266 return sys.find(systematic) != sys.end();
306 return StatusCode::SUCCESS;
310 double dDirection = 0.;
312 for (
auto& sSyst : sSystematicSet)
318 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
322 if (sSyst.parameter() * dDirection < 0)
324 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
326 return StatusCode::FAILURE;
328 dDirection = sSyst.parameter();
332 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_SME_TOTAL\" with other systematic variations!");
334 return StatusCode::FAILURE;
338 sSystematicSetAvailable.
insert(sSyst);
344 return StatusCode::SUCCESS;
357 return StatusCode::SUCCESS;
364 return StatusCode::SUCCESS;
370 return fProngness == 1 ?
"_1p" :
"_3p";
382 TIter itNext(fFile->GetListOfKeys());
383 while ((kKey = (TKey*)itNext()))
385 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
389 std::string sKeyName = kKey->GetName();
390 if (sKeyName ==
"Xaxis")
392 TNamed* tObj = (TNamed*)kKey->ReadObj();
393 std::string sTitle = tObj->GetTitle();
401 if (sKeyName ==
"Yaxis")
403 TNamed* tObj = (TNamed*)kKey->ReadObj();
404 std::string sTitle = tObj->GetTitle();
406 if (sTitle ==
"|eta|")
412 if (!cClass->InheritsFrom(
"TH1"))
414 T tObj = (T)kKey->ReadObj();
415 tObj->SetDirectory(0);
416 mMap[sKeyName] = tObj;
424 std::vector<std::string> vInputFilePath;
426 std::string sInputFileName = vInputFilePath.back();
429 std::vector<std::string> vSplitInputFilePath = {};
430 split(sInputFileName,
'_',vSplitInputFilePath);
431 std::string sEfficiencyType = vSplitInputFilePath.at(0);
432 std::string sTruthType = vSplitInputFilePath.at(1);
433 std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
434 std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
435 std::string sSystematicBaseString =
"TAUS_" + sTruthType +
"_SME_" + sEfficiencyType +
"_";
441 for (
auto& mSF :
m_mSF)
444 std::vector<std::string> vSplitNP = {};
445 split(mSF.first,
'_',vSplitNP);
447 std::string sNPUppercase;
448 if (vSplitNP.size() > 2)
450 sNP = vSplitNP.at(0)+
'_'+vSplitNP.at(1);
451 sNPUppercase = vSplitNP.at(0) +
'_' + vSplitNP.at(1);
453 sNP = vSplitNP.at(0);
454 sNPUppercase = vSplitNP.at(0);
458 if (sNP ==
"sf")
continue;
460 if (mSF.first.find(
"_1p") == std::string::npos)
continue;
463 bool bIsRecommended =
false;
464 if (isupper(sNP.at(0)))
465 bIsRecommended =
true;
468 std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
469 std::string sSystematicString = sSystematicBaseString + sNPUppercase;
481 ATH_MSG_DEBUG(
"connected histogram base name " << sNP <<
" with systematic " << sSystematicString);
489 double& dEfficiencyScaleFactor)
const
491 TH1* hHist =
m_mSF.at(sHistName);
492 if (hHist ==
nullptr)
494 ATH_MSG_ERROR(
"Histogram with name " << sHistName <<
" was not found in input file.");
498 double dPt =
m_fX(xTau);
499 double dEta =
m_fY(xTau);
502 dPt = std::max(dPt,hHist->GetXaxis()->GetXmin());
503 dEta = std::max(dEta,hHist->GetYaxis()->GetXmin());
505 dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
506 dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
508 int iBin = hHist->FindFixBin(dPt,dEta);
509 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
513 std::string sTitle = hHist->GetTitle();
516 TF1 f(
"",sTitle.c_str(), 0, 1000);
517 if (sHistName.find(
"sf_") != std::string::npos)
518 dEfficiencyScaleFactor = (dEfficiencyScaleFactor -1.) *f.Eval(
m_fX(xTau)) + 1.;
520 dEfficiencyScaleFactor *= f.Eval(
m_fX(xTau));
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(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.
@ Ok
The correction was done successfully.
Class to wrap a set of SystematicVariations.
std::string name() const
returns: the systematics joined into a single string.
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
size_t size() const
returns: size of the set
Helper class to provide type-safe access to aux data.
void makePrivateStore()
Create a new (empty) private store for this object.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
bool getTESCompatibility(const xAOD::TauJet &tau) const
Check if MVA TES and CaloTES are compatible, invoked by TauSmearing tool.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
double ptFinalCalib() const
virtual double m() const
The invariant mass of the particle.
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
EventInfo_v1 EventInfo
Definition of the latest event info version.
TauJet_v3 TauJet
Definition of the current "tau version".