pythonand import cmstools and ROOT:
from PhysicsTools.PythonAnalysis import * from ROOT import *That's it.
histo.root
and tofhits.jpg
.
from PhysicsTools.PythonAnalysis.cmstools import * from ROOT import *
events = EventTree.('simevents.root')
histo = TH1F('tofhits', 'Tof of hits', 100, -0.5, 50) for event in events: simHits = event.getProduct('PSimHit_r_TrackerHitsTIBLowTof.obj') for hit in simHits: histo.Fill(hit.timeOfFlight())
hFile = TFile('histo.root', 'RECREATE') histo.Write()
gROOT.SetBatch() gROOT.SetStyle('Plain') c = TCanvas() histo.Draw() c.SaveAs('tofhits.jpg')
For more details, refer to the Analysis Tools TWiki on the Software Guide.