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.items():
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  displacedGeneralStep = 25,
45  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:11