2020namespace o2 ::quality_control_modules::muon
2121{
2222template <>
23- std::string getConfigurationParameter (o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue)
23+ std::string getConfigurationParameter<std::string> (o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue)
2424{
2525 std::string result = defaultValue;
2626 auto parOpt = customParameters.atOptional (parName);
@@ -31,7 +31,7 @@ std::string getConfigurationParameter(o2::quality_control::core::CustomParameter
3131}
3232
3333template <>
34- std::string getConfigurationParameter (o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue, const o2::quality_control::core::Activity& activity)
34+ std::string getConfigurationParameter<std::string> (o2::quality_control::core::CustomParameters customParameters, std::string parName, const std::string defaultValue, const o2::quality_control::core::Activity& activity)
3535{
3636 auto parOpt = customParameters.atOptional (parName, activity);
3737 if (parOpt.has_value ()) {
@@ -41,6 +41,43 @@ std::string getConfigurationParameter(o2::quality_control::core::CustomParameter
4141 return getConfigurationParameter<std::string>(customParameters, parName, defaultValue);
4242}
4343
44+ template <>
45+ bool getConfigurationParameter<bool >(o2::quality_control::core::CustomParameters customParameters, std::string parName, const bool defaultValue)
46+ {
47+ bool result = defaultValue;
48+ auto parOpt = customParameters.atOptional (parName);
49+ if (parOpt.has_value ()) {
50+ std::string value = parOpt.value ();
51+ std::transform (value.begin (), value.end (), value.begin (), ::toupper);
52+ if (value == " TRUE" || value == " YES" || value == " 1" ) {
53+ return true ;
54+ }
55+ if (value == " FALSE" || value == " NO" || value == " 0" ) {
56+ return false ;
57+ }
58+ throw std::invalid_argument (std::string (" error parsing boolean configurable parameter: key=" ) + parName + " value=" + value);
59+ }
60+ return result;
61+ }
62+
63+ template <>
64+ bool getConfigurationParameter<bool >(o2::quality_control::core::CustomParameters customParameters, std::string parName, const bool defaultValue, const o2::quality_control::core::Activity& activity)
65+ {
66+ auto parOpt = customParameters.atOptional (parName, activity);
67+ if (parOpt.has_value ()) {
68+ std::string value = parOpt.value ();
69+ std::transform (value.begin (), value.end (), value.begin (), ::toupper);
70+ if (value == " TRUE" || value == " YES" || value == " 1" ) {
71+ return true ;
72+ }
73+ if (value == " FALSE" || value == " NO" || value == " 0" ) {
74+ return false ;
75+ }
76+ throw std::invalid_argument (std::string (" error parsing boolean configurable parameter: key=" ) + parName + " value=" + value);
77+ }
78+ return getConfigurationParameter<bool >(customParameters, parName, defaultValue);
79+ }
80+
4481// _________________________________________________________________________________________
4582
4683TLine* addHorizontalLine (TH1 & histo, double y,
0 commit comments