31def divideHistCaloMon(inputs,doPercentage=False):
32 """ This function returns the ratio of two ROOT histograms """
33 assert len(inputs) == 1
34 assert len(inputs[0][1]) == 3
35
36 cl = cloneHistFloat(inputs[0][1][0])
37 cl.Divide(inputs[0][1][1])
38
39 label = inputs[0][0]['thr']
40
41 hnorm = inputs[0][1][2].Clone()
42 n0 = hnorm.GetNbinsX()
43 fbin = hnorm.GetXaxis().FindBin(label)
44
45 if fbin>=n0 or fbin<=0:
46 return [cl]
47
48 thenorm = hnorm.GetBinContent(fbin)
49 cl.SetEntries(thenorm)
50
51 if not doPercentage or thenorm==0:
52 return [cl]
53
54 cl.Scale(100.0/thenorm)
55
56 return [cl]
57
58