CMS 3D CMS Logo

python::cmstools Namespace Reference


Classes

class  cmserror
class  Event
class  EventBranch
class  EventTree

Functions

def all
def createBranchBuffer
def loop


Function Documentation

def python::cmstools::all (   container  ) 

Definition at line 22 of file cmstools.py.

Referenced by LayerCollector::barrelLayers(), AlignmentMonitorSurvey::book(), CastorHardcodeCalibrations::CastorHardcodeCalibrations(), EgHLTOfflineClient::createTrigTagProbeEffHists(), JetBProbabilityComputer::discriminator(), Ig3DBaseBrowser::drawGrid(), LayerCollector::forwardLayers(), SiStripDetCabling::getAllDetectorsContiguousIds(), IgEnvsElement::getEnv(), HcalHardcodeCalibrations::HcalHardcodeCalibrations(), ThePEG::HepMCConverter< HepMCEventT, Traits >::init(), EcalListOfFEDSProducer::ListOfFEDS(), EcalRawToRecHitRoI::ListOfFEDS(), HLTPi0RecHitsFilter::ListOfFEDS(), AlignableTracker::merge(), MuonSeedOrcaPatternRecognition::produce(), SiStripConfigDb::runs(), IgModuleCache::update(), and ConfigurableTrimmedVertexFinder::vertices().

00022                   :
00023 
00024   # loop over ROOT::TTree and similar
00025   if hasattr(container,'GetEntries'):
00026     try:
00027       entries = container.GetEntries()
00028       for entry in xrange(entries):
00029         yield entry
00030     except:
00031         raise cmserror("Looping of %s failed" %container) 
00032 
00033   # loop over std::vectors and similar
00034   elif hasattr(container, 'size'):
00035     try:
00036       entries = container.size()
00037       for entry in xrange(entries):
00038         yield container[entry]
00039     except:
00040       pass
00041 
00042  # loop over containers with begin and end iterators
def loop(begin, end):

def python::cmstools::createBranchBuffer (   branch  ) 

Definition at line 50 of file cmstools.py.

00050                               :
00051     reColons = re.compile(r'::')
00052     reCloseTemplate =re.compile(r'>')
00053     reOpenTemplate =re.compile(r'<')
00054     branchType = ROOT.branchToClass(branch)
00055     #buffer = eval ('ROOT.'+reColons.sub(".",reOpenTemplate.sub("(ROOT.",reCloseTemplate.sub(")",branchType.GetName())))+'()')
00056     buffer = ROOT.MakeRootClass(branchType.GetName()) ()
00057     if( branch.GetName()[-1] != '.') and (branch.GetName()!="EventAuxiliary"):
00058         branch.SetAddress(buffer)
00059     else:
00060         branch.SetAddress(ROOT.AddressOf(buffer))
00061     return buffer
00062 
00063 
class EventTree(object):

def python::cmstools::loop (   begin,
  end 
)

Convert a pair of C++ iterators into a python generator

Definition at line 43 of file cmstools.py.

Referenced by DDCheckMaterial(), SiStripTFile::dirContent(), PhysicsTools::MVAComputer::eval(), output(), SiStripTFile::readDQMFormat(), TrajectoryManager::reconstruct(), HcalTestAnalysis::update(), DDI::Polycone::volume(), and DDI::Polyhedra::volume().

00043                     :
00044     """Convert a pair of C++ iterators into a python generator"""
00045     while (begin != end):
00046         yield begin.__deref__()  #*b
00047         begin.__preinc__()       #++b 
00048 
### auto branch types (Chris Jones)


Generated on Tue Jun 9 18:50:42 2009 for CMSSW by  doxygen 1.5.4