-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGetRates.py
More file actions
47 lines (34 loc) · 1.15 KB
/
GetRates.py
File metadata and controls
47 lines (34 loc) · 1.15 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
import math,ROOT
from ROOT import gROOT, TFile, TChain, TTree, TH1F, TF1
gROOT.Reset()
#file = TFile("MinBiasOutput/hltmenu_8TeV_7.0e33_20130321_MinBias.root")
file = TFile("hltmenu_8TeV_5.0e32_20130801Counts.root")
histInd = file.Get("individual")
histCum = file.Get("cumulative")
histNevt = file.Get("NEVTS")
nevt = histNevt.GetBinContent(1)
nfillb = 312.
mfillb = 3564.
xtime = 75e-9
#xsec = 7.2700002e10*1e-36
xsec = (7.13E10)*1e-36
ilumi = 5e32
collrate = (nfillb/mfillb)/xtime
def Rate(counts):
if counts < 0 : return 0
rate = collrate * (1 - math.exp(-1* (xsec*ilumi*counts/nevt)/collrate))
return rate
def RateErr(counts):
if counts < 0 : return -1
rateerr = xsec * ilumi * ((math.sqrt(counts + ((counts)**2)/nevt))/nevt)
return rateerr
nbins = histInd.GetNbinsX()
for b in xrange(1,nbins+1):
Label = histInd.GetXaxis().GetBinLabel(b)
CountInd = histInd.GetBinContent(b)
CountCum = histCum.GetBinContent(b)
RateInd = Rate(CountInd)
RateIndErr = RateErr(CountInd)
RateCum = Rate(CountCum)
RateCumErr = RateErr(CountCum)
print Label, " ", RateInd, " +- ", RateIndErr, " ", RateCum, " +- ", RateCumErr