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.

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

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

l1t::gtHTM
Definition: GlobalObject.h:24
l1t::gtCentrality0
Definition: GlobalObject.h:36
l1t::gtExternal
Definition: GlobalObject.h:44
mps_fire.i
i
Definition: mps_fire.py:355
ObjNull
Definition: L1GtObject.h:46
edm::LogInfo
Definition: MessageLogger.h:254
l1t::gtEG
Definition: GlobalObject.h:18
l1t::L1TGtObjectStringToEnum
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:50
l1t::gtETTem
Definition: GlobalObject.h:31
l1t::gtMinBiasHFP1
Definition: GlobalObject.h:29
l1t::gtMinBiasHFM1
Definition: GlobalObject.h:30
l1t::gtAsymmetryEt
Definition: GlobalObject.h:32
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
l1t::gtCentrality5
Definition: GlobalObject.h:41
l1t::gtCentrality7
Definition: GlobalObject.h:43
l1t::gtAsymmetryHt
Definition: GlobalObject.h:33
l1t::gtCentrality4
Definition: GlobalObject.h:40
l1t::gtJet
Definition: GlobalObject.h:19
l1t::gtTowerCount
Definition: GlobalObject.h:26
l1t::gtETMHF
Definition: GlobalObject.h:25
l1t::gtHTT
Definition: GlobalObject.h:23
l1t::gtCentrality1
Definition: GlobalObject.h:37
l1t::gtETM
Definition: GlobalObject.h:21
l1t::gtMu
Definition: GlobalObject.h:17
l1t::L1TGtObjectStringToEnum::value
GlobalObject value
Definition: GlobalObject.h:52
l1t::gtAsymmetryEtHF
Definition: GlobalObject.h:34
l1t::gtCentrality6
Definition: GlobalObject.h:42
l1t::gtMinBiasHFP0
Definition: GlobalObject.h:27
value
Definition: value.py:1
l1t::GlobalObject
GlobalObject
Definition: GlobalObject.h:16
l1t::gtETT
Definition: GlobalObject.h:22
l1t::gtCentrality3
Definition: GlobalObject.h:39
relativeConstraints.value
value
Definition: relativeConstraints.py:53
l1t::gtTau
Definition: GlobalObject.h:20
l1t::gtMinBiasHFM0
Definition: GlobalObject.h:28
l1t::gtCentrality2
Definition: GlobalObject.h:38
label
const char * label
Definition: PFTauDecayModeTools.cc:11
l1t::L1TGtObjectStringToEnum::label
const char * label
Definition: GlobalObject.h:51
l1t::gtAsymmetryHtHF
Definition: GlobalObject.h:35