CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 69 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().

69  {
70  std::string gtObjectString;
71 
72  switch (gtObject) {
73  case Mu: {
74  gtObjectString = "Mu";
75  } break;
76 
77  case NoIsoEG: {
78  gtObjectString = "NoIsoEG";
79  } break;
80 
81  case IsoEG: {
82  gtObjectString = "IsoEG";
83  } break;
84 
85  case CenJet: {
86  gtObjectString = "CenJet";
87  } break;
88 
89  case ForJet: {
90  gtObjectString = "ForJet";
91  } break;
92 
93  case TauJet: {
94  gtObjectString = "TauJet";
95  } break;
96 
97  case ETM: {
98  gtObjectString = "ETM";
99  } break;
100 
101  case ETT: {
102  gtObjectString = "ETT";
103  } break;
104 
105  case HTT: {
106  gtObjectString = "HTT";
107  } break;
108 
109  case HTM: {
110  gtObjectString = "HTM";
111  } break;
112 
113  case JetCounts: {
114  gtObjectString = "JetCounts";
115  } break;
116 
117  case HfBitCounts: {
118  gtObjectString = "HfBitCounts";
119  } break;
120 
121  case HfRingEtSums: {
122  gtObjectString = "HfRingEtSums";
123  } break;
124 
125  case TechTrig: {
126  gtObjectString = "TechTrig";
127  } break;
128 
129  case Castor: {
130  gtObjectString = "Castor";
131  } break;
132 
133  case BPTX: {
134  gtObjectString = "BPTX";
135  } break;
136 
137  case GtExternal: {
138  gtObjectString = "GtExternal";
139  } break;
140 
141  case ObjNull: {
142  gtObjectString = "ObjNull";
143  edm::LogInfo("L1GtObject") << "\n ObjNull means no valid L1GtObject defined!";
144  } break;
145 
146  default: {
147  edm::LogInfo("L1GtObject") << "\n '" << gtObject << "' is not a recognized L1GtObject. "
148  << "\n Return ObjNull, which means no valid L1GtObject defined!";
149 
150  gtObjectString = "ObjNull";
151 
152  } break;
153  }
154 
155  return gtObjectString;
156 }
Definition: L1GtObject.h:38
Definition: L1GtObject.h:35
Definition: L1GtObject.h:37
Log< level::Info, false > LogInfo
Definition: L1GtObject.h:29
Definition: L1GtObject.h:36
L1GtObject l1GtObjectStringToEnum ( const std::string &  label)

Definition at line 24 of file L1GtObject.cc.

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

Referenced by L1GtHwValidation::L1GtHwValidation().

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