31 constexpr
bool same(
char const *
x,
char const *
y) {
32 return !*
x && !*
y ?
true : (*
x == *
y && same(
x + 1,
y + 1));
36 constexpr
T keyToValue(
char const *
label, entry<T>
const *entries) {
37 return !entries->label ? entries->value
38 : same(entries->label,
label) ? entries->value
39 : keyToValue(
label, entries + 1);
43 constexpr
char const *valueToKey(
T value, entry<T>
const *entries) {
44 return !entries->label ? entries->label
45 : entries->value ==
value ? entries->label
46 : valueToKey(
value, entries + 1);
48 constexpr entry<l1t::L1GtBoardType> l1GtBoardTypeStringToEnumMap[] = {
52 constexpr entry<l1t::GtConditionType> l1GtConditionTypeStringToEnumMap[] = {
90 constexpr entry<l1t::GtConditionCategory> l1GtConditionCategoryStringToEnumMap[] = {
109 <<
"' is not a recognized l1t::L1GtBoardType. \n Return l1t::BoardNull.";
114 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::BoardNull means no valid board type defined!";
121 char const *
result = valueToKey(boardType, l1GtBoardTypeStringToEnumMap);
123 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::BoardNull means no valid board type defined!";
126 edm::LogInfo(
"L1TGlobal") <<
"\n '" << boardType <<
"' is not a recognized l1t::L1GtBoardType. " 127 <<
"\n Return l1t::BoardNull, which means no valid board type defined!";
128 return "l1t::BoardNull";
140 <<
"' is not a recognized l1t::GtConditionType. \n Return l1t::TypeNull.";
146 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::TypeNull means no valid condition type defined!";
153 const char *
result = valueToKey(conditionType, l1GtConditionTypeStringToEnumMap);
155 edm::LogInfo(
"L1TGlobal") <<
"\n Return l1t::TypeNull, which means no valid condition type defined!";
158 edm::LogInfo(
"L1TGlobal") <<
"\n '" << conditionType <<
"' is not a recognized l1t::GtConditionType. " 159 <<
"\n Return l1t::TypeNull, which means no valid condition type defined!";
170 <<
"' is not a recognized l1t::GtConditionCategory. \n Return l1t::CondNull.";
176 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::CondNull means no valid condition category defined!";
183 char const *
result = valueToKey(conditionCategory, l1GtConditionCategoryStringToEnumMap);
185 edm::LogInfo(
"L1TGlobal") <<
"\n Return l1t::CondNull, which means no valid condition category defined!";
189 edm::LogInfo(
"L1TGlobal") <<
"\n '" << conditionCategory <<
"' is not a recognized l1t::GtConditionCategory. " 190 <<
"\n Return l1t::CondNull, which means no valid condition category defined!";
L1GtBoardType
board types in GT
std::string l1GtConditionTypeEnumToString(const GtConditionType &)
std::string l1GtBoardTypeEnumToString(const L1GtBoardType &)
GtConditionCategory
condition categories
GtConditionCategory l1GtConditionCategoryStringToEnum(const std::string &)
Log< level::Info, false > LogInfo
std::string l1GtConditionCategoryEnumToString(const GtConditionCategory &)
L1GtBoardType l1GtBoardTypeStringToEnum(const std::string &)
GtConditionType l1GtConditionTypeStringToEnum(const std::string &)