![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
75 :
asg::AsgMetadataTool( sName )
76 , m_sSystematicSet(nullptr)
80 , m_bIsConfigured(false)
81 , m_tTauCombinedTES(
"TauCombinedTES", this)
96 for (
auto& mEntry :
m_mSF)
116 std::unique_ptr<TFile> fSF( TFile::Open(sInputFilePath.c_str()) );
118 ATH_MSG_FATAL(
"Could not open file " << sInputFilePath.c_str());
119 return StatusCode::FAILURE;
129 return StatusCode::FAILURE;
139 return StatusCode::SUCCESS;
157 bool useCaloPt =
false;
170 accUseCaloPt(xTau) =
char(useCaloPt);
190 double dCorrection = 1.;
195 tmpCorrectionCode =
getValue(
"sf"+sProng,
200 return tmpCorrectionCode;
207 double dTotalSystematic2 = 0.;
208 double dDirection = 0.;
215 double dUncertaintySyst = 0.;
216 tmpCorrectionCode =
getValue(
it->second+sProng,
221 return tmpCorrectionCode;
224 dDirection = syst.parameter();
227 dUncertaintySyst *= dDirection;
230 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
234 dDirection = (dDirection > 0.) ? 1. : -1.;
237 dCorrection *= 1 + dDirection * std::sqrt(dTotalSystematic2);
244 xTau.
eta(), xTau.
phi(), xTau.
m());
261 "There's a possible memory leak!" );
279 return sys.find(systematic) !=
sys.end();
319 return StatusCode::SUCCESS;
323 double dDirection = 0.;
325 for (
auto& sSyst : sSystematicSet)
331 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
335 if (sSyst.parameter() * dDirection < 0)
337 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
339 return StatusCode::FAILURE;
341 dDirection = sSyst.parameter();
345 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_SME_TOTAL\" with other systematic variations!");
347 return StatusCode::FAILURE;
351 sSystematicSetAvailable.
insert(sSyst);
357 return StatusCode::SUCCESS;
370 return StatusCode::SUCCESS;
377 return StatusCode::SUCCESS;
383 return fProngness == 1 ?
"_1p" :
"_3p";
395 TIter itNext(fFile->GetListOfKeys());
396 while ((kKey = (TKey*)itNext()))
398 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
402 std::string sKeyName = kKey->GetName();
403 if (sKeyName ==
"Xaxis")
405 TNamed* tObj = (TNamed*)kKey->ReadObj();
406 std::string sTitle = tObj->GetTitle();
408 if (sTitle ==
"P" || sTitle ==
"PFinalCalib")
414 if (sKeyName ==
"Yaxis")
416 TNamed* tObj = (TNamed*)kKey->ReadObj();
417 std::string sTitle = tObj->GetTitle();
419 if (sTitle ==
"track-eta")
424 else if (sTitle ==
"|eta|")
430 if (!cClass->InheritsFrom(
"TH1"))
432 T tObj = (T)kKey->ReadObj();
433 tObj->SetDirectory(0);
434 mMap[sKeyName] = tObj;
442 std::vector<std::string> vInputFilePath;
444 std::string sInputFileName = vInputFilePath.back();
447 std::vector<std::string> vSplitInputFilePath = {};
448 split(sInputFileName,
'_',vSplitInputFilePath);
449 std::string sEfficiencyType = vSplitInputFilePath.at(0);
450 std::string sTruthType = vSplitInputFilePath.at(1);
451 std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
452 std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
453 std::string sSystematicBaseString =
"TAUS_" + sTruthType +
"_SME_" + sEfficiencyType +
"_";
461 for (
auto& mSF :
m_mSF)
464 std::vector<std::string> vSplitNP = {};
465 split(mSF.first,
'_',vSplitNP);
467 std::string sNPUppercase;
468 if (vSplitNP.size() > 2)
470 sNP = vSplitNP.at(0)+
'_'+vSplitNP.at(1);
471 sNPUppercase = vSplitNP.at(0) +
'_' + vSplitNP.at(1);
473 sNP = vSplitNP.at(0);
474 sNPUppercase = vSplitNP.at(0);
478 if (sNP ==
"sf")
continue;
480 if (mSF.first.find(
"_1p") == std::string::npos)
continue;
483 bool bIsRecommended =
false;
484 if (isupper(sNP.at(0)))
485 bIsRecommended =
true;
488 std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
489 std::string sSystematicString = sSystematicBaseString + sNPUppercase;
501 ATH_MSG_DEBUG(
"connected histogram base name " << sNP <<
" with systematic " << sSystematicString);
509 double& dEfficiencyScaleFactor)
const
511 TH1* hHist =
m_mSF.at(sHistName);
512 if (hHist ==
nullptr)
514 ATH_MSG_ERROR(
"Histogram with name " << sHistName <<
" was not found in input file.");
518 double dPt =
m_fX(xTau);
522 dPt =
std::max(dPt,hHist->GetXaxis()->GetXmin());
525 dPt =
std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
528 int iBin = hHist->FindFixBin(dPt,
dEta);
529 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
533 std::string sTitle = hHist->GetTitle();
536 TF1
f(
"",sTitle.c_str(), 0, 1000);
537 if (sHistName.find(
"sf_") != std::string::npos)
538 dEfficiencyScaleFactor = (dEfficiencyScaleFactor -1.) *
f.Eval(
m_fX(xTau)) + 1.;
540 dEfficiencyScaleFactor *=
f.Eval(
m_fX(xTau));
def retrieve(aClass, aKey=None)
bool getUseCaloPtFlag(const xAOD::TauJet &tau) const
Whether to use calo pt, invoked by TauSmearing tool.
virtual double eta() const
The pseudorapidity ( ) of the particle.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
bool empty() const
returns: whether the set is empty
virtual double m() const
The invariant mass of the particle.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Class to wrap a set of SystematicVariations.
std::string name() const
returns: the systematics joined into a single string.
#define ATH_MSG_VERBOSE(x)
@ IS_SIMULATION
true: simulation, false: data
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ Error
Some error happened during the object correction.
double ptTauEnergyScale() const
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a tau jet.
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
const_iterator end() const
description: const iterator to the end of the set
TauJet_v3 TauJet
Definition of the current "tau version".
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
void makePrivateStore()
Create a new (empty) private store for this object.
Class describing the basic event information.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
iterator find(const SystematicVariation &sys) const
description: find an element in the set
@ Ok
The correction was done successfully.
#define ATH_MSG_WARNING(x)
Return value from object correction CP tools.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Helper class to provide constant type-safe access to aux data.
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
double ptFinalCalib() const
bool eventType(EventType type) const
Check for one particular bitmask value.