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;
156 bool compatibility =
true;
163 accTESCompatibility(xTau) = char(compatibility);
183 double dCorrection = 1.;
188 tmpCorrectionCode =
getValue(
"sf"+sProng,
193 return tmpCorrectionCode;
200 double dTotalSystematic2 = 0.;
201 double dDirection = 0.;
208 double dUncertaintySyst = 0.;
209 tmpCorrectionCode =
getValue(it->second+sProng,
214 return tmpCorrectionCode;
217 dDirection = syst.parameter();
220 dUncertaintySyst *= dDirection;
223 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
227 dDirection = (dDirection > 0.) ? 1. : -1.;
230 dCorrection *= 1 + dDirection * std::sqrt(dTotalSystematic2);
237 xTau.
eta(), xTau.
phi(), xTau.
m());
254 "There's a possible memory leak!" );
259 xTauCopy->makePrivateStore( xTau );
272 return sys.find(systematic) != sys.end();
312 return StatusCode::SUCCESS;
316 double dDirection = 0.;
318 for (
auto& sSyst : sSystematicSet)
324 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
328 if (sSyst.parameter() * dDirection < 0)
330 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
332 return StatusCode::FAILURE;
334 dDirection = sSyst.parameter();
338 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_SME_TOTAL\" with other systematic variations!");
340 return StatusCode::FAILURE;
344 sSystematicSetAvailable.
insert(sSyst);
350 return StatusCode::SUCCESS;
363 return StatusCode::SUCCESS;
370 return StatusCode::SUCCESS;
376 return fProngness == 1 ?
"_1p" :
"_3p";
388 TIter itNext(fFile->GetListOfKeys());
389 while ((kKey = (TKey*)itNext()))
391 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
395 std::string sKeyName = kKey->GetName();
396 if (sKeyName ==
"Xaxis")
398 TNamed* tObj = (TNamed*)kKey->ReadObj();
399 std::string sTitle = tObj->GetTitle();
407 if (sKeyName ==
"Yaxis")
409 TNamed* tObj = (TNamed*)kKey->ReadObj();
410 std::string sTitle = tObj->GetTitle();
412 if (sTitle ==
"|eta|")
418 if (!cClass->InheritsFrom(
"TH1"))
420 T tObj = (T)kKey->ReadObj();
421 tObj->SetDirectory(0);
422 mMap[sKeyName] = tObj;
430 std::vector<std::string> vInputFilePath;
432 std::string sInputFileName = vInputFilePath.back();
435 std::vector<std::string> vSplitInputFilePath = {};
436 split(sInputFileName,
'_',vSplitInputFilePath);
437 std::string sEfficiencyType = vSplitInputFilePath.at(0);
438 std::string sTruthType = vSplitInputFilePath.at(1);
439 std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
440 std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
441 std::string sSystematicBaseString =
"TAUS_" + sTruthType +
"_SME_" + sEfficiencyType +
"_";
447 for (
auto& mSF :
m_mSF)
450 std::vector<std::string> vSplitNP = {};
451 split(mSF.first,
'_',vSplitNP);
453 std::string sNPUppercase;
454 if (vSplitNP.size() > 2)
456 sNP = vSplitNP.at(0)+
'_'+vSplitNP.at(1);
457 sNPUppercase = vSplitNP.at(0) +
'_' + vSplitNP.at(1);
459 sNP = vSplitNP.at(0);
460 sNPUppercase = vSplitNP.at(0);
464 if (sNP ==
"sf")
continue;
466 if (mSF.first.find(
"_1p") == std::string::npos)
continue;
469 bool bIsRecommended =
false;
470 if (isupper(sNP.at(0)))
471 bIsRecommended =
true;
474 std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
475 std::string sSystematicString = sSystematicBaseString + sNPUppercase;
487 ATH_MSG_DEBUG(
"connected histogram base name " << sNP <<
" with systematic " << sSystematicString);
495 double& dEfficiencyScaleFactor)
const
497 TH1* hHist =
m_mSF.at(sHistName);
498 if (hHist ==
nullptr)
500 ATH_MSG_ERROR(
"Histogram with name " << sHistName <<
" was not found in input file.");
504 double dPt =
m_fX(xTau);
505 double dEta =
m_fY(xTau);
508 dPt = std::max(dPt,hHist->GetXaxis()->GetXmin());
509 dEta = std::max(dEta,hHist->GetYaxis()->GetXmin());
511 dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
512 dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
514 int iBin = hHist->FindFixBin(dPt,dEta);
515 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
519 std::string sTitle = hHist->GetTitle();
522 TF1 f(
"",sTitle.c_str(), 0, 1000);
523 if (sHistName.find(
"sf_") != std::string::npos)
524 dEfficiencyScaleFactor = (dEfficiencyScaleFactor -1.) *f.Eval(
m_fX(xTau)) + 1.;
526 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.
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".