CMS 3D CMS Logo

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

Go to the source code of this file.

Functions

l1t::GlobalObject l1TGtObjectStringToEnum (const std::string &label)
 

Function Documentation

◆ l1TGtObjectStringToEnum()

l1t::GlobalObject l1TGtObjectStringToEnum ( const std::string &  label)

Definition at line 26 of file GlobalObject.cc.

References newFWLiteAna::found, l1t::gtAsymmetryEt, l1t::gtAsymmetryEtHF, l1t::gtAsymmetryHt, l1t::gtAsymmetryHtHF, l1t::gtCentrality0, l1t::gtCentrality1, l1t::gtCentrality2, l1t::gtCentrality3, l1t::gtCentrality4, l1t::gtCentrality5, l1t::gtCentrality6, l1t::gtCentrality7, l1t::gtEG, l1t::gtETM, l1t::gtETMHF, l1t::gtETT, l1t::gtETTem, l1t::gtExternal, l1t::gtHTM, l1t::gtHTT, l1t::gtJet, l1t::gtMinBiasHFM0, l1t::gtMinBiasHFM1, l1t::gtMinBiasHFP0, l1t::gtMinBiasHFP1, l1t::gtMu, l1t::gtMuShower, l1t::gtTau, l1t::gtTowerCount, mps_fire::i, label, l1t::L1TGtObjectStringToEnum::label, l1t::ObjNull, l1t::L1TGtObjectStringToEnum::value, and relativeConstraints::value.

26  {
27  static const l1t::L1TGtObjectStringToEnum l1TGtObjectStringToEnumMap[] = {{"Mu", gtMu},
28  {"MuShower", gtMuShower},
29  {"EG", gtEG},
30  {"Tau", gtTau},
31  {"Jet", gtJet},
32  {"ETM", gtETM},
33  {"ETT", gtETT},
34  {"HTT", gtHTT},
35  {"HTM", gtHTM},
36  {"ETMHF", gtETMHF},
37  {"TowerCount", gtTowerCount},
38  {"MinBiasHFP0", gtMinBiasHFP0},
39  {"MinBiasHFM0", gtMinBiasHFM0},
40  {"MinBiasHFP1", gtMinBiasHFP1},
41  {"MinBiasHFM1", gtMinBiasHFM1},
42  {"ETTem", gtETTem},
43  {"AsymEt", gtAsymmetryEt},
44  {"AsymHt", gtAsymmetryHt},
45  {"AsymEtHF", gtAsymmetryEtHF},
46  {"AsymEtHF", gtAsymmetryHtHF},
47  {"CENT0", gtCentrality0},
48  {"CENT1", gtCentrality1},
49  {"CENT2", gtCentrality2},
50  {"CENT3", gtCentrality3},
51  {"CENT4", gtCentrality4},
52  {"CENT5", gtCentrality5},
53  {"CENT6", gtCentrality6},
54  {"CENT7", gtCentrality7},
55  {"External", gtExternal},
56  {"ObjNull", ObjNull},
57  {nullptr, (GlobalObject)-1}};
58 
60 
61  bool found = false;
62  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
63  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
64  found = true;
65  value = l1TGtObjectStringToEnumMap[i].value;
66  }
67 
68  // in case of unrecognized GlobalObject, returns Mu
69  // and write a warning (to not throw an exception)
70  if (!found) {
71  edm::LogInfo("L1TGlobal") << "\n '" << label << "' is not a recognized GlobalObject. \n Return ObjNull.";
72 
73  value = ObjNull;
74  }
75 
76  if (value == ObjNull) {
77  edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
78  }
79 
80  return value;
81 }
GlobalObject
Definition: GlobalObject.h:16
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:51
char const * label
Definition: value.py:1
Log< level::Info, false > LogInfo