File indexing completed on 2024-04-06 12:24:07
0001
0002 from PhysicsTools.PythonAnalysis import *
0003 from ROOT import gSystem, gROOT, TFile, TH1F, TCanvas
0004 import ROOT
0005
0006 gSystem.Load("libFWCoreFWLite.so")
0007 ROOT.FWLiteEnabler.enable()
0008
0009
0010 events = EventTree("simevent.root")
0011
0012
0013 histo = TH1F("tofhits", "Tof of hits", 100, -0.5, 50)
0014
0015
0016 for event in events:
0017 simHits = event.getProduct("PSimHit_r_TrackerHitsTIBLowTof.obj")
0018 for hit in simHits:
0019 histo.Fill(hit.timeOfFlight())
0020
0021 hFile = TFile("histo.root", "RECREATE")
0022 histo.Write()
0023
0024 gROOT.SetBatch()
0025 gROOT.SetStyle("Plain")
0026
0027 c = TCanvas()
0028 histo.Draw()
0029 c.SaveAs("tofhits.jpg")