-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalysisMacro.py
More file actions
79 lines (68 loc) · 2.65 KB
/
AnalysisMacro.py
File metadata and controls
79 lines (68 loc) · 2.65 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from ROOT import TFile,TH1I,TH1F,TH2F,TCanvas
# hitmapFile = TFile("data15_hi.00287382.calibration_SCTNoise.sctcal.HITMAP.c0._0002.SCTHitMaps.root");
# outFile = TFile("outputhm.root","recreate")
# listEAhm = hitmapFile.GetDirectory("SCTEA").GetListOfKeys()
# listBhm = hitmapFile.GetDirectory("SCTB").GetListOfKeys()
# listEChm = hitmapFile.GetDirectory("SCTEC").GetListOfKeys()
# listOfNamesBarrel = []
# counter = 0
# for key in listBhm:
# keyName = key.GetName()
# if '2D' in keyName:
# H2D = TH2F(hitmapFile.Get("SCTB/"+keyName))
# H2D.Scale(1e-4)
# firstBin = H2D.FindFirstBinAbove(0.015)
# if (firstBin != -1):
# # print keyName
# # H2D.SetMinimum(0.010)
# c = TCanvas()
# c.SetTitle(H2D.GetTitle())
# H2D.Draw("col4z");
# c.Write("c"+str(counter))
# counter+=1
# # listOfNamesBarrel.append(keyName)
#print listOfNamesBarrel
lbFile = TFile("data15_hi.00287382.calibration_SCTNoise.sctcal.HITMAP.c0._0002.SCTLB.root");
outFile = TFile("outputlb.root","recreate")
listEAlb = lbFile.GetDirectory("SCTEA").GetListOfKeys()
listBlb = lbFile.GetDirectory("SCTB").GetListOfKeys()
listEClb = lbFile.GetDirectory("SCTEC").GetListOfKeys()
#create 1D>2D with number of events per lumiblock
eventsLB = TH1I(lbFile.Get("GENERAL/events"))
LB2D = TH2F(lbFile.Get("SCTB/0_0_0_1_0__2D"))
LB2D.Reset()
#nbinsY = LB2D.GetNbinsY()
#nbinsX = LB2D.GetNbinsX()
for binsX in range(1,eventsLB.GetNbinsX()+1):
nLB = eventsLB.GetBinContent(binsX)
binY = eventsLB.GetBinCenter(binsX)
for binsX2D in range(1,LB2D.GetNbinsX()+1):
binX = LB2D.GetXaxis().GetBinCenter(binsX2D)
LB2D.Fill(binX,binY,nLB)
# binY = LB2D.GetYaxis().GetBinCenter(binsY)
# binYLB = eventsLB.FindBin(binY)
# nevents = eventsLB.GetBinContent(binYLB)
# binX = LB2D.GetXaxis().GetBinCenter(binsX)
# LB2D.Fill(binX,binY,nevents)
#LB2D.RebinY(30)
# meanEVLB = eventsLB.GetMean()
# #number of LB bins that will have roughly 10000 events
# rebinIdx = int(10000./meanEVLB)
LB2D.Write("LB2D")
eventsLB.Write("LB")
listOfNamesBarrelLB = []
counter = 0
for key in listBlb:
keyName = key.GetName()
if '2D' in keyName:
H2D = TH2F(lbFile.Get("SCTB/"+keyName))
# H2D.RebinY(30)
H2D.Divide(LB2D)
firstBin = H2D.FindFirstBinAbove(0.015)
if (firstBin != -1):
H2D.SetMinimum(0.015)
c = TCanvas()
c.SetTitle(H2D.GetTitle())
H2D.Draw("col4z");
c.Write("c"+str(counter))
counter+=1