forked from artlbv/HexaBoardAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_profiles.py
executable file
·60 lines (44 loc) · 1.57 KB
/
plot_profiles.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python2
import os
import ROOT as rt
rt.gStyle.SetOptStat(0)
fname = "/Users/artur/Work/LLR/HGCAL/Testbeam/data/may17/RUN_0705_100517_0316.root"
tfile = rt.TFile(fname)
tree = tfile.Get("sk2cms")
chip = str(0)
chan = str(1)
variabs = ["lg["+chip+"][]["+chan+"]","hg["+chip+"][]["+chan+"]"]
var_suf = ":timesamp[Iteration$]"
var_name = ["lg","hg"]
cuts = ["","toa_rise["+chip+"]["+chan+"] > 100","tot_fast[1][24] > 100"]
cut_name = ["all","wTOA","wTOT"]
outdir = "plots/chip"+chip+"_chan"+chan+"/"
if not os.path.exists(outdir): os.makedirs(outdir)
for i,var in enumerate(variabs):
for j,cut in enumerate(cuts):
cname = var_name[i] + "_" + cut_name[j]
print cname
hname = "h" + cname
canv = rt.TCanvas("canv","canv",800,600)
canv.SetLogz()
print var+var_suf+hname, cut
tree.Draw(var+var_suf+">>"+hname,cut,"colz")
hist = rt.gDirectory.Get(hname)
hist.GetXaxis().SetTitle("Time Sample")
hist.GetYaxis().SetTitle("ADC")
hist.GetYaxis().SetTitleOffset(1.2)
#hist.GetXaxis().SetRangeUser(0,10)
canv.SaveAs(outdir + cname + "_scat.png")
proj = hist.ProfileX()
proj.SetMarkerStyle(20)
proj.GetYaxis().SetTitle("ADC")
proj.GetYaxis().SetTitleOffset(1.2)
proj.GetYaxis().UnZoom()
#proj.GetXaxis().SetRangeUser(0,10)
canv2 = rt.TCanvas("canv2","canv2",800,600)
proj.Draw("p")
canv2.Update()
canv2.SaveAs(outdir + cname + "_prof.png")
print hist
canv.Update()
#q = raw_input()