 |
ATLAS Offline Software
|
Go to the documentation of this file.
69 :
asg::AsgTool( sName )
71 , m_sSystematicSet(nullptr)
75 , m_bNoMultiprong(false)
77 , m_bSFIsAvailable(false)
78 , m_bSFIsAvailableChecked(false)
88 for (
auto mEntry : *
m_mSF)
89 delete std::get<0>(mEntry.second);
107 m_mSF = std::make_unique< tSFMAP >();
108 std::unique_ptr< TFile > fSF( TFile::Open( sInputFilePath.c_str(),
"READ" ) );
111 ATH_MSG_FATAL(
"Could not open file " << sInputFilePath.c_str());
112 return StatusCode::FAILURE;
119 std::vector<std::string> vInputFilePath;
130 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
142 double& dEfficiencyScaleFactor,
unsigned int )
147 dEfficiencyScaleFactor = 1.;
154 dEfficiencyScaleFactor = 1.;
167 ATH_MSG_WARNING(
"Found tau with unknown decay mode. Skip efficiency correction.");
175 dEfficiencyScaleFactor = 1.;
182 std::string sHistName;
184 sHistName =
"sf_all_"+
m_sWP+sMode;
192 dEfficiencyScaleFactor);
195 return tmpCorrectionCode;
202 double dTotalSystematic2 = 0.;
203 double dDirection = 0.;
210 double dUncertaintySyst = 0.;
213 dDirection = syst.parameter();
216 sHistName =
it->second;
217 if (dDirection>0.) sHistName+=
"_up";
218 else sHistName+=
"_down";
227 if( (sHistName.find(
"3P") != std::string::npos && sHistName.find(
"1p") != std::string::npos) ||
228 (sHistName.find(
"1P") != std::string::npos && sHistName.find(
"3p") != std::string::npos))
231 if( (sHistName.find(
"1520") != std::string::npos && sHistName.find(
"loose") != std::string::npos) ){
236 tmpCorrectionCode =
getValue(sHistName,
242 return tmpCorrectionCode;
245 dUncertaintySyst *= dDirection;
248 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
252 dDirection = (dDirection > 0.) ? 1. : -1.;
255 dEfficiencyScaleFactor *= 1. + dDirection * std::sqrt(dTotalSystematic2);
271 unsigned int iRunNumber)
282 ATH_MSG_DEBUG(
m_sVarName <<
" decoration is available on first tau processed, switched off applyEfficiencyScaleFactor for further taus.");
283 ATH_MSG_DEBUG(
"If an application of efficiency scale factors needs to be redone, please pass a shallow copy of the original tau.");
294 return tmpCorrectionCode;
304 return sys.find(systematic) !=
sys.end();
345 return StatusCode::SUCCESS;
349 double dDirection = 0.;
351 for (
auto sSyst : sSystematicSet)
357 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
362 if (sSyst.parameter() * dDirection < 0)
364 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
366 return StatusCode::FAILURE;
368 dDirection = sSyst.parameter();
372 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_EFF_*_TOTAL\" with other systematic variations!");
374 return StatusCode::FAILURE;
378 sSystematicSetAvailable.
insert(sSyst);
384 return StatusCode::SUCCESS;
390 return fProngness == 1 ?
"_1p" :
"_3p";
435 TIter itNext(fFile.GetListOfKeys());
436 while ((kKey = (TKey*)itNext()))
440 std::string sKeyName = kKey->GetName();
441 if (sKeyName ==
"Xaxis")
443 TNamed* tObj = (TNamed*)kKey->ReadObj();
444 std::string sTitle = tObj->GetTitle();
446 if (sTitle ==
"P" || sTitle ==
"PFinalCalib")
451 if (sTitle ==
"TruthDecayMode")
456 if (sTitle ==
"truth pt")
461 if (sTitle ==
"|eta|")
469 else if (sKeyName ==
"Yaxis")
471 TNamed* tObj = (TNamed*)kKey->ReadObj();
472 std::string sTitle = tObj->GetTitle();
474 if (sTitle ==
"track-eta")
479 else if (sTitle ==
"|eta|")
484 else if (sTitle ==
"mu")
488 if (
evtStore()->retrieve(xEventInfo,
"EventInfo").isFailure()) {
503 else if (sTitle ==
"truth |eta|")
511 std::vector<std::string> vSplitName = {};
512 split(sKeyName,
'_',vSplitName);
513 if (vSplitName[0] ==
"sf")
520 if (sKeyName.find(
"_up_") != std::string::npos or sKeyName.find(
"_down_") != std::string::npos)
524 size_t iPos = sKeyName.find(
'_');
541 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
542 if (cClass->InheritsFrom(
"TH2"))
544 TH1* oObject = (TH1*)kKey->ReadObj();
545 oObject->SetDirectory(0);
549 else if (cClass->InheritsFrom(
"TH1"))
551 TH1* oObject = (TH1*)kKey->ReadObj();
552 oObject->SetDirectory(0);
556 else if (cClass->InheritsFrom(
"TF1"))
558 TObject* oObject = kKey->ReadObj();
585 std::vector<std::string> vSplitInputFilePath = {};
587 std::string sEfficiencyType = vSplitInputFilePath.at(0);
588 std::string sTruthType = vSplitInputFilePath.at(1);
589 std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
590 std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
591 std::string sSystematicBaseString =
"TAUS_"+sTruthType+
"_EFF_"+sEfficiencyType+
"_";
597 if (sEfficiencyType==
"ELERNN" || sEfficiencyType==
"ELEOLR")
m_bNoMultiprong =
true;
599 for (
auto mSF : *
m_mSF)
602 std::vector<std::string> vSplitNP = {};
603 split(mSF.first,
'_',vSplitNP);
604 std::string sNP = vSplitNP.at(0);
605 std::string sNPUppercase = vSplitNP.at(0);
608 if (sNP ==
"sf")
continue;
614 bool bIsRecommended =
false;
615 if (isupper(sNP.at(0)) || isupper(sNP.at(1)))
616 bIsRecommended =
true;
619 std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
620 std::string sSystematicString = sSystematicBaseString+sNPUppercase;
632 ATH_MSG_DEBUG(
"connected base name " << sNP <<
" with systematic " <<sSystematicString);
644 double& dEfficiencyScaleFactor)
const
647 auto it = mSF.find (sHistName);
650 ATH_MSG_ERROR(
"Object with name "<<sHistName<<
" was not found in input file.");
652 for (
auto eEntry : mSF)
661 double dPt =
m_fX(xTau);
664 double dVars[2] = {dPt,
dEta};
668 return (std::get<1>(tTuple))(std::get<0>(tTuple), dEfficiencyScaleFactor, dVars);
678 double& dEfficiencyScaleFactor,
double dVars[])
680 double dPt = dVars[0];
682 const TH1* hHist =
dynamic_cast<const TH1*
>(oObject);
691 dPt =
std::max(dPt,hHist->GetXaxis()->GetXmin());
693 dPt =
std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
696 int iBin = hHist->FindFixBin(dPt);
697 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
708 double& dEfficiencyScaleFactor,
double dVars[])
710 double dPt = dVars[0];
711 double dEta = dVars[1];
713 const TH2* hHist =
dynamic_cast<const TH2*
>(oObject);
722 dPt =
std::max(dPt,hHist->GetXaxis()->GetXmin());
725 dPt =
std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
729 int iBin = hHist->FindFixBin(dPt,
dEta);
730 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
740 double& dEfficiencyScaleFactor,
double dVars[])
742 double dPt = dVars[0];
743 double dEta = dVars[1];
745 const TF1* fFunc =
static_cast<const TF1*
>(oObject);
754 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.