CMS 3D CMS Logo

Functions
L1GtObject.cc File Reference
#include "DataFormats/L1GlobalTrigger/interface/L1GtObject.h"
#include <cstring>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

std::string l1GtObjectEnumToString (const L1GtObject &gtObject)
 
L1GtObject l1GtObjectStringToEnum (const std::string &label)
 

Function Documentation

std::string l1GtObjectEnumToString ( const L1GtObject gtObject)

Definition at line 74 of file L1GtObject.cc.

References BPTX, CenJet, ETM, ETT, ForJet, GtExternal, HfBitCounts, HfRingEtSums, HTM, HTT, IsoEG, JetCounts, Mu, NoIsoEG, ObjNull, AlCaHLTBitMon_QueryRunRegistry::string, TauJet, and TechTrig.

Referenced by L1GtEtaPhiConversions::convertEtaIndex(), L1GtCorrelationCondition::evaluateCondition(), L1GtHwValidation::excludedAlgoList(), L1GtEtaPhiConversions::gtObjectNrBinsPhi(), L1GtEtaPhiConversions::gtObjectPairIndex(), L1GtEtaPhiConversions::L1GtEtaPhiConversions(), and L1RetrieveL1Extra::printL1Extra().

74  {
75 
76  std::string gtObjectString;
77 
78  switch (gtObject) {
79 
80  case Mu: {
81  gtObjectString = "Mu";
82  }
83  break;
84 
85  case NoIsoEG: {
86  gtObjectString = "NoIsoEG";
87  }
88  break;
89 
90  case IsoEG: {
91  gtObjectString = "IsoEG";
92  }
93  break;
94 
95  case CenJet: {
96  gtObjectString = "CenJet";
97  }
98  break;
99 
100  case ForJet: {
101  gtObjectString = "ForJet";
102  }
103  break;
104 
105  case TauJet: {
106  gtObjectString = "TauJet";
107  }
108  break;
109 
110  case ETM: {
111  gtObjectString = "ETM";
112  }
113  break;
114 
115  case ETT: {
116  gtObjectString = "ETT";
117  }
118  break;
119 
120  case HTT: {
121  gtObjectString = "HTT";
122  }
123  break;
124 
125  case HTM: {
126  gtObjectString = "HTM";
127  }
128  break;
129 
130  case JetCounts: {
131  gtObjectString = "JetCounts";
132  }
133  break;
134 
135  case HfBitCounts: {
136  gtObjectString = "HfBitCounts";
137  }
138  break;
139 
140  case HfRingEtSums: {
141  gtObjectString = "HfRingEtSums";
142  }
143  break;
144 
145  case TechTrig: {
146  gtObjectString = "TechTrig";
147  }
148  break;
149 
150  case Castor: {
151  gtObjectString = "Castor";
152  }
153  break;
154 
155  case BPTX: {
156  gtObjectString = "BPTX";
157  }
158  break;
159 
160  case GtExternal: {
161  gtObjectString = "GtExternal";
162  }
163  break;
164 
165  case ObjNull: {
166  gtObjectString = "ObjNull";
167  edm::LogInfo("L1GtObject")
168  << "\n ObjNull means no valid L1GtObject defined!";
169  }
170  break;
171 
172  default: {
173  edm::LogInfo("L1GtObject") << "\n '" << gtObject
174  << "' is not a recognized L1GtObject. "
175  << "\n Return ObjNull, which means no valid L1GtObject defined!";
176 
177  gtObjectString = "ObjNull";
178 
179  }
180  break;
181  }
182 
183  return gtObjectString;
184 
185 }
Definition: L1GtObject.h:39
Definition: L1GtObject.h:36
Definition: L1GtObject.h:38
Definition: L1GtObject.h:30
Definition: L1GtObject.h:37
L1GtObject l1GtObjectStringToEnum ( const std::string &  label)

Definition at line 24 of file L1GtObject.cc.

References BPTX, CenJet, ETM, ETT, ForJet, runEdmFileComparison::found, GtExternal, HfBitCounts, HfRingEtSums, HTM, HTT, mps_fire::i, IsoEG, JetCounts, L1GtObjectStringToEnum::label, Mu, NoIsoEG, ObjNull, TauJet, TechTrig, relativeConstraints::value, and L1GtObjectStringToEnum::value.

Referenced by L1GtHwValidation::L1GtHwValidation().

24  {
25 
26  static const L1GtObjectStringToEnum l1GtObjectStringToEnumMap[] = {
27  {"Mu", Mu},
28  {"NoIsoEG", NoIsoEG},
29  {"IsoEG", IsoEG},
30  {"CenJet", CenJet},
31  {"ForJet", ForJet},
32  {"TauJet", TauJet},
33  {"ETM", ETM},
34  {"ETT", ETT},
35  {"HTT", HTT},
36  {"HTM", HTM},
37  {"JetCounts", JetCounts},
38  {"HfBitCounts", HfBitCounts},
39  {"HfRingEtSums", HfRingEtSums},
40  {"TechTrig", TechTrig},
41  {"Castor", Castor},
42  {"BPTX", BPTX},
43  {"GtExternal", GtExternal},
44  {"ObjNull", ObjNull},
45  {0, (L1GtObject) - 1}
46  };
47 
48  L1GtObject value = (L1GtObject) - 1;
49 
50  bool found = false;
51  for (int i = 0; l1GtObjectStringToEnumMap[i].label && (!found); ++i)
52  if (!std::strcmp(label.c_str(), l1GtObjectStringToEnumMap[i].label)) {
53  found = true;
54  value = l1GtObjectStringToEnumMap[i].value;
55  }
56 
57  // in case of unrecognized L1GtObject, returns Mu
58  // and write a warning (to not throw an exception)
59  if (!found) {
60  edm::LogInfo("L1GtObject") << "\n '" << label
61  << "' is not a recognized L1GtObject. \n Return ObjNull.";
62 
63  value = ObjNull;
64  }
65 
66  if (value == ObjNull) {
67  edm::LogInfo("L1GtObject")
68  << "\n ObjNull means no valid L1GtObject defined!";
69  }
70 
71  return value;
72 }
Definition: L1GtObject.h:39
Definition: L1GtObject.h:36
const char * label
Definition: L1GtObject.h:53
L1GtObject
Definition: L1GtObject.h:28
Definition: L1GtObject.h:38
Definition: value.py:1
Definition: L1GtObject.h:30
the string to enum and enum to string conversions for L1GtObject
Definition: L1GtObject.h:52
Definition: L1GtObject.h:37