|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef JETUNCERTAINTIES_OPTIONHELPER_H
6 #define JETUNCERTAINTIES_OPTIONHELPER_H
169 template <
typename T>
175 std::vector<double>
getBins(
const TString& toParse)
const;
183 , m_isEtaDepPU(false)
185 , m_compNamePrefix(
"JET_")
189 , m_ignoreNoMatch(false)
191 , m_doATLASLabel(true)
192 , m_ATLASLabel(
"Internal")
195 , m_totalUncName(
"Total uncertainty")
196 , m_specifyTagger(true)
204 , m_twoColumnLegend(false)
210 , m_fixedMoverPtVals(
"")
211 , m_fixedMassVals(
"")
222 , m_truthLabelMoment(
"")
226 , m_largeRjetTagResultName(
"")
227 , m_largeRjetTagAccept(0)
229 , m_onlyCompare(false)
235 , m_topology(JetTopology::UNKNOWN)
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;
276 std::vector<double>
range = jet::utils::vectorize<double>(
xAxisRange,
"&");
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);
292 std::vector<double> shift = jet::utils::vectorize<double>(
fillShift,
"&");
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);
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 ==
"")
370 std::vector<TString> localScaleVarVec = jet::utils::vectorize<TString>(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");
386 if (systFilterString !=
"")
387 m_systFilters = jet::utils::vectorize<std::string>(systFilterString,
",");
395 for (
size_t iOpt = 0; iOpt <
options.size(); ++iOpt)
397 std::vector<TString> option = jet::utils::vectorize<TString>(
options.at(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))
409 template <
typename T>
415 return jet::utils::getTypeObjFromString<T>(optionVal);
420 std::vector<TString> returnVal;
421 for (
int i=1;
i> 0;
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");
449 std::vector<TString>
tokens = jet::utils::vectorize<TString>(toParse,
"&");
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;
545 bins = jet::utils::vectorize<double>(
"25,40,60,80,120",
",");
553 std::vector<double>
bins;
561 bins = jet::utils::vectorize<double>(
"0",
",");
563 bins = jet::utils::vectorize<double>(
"0,0.8,1.2,2.1,2.8,3.2,3.6",
",");
565 bins = jet::utils::vectorize<double>(
"0,0.5,1,2,2.5,3,4",
",");
573 std::vector<double>
bins;
581 bins = jet::utils::vectorize<double>(
"0",
",");
583 bins = jet::utils::vectorize<double>(
"0.101",
",");
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");
std::vector< std::string > m_systFilters
std::vector< TString > getCompareVals(const std::vector< TString > &options) const
JetTopology::TypeEnum GetTopology() const
bool IsSpecialComposition() const
std::vector< TString > GetCompareVals() const
std::vector< double > getUniformBins(const size_t numBins, const double minVal, const double maxVal)
LargeRJetTruthLabel::TypeEnum m_largeRJetTruthLabel
TString m_largeRjetTagResultName
std::vector< double > GetFixedPtVals() const
bool TwoColumnLegend() const
std::vector< double > getLogBins(const size_t numBins, const double minVal, const double maxVal)
TypeEnum stringToEnum(const TString &name)
std::vector< double > GetEtaBins() const
std::vector< double > GetFixedMoverPtVals() const
std::vector< double > GetFixedEtaVals() const
TString GetCompositionPath() const
int FixedTruthLabel() const
T getOptionValueWithDefault(const std::vector< TString > &options, const TString optionName, const T defaultVal)
TString TruthLabelMoment() const
std::vector< CompScaleVar::TypeEnum > GetScaleVars() const
std::vector< double > GetFixedMassVals() const
int GetNjetFlavour() const
TypeEnum stringToEnum(const TString &type)
bool IsEtaDepPileup() const
TString TagScaleFactorName() const
TString TotalUncName() const
bool DoATLASLabel() const
TString m_fixedMoverPtVals
std::pair< double, double > xAxisRange() const
std::pair< double, double > fillShift() const
std::vector< double > getBins(const TString &toParse) const
OptionHelper(const std::string &name="OptionHelper")
TString m_truthLabelMoment
std::pair< double, double > m_xAxisRange
std::string m_path
the path being used
TString GetATLASLabel() const
TString GetDumpFile() const
TString DoCompare() const
bool Initialize(const std::vector< TString > &options)
TString GetBunchSpacing() const
bool IsPublicFormat() const
int FixedLargeRJetTagAccept() const
bool IgnoreNoMatch() const
std::vector< TString > m_compareVals
TString GetInputsDir() const
TString getOptionValue(const std::vector< TString > &options, const TString optionName) const
Class mimicking the AthMessaging class from the offline software.
const std::vector< std::string > VariablesToShift() const
bool SpecifyTagger() const
#define ATH_MSG_WARNING(x)
TString FixedLargeRJetTagResultName() const
TypeEnum stringToEnum(const TString &type)
std::vector< CompScaleVar::TypeEnum > m_scaleVars
bool getTypeObjFromString(const std::string &str, T &obj)
JetTopology::TypeEnum m_topology
LargeRJetTruthLabel::TypeEnum FixedLargeRJetTruthLabel() const
std::vector< double > GetPtBins() const
TString GetNamePrefix() const
TString getMassType() const
TString GetCompositionName() const
std::pair< double, double > m_fillShift
TString GetCalibArea() const