/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
PhysicsTools/PythonAnalysis/examples/trackerHits.py
29 строк
694 B
Ivan Razumov
Fix wildcard imports from ROOT (they are forbidden now)
15 фев 2024, 12:47
15 фев 2024, 12:47
3fbccf4
Код
Авторство
О чём код?
# first load cmstools and ROOT classes from PhysicsTools.PythonAnalysis import * from ROOT import gSystem, gROOT, TFile, TH1F, TCanvas import ROOT gSystem.Load("libFWCoreFWLite.so") ROOT.FWLiteEnabler.enable() # opening file events = EventTree("simevent.root") # prepare the histogram histo = TH1F("tofhits", "Tof of hits", 100, -0.5, 50) # loop over all events and filling the histogram 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")