ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/CMSSW/PhysicsTools/PythonAnalysis/test/trackerHits.py
Revision: 1.3
Committed: Wed Nov 1 10:45:10 2006 UTC (18 years, 6 months ago) by hegner
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
moved examples to examples directory

File Contents

# Content
1 # first load cmstools and ROOT classes
2 from cmstools import *
3 from ROOT import *
4
5 # opening file and accessing branches
6 print "Opening SimHit file"
7 file = TFile("simevent.root")
8 events = file.Get("Events")
9 branch = events.GetBranch("PSimHit_r_TrackerHitsTIBLowTof.obj")
10
11 simHit = std.vector(PSimHit)()
12 branch.SetAddress(simHit)
13
14 histo = TH1F("tofhits", "Tof of hits", 100, -0.5, 50)
15
16 # loop over all events
17 for ev in all(events):
18 branch.GetEntry(ev)
19 for hit in all(simHit):
20 histo.Fill(hit.timeOfFlight())
21
22 hFile = TFile("histo.root", "RECREATE")
23 histo.Write()
24
25 gROOT.SetBatch()
26 gROOT.SetStyle("Plain")
27
28 c = TCanvas()
29 histo.Draw()
30 c.SaveAs("tofhits.jpg")