5#ifndef JETUNCERTAINTIES_OPTIONHELPER_H
6#define JETUNCERTAINTIES_OPTIONHELPER_H
28 bool Initialize(
const std::vector<TString>& options);
168 TString
getOptionValue(
const std::vector<TString>& options,
const TString optionName)
const;
169 template <
typename T>
171 std::vector<TString>
getCompareVals(
const std::vector<TString>& options)
const;
175 std::vector<double>
getBins(
const TString& toParse)
const;
237 ,
m_inputsDir(
"/eos/atlas/atlascerngroupdisk/perf-jets/JetUncertainties/Inputs/")
246 ATH_MSG_ERROR(
"The tool has already been initialized, blocking re-initialization");
252 if (!options.size())
return true;
277 if (range.size() != 2)
278 ATH_MSG_WARNING(
"xAxisRange doesn't match expected format of \"val1&val2\". Skipping.");
281 const double lowX = range.at(0);
282 const double highX = range.at(1);
293 if (shift.size() != 2)
294 ATH_MSG_WARNING(
"FillLabelShift doesn't match expected format of \"val1&val2\". Skipping.");
297 const double lowShift = shift.at(0);
298 const double highShift = shift.at(1);
319 TString largeRJetTruthLabelStr =
getOptionValue(options,
"LargeRJetTruthLabel");
320 if (largeRJetTruthLabelStr !=
"")
325 ATH_MSG_WARNING(
"LargeRJetTruthLabel is UNKNOWN value, skipping usage: " << largeRJetTruthLabelStr.Data());
336 ATH_MSG_ERROR(
"The composition was double-specified, please check that you don't specify both \"Composition\" and \"isDijet\"");
337 throw std::runtime_error(
"Double composition failure");
363 if (localScaleVar ==
"")
371 for (
size_t iVar = 0; iVar < localScaleVarVec.size(); ++iVar)
375 if (jetTopology !=
"")
380 ATH_MSG_ERROR(
"The topology specified is invalid: " << jetTopology.Data());
381 throw std::runtime_error(
"Topology failure");
385 const TString systFilterString =
getOptionValue(options,
"VariablesToShift");
386 if (systFilterString !=
"")
395 for (
size_t iOpt = 0; iOpt < options.size(); ++iOpt)
398 if (option.size() != 2)
400 printf(
"Bad option, check formatting: %s\n",options.at(iOpt).Data());
403 if (!option.at(0).CompareTo(optionName,TString::kIgnoreCase))
420 std::vector<TString> returnVal;
421 for (
int i=1; i> 0; i++) {
422 TString optname = TString::Format(
"compareConfig%i",i);
424 if (thisname !=
"") returnVal.push_back(thisname);
435 ATH_MSG_FATAL(
"Asked for a value before initializing the tool");
436 throw std::runtime_error(
"Initialization failure");
452 if (tokens.size() != 4)
454 ATH_MSG_FATAL(
"Unexpected format for bins: " << toParse.Data());
455 throw std::runtime_error(
"Parse failure");
459 const bool isUniform = (tokens.at(0) ==
"U") || (tokens.at(0) ==
"u");
460 const bool isLog = (tokens.at(0) ==
"L") || (tokens.at(0) ==
"l");
461 if (!isUniform && !isLog)
463 ATH_MSG_FATAL(
"Unexpected binning type (token 0), only U/u and L/l are currently supported: " << toParse.Data());
464 throw std::runtime_error(
"Parse failure");
468 unsigned numBins = 0;
471 ATH_MSG_FATAL(
"Number of bins (token 1) was not an unsigned int: " << toParse.Data());
472 throw std::runtime_error(
"Parse failure");
476 double minVal = 0, maxVal = 0;
479 ATH_MSG_FATAL(
"Number of bins (token 2) was not a double: " << toParse.Data());
480 throw std::runtime_error(
"Parse failure");
484 ATH_MSG_FATAL(
"Number of bins (token 3) was not a double: " << toParse.Data());
485 throw std::runtime_error(
"Parse failure");
489 ATH_MSG_FATAL(
"The maximum value is smaller than the minimum: " << toParse.Data());
490 throw std::runtime_error(
"Parse failure");
504 std::vector<double>
bins;
523 std::vector<double>
bins;
537 std::vector<double>
bins;
553 std::vector<double>
bins;
573 std::vector<double>
bins;
585 bins =
jet::utils::vectorize<double>(
"0.001,0.05,0.101,0.15,0.201,0.25,0.301,0.35,0.401,0.45,0.501,0.55,0.601,0.65,0.701,0.75,0.801,0.85,0.901,0.95,1.001",
",");
593 std::vector<double>
bins;
614 if (!
m_composition.CompareTo(
"Unknown",TString::kIgnoreCase))
623 throw std::runtime_error(
"Composition path failure");
633 return "unknown composition";
637 return "custom composition";
642 if (!
m_composition.CompareTo(
"Unknown",TString::kIgnoreCase))
643 return "unknown composition";
645 return "inclusive jets";
647 return "Gino's composition";
652 throw std::runtime_error(
"Composition name failure");
#define ATH_MSG_WARNING(x)
static const std::vector< std::string > bins
Class mimicking the AthMessaging class from the offline software.
AsgMessaging(const std::string &name)
Constructor with a name.
TString GetCompositionName() const
TString GetCalibArea() const
T getOptionValueWithDefault(const std::vector< TString > &options, const TString optionName, const T defaultVal)
TString GetCompositionPath() const
TString getMassType() const
TString m_truthLabelMoment
bool IgnoreNoMatch() const
bool IsSpecialComposition() const
std::pair< double, double > m_fillShift
std::vector< TString > m_compareVals
TString m_fixedMoverPtVals
std::vector< double > GetFixedEtaVals() const
bool SpecifyTagger() const
bool IsPublicFormat() const
std::pair< double, double > m_xAxisRange
std::pair< double, double > fillShift() const
std::vector< TString > getCompareVals(const std::vector< TString > &options) const
TString DoCompare() const
JetTopology::TypeEnum GetTopology() const
std::vector< double > GetEtaBins() const
std::vector< CompScaleVar::TypeEnum > m_scaleVars
std::vector< TString > GetCompareVals() const
TString GetNamePrefix() const
TString GetInputsDir() const
bool Initialize(const std::vector< TString > &options)
std::vector< double > GetFixedMoverPtVals() const
std::vector< double > GetFixedMassVals() const
int GetNjetFlavour() const
OptionHelper(const std::string &name="OptionHelper")
std::vector< std::string > m_systFilters
int FixedLargeRJetTagAccept() const
TString GetDumpFile() const
int FixedTruthLabel() const
bool DoATLASLabel() const
std::vector< double > GetPtBins() const
TString GetBunchSpacing() const
std::vector< double > GetFixedPtVals() const
JetTopology::TypeEnum m_topology
LargeRJetTruthLabel::TypeEnum m_largeRJetTruthLabel
const std::vector< std::string > VariablesToShift() const
LargeRJetTruthLabel::TypeEnum FixedLargeRJetTruthLabel() const
std::vector< CompScaleVar::TypeEnum > GetScaleVars() const
TString m_largeRjetTagResultName
std::pair< double, double > xAxisRange() const
bool TwoColumnLegend() const
TString TagScaleFactorName() const
TString TruthLabelMoment() const
TString GetATLASLabel() const
std::vector< double > getBins(const TString &toParse) const
TString getOptionValue(const std::vector< TString > &options, const TString optionName) const
bool IsEtaDepPileup() const
TString FixedLargeRJetTagResultName() const
TString TotalUncName() const
TypeEnum stringToEnum(const TString &name)
TypeEnum stringToEnum(const TString &type)
TypeEnum stringToEnum(const TString &type)
std::vector< double > getLogBins(const size_t numBins, const double minVal, const double maxVal)
bool getTypeObjFromString(const std::string &str, T &obj)
bool vectorize(const TString &str, const TString &sep, std::vector< T > &result)
std::vector< double > getUniformBins(const size_t numBins, const double minVal, const double maxVal)