 |
ATLAS Offline Software
|
Go to the documentation of this file.
70 :
asg::AsgTool( sName )
72 , m_sSystematicSet(nullptr)
76 , m_bNoMultiprong(false)
78 , m_bSFIsAvailable(false)
79 , m_bSFIsAvailableChecked(false)
89 for (
auto mEntry : *
m_mSF)
90 delete std::get<0>(mEntry.second);
108 m_mSF = std::make_unique< tSFMAP >();
109 std::unique_ptr< TFile > fSF( TFile::Open( sInputFilePath.c_str(),
"READ" ) );
112 ATH_MSG_FATAL(
"Could not open file " << sInputFilePath.c_str());
113 return StatusCode::FAILURE;
120 std::vector<std::string> vInputFilePath;
131 return StatusCode::FAILURE;
133 return StatusCode::SUCCESS;
143 double& dEfficiencyScaleFactor,
unsigned int )
148 dEfficiencyScaleFactor = 1.;
155 dEfficiencyScaleFactor = 1.;
168 ATH_MSG_WARNING(
"Found tau with unknown decay mode. Skip efficiency correction.");
176 dEfficiencyScaleFactor = 1.;
183 std::string sHistName;
185 sHistName =
"sf_all_"+
m_sWP+sMode;
193 dEfficiencyScaleFactor);
196 return tmpCorrectionCode;
203 double dTotalSystematic2 = 0.;
204 double dDirection = 0.;
211 double dUncertaintySyst = 0.;
214 dDirection = syst.parameter();
217 sHistName =
it->second;
218 if (dDirection>0.) sHistName+=
"_up";
219 else sHistName+=
"_down";
228 if( (sHistName.find(
"3P") != std::string::npos && sHistName.find(
"1p") != std::string::npos) ||
229 (sHistName.find(
"1P") != std::string::npos && sHistName.find(
"3p") != std::string::npos))
232 if( (sHistName.find(
"1520") != std::string::npos && sHistName.find(
"loose") != std::string::npos) ){
237 tmpCorrectionCode =
getValue(sHistName,
243 return tmpCorrectionCode;
246 dUncertaintySyst *= dDirection;
249 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
253 dDirection = (dDirection > 0.) ? 1. : -1.;
256 dEfficiencyScaleFactor *= 1. + dDirection * std::sqrt(dTotalSystematic2);
272 unsigned int iRunNumber)
283 ATH_MSG_DEBUG(
m_sVarName <<
" decoration is available on first tau processed, switched off applyEfficiencyScaleFactor for further taus.");
284 ATH_MSG_DEBUG(
"If an application of efficiency scale factors needs to be redone, please pass a shallow copy of the original tau.");
295 return tmpCorrectionCode;
305 return sys.find(systematic) !=
sys.end();
346 return StatusCode::SUCCESS;
350 double dDirection = 0.;
352 for (
auto sSyst : sSystematicSet)
358 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
363 if (sSyst.parameter() * dDirection < 0)
365 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
367 return StatusCode::FAILURE;
369 dDirection = sSyst.parameter();
373 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_EFF_*_TOTAL\" with other systematic variations!");
375 return StatusCode::FAILURE;
379 sSystematicSetAvailable.
insert(sSyst);
385 return StatusCode::SUCCESS;
391 return fProngness == 1 ?
"_1p" :
"_3p";
436 TIter itNext(fFile.GetListOfKeys());
437 while ((kKey = (TKey*)itNext()))
441 std::string sKeyName = kKey->GetName();
442 if (sKeyName ==
"Xaxis")
444 TNamed* tObj = (TNamed*)kKey->ReadObj();
445 std::string sTitle = tObj->GetTitle();
447 if (sTitle ==
"P" || sTitle ==
"PFinalCalib")
452 if (sTitle ==
"TruthDecayMode")
457 if (sTitle ==
"truth pt")
462 if (sTitle ==
"|eta|")
470 else if (sKeyName ==
"Yaxis")
472 TNamed* tObj = (TNamed*)kKey->ReadObj();
473 std::string sTitle = tObj->GetTitle();
475 if (sTitle ==
"track-eta")
480 else if (sTitle ==
"|eta|")
485 else if (sTitle ==
"mu")
489 if (
evtStore()->retrieve(xEventInfo,
"EventInfo").isFailure()) {
504 else if (sTitle ==
"truth |eta|")
512 std::vector<std::string> vSplitName = {};
513 split(sKeyName,
'_',vSplitName);
514 if (vSplitName[0] ==
"sf")
521 if (sKeyName.find(
"_up_") != std::string::npos or sKeyName.find(
"_down_") != std::string::npos)
525 size_t iPos = sKeyName.find(
'_');
542 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
543 if (cClass->InheritsFrom(
"TH2"))
545 TH1* oObject = (TH1*)kKey->ReadObj();
546 oObject->SetDirectory(0);
550 else if (cClass->InheritsFrom(
"TH1"))
552 TH1* oObject = (TH1*)kKey->ReadObj();
553 oObject->SetDirectory(0);
557 else if (cClass->InheritsFrom(
"TF1"))
559 TObject* oObject = kKey->ReadObj();
586 std::vector<std::string> vSplitInputFilePath = {};
588 std::string sEfficiencyType = vSplitInputFilePath.at(0);
589 std::string sTruthType = vSplitInputFilePath.at(1);
590 std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
591 std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
592 std::string sSystematicBaseString =
"TAUS_"+sTruthType+
"_EFF_"+sEfficiencyType+
"_";
598 if (sEfficiencyType==
"ELERNN" || sEfficiencyType==
"ELEOLR")
m_bNoMultiprong =
true;
600 for (
auto mSF : *
m_mSF)
603 std::vector<std::string> vSplitNP = {};
604 split(mSF.first,
'_',vSplitNP);
605 std::string sNP = vSplitNP.at(0);
606 std::string sNPUppercase = vSplitNP.at(0);
609 if (sNP ==
"sf")
continue;
615 bool bIsRecommended =
false;
616 if (isupper(sNP.at(0)) || isupper(sNP.at(1)))
617 bIsRecommended =
true;
620 std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
621 std::string sSystematicString = sSystematicBaseString+sNPUppercase;
633 ATH_MSG_DEBUG(
"connected base name " << sNP <<
" with systematic " <<sSystematicString);
645 double& dEfficiencyScaleFactor)
const
648 auto it = mSF.find (sHistName);
651 ATH_MSG_ERROR(
"Object with name "<<sHistName<<
" was not found in input file.");
653 for (
auto eEntry : mSF)
662 double dPt =
m_fX(xTau);
665 double dVars[2] = {dPt,
dEta};
669 return (std::get<1>(tTuple))(std::get<0>(tTuple), dEfficiencyScaleFactor, dVars);
679 double& dEfficiencyScaleFactor,
double dVars[])
681 double dPt = dVars[0];
683 const TH1* hHist =
dynamic_cast<const TH1*
>(oObject);
692 dPt =
std::max(dPt,hHist->GetXaxis()->GetXmin());
694 dPt =
std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
697 int iBin = hHist->FindFixBin(dPt);
698 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
709 double& dEfficiencyScaleFactor,
double dVars[])
711 double dPt = dVars[0];
712 double dEta = dVars[1];
714 const TH2* hHist =
dynamic_cast<const TH2*
>(oObject);
723 dPt =
std::max(dPt,hHist->GetXaxis()->GetXmin());
726 dPt =
std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
730 int iBin = hHist->FindFixBin(dPt,
dEta);
731 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
741 double& dEfficiencyScaleFactor,
double dVars[])
743 double dPt = dVars[0];
744 double dEta = dVars[1];
746 const TF1* fFunc =
static_cast<const TF1*
>(oObject);
755 dEfficiencyScaleFactor = fFunc->Eval(dPt,
dEta);
bool empty() const
returns: whether the set is empty
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.
bool panTauDetail(TauJetParameters::PanTauDetails panTauDetail, int &value) const
Get and set values of pantau details variables via enum.
#define ATH_MSG_VERBOSE(x)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
uint32_t runNumber() const
The current event's run number.
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.
Helper class to provide type-safe access to aux data.
::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
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
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)
iterator find(const SystematicVariation &sys) const
description: find an element in the set
@ Ok
The correction was done successfully.
#define ATH_MSG_WARNING(x)
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Return value from object correction CP tools.
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.