CMS 3D CMS Logo

List of all members | Public Member Functions
ntupleDataFormat._DetIdStrAdaptor Class Reference
Inheritance diagram for ntupleDataFormat._DetIdStrAdaptor:
ntupleDataFormat._HitObject ntupleDataFormat.GluedHit ntupleDataFormat.InvalidHit ntupleDataFormat.SimHit ntupleDataFormat.Phase2OTHit ntupleDataFormat.PixelHit ntupleDataFormat.StripHit

Public Member Functions

def __init__ (self)
 
def detIdStr (self)
 
def layerStr (self)
 

Detailed Description

Adaptor class for objects containgin DetId (hits).

Definition at line 90 of file ntupleDataFormat.py.

Constructor & Destructor Documentation

def ntupleDataFormat._DetIdStrAdaptor.__init__ (   self)

Definition at line 92 of file ntupleDataFormat.py.

92  def __init__(self):
93  super(_DetIdStrAdaptor, self).__init__()
94 

Member Function Documentation

def ntupleDataFormat._DetIdStrAdaptor.detIdStr (   self)
Returns a string describing the DetId fields.

Definition at line 116 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), SeedingNode< TrackingLayer >._index, SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, CommonAnalyzer._prefix, ntupleDataFormat._Object._prefix, html.PageSet._prefix, ntupleDataFormat.BeamSpot._prefix, ntuplePrintersDiff._IndentPrinter._prefix, ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, ntupleDataFormat.TrackingNtuple._tree, ntupleDataFormat.Event._tree, ntupleDataFormat.BeamSpot._tree, and reco.get().

116  def detIdStr(self):
117  """Returns a string describing the DetId fields."""
118  self._checkIsValid
119  get = lambda name: getattr(self._tree, self._prefix+"_"+name)[self._index]
120  isPhase2 = hasattr(self._tree, self._prefix+"_isLower")
121  def stereo():
122  if isPhase2:
123  if get("isLower"):
124  return " isLower"
125  if get("isUpper"):
126  return " isUpper"
127  if get("isStack"):
128  return " isStack"
129  else:
130  if get("isStereo"):
131  return " isStereo"
132  if get("isRPhi"):
133  return " isRPhi"
134  if get("isGlued"):
135  return " isGlued"
136  return ""
137 
138  subdet = get("subdet")
139  if subdet == SubDet.BPix:
140  return "ladder {} module {}".format(get("ladder"), get("module"))
141  if subdet == SubDet.FPix:
142  return "blade {} panel {} module {}".format(get("blade"), get("panel"), get("module"))
143  if subdet == SubDet.TIB:
144  return "side {} order {} string {} module {}{}".format(get("side"), get("order"), get("string"), get("module"), stereo())
145  if subdet == SubDet.TID:
146  return "ring {} order {} module {}{}".format(get("ring"), get("order"), get("module"), stereo())
147  if subdet == SubDet.TOB:
148  if isPhase2:
149  return "rod {} module {}{}".format(get("rod"), get("module"), stereo())
150  else:
151  return "side {} rod {} module {}{}".format(get("side"), get("rod"), get("module"), stereo())
152  if subdet == SubDet.TEC:
153  return "order {} petal {} ring {} module {}{}".format(get("order"), get("petalNumber"), get("ring"), get("module"), stereo())
154  raise Exception("Unknown subdet %d" % subdet)
155 
T get(const Candidate &c)
Definition: component.h:55
def ntupleDataFormat._DetIdStrAdaptor.layerStr (   self)
Returns a string describing the layer of the hit.

Definition at line 95 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), SeedingNode< TrackingLayer >._index, SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, CommonAnalyzer._prefix, ntupleDataFormat._Object._prefix, html.PageSet._prefix, ntupleDataFormat.BeamSpot._prefix, ntuplePrintersDiff._IndentPrinter._prefix, ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, ntupleDataFormat.TrackingNtuple._tree, ntupleDataFormat.Event._tree, ntupleDataFormat.BeamSpot._tree, and reco.get().

95  def layerStr(self):
96  """Returns a string describing the layer of the hit."""
97  self._checkIsValid()
98  get = lambda name: getattr(self._tree, self._prefix+"_"+name)[self._index]
99  subdet = get("subdet")
100  side = ""
101  isPhase2OTBarrel = (subdet == SubDet.TOB and hasattr(self._tree, self._prefix+"_isLower"))
102  if subdet in [SubDet.FPix, SubDet.TID, SubDet.TEC] or isPhase2OTBarrel:
103  sideNum = get("side")
104  if sideNum == 1:
105  side = "-"
106  elif sideNum == 2:
107  side = "+"
108  elif isPhase2OTBarrel and sideNum == 3:
109  side = ""
110  else:
111  side = "?"
112  return "%s%d%s" % (SubDet.toString(subdet),
113  getattr(self._tree, self._prefix+"_layer")[self._index],
114  side)
115 
T get(const Candidate &c)
Definition: component.h:55