4 def drawHisto(histo,title,ymin,ymax,option="HISTOP",draw=True):
7 histo.SetMarkerStyle(20)
8 histo.SetMarkerSize(0.9)
9 histo.GetYaxis().SetRangeUser(ymin,ymax)
10 histo.GetYaxis().SetTitle(title)
11 histo.GetXaxis().SetLabelSize(0.04)
12 histo.GetXaxis().SetTickLength(0.)
13 histo.LabelsOption(
"d",
"X")
18 canvas = ROOT.TCanvas(
"c_" + histo.GetName())
20 canvas.SetFillColor(fillColor)
21 if draw: histo.Draw(option)
26 for idx_st
in range(1,5):
28 if idx_st == 4: nSectors = 14
29 for idx_wh
in range(-1,3):
30 xline = (idx_st - 1)*60 + (idx_wh + 2)*nSectors
31 if xline >= histo.GetNbinsX():
continue
33 linesWh[(idx_st,idx_wh)] = ROOT.TLine(xline,ymin,xline,ymax)
34 linesWh[(idx_st,idx_wh)].SetLineStyle(2)
35 if draw: linesWh[(idx_st,idx_wh)].Draw(
"SAME")
37 for idx
in range(1,4):
39 if xline >= histo.GetNbinsX():
continue
41 linesSt[idx] = ROOT.TLine(xline,ymin,xline,ymax)
42 linesSt[idx].SetLineStyle(2)
43 linesSt[idx].SetLineWidth(2)
44 if draw: linesSt[idx].Draw(
"SAME")
46 for idx
in range(1,5):
47 xlabel = (idx - 1)*60 + 20
48 ylabel = ymin + 0.75*(ymax -ymin)
49 if xlabel >= histo.GetNbinsX():
continue
52 labels[idx] = ROOT.TPaveLabel(xlabel,ylabel,(xlabel+20),(ylabel + 0.10*(ymax -ymin)),strSt)
53 labels[idx].SetTextSize(0.5)
54 labels[idx].SetFillColor(fillColor)
55 if draw: labels[idx].Draw(
"SAME")
58 objects.append(linesWh)
59 objects.append(linesSt)
60 objects.append(labels)
62 return (canvas,histo,objects)