CMS 3D CMS Logo

trackerHits.py

Go to the documentation of this file.
00001 # first load cmstools and ROOT classes
00002 from PhysicsTools.PythonAnalysis import *
00003 from ROOT import *
00004 
00005 # opening file
00006 events = EventTree("simevent.root")
00007 
00008 # prepare the histogram
00009 histo = TH1F("tofhits", "Tof of hits", 100, -0.5, 50)
00010 
00011 # loop over all events and filling the histogram
00012 for event in events:
00013     simHits = event.getProduct("PSimHit_r_TrackerHitsTIBLowTof.obj")
00014     for hit in simHits:
00015         histo.Fill(hit.timeOfFlight())
00016 
00017 hFile = TFile("histo.root", "RECREATE")
00018 histo.Write()
00019 
00020 gROOT.SetBatch()
00021 gROOT.SetStyle("Plain")
00022 
00023 c = TCanvas()
00024 histo.Draw()
00025 c.SaveAs("tofhits.jpg")

Generated on Tue Jun 9 17:41:49 2009 for CMSSW by  doxygen 1.5.4