CMS 3D CMS Logo

ntupleDataFormat.py
Go to the documentation of this file.
1 from builtins import range
2 import math
3 import collections
4 
5 import ROOT
6 
9 import six
10 
12  """Adaptor class representing a collection of objects.
13 
14  Concrete collection classes should inherit from this class.
15 
16  """
17  def __init__(self, tree, sizeBranch, objclass):
18  """Constructor.
19 
20  Arguments:
21  tree -- TTree object
22  sizeBranch -- Name of the branch to be used in size()
23  objclass -- Class to be used for the objects in __getitem__()
24  """
25  super(_Collection, self).__init__()
26  self._tree = tree
27  self._sizeBranch = sizeBranch
28  self._objclass = objclass
29 
30  def size(self):
31  """Number of objects in the collection."""
32  return int(getattr(self._tree, self._sizeBranch).size())
33 
34  def __len__(self):
35  """Number of objects in the collection."""
36  return self.size()
37 
38  def __getitem__(self, index):
39  """Get object 'index' in the collection."""
40  return self._objclass(self._tree, index)
41 
42  def __iter__(self):
43  """Returns generator for the objects."""
44  for index in range(self.size()):
45  yield self._objclass(self._tree, index)
46 
47 class _Object(object):
48  """Adaptor class representing a single object in a collection.
49 
50  The member variables of the object are obtained from the branches
51  with common prefix and a given index.
52 
53  Concrete object classes should inherit from this class.
54  """
55  def __init__(self, tree, index, prefix):
56  """Constructor.
57 
58  Arguments:
59  tree -- TTree object
60  index -- Index for this object
61  prefix -- Prefix of the branchs
62  """
63  super(_Object, self).__init__()
64  self._tree = tree
65  self._index = index
66  self._prefix = prefix
67 
68  def __getattr__(self, attr):
69  """Return object member variable.
70 
71  'attr' is translated as a branch in the TTree (<prefix>_<attr>).
72  """
73  self._checkIsValid()
74  val = getattr(self._tree, self._prefix+"_"+attr)[self._index]
75  return lambda: val
76 
77  def _checkIsValid(self):
78  """Raise an exception if the object index is not valid."""
79  if not self.isValid():
80  raise Exception("%s is not valid" % self.__class__.__name__)
81 
82  def isValid(self):
83  """Check if object index is valid."""
84  return self._index != -1
85 
86  def index(self):
87  """Return object index."""
88  return self._index
89 
91  """Adaptor class for objects containgin DetId (hits)."""
92  def __init__(self):
93  super(_DetIdStrAdaptor, self).__init__()
94 
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 
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 
157  """Adaptor class for pixel/strip hit objects."""
158  def __init__(self, tree, index, prefix):
159  """Constructor.
160 
161  Arguments:
162  tree -- TTree object
163  index -- Index for this object
164  prefix -- Prefix of the branchs
165  """
166  """Constructor
167  """
168  super(_HitObject, self).__init__(tree, index, prefix)
169 
170  def ntracks(self):
171  """Returns number of tracks containing this hit."""
172  self._checkIsValid()
173  return getattr(self._tree, self._prefix+"_trkIdx")[self._index].size()
174 
175  def tracks(self):
176  """Returns generator for tracks containing this hit.
177 
178  The generator returns Track objects
179  """
180  self._checkIsValid()
181  for itrack in getattr(self._tree, self._prefix+"_trkIdx")[self._index]:
182  yield Track(self._tree, itrack)
183 
184  def nseeds(self):
185  """Returns number of seeds containing this hit."""
186  self._checkIsValid()
187  return getattr(self._tree, self._prefix+"_seeIdx")[self._index].size()
188 
189  def seeds(self):
190  """Returns generator for tracks containing this hit.
191 
192  The generator returns Seed objects
193  """
194  self._checkIsValid()
195  for iseed in getattr(self._tree, self._prefix+"_seeIdx")[self._index]:
196  yield Seed(self._tree, iseed)
197 
198  def r(self):
199  return math.sqrt(self.x()**2 + self.y()**2)
200 
201  def r3D(self):
202  return math.sqrt(self.x()**2 + self.y()**2 + self.z()**2)
203 
205  """Adaptor class for objects containing hits (e.g. tracks)"""
206  def __init__(self):
207  super(_RecoHitAdaptor, self).__init__()
208 
209  def _hits(self):
210  """Internal method to generate pairs of hit index and type."""
211  for ihit, hitType in zip(self.hitIdx(), self.hitType()):
212  yield (ihit, hitType)
213 
214  def hits(self):
215  """Returns generator for hits.
216 
217  Generator returns PixelHit/StripHit/GluedHit/Phase2OT depending on the
218  hit type.
219 
220  """
221  for ihit, hitType in self._hits():
222  if hitType == 0:
223  yield PixelHit(self._tree, ihit)
224  elif hitType == 1:
225  yield StripHit(self._tree, ihit)
226  elif hitType == 2:
227  yield GluedHit(self._tree, ihit)
228  elif hitType == 3:
229  yield InvalidHit(self._tree, ihit)
230  elif hitType == 4:
231  yield Phase2OTHit(self._tree, ihit)
232  else:
233  raise Exception("Unknown hit type %d" % hitType)
234 
235  def pixelHits(self):
236  """Returns generator for pixel hits."""
237  self._checkIsValid()
238  for ihit, hitType in self._hits():
239  if hitType != 0:
240  continue
241  yield PixelHit(self._tree, ihit)
242 
243  def stripHits(self):
244  """Returns generator for strip hits."""
245  self._checkIsValid()
246  for ihit, hitType in self._hits():
247  if hitType != 1:
248  continue
249  yield StripHit(self._tree, ihit)
250 
251  def gluedHits(self):
252  """Returns generator for matched strip hits."""
253  self._checkIsValid()
254  for ihit, hitType in self._hits():
255  if hitType != 2:
256  continue
257  yield GluedHit(self._tree, ihit)
258 
259  def invalidHits(self):
260  """Returns generator for invalid hits."""
261  self._checkIsValid()
262  for ihit, hitType in self._hits():
263  if hitType != 3:
264  continue
265  yield InvalidHit(self._tree, ihit)
266 
267  def phase2OTHits(self):
268  """Returns generator for phase2 outer tracker hits."""
269  self._checkIsValid()
270  for ihit, hitType in self._hits():
271  if hitType != 4:
272  continue
273  yield Phase2OTHit(self._tree, ihit)
274 
276  """Adaptor class for objects containing or matched to SimHits (e.g. reco hits)."""
277  def __init__(self):
278  super(_SimHitMatchAdaptor, self).__init__()
279 
280  def _nMatchedSimHits(self):
281  """Internal method to get the number of matched SimHits."""
282  return getattr(self._tree, self._prefix+"_simHitIdx")[self._index].size()
283 
284  def nMatchedSimHits(self):
285  """Returns the number of matched SimHits."""
286  self._checkIsValid()
287  return self._nMatchedSimHits()
288 
290  """Returns a generator for matched SimHits.
291 
292  The generator returns SimHitMatchInfo objects.
293  """
294  self._checkIsValid()
295  for imatch in range(self._nMatchedSimHits()):
296  yield SimHitMatchInfo(self._tree, self._index, imatch, self._prefix)
297 
299  """Adaptor class for objects matched to TrackingParticles."""
300  def __init__(self):
301  super(_TrackingParticleMatchAdaptor, self).__init__()
302 
304  """Internal method to get the number of matched TrackingParticles."""
305  return getattr(self._tree, self._prefix+"_simTrkIdx")[self._index].size()
306 
308  """Returns the number of matched TrackingParticles."""
309  self._checkIsValid()
310  return self._nMatchedTrackingParticles()
311 
313  """Returns a generator for matched TrackingParticles.
314 
315  The generator returns TrackingParticleMatchInfo objects.
316 
317  """
318  self._checkIsValid()
319  for imatch in range(self._nMatchedTrackingParticles()):
320  yield TrackingParticleMatchInfo(self._tree, self._index, imatch, self._prefix)
321 
323  """Returns best-matching TrackingParticle, even for fake tracks, or None if there is no best-matching TrackingParticle.
324 
325  Best-matching is defined as the one with largest number of
326  hits matched to the hits of a track (>= 3). If there are many
327  fulfilling the same number of hits, the one inducing the
328  innermost hit of the track is chosen.
329  """
330  idx = self.bestSimTrkIdx()
331  if idx < 0:
332  return None
333  return TrackingParticle(self._tree, idx)
334 
336  """Fraction of shared hits with reco hits as denominator for best-matching TrackingParticle."""
337  return self.bestSimTrkShareFrac()
338 
340  """Fraction of shared hits with TrackingParticle::numberOfTrackerHits() as denominator for best-matching TrackingParticle."""
341  return self.bestSimTrkShareFracSimDenom()
342 
344  """Fraction of shared hits with number of reco clusters associated to a TrackingParticle as denominator for best-matching TrackingParticle."""
345  return self.bestSimTrkShareFracSimClusterDenom()
346 
348  """Normalized chi2 calculated from track parameters+covariance matrix and TrackingParticle parameters for best-matching TrackingParticle."""
349  return self.bestSimTrkNChi2()
350 
352  """Returns best-matching TrackingParticle, even for fake tracks, or None if there is no best-matching TrackingParticle.
353 
354  Best-matching is defined as the one with largest number of
355  hits matched to the hits of a track (>= 3) starting from the
356  beginning of the track. If there are many fulfilling the same
357  number of hits, "a first TP" is chosen (a bit arbitrary, but
358  should be rare".
359  """
360  idx = self.bestFromFirstHitSimTrkIdx()
361  if idx < 0:
362  return None
363  return TrackingParticle(self._tree, idx)
364 
366  """Fraction of shared hits with reco hits as denominator for best-matching TrackingParticle starting from the first hit of a track."""
367  return self.bestFromFirstHitSimTrkShareFrac()
368 
370  """Fraction of shared hits with TrackingParticle::numberOfTrackerHits() as denominator for best-matching TrackingParticle starting from the first hit of a track."""
371  return self.bestFromFirstHitSimTrkShareFracSimDenom()
372 
374  """Fraction of shared hits with number of reco clusters associated to a TrackingParticle as denominator for best-matching TrackingParticle starting from the first hit of a track."""
375  return self.bestFromFirstHitSimTrkShareFracSimClusterDenom()
376 
378  """Normalized chi2 calculated from track parameters+covariance matrix and TrackingParticle parameters for best-matching TrackingParticle starting from the first hit of a track."""
379  return self.bestFromFirstHitSimTrkNChi2()
380 
381 
383  """Class abstracting the whole ntuple/TTree.
384 
385  Main benefit is to provide nice interface for
386  - iterating over events
387  - querying whether hit/seed information exists
388 
389  Note that to iteratate over the evets with zip(), you should use
390  itertools.izip() instead.
391  """
392  def __init__(self, fileName, tree="trackingNtuple/tree"):
393  """Constructor.
394 
395  Arguments:
396  fileName -- String for path to the ROOT file
397  tree -- Name of the TTree object inside the ROOT file (default: 'trackingNtuple/tree')
398  """
399  super(TrackingNtuple, self).__init__()
400  self._file = ROOT.TFile.Open(fileName)
401  self._tree = self._file.Get(tree)
402  self._entries = self._tree.GetEntriesFast()
403 
404  def file(self):
405  return self._file
406 
407  def tree(self):
408  return self._tree
409 
410  def nevents(self):
411  return self._entries
412 
413  def hasHits(self):
414  """Returns true if the ntuple has hit information."""
415  return hasattr(self._tree, "pix_isBarrel")
416 
417  def hasSeeds(self):
418  """Returns true if the ntuple has seed information."""
419  return hasattr(self._tree, "see_fitok")
420 
421  def __iter__(self):
422  """Returns generator for iterating over TTree entries (events)
423 
424  Generator returns Event objects.
425 
426  """
427  for jentry in range(self._entries):
428  # get the next tree in the chain and verify
429  ientry = self._tree.LoadTree( jentry )
430  if ientry < 0: break
431  # copy next entry into memory and verify
432  nb = self._tree.GetEntry( jentry )
433  if nb <= 0: continue
434 
435  yield Event(self._tree, jentry)
436 
437  def getEvent(self, index):
438  """Returns Event for a given index"""
439  ientry = self._tree.LoadTree(index)
440  if ientry < 0: return None
441  nb = self._tree.GetEntry(ientry) # ientry or jentry?
442  if nb <= 0: None
443 
444  return Event(self._tree, ientry) # ientry of jentry?
445 
446 
447 class Event(object):
448  """Class abstracting a single event.
449 
450  Main benefit is to provide nice interface to get various objects
451  or collections of objects.
452  """
453  def __init__(self, tree, entry):
454  """Constructor.
455 
456  Arguments:
457  tree -- TTree object
458  entry -- Entry number in the tree
459  """
460  super(Event, self).__init__()
461  self._tree = tree
462  self._entry = entry
463 
464  def entry(self):
465  return self._entry
466 
467  def event(self):
468  """Returns event number."""
469  return self._tree.event
470 
471  def lumi(self):
472  """Returns lumisection number."""
473  return self._tree.lumi
474 
475  def run(self):
476  """Returns run number."""
477  return self._tree.run
478 
479  def eventId(self):
480  """Returns (run, lumi, event) tuple."""
481  return (self._tree.run, self._tree.lumi, self._tree.event)
482 
483  def eventIdStr(self):
484  """Returns 'run:lumi:event' string."""
485  return "%d:%d:%d" % self.eventId()
486 
487  def beamspot(self):
488  """Returns BeamSpot object."""
489  return BeamSpot(self._tree)
490 
491  def tracks(self):
492  """Returns Tracks object."""
493  return Tracks(self._tree)
494 
495  def pixelHits(self):
496  """Returns PixelHits object."""
497  return PixelHits(self._tree)
498 
499  def stripHits(self):
500  """Returns StripHits object."""
501  return StripHits(self._tree)
502 
503  def gluedHits(self):
504  """Returns GluedHits object."""
505  return GluedHits(self._tree)
506 
507  def phase2OTHits(self):
508  """Returns Phase2OTHits object."""
509  return Phase2OTHits(self._tree)
510 
511  def seeds(self):
512  """Returns Seeds object."""
513  return Seeds(self._tree)
514 
515  def trackingParticles(self):
516  """Returns TrackingParticles object."""
517  return TrackingParticles(self._tree)
518 
519  def vertices(self):
520  """Returns Vertices object."""
521  return Vertices(self._tree)
522 
523  def trackingVertices(self):
524  """Returns TrackingVertices object."""
525  return TrackingVertices(self._tree)
526 
527 
529  """Class representing the beam spot."""
530  def __init__(self, tree):
531  """Constructor.
532 
533  Arguments:
534  tree -- TTree object
535  """
536  super(BeamSpot, self).__init__()
537  self._tree = tree
538  self._prefix = "bsp"
539 
540  def __getattr__(self, attr):
541  """Return object member variable.
542 
543  'attr' is translated as a branch in the TTree (bsp_<attr>).
544  """
545  val = getattr(self._tree, self._prefix+"_"+attr)
546  return lambda: val
547 
548 
550  """Class representing a match to a SimHit.
551 
552  The point of this class is to provide, in addition to the matched
553  SimHit, also other information about the match (e.g. fraction of
554  charge from this SimHit).
555  """
556  def __init__(self, tree, index, shindex, prefix):
557  """Constructor.
558 
559  Arguments:
560  tree -- TTree object
561  index -- Index of the hit matched to SimHit
562  shindex -- Index of the SimHit match (second index in _simHitIdx branch)
563  prefix -- String for prefix of the object (track/seed/hit) matched to TrackingParticle
564  """
565  super(SimHitMatchInfo, self).__init__(tree, index, prefix)
566  self._shindex = shindex
567 
568  def __getattr__(self, attr):
569  """Custom __getattr__ because of the second index needed to access the branch."""
570  val = super(SimHitMatchInfo, self).__getattr__(attr)()[self._shindex]
571  return lambda: val
572 
573  def simHit(self):
574  """Returns matched SimHit."""
575  self._checkIsValid()
576  return SimHit(self._tree, getattr(self._tree, self._prefix+"_simHitIdx")[self._index][self._shindex])
577 
579 
580  """Class representing a match to a TrackingParticle.
581 
582  The point of this class is to provide, in addition to the matched
583  TrackingParticle, also other information about the match (e.g.
584  shared hit fraction for tracks/seeds).
585  """
586  def __init__(self, tree, index, tpindex, prefix):
587  """Constructor.
588 
589  Arguments:
590  tree -- TTree object
591  index -- Index of the object (track/seed) matched to TrackingParticle
592  tpindex -- Index of the TrackingParticle match (second index in _simTrkIdx branch)
593  prefix -- String for prefix of the object (track/seed) matched to TrackingParticle
594  """
595  super(TrackingParticleMatchInfo, self).__init__(tree, index, prefix)
596  self._tpindex = tpindex
597 
598  def __getattr__(self, attr):
599  """Custom __getattr__ because of the second index needed to access the branch.
600 
601  Note that when mapping the 'attr' to a branch, a 'simTrk' is
602  prepended and the first letter of 'attr' is turned to upper
603  case.
604  """
605  val = super(TrackingParticleMatchInfo, self).__getattr__("simTrk"+attr[0].upper()+attr[1:])()[self._tpindex]
606  return lambda: val
607 
608  def trackingParticle(self):
609  """Returns matched TrackingParticle."""
610  return TrackingParticle(self._tree, self.idx())
611 
613  """Class representing a match to a Track.
614 
615  The point of this class is to provide, in addition to the matched
616  Track, also other information about the match (e.g. shared hit fraction.
617  """
618  def __init__(self, tree, index, trkindex, prefix):
619  """Constructor.
620 
621  Arguments:
622  tree -- TTree object
623  index -- Index of the object (TrackingParticle) matched to track
624  trkindex -- Index of the track match (second index in _trkIdx branch)
625  prefix -- String for prefix of the object (TrackingParticle) matched to track
626  """
627  super(TrackMatchInfo, self).__init__(tree, index, prefix)
628  self._trkindex = trkindex
629 
630  def __getattr__(self, attr):
631  """Custom __getattr__ because of the second index needed to access the branch.
632 
633  Note that when mapping the 'attr' to a branch, a 'trk' is
634  prepended and the first letter of 'attr' is turned to upper
635  case.
636  """
637  val = super(TrackMatchInfo, self).__getattr__("trk"+attr[0].upper()+attr[1:])()[self._trkindex]
638  return lambda: val
639 
640  def track(self):
641  """Returns matched Track."""
642  return Track(self._tree, self.idx())
643 
645  """Class representing a match to a Seed.
646 
647  The point of this class is to provide an interface compatible with
648  all other "MatchInfo" classes
649 
650  """
651  def __init__(self, tree, index, seedindex, prefix):
652  """Constructor.
653 
654  Arguments:
655  tree -- TTree object
656  index -- Index of the object (TrackingParticle) matched to seed
657  seedindex -- Index of the seed match (second index in _trkIdx branch)
658  prefix -- String for prefix of the object (TrackingParticle) matched to seed
659  """
660  super(SeedMatchInfo, self).__init__(tree, index, prefix)
661  self._seedindex = seedindex
662 
663  def seed(self):
664  """Returns matched Seed."""
665  self._checkIsValid()
666  return Seed(self._tree, getattr(self._tree, self._prefix+"_seedIdx")[self._index][self._seedindex])
667 
668 
670  """Class presenting a track."""
671  def __init__(self, tree, index):
672  """Constructor.
673 
674  Arguments:
675  tree -- TTree object
676  index -- Index of the track
677  """
678  super(Track, self).__init__(tree, index, "trk")
679 
680  def seed(self):
681  """Returns Seed of the track."""
682  self._checkIsValid()
683  return Seed(self._tree, self._tree.trk_seedIdx[self._index])
684 
685  def vertex(self):
686  """Returns Vertex that used this track in its fit."""
687  self._checkIsValid()
688  return Vertex(self._tree, self._tree.trk_vtxIdx[self._index])
689 
690  def ptPull(self):
691  tp = self.bestMatchingTrackingParticle()
692  if tp is None:
693  return None
694  return (self.pt() - tp.pca_pt())/self.ptErr()
695 
696  def thetaPull(self):
697  tp = self.bestMatchingTrackingParticle()
698  if tp is None:
699  return None
700  return (getattr(self, "lambda")() - tp.pca_lambda())/self.lambdaErr() # as in MTV
701 
702  def phiPull(self):
703  tp = self.bestMatchingTrackingParticle()
704  if tp is None:
705  return None
706  return (self.phi() - tp.pca_phi())/self.phiErr()
707 
708  def dxyPull(self):
709  tp = self.bestMatchingTrackingParticle()
710  if tp is None:
711  return None
712  return (self.dxy() - tp.pca_dxy())/self.dxyErr()
713 
714  def dzPull(self):
715  tp = self.bestMatchingTrackingParticle()
716  if tp is None:
717  return None
718  return (self.dz() - tp.pca_dz())/self.dzErr()
719 
721  """Class presenting a collection of tracks."""
722  def __init__(self, tree):
723  """Constructor.
724 
725  Arguments:
726  tree -- TTree object
727  """
728  super(Tracks, self).__init__(tree, "trk_pt", Track)
729 
730 
732  """Class representing a pixel hit."""
733  def __init__(self, tree, index):
734  """Constructor.
735 
736  Arguments:
737  tree -- TTree object
738  index -- Index of the hit
739  """
740  super(PixelHit, self).__init__(tree, index, "pix")
741 
742  def isValidHit(self):
743  return True
744 
746  """Class presenting a collection of pixel hits."""
747  def __init__(self, tree):
748  """Constructor.
749 
750  Arguments:
751  tree -- TTree object
752  """
753  super(PixelHits, self).__init__(tree, "pix_isBarrel", PixelHit)
754 
755 
757  """Class representing a strip hit."""
758  def __init__(self, tree, index):
759  """Constructor.
760 
761  Arguments:
762  tree -- TTree object
763  index -- Index of the hit
764  """
765  super(StripHit, self).__init__(tree, index, "str")
766 
767  def isValidHit(self):
768  return True
769 
771  """Class presenting a collection of strip hits."""
772  def __init__(self, tree):
773  """Constructor.
774 
775  Arguments:
776  tree -- TTree object
777  """
778  super(StripHits, self).__init__(tree, "str_isBarrel", StripHit)
779 
780 
782  """Class representing a matched strip hit."""
783  def __init__(self, tree, index):
784  """Constructor.
785 
786  Arguments:
787  tree -- TTree object
788  index -- Index of the hit
789  """
790  super(GluedHit, self).__init__(tree, index, "glu")
791 
792  def isValidHit(self):
793  return True
794 
795  def monoHit(self):
796  """Returns a StripHit for the mono hit."""
797  self._checkIsValid()
798  return StripHit(self._tree, self._tree.glu_monoIdx[self._index])
799 
800  def stereoHit(self):
801  """Returns a StripHit for the stereo hit."""
802  self._checkIsValid()
803  return StripHit(self._tree, self._tree.glu_stereoIdx[self._index])
804 
805  def nseeds(self):
806  """Returns the number of seeds containing this hit."""
807  self._checkIsValid()
808  return self._tree.glu_seeIdx[self._index].size()
809 
810  def seeds(self):
811  """Returns generator for seeds containing this hit.
812 
813  The generator returns Seed objects
814  """
815  self._checkIsValid()
816  for iseed in self._tree.glu_seeIdx[self._index]:
817  yield Seed(self._tree, iseed)
818 
820  """Class presenting a collection of matched strip hits."""
821  def __init__(self, tree):
822  """Constructor.
823 
824  Arguments:
825  tree -- TTree object
826  """
827  super(GluedHits, self).__init__(tree, "glu_isBarrel", GluedHit)
828 
829 
831  # repeating TrackingRecHit::Type
832  Type = _Enum(
833  missing = 1,
834  inactive = 2,
835  bad = 3,
836  missing_inner = 4,
837  missing_outer = 5
838  )
839 
840  """Class representing an invalid hit."""
841  def __init__(self, tree, index):
842  """Constructor.
843 
844  Arguments:
845  tree -- TTree object
846  index -- Index of the hit
847  """
848  super(InvalidHit, self).__init__(tree, index, "inv")
849 
850  def isValidHit(self):
851  return False
852 
853  def layerStr(self):
854  """Returns a string describing the layer of the hit."""
855  invalid_type = self._tree.inv_type[self._index]
856  return super(InvalidHit, self).layerStr() + " (%s)"%InvalidHit.Type.toString(invalid_type)
857 
858 
860  """Class representing a phase2 OT hit."""
861  def __init__(self, tree, index):
862  """Constructor.
863 
864  Arguments:
865  tree -- TTree object
866  index -- Index of the hit
867  """
868  super(Phase2OTHit, self).__init__(tree, index, "ph2")
869 
870  def isValidHit(self):
871  return True
872 
874  """Class presenting a collection of phase2 OT hits."""
875  def __init__(self, tree):
876  """Constructor.
877 
878  Arguments:
879  tree -- TTree object
880  """
881  super(Phase2OTHits, self).__init__(tree, "ph2_isBarrel", Phase2OTHit)
882 
883 
884 def _seedOffsetForAlgo(tree, algo):
885  """Internal function for returning a pair of indices for the beginning of seeds of a given 'algo', and the one-beyond-last index of the seeds."""
886  for ioffset, offset in enumerate(tree.see_offset):
887  if tree.see_algo[offset] == algo:
888  next_offset = tree.see_offset[ioffset+1] if ioffset < tree.see_offset.size()-1 else tree.see_algo.size()
889  return (offset, next_offset)
890  return (-1, -1)
891 
893  """Class presenting a seed."""
894  def __init__(self, tree, index):
895  """Constructor.
896 
897  Arguments:
898  tree -- TTree object
899  index -- Index of the seed
900  """
901  super(Seed, self).__init__(tree, index, "see")
902 
903  def indexWithinAlgo(self):
904  """Returns the seed index within the seeds of the same algo.
905 
906  In case of errors, -1 is returned.
907  """
908  self._checkIsValid()
909  algo = self._tree.see_algo[self._index]
910  (offset, next_offset) = _seedOffsetForAlgo(self._tree, algo)
911  if offset == -1: # algo not found
912  return -1
913  return self._index - offset
914 
915  def track(self):
916  """Returns Track that was made from this seed."""
917  self._checkIsValid()
918  return Track(self._tree, self._tree.see_trkIdx[self._index])
919 
921  """Class presenting a collection of seeds."""
922  def __init__(self, tree):
923  """Constructor.
924 
925  Arguments:
926  tree -- TTree object
927  """
928  super(Seeds, self).__init__(tree, "see_pt", Seed)
929 
930  def nSeedsForAlgo(self, algo):
931  """Returns the number of seeds for a given 'algo'."""
932  (offset, next_offset) = _seedOffsetForAlgo(self._tree, algo)
933  return next_offset - offset
934 
935  def seedsForAlgo(self, algo):
936  """Returns generator iterating over the seeds of a given 'algo'.
937 
938  Generator returns Seed object.
939  """
940  (offset, next_offset) = _seedOffsetForAlgo(self._tree, algo)
941  for isee in range(offset, next_offset):
942  yield Seed(self._tree, isee)
943 
944  def seedForAlgo(self, algo, iseed):
945  """Returns Seed of index 'iseed' for 'algo'."""
946  (offset, next_offset) = _seedOffsetForAlgo(self._tree, algo)
947  if iseed >= (next_offset-offset):
948  raise Exception("Seed index %d is larger than the number of seeds %d for algo %d (%s)" % (iseed, next_offset-offset, algo, Algo.toString(algo)))
949  return Seed(self._tree, offset+iseed)
950 
951 
953  """Class representing a SimHit which has not induced a RecHit."""
954  def __init__(self, tree, index):
955  """Constructor.
956 
957  Arguments:
958  tree -- TTree object
959  index -- Index of the SimHit
960  """
961  super(SimHit, self).__init__(tree, index, "simhit")
962 
963  def nRecHits(self):
964  self._checkIsValid()
965  return self._tree.simhit_hitIdx[self._index].size()
966 
967  def trackingParticle(self):
968  self._checkIsValid()
969  return TrackingParticle(self._tree, getattr(self._tree, self._prefix+"_simTrkIdx")[self._index])
970 
971 
973  """Class representing a TrackingParticle."""
974  def __init__(self, tree, index):
975  """Constructor.
976 
977  Arguments:
978  tree -- TTree object
979  index -- Index of the TrackingParticle
980  """
981  super(TrackingParticle, self).__init__(tree, index, "sim")
982 
983  def _nMatchedTracks(self):
984  """Internal function to get the number of matched tracks."""
985  return self._tree.sim_trkIdx[self._index].size()
986 
987  def nMatchedTracks(self):
988  """Returns the number of matched tracks."""
989  self._checkIsValid()
990  return self._nMatchedTracks()
991 
992  def matchedTrackInfos(self):
993  """Returns a generator for matched tracks.
994 
995  The generator returns TrackMatchInfo objects.
996  """
997  self._checkIsValid()
998  for imatch in range(self._nMatchedTracks()):
999  yield TrackMatchInfo(self._tree, self._index, imatch, self._prefix)
1000 
1002  """Returns best-matching track, even for non-reconstructed TrackingParticles, or None, if there is no best-matching track.
1003 
1004  Best-matching is defined as the one with largest number of
1005  hits matched to the hits of a TrackingParticle (>= 3). If
1006  there are many fulfilling the same number of hits, the one
1007  inducing the innermost hit of the TrackingParticle is chosen.
1008  """
1009  self._checkIsValid()
1010  if self._nMatchedTracks() == 1:
1011  return next(self.matchedTrackInfos()).track()
1012 
1013  tracks = collections.OrderedDict()
1014  for hit in self.simHits():
1015  for recHit in hit.hits():
1016  for track in recHit.tracks():
1017  if track.index() in tracks:
1018  tracks[track.index()] += 1
1019  else:
1020  tracks[track.index()] = 1
1021 
1022  best = (None, 2)
1023  for trackIndex, nhits in six.iteritems(tracks):
1024  if nhits > best[1]:
1025  best = (trackIndex, nhits)
1026  if best[0] is None:
1027  return None
1028  return Tracks(self._tree)[best[0]]
1029 
1030  def _nMatchedSeeds(self):
1031  """Internal function to get the number of matched seeds."""
1032  return self._tree.sim_seedIdx[self._index].size()
1033 
1034  def nMatchedSeeds(self):
1035  """Returns the number of matched seeds."""
1036  self._checkIsValid()
1037  return self._nMatchedSeeds()
1038 
1039  def matchedSeedInfos(self):
1040  """Returns a generator for matched tracks.
1041 
1042  The generator returns SeedMatchInfo objects.
1043  """
1044  self._checkIsValid()
1045  for imatch in range(self._nMatchedSeeds()):
1046  yield SeedMatchInfo(self._tree, self._index, imatch, self._prefix)
1047 
1048  def nSimHits(self):
1049  self._checkIsValid()
1050  return self.simHitIdx().size()
1051 
1052  def simHits(self):
1053  """Returns generator for SimHits."""
1054  self._checkIsValid()
1055  for ihit in self.simHitIdx():
1056  yield SimHit(self._tree, ihit)
1057 
1058  def parentVertex(self):
1059  """Returns the parent TrackingVertex."""
1060  self._checkIsValid()
1061  return TrackingVertex(self._tree, self._tree.sim_parentVtxIdx[self._index])
1062 
1063  def decayVertices(self):
1064  """Returns a generator for decay vertices.
1065 
1066  The generator returns TrackingVertex objects.
1067  """
1068  self._checkIsValid()
1069  for ivtx in self._tree.sim_decayVtxIdx[self._index]:
1070  yield TrackingVertex(self._tree, ivtx)
1071 
1072  def isLooper(self):
1073  """Returns True if this TrackingParticle is a looper.
1074 
1075  Note that the check involves looping over the SimHits, so it is not too cheap."""
1076  self._checkIsValid()
1077  prevr = 0
1078  for ihit in self.simHitIdx():
1079  hit = SimHit(self._tree, ihit)
1080  r = hit.x()**2 + hit.y()**2
1081  if r < prevr:
1082  return True
1083  prevr = r
1084  return False
1085 
1086 
1088  """Class presenting a collection of TrackingParticles."""
1089  def __init__(self, tree):
1090  """Constructor.
1091 
1092  Arguments:
1093  tree -- TTree object
1094  """
1095  super(TrackingParticles, self).__init__(tree, "sim_pt", TrackingParticle)
1096 
1097 
1099  """Class presenting a primary vertex."""
1100  def __init__(self, tree, index):
1101  """Constructor.
1102 
1103  Arguments:
1104  tree -- TTree object
1105  index -- Index of the vertex
1106  """
1107  super(Vertex, self).__init__(tree, index, "vtx")
1108 
1109  def nTracks(self):
1110  """Returns the number of tracks used in the vertex fit."""
1111  self._checkIsValid()
1112  return self._tree.vtx_trkIdx[self._index].size()
1113 
1114  def tracks(self):
1115  """Returns a generator for the tracks used in the vertex fit.
1116 
1117  The generator returns Track object.
1118  """
1119  self._checkIsValid()
1120  for itrk in self._tree.vtx_trkIdx[self._index]:
1121  yield Track(self._tree, itrk)
1122 
1124  """Class presenting a collection of vertices."""
1125  def __init__(self, tree):
1126  """Constructor.
1127 
1128  Arguments:
1129  tree -- TTree object
1130  """
1131  super(Vertices, self).__init__(tree, "vtx_valid", Vertex)
1132 
1133 
1135  """Class representing a TrackingVertex."""
1136  def __init__(self, tree, index):
1137  """Constructor.
1138 
1139  Arguments:
1140  tree -- TTree object
1141  index -- Index of the TrackingVertex
1142  """
1143  super(TrackingVertex, self).__init__(tree, index, "simvtx")
1144 
1146  """Returns the number of source TrackingParticles."""
1147  self._checkIsValid()
1148  return self._tree.simvtx_sourceSimIdx[self._index].size()
1149 
1151  """Returns the number of daughter TrackingParticles."""
1152  self._checkIsValid()
1153  return self._tree.simvtx_daughterSimIdx[self._index].size()
1154 
1156  """Returns a generator for the source TrackingParticles."""
1157  self._checkIsValid()
1158  for isim in self._tree.simvtx_sourceSimIdx[self._index]:
1159  yield TrackingParticle(self._tree, isim)
1160 
1162  """Returns a generator for the daughter TrackingParticles."""
1163  self._checkIsValid()
1164  for isim in self._tree.simvtx_daughterSimIdx[self._index]:
1165  yield TrackingParticle(self._tree, isim)
1166 
1168  """Class presenting a collection of TrackingVertices."""
1169  def __init__(self, tree):
1170  """Constructor.
1171 
1172  Arguments:
1173  tree -- TTree object
1174  """
1175  super(TrackingVertex, self).__init__(tree, "simvtx_x")
ntupleDataFormat.Event.stripHits
def stripHits(self)
Definition: ntupleDataFormat.py:499
ntupleDataFormat.Seeds.seedsForAlgo
def seedsForAlgo(self, algo)
Definition: ntupleDataFormat.py:935
ntupleDataFormat._DetIdStrAdaptor.layerStr
def layerStr(self)
Definition: ntupleDataFormat.py:95
ntupleDataFormat.GluedHit.stereoHit
def stereoHit(self)
Definition: ntupleDataFormat.py:800
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
ntupleDataFormat._RecoHitAdaptor.stripHits
def stripHits(self)
Definition: ntupleDataFormat.py:243
resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
ntupleDataFormat.TrackMatchInfo
Definition: ntupleDataFormat.py:612
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
ntupleDataFormat.Tracks
Definition: ntupleDataFormat.py:720
ntupleDataFormat.TrackingVertices.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:1169
ntupleDataFormat.TrackingParticle.parentVertex
def parentVertex(self)
Definition: ntupleDataFormat.py:1058
ntupleDataFormat.Vertices
Definition: ntupleDataFormat.py:1123
ntupleDataFormat.Event.eventIdStr
def eventIdStr(self)
Definition: ntupleDataFormat.py:483
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
ntupleDataFormat.Event.phase2OTHits
def phase2OTHits(self)
Definition: ntupleDataFormat.py:507
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleShareFrac
def bestMatchingTrackingParticleShareFrac(self)
Definition: ntupleDataFormat.py:335
ntupleDataFormat.Event.eventId
def eventId(self)
Definition: ntupleDataFormat.py:479
ntupleDataFormat._Collection.__len__
def __len__(self)
Definition: ntupleDataFormat.py:34
ntupleDataFormat._Collection.__getitem__
def __getitem__(self, index)
Definition: ntupleDataFormat.py:38
ntupleDataFormat.BeamSpot
Definition: ntupleDataFormat.py:528
ntupleDataFormat.SeedMatchInfo
Definition: ntupleDataFormat.py:644
ntupleDataFormat.SimHitMatchInfo.__getattr__
def __getattr__(self, attr)
Definition: ntupleDataFormat.py:568
ntupleDataFormat.GluedHit
Definition: ntupleDataFormat.py:781
ntupleDataFormat.PixelHit.isValidHit
def isValidHit(self)
Definition: ntupleDataFormat.py:742
ntupleDataFormat._HitObject.r3D
def r3D(self)
Definition: ntupleDataFormat.py:201
ntupleDataFormat.TrackingParticle.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:974
ntupleDataFormat.StripHit.isValidHit
def isValidHit(self)
Definition: ntupleDataFormat.py:767
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticle
def bestMatchingTrackingParticle(self)
Definition: ntupleDataFormat.py:322
ntupleDataFormat.Seeds
Definition: ntupleDataFormat.py:920
ntupleDataFormat._Object.__init__
def __init__(self, tree, index, prefix)
Definition: ntupleDataFormat.py:55
ntupleDataFormat._SimHitMatchAdaptor.__init__
def __init__(self)
Definition: ntupleDataFormat.py:277
ntupleDataFormat._SimHitMatchAdaptor.matchedSimHitInfos
def matchedSimHitInfos(self)
Definition: ntupleDataFormat.py:289
ntupleDataFormat.Track.vertex
def vertex(self)
Definition: ntupleDataFormat.py:685
ntupleDataFormat.Vertex.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:1100
ntupleDataFormat.InvalidHit
Definition: ntupleDataFormat.py:830
ntupleDataFormat.SeedMatchInfo.__init__
def __init__(self, tree, index, seedindex, prefix)
Definition: ntupleDataFormat.py:651
ntupleDataFormat.TrackingParticle.matchedTrackInfos
def matchedTrackInfos(self)
Definition: ntupleDataFormat.py:992
ntupleDataFormat.TrackingNtuple._file
_file
Definition: ntupleDataFormat.py:400
ntupleDataFormat.Event.gluedHits
def gluedHits(self)
Definition: ntupleDataFormat.py:503
ntupleDataFormat._Object._checkIsValid
def _checkIsValid(self)
Definition: ntupleDataFormat.py:77
ntupleDataFormat.Event.vertices
def vertices(self)
Definition: ntupleDataFormat.py:519
ntupleDataFormat._HitObject.seeds
def seeds(self)
Definition: ntupleDataFormat.py:189
ntupleDataFormat._RecoHitAdaptor.hits
def hits(self)
Definition: ntupleDataFormat.py:214
ntupleDataFormat._Object._tree
_tree
Definition: ntupleDataFormat.py:64
ntupleDataFormat._Object._index
_index
Definition: ntupleDataFormat.py:65
ntupleDataFormat._Collection._objclass
_objclass
Definition: ntupleDataFormat.py:28
ntupleDataFormat.InvalidHit.isValidHit
def isValidHit(self)
Definition: ntupleDataFormat.py:850
ntupleDataFormat.TrackingParticle.isLooper
def isLooper(self)
Definition: ntupleDataFormat.py:1072
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleNormalizedChi2
def bestMatchingTrackingParticleNormalizedChi2(self)
Definition: ntupleDataFormat.py:347
ntupleDataFormat.TrackingParticleMatchInfo.__init__
def __init__(self, tree, index, tpindex, prefix)
Definition: ntupleDataFormat.py:586
ntupleDataFormat.TrackingNtuple.hasSeeds
def hasSeeds(self)
Definition: ntupleDataFormat.py:417
ntupleDataFormat.GluedHit.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:783
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleShareFracSimDenom
def bestMatchingTrackingParticleShareFracSimDenom(self)
Definition: ntupleDataFormat.py:339
ntupleDataFormat.Track.thetaPull
def thetaPull(self)
Definition: ntupleDataFormat.py:696
ntupleDataFormat.GluedHit.nseeds
def nseeds(self)
Definition: ntupleDataFormat.py:805
ntupleDataFormat.Seed
Definition: ntupleDataFormat.py:892
ntupleDataFormat._Object.__getattr__
def __getattr__(self, attr)
Definition: ntupleDataFormat.py:68
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
ntupleDataFormat.Seed.indexWithinAlgo
def indexWithinAlgo(self)
Definition: ntupleDataFormat.py:903
ntupleDataFormat.TrackMatchInfo._trkindex
_trkindex
Definition: ntupleDataFormat.py:628
ntupleDataFormat.InvalidHit.layerStr
def layerStr(self)
Definition: ntupleDataFormat.py:853
ntupleDataFormat.Phase2OTHit
Definition: ntupleDataFormat.py:859
ntupleDataFormat._RecoHitAdaptor.pixelHits
def pixelHits(self)
Definition: ntupleDataFormat.py:235
ntupleDataFormat.SeedMatchInfo.seed
def seed(self)
Definition: ntupleDataFormat.py:663
ntupleDataFormat._RecoHitAdaptor.gluedHits
def gluedHits(self)
Definition: ntupleDataFormat.py:251
ntupleDataFormat.GluedHit.isValidHit
def isValidHit(self)
Definition: ntupleDataFormat.py:792
ntupleDataFormat.SimHitMatchInfo
Definition: ntupleDataFormat.py:549
ntupleDataFormat._RecoHitAdaptor.invalidHits
def invalidHits(self)
Definition: ntupleDataFormat.py:259
ntupleDataFormat.TrackingNtuple.nevents
def nevents(self)
Definition: ntupleDataFormat.py:410
ntupleDataFormat.TrackingNtuple.tree
def tree(self)
Definition: ntupleDataFormat.py:407
ntupleDataFormat.TrackingParticleMatchInfo
Definition: ntupleDataFormat.py:578
ntupleDataFormat.Event.run
def run(self)
Definition: ntupleDataFormat.py:475
ntupleDataFormat.TrackingParticleMatchInfo._tpindex
_tpindex
Definition: ntupleDataFormat.py:596
ntupleDataFormat._TrackingParticleMatchAdaptor.__init__
def __init__(self)
Definition: ntupleDataFormat.py:300
ntupleDataFormat.Event._entry
_entry
Definition: ntupleDataFormat.py:462
ntupleDataFormat.GluedHit.seeds
def seeds(self)
Definition: ntupleDataFormat.py:810
ntupleEnum
ntupleDataFormat.StripHits.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:772
ntupleDataFormat._TrackingParticleMatchAdaptor.matchedTrackingParticleInfos
def matchedTrackingParticleInfos(self)
Definition: ntupleDataFormat.py:312
ntupleDataFormat.Event.tracks
def tracks(self)
Definition: ntupleDataFormat.py:491
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHitShareFrac
def bestMatchingTrackingParticleFromFirstHitShareFrac(self)
Definition: ntupleDataFormat.py:365
ntupleDataFormat.SeedMatchInfo._seedindex
_seedindex
Definition: ntupleDataFormat.py:661
ntupleDataFormat.TrackingParticles
Definition: ntupleDataFormat.py:1087
ntupleDataFormat._RecoHitAdaptor.__init__
def __init__(self)
Definition: ntupleDataFormat.py:206
ntupleDataFormat.TrackingParticle.nSimHits
def nSimHits(self)
Definition: ntupleDataFormat.py:1048
ntupleDataFormat.TrackingNtuple.hasHits
def hasHits(self)
Definition: ntupleDataFormat.py:413
ntupleDataFormat.BeamSpot.__getattr__
def __getattr__(self, attr)
Definition: ntupleDataFormat.py:540
ntupleDataFormat._Object.isValid
def isValid(self)
Definition: ntupleDataFormat.py:82
ntupleDataFormat.Vertices.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:1125
ntupleDataFormat.Event.__init__
def __init__(self, tree, entry)
Definition: ntupleDataFormat.py:453
ntupleDataFormat.GluedHit.monoHit
def monoHit(self)
Definition: ntupleDataFormat.py:795
ntupleDataFormat.Event.entry
def entry(self)
Definition: ntupleDataFormat.py:464
ntupleDataFormat.TrackingParticle.nMatchedTracks
def nMatchedTracks(self)
Definition: ntupleDataFormat.py:987
ntupleDataFormat.TrackingNtuple.getEvent
def getEvent(self, index)
Definition: ntupleDataFormat.py:437
ntupleDataFormat.TrackingNtuple.__init__
def __init__(self, fileName, tree="trackingNtuple/tree")
Definition: ntupleDataFormat.py:392
ntupleDataFormat.TrackingVertex.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:1136
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHitNormalizedChi2
def bestMatchingTrackingParticleFromFirstHitNormalizedChi2(self)
Definition: ntupleDataFormat.py:377
ntupleDataFormat._HitObject
Definition: ntupleDataFormat.py:156
ntupleDataFormat.TrackMatchInfo.__getattr__
def __getattr__(self, attr)
Definition: ntupleDataFormat.py:630
ntupleDataFormat._seedOffsetForAlgo
def _seedOffsetForAlgo(tree, algo)
Definition: ntupleDataFormat.py:884
ntupleDataFormat.PixelHit.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:733
ntupleDataFormat._RecoHitAdaptor._hits
def _hits(self)
Definition: ntupleDataFormat.py:209
ntupleDataFormat._HitObject.ntracks
def ntracks(self)
Definition: ntupleDataFormat.py:170
ntupleDataFormat._SimHitMatchAdaptor.nMatchedSimHits
def nMatchedSimHits(self)
Definition: ntupleDataFormat.py:284
ntupleDataFormat.StripHit
Definition: ntupleDataFormat.py:756
ntupleDataFormat._Collection._tree
_tree
Definition: ntupleDataFormat.py:26
ntupleDataFormat.TrackingVertex.sourceTrackingParticles
def sourceTrackingParticles(self)
Definition: ntupleDataFormat.py:1155
ntupleDataFormat._Collection
Definition: ntupleDataFormat.py:11
Exception
ntupleDataFormat.Event
Definition: ntupleDataFormat.py:447
ntupleDataFormat._Object
Definition: ntupleDataFormat.py:47
ntupleDataFormat.BeamSpot._prefix
_prefix
Definition: ntupleDataFormat.py:538
ntupleDataFormat._DetIdStrAdaptor.detIdStr
def detIdStr(self)
Definition: ntupleDataFormat.py:116
ntupleDataFormat.SimHit.trackingParticle
def trackingParticle(self)
Definition: ntupleDataFormat.py:967
ntupleDataFormat.TrackingParticle.simHits
def simHits(self)
Definition: ntupleDataFormat.py:1052
ntupleDataFormat.GluedHits.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:821
ntupleDataFormat.PixelHits
Definition: ntupleDataFormat.py:745
ntupleDataFormat.Phase2OTHits.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:875
ntupleDataFormat.Event.beamspot
def beamspot(self)
Definition: ntupleDataFormat.py:487
ntupleDataFormat.Vertex.nTracks
def nTracks(self)
Definition: ntupleDataFormat.py:1109
ntupleDataFormat._Collection.__iter__
def __iter__(self)
Definition: ntupleDataFormat.py:42
ntupleDataFormat.Vertex
Definition: ntupleDataFormat.py:1098
createfilelist.int
int
Definition: createfilelist.py:10
ntupleDataFormat.TrackingParticle
Definition: ntupleDataFormat.py:972
ntupleDataFormat.TrackingParticle._nMatchedTracks
def _nMatchedTracks(self)
Definition: ntupleDataFormat.py:983
ntupleDataFormat.TrackingVertex
Definition: ntupleDataFormat.py:1134
ntupleDataFormat.Seeds.seedForAlgo
def seedForAlgo(self, algo, iseed)
Definition: ntupleDataFormat.py:944
ntupleDataFormat.PixelHits.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:747
ntupleDataFormat._Collection._sizeBranch
_sizeBranch
Definition: ntupleDataFormat.py:27
ntupleDataFormat.Event.trackingVertices
def trackingVertices(self)
Definition: ntupleDataFormat.py:523
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHit
def bestMatchingTrackingParticleFromFirstHit(self)
Definition: ntupleDataFormat.py:351
ntupleDataFormat.TrackMatchInfo.__init__
def __init__(self, tree, index, trkindex, prefix)
Definition: ntupleDataFormat.py:618
ntupleDataFormat.SimHitMatchInfo.__init__
def __init__(self, tree, index, shindex, prefix)
Definition: ntupleDataFormat.py:556
ntupleDataFormat.Event.trackingParticles
def trackingParticles(self)
Definition: ntupleDataFormat.py:515
ntupleDataFormat.Tracks.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:722
ntupleDataFormat.StripHits
Definition: ntupleDataFormat.py:770
ntupleDataFormat._SimHitMatchAdaptor._nMatchedSimHits
def _nMatchedSimHits(self)
Definition: ntupleDataFormat.py:280
ntupleDataFormat.TrackingNtuple
Definition: ntupleDataFormat.py:382
ntupleDataFormat.TrackingNtuple.__iter__
def __iter__(self)
Definition: ntupleDataFormat.py:421
ntupleDataFormat.Event.lumi
def lumi(self)
Definition: ntupleDataFormat.py:471
ntupleDataFormat.Event.seeds
def seeds(self)
Definition: ntupleDataFormat.py:511
ntupleDataFormat.TrackingVertex.nDaughterTrackingParticles
def nDaughterTrackingParticles(self)
Definition: ntupleDataFormat.py:1150
ntupleDataFormat.Track.dxyPull
def dxyPull(self)
Definition: ntupleDataFormat.py:708
ntupleDataFormat.TrackMatchInfo.track
def track(self)
Definition: ntupleDataFormat.py:640
ntupleDataFormat.StripHit.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:758
ntupleDataFormat.Phase2OTHit.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:861
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:41
ntupleDataFormat.TrackingNtuple._entries
_entries
Definition: ntupleDataFormat.py:402
ntupleDataFormat._Collection.size
def size(self)
Definition: ntupleDataFormat.py:30
ntupleDataFormat._RecoHitAdaptor
Definition: ntupleDataFormat.py:204
ntupleDataFormat.Seeds.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:922
ntupleDataFormat.TrackingVertices
Definition: ntupleDataFormat.py:1167
ntupleDataFormat.SimHitMatchInfo._shindex
_shindex
Definition: ntupleDataFormat.py:566
ntupleDataFormat._TrackingParticleMatchAdaptor.nMatchedTrackingParticles
def nMatchedTrackingParticles(self)
Definition: ntupleDataFormat.py:307
ntupleDataFormat.Track
Definition: ntupleDataFormat.py:669
ntupleDataFormat._HitObject.nseeds
def nseeds(self)
Definition: ntupleDataFormat.py:184
ntupleDataFormat._RecoHitAdaptor.phase2OTHits
def phase2OTHits(self)
Definition: ntupleDataFormat.py:267
ntupleDataFormat._Object._prefix
_prefix
Definition: ntupleDataFormat.py:66
ntupleDataFormat.Event.pixelHits
def pixelHits(self)
Definition: ntupleDataFormat.py:495
ntupleDataFormat.Track.phiPull
def phiPull(self)
Definition: ntupleDataFormat.py:702
ntupleDataFormat.Phase2OTHits
Definition: ntupleDataFormat.py:873
ntupleDataFormat.Track.seed
def seed(self)
Definition: ntupleDataFormat.py:680
ntupleDataFormat._DetIdStrAdaptor
Definition: ntupleDataFormat.py:90
ntupleDataFormat.SimHitMatchInfo.simHit
def simHit(self)
Definition: ntupleDataFormat.py:573
ntupleDataFormat._HitObject.r
def r(self)
Definition: ntupleDataFormat.py:198
ntupleDataFormat.Track.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:671
ntupleDataFormat._DetIdStrAdaptor.__init__
def __init__(self)
Definition: ntupleDataFormat.py:92
ntupleDataFormat._HitObject.__init__
def __init__(self, tree, index, prefix)
Definition: ntupleDataFormat.py:158
ntupleDataFormat.InvalidHit.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:841
ntupleDataFormat.TrackingParticle.bestMatchingTrack
def bestMatchingTrack(self)
Definition: ntupleDataFormat.py:1001
format
ntupleDataFormat.PixelHit
Definition: ntupleDataFormat.py:731
ntupleDataFormat.Track.dzPull
def dzPull(self)
Definition: ntupleDataFormat.py:714
pileupCalc.upper
upper
Definition: pileupCalc.py:214
ntupleDataFormat.Event.event
def event(self)
Definition: ntupleDataFormat.py:467
ntupleDataFormat.TrackingParticle.nMatchedSeeds
def nMatchedSeeds(self)
Definition: ntupleDataFormat.py:1034
ntupleDataFormat.Seeds.nSeedsForAlgo
def nSeedsForAlgo(self, algo)
Definition: ntupleDataFormat.py:930
ntupleDataFormat.TrackingParticle._nMatchedSeeds
def _nMatchedSeeds(self)
Definition: ntupleDataFormat.py:1030
ntupleDataFormat.SimHit.nRecHits
def nRecHits(self)
Definition: ntupleDataFormat.py:963
ntupleDataFormat.BeamSpot.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:530
ntupleDataFormat.Vertex.tracks
def tracks(self)
Definition: ntupleDataFormat.py:1114
ntupleDataFormat.TrackingNtuple._tree
_tree
Definition: ntupleDataFormat.py:401
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHitShareFracSimDenom
def bestMatchingTrackingParticleFromFirstHitShareFracSimDenom(self)
Definition: ntupleDataFormat.py:369
ntupleDataFormat._Collection.__init__
def __init__(self, tree, sizeBranch, objclass)
Definition: ntupleDataFormat.py:17
ntupleDataFormat._Object.index
def index(self)
Definition: ntupleDataFormat.py:86
ntupleDataFormat.TrackingParticle.decayVertices
def decayVertices(self)
Definition: ntupleDataFormat.py:1063
ntupleDataFormat.Seed.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:894
ntupleDataFormat.TrackingVertex.daughterTrackingParticles
def daughterTrackingParticles(self)
Definition: ntupleDataFormat.py:1161
ntupleDataFormat.TrackingParticleMatchInfo.trackingParticle
def trackingParticle(self)
Definition: ntupleDataFormat.py:608
ntupleDataFormat.Seed.track
def track(self)
Definition: ntupleDataFormat.py:915
ntupleDataFormat.Phase2OTHit.isValidHit
def isValidHit(self)
Definition: ntupleDataFormat.py:870
ntupleDataFormat.BeamSpot._tree
_tree
Definition: ntupleDataFormat.py:537
ntupleDataFormat._SimHitMatchAdaptor
Definition: ntupleDataFormat.py:275
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleShareFracSimClusterDenom
def bestMatchingTrackingParticleShareFracSimClusterDenom(self)
Definition: ntupleDataFormat.py:343
ntupleDataFormat.TrackingParticle.matchedSeedInfos
def matchedSeedInfos(self)
Definition: ntupleDataFormat.py:1039
ntupleDataFormat.GluedHits
Definition: ntupleDataFormat.py:819
ntupleDataFormat.Event._tree
_tree
Definition: ntupleDataFormat.py:461
ntupleDataFormat._TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHitShareFracSimClusterDenom
def bestMatchingTrackingParticleFromFirstHitShareFracSimClusterDenom(self)
Definition: ntupleDataFormat.py:373
ntupleDataFormat.TrackingVertex.nSourceTrackingParticles
def nSourceTrackingParticles(self)
Definition: ntupleDataFormat.py:1145
ntupleDataFormat.SimHit.__init__
def __init__(self, tree, index)
Definition: ntupleDataFormat.py:954
ntupleDataFormat._HitObject.tracks
def tracks(self)
Definition: ntupleDataFormat.py:175
ntupleDataFormat._TrackingParticleMatchAdaptor
Definition: ntupleDataFormat.py:298
ntupleDataFormat.TrackingNtuple.file
def file(self)
Definition: ntupleDataFormat.py:404
ntupleDataFormat._TrackingParticleMatchAdaptor._nMatchedTrackingParticles
def _nMatchedTrackingParticles(self)
Definition: ntupleDataFormat.py:303
ntupleDataFormat.TrackingParticleMatchInfo.__getattr__
def __getattr__(self, attr)
Definition: ntupleDataFormat.py:598
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
ntupleDataFormat.Track.ptPull
def ptPull(self)
Definition: ntupleDataFormat.py:690
ntupleDataFormat.TrackingParticles.__init__
def __init__(self, tree)
Definition: ntupleDataFormat.py:1089
ntupleDataFormat.SimHit
Definition: ntupleDataFormat.py:952