7 def plot(fileName,sl,dir='DQMData/Run 1/DT/Run summary/DTCalibValidation',option="HISTOPE1",draw=True):
10 slStr =
"SL%d" % slType
14 ROOT.TH1.AddDirectory(
False)
16 file = ROOT.TFile(fileName,
'read')
18 wheels = (-2,-1,0,1,2)
24 if slType == 2: nBins = 180
25 histoMean = ROOT.TH1F(
"h_ResMeanAll",
"Mean of residuals",nBins,0,nBins)
26 histoSigma = ROOT.TH1F(
"h_ResSigmaAll",
"Sigma of residuals",nBins,0,nBins)
29 if st == 4: nSectors = 14
30 if st == 4
and slType == 2:
continue
31 if verbose:
print(
"Station",st)
33 if verbose:
print(
"Wheel",wh)
34 for sec
in range(1,nSectors+1):
35 if verbose:
print(
"Sector",sec)
37 histoName =
"%s/Wheel%d/Station%d/Sector%d/hResDist_STEP3_W%d_St%d_Sec%d_%s" % (dir,wh,st,sec,wh,st,sec,slStr)
38 print(
"Accessing",histoName)
39 histo = file.Get(histoName)
40 (histo,fitFunc) =
fitResidual(histo,nSigmas,verbose)
41 fitMean = fitFunc.GetParameter(1)
42 fitMeanErr = fitFunc.GetParError(1)
43 fitSigma = fitFunc.GetParameter(2)
44 fitSigmaErr = fitFunc.GetParError(2)
46 binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
47 if verbose:
print(
"Bin in summary histo",binHistoNew)
48 histoMean.SetBinContent(binHistoNew,fitMean)
49 histoMean.SetBinError(binHistoNew,fitMeanErr)
50 histoSigma.SetBinContent(binHistoNew,fitSigma)
51 histoSigma.SetBinError(binHistoNew,fitSigmaErr)
54 label =
"Wheel %d" % wh
55 if wh == -2: label +=
" MB%d" % st
56 histoMean.GetXaxis().SetBinLabel(binHistoNew,label)
57 histoSigma.GetXaxis().SetBinLabel(binHistoNew,label)
59 objectsMean =
drawHisto(histoMean,title=
"Mean of residuals (cm)",
60 ymin=-0.1,ymax=0.1,option=option,draw=draw)
61 objectsSigma =
drawHisto(histoSigma,title=
"Sigma of residuals (cm)",
62 ymin=0.,ymax=0.15,option=option,draw=draw)
64 return (objectsMean,objectsSigma)