47 std::unique_ptr< TFile > fSF( TFile::Open(sInputFilePath.c_str(),
"READ") );
50 ATH_MSG_FATAL(
"Could not open file " << sInputFilePath.c_str());
51 return StatusCode::FAILURE;
61 return StatusCode::FAILURE;
63 return StatusCode::SUCCESS;
84 double dCorrection = 1.;
91 return tmpCorrectionCode;
97 double dTotalSystematic2 = 0;
98 double dDirection = 0;
107 double dUncertaintySyst = 0;
108 tmpCorrectionCode =
getValue(it->second,
114 return tmpCorrectionCode;
117 dDirection = syst.parameter();
120 dUncertaintySyst *= dDirection;
123 dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
127 dDirection = (dDirection > 0) ? +1 : -1;
130 dCorrection *= 1 + dDirection * std::sqrt(dTotalSystematic2);
134 xDiTau.
setP4( xDiTau.
pt() * dCorrection,
135 xDiTau.
eta(), xDiTau.
phi(), xDiTau.
m());
152 "There's a possible memory leak!" );
157 xDiTauCopy->makePrivateStore( xDiTau );
170 return sys.find(systematic) != sys.end();
210 return StatusCode::SUCCESS;
214 double dDirection = 0.;
216 for (
auto& sSyst : sSystematicSet)
222 ATH_MSG_VERBOSE(
"unsupported systematic variation: "<< sSyst.basename()<<
"; skipping this one");
226 if (sSyst.parameter() * dDirection < 0)
228 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
230 return StatusCode::FAILURE;
232 dDirection = sSyst.parameter();
236 ATH_MSG_ERROR(
"unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_SME_TOTAL\" with other systematic variations!");
238 return StatusCode::FAILURE;
242 sSystematicSetAvailable.
insert(sSyst);
248 return StatusCode::SUCCESS;
262 TIter itNext(fFile->GetListOfKeys());
263 while ((kKey = (TKey*)itNext()))
265 TClass *cClass = gROOT->GetClass(kKey->GetClassName());
266 std::string sKeyName = kKey->GetName();
268 if (!cClass->InheritsFrom(
"TH3"))
271 T tObj = (T)kKey->ReadObj();
272 tObj->SetDirectory(0);
273 mMap[sKeyName] = tObj;
281 std::vector<std::string> vInputFilePath;
283 std::string sInputFileName = vInputFilePath.back();
286 std::vector<std::string> vSplitInputFilePath = {};
287 split(sInputFileName,
'_',vSplitInputFilePath);
288 std::string sEfficiencyType = vSplitInputFilePath.at(0);
289 std::string sTruthType = vSplitInputFilePath.at(1);
290 std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
291 std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
292 std::string sSystematicBaseString =
"TAUS_"+sTruthType+
"_SME_"+sEfficiencyType+
"_";
298 for (
const auto & mSF :
m_mDTSF)
301 std::vector<std::string> vSplitNP = {};
302 split(mSF.first,
'_',vSplitNP);
303 std::string sNP = vSplitNP.at(0);
304 std::string sNPUppercase = vSplitNP.at(0);
307 if (sNP ==
"sf")
continue;
310 bool bIsRecommended =
false;
311 if (isupper(sNP.at(0)))
312 bIsRecommended =
true;
315 std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
316 std::string sSystematicString = sSystematicBaseString+sNPUppercase;
328 ATH_MSG_DEBUG(
"connected histogram base name " << sNP <<
" with systematic " <<sSystematicString);
336 double& dEfficiencyScaleFactor)
const
338 TH3* hHist =
m_mDTSF.at(sHistName);
341 ATH_MSG_ERROR(
"Histogram with name "<<sHistName<<
" was not found in input file.");
345 double dX =
m_fX(xDiTau);
346 double dY =
m_fY(xDiTau);
347 double dZ =
m_fZ(xDiTau);
350 dX = std::max(dX,hHist->GetXaxis()->GetXmin());
351 dY = std::max(dY,hHist->GetYaxis()->GetXmin());
352 dZ = std::max(dZ,hHist->GetZaxis()->GetXmin());
354 dX = std::min(dX,hHist->GetXaxis()->GetXmax() * .999);
355 dY = std::min(dY,hHist->GetYaxis()->GetXmax() * .999);
356 dZ = std::min(dZ,hHist->GetZaxis()->GetXmax() * .999);
358 int iBin = hHist->FindFixBin(dX,dY,dZ);
359 dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
367 return StatusCode::SUCCESS;
374 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(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
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double m() const
The invariant mass of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
EventInfo_v1 EventInfo
Definition of the latest event info version.
DiTauJet_v1 DiTauJet
Definition of the current version.