Classes | |
class | cmserror |
class | Event |
class | EventBranch |
class | EventTree |
Functions | |
def | all |
workaround iterator generators for ROOT classes | |
def | createBranchBuffer |
auto branch types (Chris Jones) | |
def | loop |
Python helper tools for CMS FWLite benedikt.hegner@cern.ch
def python::cmstools::all | ( | container | ) |
workaround iterator generators for ROOT classes
Definition at line 23 of file cmstools.py.
00024 : 00025 00026 # loop over ROOT::TTree and similar 00027 if hasattr(container,'GetEntries'): 00028 try: 00029 entries = container.GetEntries() 00030 for entry in xrange(entries): 00031 yield entry 00032 except: 00033 raise cmserror("Looping of %s failed" %container) 00034 00035 # loop over std::vectors and similar 00036 elif hasattr(container, 'size'): 00037 try: 00038 entries = container.size() 00039 for entry in xrange(entries): 00040 yield container[entry] 00041 except: 00042 pass 00043 # loop over containers with begin and end iterators
def python::cmstools::createBranchBuffer | ( | branch | ) |
auto branch types (Chris Jones)
Definition at line 51 of file cmstools.py.
00052 : 00053 reColons = re.compile(r'::') 00054 reCloseTemplate =re.compile(r'>') 00055 reOpenTemplate =re.compile(r'<') 00056 branchType = ROOT.branchToClass(branch) 00057 #buffer = eval ('ROOT.'+reColons.sub(".",reOpenTemplate.sub("(ROOT.",reCloseTemplate.sub(")",branchType.GetName())))+'()') 00058 buffer = ROOT.MakeRootClass(branchType.GetName()) () 00059 if( branch.GetName()[-1] != '.') and (branch.GetName()!="EventAuxiliary"): 00060 branch.SetAddress(buffer) 00061 else: 00062 branch.SetAddress(ROOT.AddressOf(buffer)) 00063 return buffer 00064
def python::cmstools::loop | ( | begin, | |
end | |||
) |
Convert a pair of C++ iterators into a python generator
Definition at line 44 of file cmstools.py.
Referenced by optutl::CommandLineParser::_getSectionFiles(), RawDataConverter::ClearData(), CmsShowMainFrame::CmsShowMainFrame(), DDCheckMaterial(), SiStripTFile::dirContent(), MillePedeAlignmentAlgorithm::doIO(), LaserAlignment::DumpPosFileSet(), LaserAlignment::DumpStripFileSet(), SETSeedFinder::estimateMomentum(), PhysicsTools::MVAComputer::evalInternal(), LMFDefFabric::getColor(), LMFDefFabric::getColorFromID(), RawDataConverter::GetDigis(), LMFDefFabric::getRunTag(), LMFDefFabric::getRunTagFromID(), LMFDefFabric::getTrigType(), LMFDefFabric::getTrigTypeFromID(), pat::EventHypothesis::loop(), output(), optutl::CommandLineParser::parseArguments(), EcalDigiSelector::produce(), SiStripTFile::readDQMFormat(), TrajectoryManager::reconstruct(), stdcomb::recursive_combination(), LMFColoredTable::setColor(), LMFColoredTable::setSystem(), HcalTestAnalysis::update(), DDI::Polycone::volume(), and DDI::Polyhedra::volume().