CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Definition at line 27 of file GlobalObject.cc.

References newFWLiteAna::found, 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::gtTau, l1t::gtTowerCount, i, l1t::L1TGtObjectStringToEnum::label, l1t::ObjNull, l1t::L1TGtObjectStringToEnum::value, and relativeConstraints::value.

27  {
28 
29 
30 
31  static const l1t::L1TGtObjectStringToEnum l1TGtObjectStringToEnumMap[] = {
32  {"Mu", gtMu},
33  {"EG", gtEG},
34  {"Tau", gtTau},
35  {"Jet", gtJet},
36  {"ETM", gtETM},
37  {"ETT", gtETT},
38  {"HTT", gtHTT},
39  {"HTM", gtHTM},
40  {"ETMHF", gtETMHF},
41  {"TowerCount",gtTowerCount},
42  {"MinBiasHFP0", gtMinBiasHFP0},
43  {"MinBiasHFM0", gtMinBiasHFM0},
44  {"MinBiasHFP1", gtMinBiasHFP1},
45  {"MinBiasHFM1", gtMinBiasHFM1},
46  {"ETTem", gtETTem},
47  {"External", gtExternal},
48  {"ObjNull", ObjNull},
49  {0, (GlobalObject) - 1}
50  };
51 
53 
54  bool found = false;
55  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
56  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
57  found = true;
58  value = l1TGtObjectStringToEnumMap[i].value;
59  }
60 
61  // in case of unrecognized GlobalObject, returns Mu
62  // and write a warning (to not throw an exception)
63  if (!found) {
64  edm::LogInfo("L1TGlobal") << "\n '" << label
65  << "' is not a recognized GlobalObject. \n Return ObjNull.";
66 
67  value = ObjNull;
68  }
69 
70  if (value == ObjNull) {
71  edm::LogInfo("L1TGlobal")
72  << "\n ObjNull means no valid GlobalObject defined!";
73  }
74 
75  return value;
76 }
int i
Definition: DBlmapReader.cc:9
GlobalObject
Definition: GlobalObject.h:16
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:39