1 from __future__
import print_function
2 from __future__
import absolute_import
4 from .drawHistoAllChambers
import drawHisto
7 start = (station - 1)*12
10 def plot(fileName,sl,option="HISTOP",draw=True):
13 slStr =
"SL%d" % slType
16 ROOT.TH1.AddDirectory(
False)
18 file = ROOT.TFile(fileName,
'read')
20 wheels = (-2,-1,0,1,2)
25 histoName =
'Wheel%d_%s_VDrift' % (wh,slStr)
26 print(
"Accessing",histoName)
27 histosWheel[wh] = file.Get(histoName)
32 if slType == 2: nBins = 180
33 histo = ROOT.TH1F(
"h_VDriftAll",
"VDrift",nBins,0,nBins)
36 if st == 4: nSectors = 14
37 if st == 4
and slType == 2:
continue
38 if verbose:
print(
"Station",st)
40 if verbose:
print(
"Wheel",wh)
41 for sec
in range(1,nSectors+1):
42 if verbose:
print(
"Sector",sec)
44 if verbose:
print(
"Bin from histos:",binHisto)
45 value = histosWheel[wh].GetBinContent(binHisto)
49 binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
50 if verbose:
print(
"Bin final",binHistoNew)
51 histo.SetBinContent(binHistoNew,value)
54 label =
"Wheel %d" % wh
55 if wh == -2: label +=
" MB%d" % st
56 histo.GetXaxis().SetBinLabel(binHistoNew,label)
59 title=
"v_{drift} (#mum/ns)",
60 ymin=53,ymax=57,option=option,draw=draw)
66 colors = (2,4,12,44,55)
67 markers = (24,25,26,27)
73 for fileName
in fileNames:
75 if not idx: draw =
True
77 objs =
plot(fileName,sl,option,draw)
81 histos.append(objs[1])
85 histos[-1].SetLineColor(colors[ (idx - 1) % len(colors) ])
86 histos[-1].SetMarkerColor(colors[ (idx - 1) % len(colors) ])
87 histos[-1].SetMarkerStyle(markers[ (idx - 1) % len(markers) ])
89 histos[-1].Draw(option +
"SAME")
93 return (canvas,histos,objects)