CMS 3D CMS Logo

ntupleEnum.py
Go to the documentation of this file.
1 # Poor-man enum class with string conversion
2 class _Enum:
3  def __init__(self, **values):
4  self._reverse = {}
5  for key, value in values.iteritems():
6  setattr(self, key, value)
7  if value in self._reverse:
8  raise Exception("Value %s is already used for a key %s, tried to re-add it for key %s" % (value, self._reverse[value], key))
9  self._reverse[value] = key
10 
11  def toString(self, val):
12  return self._reverse[val]
13 
14 SubDet = _Enum(
15  BPix = 1,
16  FPix = 2,
17  TIB = 3,
18  TID = 4,
19  TOB = 5,
20  TEC = 6
21 )
22 
23 # Needs to be kept consistent with
24 # DataFormats/TrackReco/interface/TrackBase.h
25 Algo = _Enum(
26  undefAlgorithm = 0, ctf = 1,
27  duplicateMerge = 2, cosmics = 3,
28  initialStep = 4,
29  lowPtTripletStep = 5,
30  pixelPairStep = 6,
31  detachedTripletStep = 7,
32  mixedTripletStep = 8,
33  pixelLessStep = 9,
34  tobTecStep = 10,
35  jetCoreRegionalStep = 11,
36  conversionStep = 12,
37  muonSeededStepInOut = 13,
38  muonSeededStepOutIn = 14,
39  outInEcalSeededConv = 15, inOutEcalSeededConv = 16,
40  nuclInter = 17,
41  standAloneMuon = 18, globalMuon = 19, cosmicStandAloneMuon = 20, cosmicGlobalMuon = 21,
42  # Phase1
43  highPtTripletStep = 22, lowPtQuadStep = 23, detachedQuadStep = 24,
44  reservedForUpgrades1 = 25, reservedForUpgrades2 = 26,
45  bTagGhostTracks = 27,
46  beamhalo = 28,
47  gsf = 29,
48  # HLT algo name
49  hltPixel = 30,
50  # steps used by PF
51  hltIter0 = 31,
52  hltIter1 = 32,
53  hltIter2 = 33,
54  hltIter3 = 34,
55  hltIter4 = 35,
56  # steps used by all other objects @HLT
57  hltIterX = 36,
58  # steps used by HI muon regional iterative tracking
59  hiRegitMuInitialStep = 37,
60  hiRegitMuLowPtTripletStep = 38,
61  hiRegitMuPixelPairStep = 39,
62  hiRegitMuDetachedTripletStep = 40,
63  hiRegitMuMixedTripletStep = 41,
64  hiRegitMuPixelLessStep = 42,
65  hiRegitMuTobTecStep = 43,
66  hiRegitMuMuonSeededStepInOut = 44,
67  hiRegitMuMuonSeededStepOutIn = 45,
68  algoSize = 46
69 )
70 
71 # Needs to kept consistent with
72 # DataFormats/TrackReco/interface/TrajectoryStopReasons.h
73 StopReason = _Enum(
74  UNINITIALIZED = 0,
75  MAX_HITS = 1,
76  MAX_LOST_HITS = 2,
77  MAX_CONSECUTIVE_LOST_HITS = 3,
78  LOST_HIT_FRACTION = 4,
79  MIN_PT = 5,
80  CHARGE_SIGNIFICANCE = 6,
81  LOOPER = 7,
82  MAX_CCC_LOST_HITS = 8,
83  NO_SEGMENTS_FOR_VALID_LAYERS = 9,
84  SEED_EXTENSION = 10,
85  SIZE = 12,
86  NOT_STOPPED = 255
87 )
88 
89 # Need to be kept consistent with
90 # DataFormats/TrackReco/interface/SeedStopReason.h
91 SeedStopReason = _Enum(
92  UNINITIALIZED = 0,
93  NOT_STOPPED = 1,
94  SEED_CLEANING = 2,
95  NO_TRAJECTORY = 3,
96  FINAL_CLEAN = 4,
97  SMOOTHING_FAILED = 5,
98  SIZE = 6
99 )
100 
101 # to be kept is synch with enum HitSimType in TrackingNtuple.py
102 HitSimType = _Enum(
103  Signal = 0,
104  ITPileup = 1,
105  OOTPileup = 2,
106  Noise = 3,
107  Unknown = 99
108 )
def __init__(self, values)
Definition: ntupleEnum.py:3
def toString(self, val)
Definition: ntupleEnum.py:11