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