CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 76 of file L1GtObject.cc.

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

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

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

Definition at line 26 of file L1GtObject.cc.

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

Referenced by L1GtHwValidation::L1GtHwValidation().

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