CMS 3D CMS Logo

GlobalObject.cc
Go to the documentation of this file.
1 
17 
20  unsigned int nMatches = 0;
21 
22  for (auto const& [value, name] : l1t::kGlobalObjectEnumStringPairs) {
23  if (name == label) {
24  ++nMatches;
25  ret = value;
26  }
27  }
28 
29  if (nMatches == 0) {
30  edm::LogWarning("l1tGlobalObjectStringToEnum")
31  << "Failed to find l1t::GlobalObject corresponding to \"" << label << "\"."
32  << " Will return l1t::ObjNull (" << ret << ").";
33  } else if (nMatches > 1) {
34  edm::LogError("l1tGlobalObjectStringToEnum")
35  << "Multiple matches (" << nMatches << ") found for label \"" << label << "\"."
36  << " Will return last valid match (" << ret << ")."
37  << " Please remove duplicates from l1t::kGlobalObjectEnumStringPairs !!";
38  }
39 
40  return ret;
41 }
42 
44  std::string ret = "ObjNull";
45  unsigned int nMatches = 0;
46 
47  for (auto const& [value, name] : l1t::kGlobalObjectEnumStringPairs) {
48  if (value == gtObject) {
49  ++nMatches;
50  ret = name;
51  }
52  }
53 
54  if (nMatches == 0) {
55  edm::LogWarning("l1TGtObjectEnumToString") << "Failed to find l1t::GlobalObject with a value of " << gtObject << "."
56  << " Will return \"" << ret << "\".";
57  } else if (nMatches > 1) {
58  edm::LogError("l1TGtObjectEnumToString")
59  << "Multiple matches (" << nMatches << ") found for l1t::GlobalObject value of " << gtObject
60  << ". Will return last valid match (\"" << ret << "\")."
61  << " Please remove duplicates from l1t::kGlobalObjectEnumStringPairs !!";
62  }
63 
64  return ret;
65 }
ret
prodAgent to be discontinued
GlobalObject
Definition: GlobalObject.h:30
Log< level::Error, false > LogError
char const * label
const std::vector< std::pair< GlobalObject, std::string > > kGlobalObjectEnumStringPairs
Definition: GlobalObject.h:66
l1t::GlobalObject GlobalObjectStringToEnum(const std::string &)
Definition: GlobalObject.cc:18
Definition: value.py:1
std::string GlobalObjectEnumToString(const GlobalObject &)
Log< level::Warning, false > LogWarning