CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
python.cmstools Namespace Reference

Classes

class  cmserror
 
class  Event
 
class  EventBranch
 
class  EventTree
 

Functions

def all
 workaround iterator generators for ROOT classes More...
 
def createBranchBuffer
 auto branch types (Chris Jones) More...
 
def loop
 

Detailed Description

Python helper tools for CMS FWLite

benedikt.hegner@cern.ch

Function Documentation

def python.cmstools.all (   container)

workaround iterator generators for ROOT classes

Definition at line 25 of file cmstools.py.

References sistrip::SpyUtilities.range().

Referenced by pat::EventHypothesis.all(), SiPixelPhase1GeometryDebug.analyze(), HGcalHitIdCheck.analyze(), LayerCollector.barrelLayers(), AlignmentMonitorSurvey.book(), DQMGenericTnPClient.calculateEfficiency(), HGCalCLUEAlgoT< TILE >.calculateLocalDensity(), CastorHardcodeCalibrations.CastorHardcodeCalibrations(), SummaryOutputProducer::TriggerSummary.changed(), combineBTagCalibrationData.check_csv_data(), CmsShowMain.CmsShowMain(), EgHLTOfflineClient.createTrigTagProbeEffHists(), EgHLTOfflineClient.createTrigTagProbeEffHists2Leg(), TemplatedJetBProbabilityComputer< Container, Base >.discriminator(), EwkElecDQM.dqmEndRun(), FWDetailViewManager.findViewersFor(), dqmTnP::GaussianPlusLinearFitter.fit(), dqmTnP::VoigtianPlusExponentialFitter.fit(), LayerCollector.forwardLayers(), SummaryOutputProducer::TriggerSummary.gained(), models.generate(), l1tVertexFinder::AnalysisSettings.genPdgIds(), tools.get_iovs(), tools.get_tags(), SiStripDetCabling.getAllDetectorsContiguousIds(), dataset.Dataset.getrunnumberfromfilename(), dataset.getrunnumbersfromfile(), helperFunctions.getTagsMap(), HcalHardcodeCalibrations.HcalHardcodeCalibrations(), conddblib.Connection.is_valid(), MuonTrackResidualAnalyzer.isInTheAcceptance(), MuonTrackAnalyzer.isInTheAcceptance(), o2olib.O2OJobMgr.listJobs(), conddblib.listObject(), SummaryOutputProducer::TriggerSummary.lost(), LA_Filler_Fitter.make_and_fit_symmchi2(), tmtt::Histos.makeEfficiencyPlot(), SiStripHitEffFromCalibTree.makeSummary(), AlignableTracker.merge(), mergeLHE.DefaultLHEMerger.merge_headers(), mergeLHE.DefaultLHEMerger.merge_init_blocks(), MuonSeedOrcaPatternRecognition.produce(), utils_v2.recursive_search_online(), plotBaryCentre_VS_BeamSpot.Run(), SiStripConfigDb.runs(), utils_v2.search_on_disk(), CSCTrackConfigSelector.select(), GlobalTrajectoryBuilderBase.selectTrackerHits(), DQMImplNet< DQMNet::Object >.sendObjectListToPeer(), heppy::IsolationComputer.setPackedCandidates(), TTDTC.size(), data_formats_tests.data_formats_tests.test_dicts_to_orm_objects(), data_formats_tests.data_formats_tests.test_orm_objects_to_dicts(), data_sources_tests.data_sources_tests.test_type_all_iovs(), data_sources_tests.data_sources_tests.test_type_all_tags(), TrimmedVertexFinder.vertices(), ConfigurableTrimmedVertexFinder.vertices(), dataset.DatasetBase.writefilelist_hippy(), and dataset.DatasetBase.writefilelist_validation().

25 
26 def all(container):
27 
28  # loop over ROOT::TTree and similar
29  if hasattr(container,'GetEntries'):
30  try:
31  entries = container.GetEntries()
32  for entry in range(entries):
33  yield entry
34  except:
35  raise cmserror("Looping of %s failed" %container)
36 
37  # loop over std::vectors and similar
38  elif hasattr(container, 'size'):
39  try:
40  entries = container.size()
41  for entry in range(entries):
42  yield container[entry]
43  except:
44  pass
45 
# loop over containers with begin and end iterators
const uint16_t range(const Frame &aFrame)
def all
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
def python.cmstools.createBranchBuffer (   branch)

auto branch types (Chris Jones)

Definition at line 53 of file cmstools.py.

References if().

53 
54 def createBranchBuffer(branch):
55  reColons = re.compile(r'::')
56  reCloseTemplate =re.compile(r'>')
57  reOpenTemplate =re.compile(r'<')
58  branchType = ROOT.branchToClass(branch)
59  #buffer = eval ('ROOT.'+reColons.sub(".",reOpenTemplate.sub("(ROOT.",reCloseTemplate.sub(")",branchType.GetName())))+'()')
60  buffer = ROOT.MakeRootClass(branchType.GetName()) ()
61  if( branch.GetName()[-1] != '.') and (branch.GetName()!="EventAuxiliary"):
62  branch.SetAddress(buffer)
63  else:
64  branch.SetAddress(ROOT.AddressOf(buffer))
65  return buffer
66 
def createBranchBuffer
auto branch types (Chris Jones)
Definition: cmstools.py:53
if(conf_.getParameter< bool >("UseStripCablingDB"))
def python.cmstools.loop (   begin,
  end 
)
Convert a pair of C++ iterators into a python generator

Definition at line 46 of file cmstools.py.

46 
47 def loop(begin, end):
48  """Convert a pair of C++ iterators into a python generator"""
49  while (begin != end):
50  yield begin.__deref__() #*b
51  begin.__preinc__() #++b