 |
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)
91 for (
auto& mEntry :
m_mSF)
111 std::unique_ptr<TFile> fSF( TFile::Open(sInputFilePath.c_str()) );
113 ATH_MSG_FATAL(
"Could not open file " << sInputFilePath.c_str());
114 return StatusCode::FAILURE;
124 return StatusCode::FAILURE;
134 return StatusCode::SUCCESS;
151 bool compatibility =
true;
158 accTESCompatibility(xTau) =
char(compatibility);
178 double dCorrection = 1.;
183 tmpCorrectionCode =
getValue(
"sf"+sProng,
188 return tmpCorrectionCode;
195 double dTotalSystematic2 = 0.;
196 double dDirection = 0.;
203 double dUncertaintySyst = 0.;
204 tmpCorrectionCode =
getValue(
it->second+sProng,
209 return tmpCorrectionCode;
212 dDirection = syst.parameter();
215 dUncertaintySyst *= dDirection;
218 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
222 dDirection = (dDirection > 0.) ? 1. : -1.;
225 dCorrection *= 1 + dDirection * std::sqrt(dTotalSystematic2);
232 xTau.
eta(), xTau.
phi(), xTau.
m());
249 "There's a possible memory leak!" );
267 return sys.find(systematic) !=
sys.end();
307 return StatusCode::SUCCESS;
311 double dDirection = 0.;
313 for (
auto& sSyst : sSystematicSet)
319 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
323 if (sSyst.parameter() * dDirection < 0)
325 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
327 return StatusCode::FAILURE;
329 dDirection = sSyst.parameter();
333 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_SME_TOTAL\" with other systematic variations!");
335 return StatusCode::FAILURE;
339 sSystematicSetAvailable.
insert(sSyst);
345 return StatusCode::SUCCESS;
358 return StatusCode::SUCCESS;
365 return StatusCode::SUCCESS;
371 return fProngness == 1 ?
"_1p" :
"_3p";
383 TIter itNext(fFile->GetListOfKeys());
384 while ((kKey = (TKey*)itNext()))
386 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
390 std::string sKeyName = kKey->GetName();
391 if (sKeyName ==
"Xaxis")
393 TNamed* tObj = (TNamed*)kKey->ReadObj();
394 std::string sTitle = tObj->GetTitle();
396 if (sTitle ==
"P" || sTitle ==
"PFinalCalib")
402 if (sKeyName ==
"Yaxis")
404 TNamed* tObj = (TNamed*)kKey->ReadObj();
405 std::string sTitle = tObj->GetTitle();
407 if (sTitle ==
"track-eta")
412 else 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);
508 dPt =
std::max(dPt,hHist->GetXaxis()->GetXmin());
511 dPt =
std::min(dPt,hHist->GetXaxis()->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));
def retrieve(aClass, aKey=None)
bool getTESCompatibility(const xAOD::TauJet &tau) const
Check if MVA TES and CaloTES are compatible, invoked by TauSmearing tool.
virtual double eta() const
The pseudorapidity ( ) of the particle.
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.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a tau jet.
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, float &out)
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.
double ptFinalCalib() const
bool eventType(EventType type) const
Check for one particular bitmask value.