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, l1t::gtZDCM, l1t::gtZDCP, mps_fire::i, label, l1t::L1TGtObjectStringToEnum::label, l1t::ObjNull, relativeConstraints::value, and l1t::L1TGtObjectStringToEnum::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  {"ZDCP", gtZDCP},
57  {"ZDCM", gtZDCM},
58  {"ObjNull", ObjNull},
59  {nullptr, (GlobalObject)-1}};
60 
62 
63  bool found = false;
64  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
65  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
66  found = true;
67  value = l1TGtObjectStringToEnumMap[i].value;
68  }
69 
70  // in case of unrecognized GlobalObject, returns Mu
71  // and write a warning (to not throw an exception)
72  if (!found) {
73  edm::LogInfo("L1TGlobal") << "\n '" << label << "' is not a recognized GlobalObject. \n Return ObjNull.";
74 
75  value = ObjNull;
76  }
77 
78  if (value == ObjNull) {
79  edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
80  }
81 
82  return value;
83 }
GlobalObject
Definition: GlobalObject.h:16
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:53
char const * label
Definition: value.py:1
Log< level::Info, false > LogInfo