CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
datamodel.Collection Class Reference

Public Member Functions

def __getitem__ (self, index)
 
def __init__ (self, event, prefix, lenVar=None)
 
def __len__ (self)
 

Private Attributes

 _cache
 
 _event
 
 _len
 
 _prefix
 

Detailed Description

Definition at line 127 of file datamodel.py.

Constructor & Destructor Documentation

◆ __init__()

def datamodel.Collection.__init__ (   self,
  event,
  prefix,
  lenVar = None 
)

Definition at line 128 of file datamodel.py.

128  def __init__(self, event, prefix, lenVar=None):
129  self._event = event
130  self._prefix = prefix
131  if lenVar != None:
132  self._len = getattr(event, lenVar)
133  else:
134  self._len = getattr(event, "n" + prefix)
135  self._cache = {}
136 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ __getitem__()

def datamodel.Collection.__getitem__ (   self,
  index 
)

Definition at line 137 of file datamodel.py.

References DTCache< T, Coll >._cache, tkal_create_file_lists.FileListCreator._cache, L1MuDTTrackFinder._cache, datamodel.Collection._cache, L1MuBMTrackFinder._cache, DTTrig._cache, lhef::H5Handler._event, TinyEvent._event, datamodel.Object._event, datamodel.Collection._event, python.Events._event, datamodel.Collection._len, CommonAnalyzer._prefix, datamodel.Object._prefix, and datamodel.Collection._prefix.

137  def __getitem__(self, index):
138  if type(index) == int and index in self._cache:
139  return self._cache[index]
140  if index >= self._len:
141  raise IndexError("Invalid index %r (len is %r) at %s" % (index, self._len, self._prefix))
142  elif index < 0:
143  raise IndexError("Invalid index %r (negative) at %s" % (index, self._prefix))
144  ret = Object(self._event, self._prefix, index=index)
145  if type(index) == int:
146  self._cache[index] = ret
147  return ret
148 

◆ __len__()

def datamodel.Collection.__len__ (   self)

Definition at line 149 of file datamodel.py.

References datamodel.Collection._len.

149  def __len__(self):
150  return self._len
151 

Member Data Documentation

◆ _cache

datamodel.Collection._cache
private

◆ _event

datamodel.Collection._event
private

Definition at line 129 of file datamodel.py.

Referenced by datamodel.Collection.__getitem__().

◆ _len

datamodel.Collection._len
private

Definition at line 132 of file datamodel.py.

Referenced by datamodel.Collection.__getitem__(), and datamodel.Collection.__len__().

◆ _prefix

datamodel.Collection._prefix
private

Definition at line 130 of file datamodel.py.

Referenced by ntupleDataFormat._Object.__getattr__(), ntupleDataFormat.BeamSpot.__getattr__(), datamodel.Collection.__getitem__(), ntuplePrintersDiff._IndentPrinter._indent(), ntupleDataFormat._SimHitMatchAdaptor._nMatchedSimHits(), ntupleDataFormat._TrackingParticleMatchAdaptor._nMatchedTrackingParticles(), ntuplePrintersDiff._RecHitPrinter._printHits(), ntuplePrintersDiff.TrackingParticlePrinter._printMatchedSeeds0(), ntuplePrintersDiff.TrackingParticlePrinter._printMatchedSeedsHeader(), ntuplePrintersDiff.TrackingParticlePrinter._printMatchedTracks(), ntuplePrintersDiff.TrackingParticlePrinter._printMatchedTracksHeader(), ntuplePrintersDiff.TrackingParticlePrinter._printTP(), ntupleDataFormat._DetIdStrAdaptor.detIdStr(), ntuplePrintersDiff.SeedPrinter.diff(), ntuplePrintersDiff.TrackPrinter.diff(), ntuplePrintersDiff._IndentPrinter.indent(), ntupleDataFormat._DetIdStrAdaptor.layerStr(), ntupleDataFormat.TrackingParticle.matchedSeedInfos(), ntupleDataFormat._SimHitMatchAdaptor.matchedSimHitInfos(), ntupleDataFormat.TrackingParticle.matchedTrackInfos(), ntupleDataFormat._TrackingParticleMatchAdaptor.matchedTrackingParticleInfos(), ntupleDataFormat._HitObject.nseeds(), ntupleDataFormat._HitObject.ntracks(), ntuplePrintersDiff.SeedPrinter.printHeader(), ntuplePrintersDiff.TrackPrinter.printHeader(), ntuplePrintersDiff.SeedPrinter.printHits(), ntuplePrintersDiff.TrackPrinter.printHits(), ntuplePrintersDiff.TrackingParticlePrinter.printHits(), ntuplePrintersDiff.SeedPrinter.printMatchedTrackingParticles(), ntuplePrintersDiff.TrackPrinter.printMatchedTrackingParticles(), ntuplePrintersDiff.TrackingParticlePrinter.printMatchedTracks(), ntuplePrintersDiff.TrackingParticlePrinter.printTrackingParticle(), ntuplePrintersDiff._IndentPrinter.restoreIndent(), ntupleDataFormat.SeedMatchInfo.seed(), ntupleDataFormat._HitObject.seeds(), ntuplePrintersDiff._IndentPrinter.setIndentFrom(), ntupleDataFormat.SimHitMatchInfo.simHit(), ntupleDataFormat.SimHit.trackingParticle(), ntupleDataFormat._HitObject.tracks(), and html.PageSet.write().