CMS 3D CMS Logo

interactiveExample.py
Go to the documentation of this file.
1 from __future__ import print_function
2 # has to be called with python -i interactiveExample.py
3 
4 from PhysicsTools.PythonAnalysis import *
5 from ROOT import *
6 
7 # prepare the FWLite autoloading mechanism
8 gSystem.Load("libFWCoreFWLite.so")
9 ROOT.FWLiteEnabler.enable()
10 
11 # enable support for files > 2 GB
12 gSystem.Load("libIOPoolTFileAdaptor")
14 
15 
16 # load the example file from castor
17 theFile = TFile.Open("castor:/castor/cern.ch/cms/store/CSA06/CSA06-106-os-Jets-0/AOD/CMSSW_1_0_6-AODSIM-H15a59ba7b4c3d9e291172f60a399301f/1025/96C3197B-0264-DB11-9A9C-00304885AD72.root")
18 
19 
20 # access the event tree
21 print("==============================")
22 print("Loading event tree")
23 events = EventTree(theFile)
24 
25 print("Start looping over some events")
26 for event in events:
27  photons = event.photons
28  print(" Number of photons in event %i: %i" % (event, len(photons)))
29  if event > 2: break # workaround will become obsolete
30 
31 
32 
33 
60 
TFileAdaptorUI
Definition: TFileAdaptor.h:65
PythonAnalysis
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66