-
Notifications
You must be signed in to change notification settings - Fork 0
/
showGenSUSYcontent.py
executable file
·38 lines (35 loc) · 1.32 KB
/
showGenSUSYcontent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python2
import ROOT as rt
import sys
if __name__ == '__main__':
filename=sys.argv[1]
rt.gStyle.SetNdivisions(50,"xy")
f=rt.TFile(filename,"read")
if "MINIAODSIM" in filename:
tree=f.Get("Events")
pdgId="recoGenParticles_prunedGenParticles__PAT.obj.m_state.pdgId_"
elif "AODSIM" in filename:
tree=f.Get("Events")
pdgId="recoGenParticles_genParticles__HLT.obj.m_state.pdgId_"
else:
# try local trees
tree=f.Get("TreeWriter/eventTree") # 13 TeV trees
if not tree:
tree=f.Get("susyTree") # 8 TeV trees
pdgId="genParticles.pdgId"
can=rt.TCanvas()
can.Divide(1,2)
can.cd(1)
rt.gPad.SetLogy()
tree.Draw(pdgId+"-1000000>>h1(50,0.5,50.5)",pdgId+">1e6 &&"+pdgId+"<1.1e6")
rt.gDirectory.Get("h1").SetTitle(";pdgId-1e6;")
tree.Draw("abs("+pdgId+")-1000000>>h1m(50,0.5,50.5)",pdgId+"<-1e6 &&"+pdgId+">-1.1e6","same")
rt.gDirectory.Get("h1m").SetLineColor(rt.kRed)
can.cd(2)
rt.gPad.SetLogy()
tree.Draw(pdgId+"-2000000>>h2(50,0.5,50.5)",pdgId+">2e6 &&"+pdgId+"<2.1e6")
rt.gDirectory.Get("h2").SetTitle(";pdgId-2e6;")
tree.Draw("abs("+pdgId+")-2000000>>h2m(50,0.5,50.5)",pdgId+"<-2e6 &&"+pdgId+">-2.1e6","same")
rt.gDirectory.Get("h2m").SetLineColor(rt.kRed)
raw_input("...")
f.Close()