6 def plot(fileName,sl,dir='DQMData/Run 1/DT/Run summary/DTCalibValidation',option="HISTOPE1",draw=True):
9 slStr =
"SL%d" % slType
13 ROOT.TH1.AddDirectory(
False)
15 file = ROOT.TFile(fileName,
'read')
17 wheels = (-2,-1,0,1,2)
23 if slType == 2: nBins = 180
24 histoMean = ROOT.TH1F(
"h_ResMeanAll",
"Mean of residuals",nBins,0,nBins)
25 histoSigma = ROOT.TH1F(
"h_ResSigmaAll",
"Sigma of residuals",nBins,0,nBins)
28 if st == 4: nSectors = 14
29 if st == 4
and slType == 2:
continue
30 if verbose:
print "Station",st
32 if verbose:
print "Wheel",wh
33 for sec
in range(1,nSectors+1):
34 if verbose:
print "Sector",sec
36 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)
37 print "Accessing",histoName
38 histo = file.Get(histoName)
39 (histo,fitFunc) =
fitResidual(histo,nSigmas,verbose)
40 fitMean = fitFunc.GetParameter(1)
41 fitMeanErr = fitFunc.GetParError(1)
42 fitSigma = fitFunc.GetParameter(2)
43 fitSigmaErr = fitFunc.GetParError(2)
45 binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
46 if verbose:
print "Bin in summary histo",binHistoNew
47 histoMean.SetBinContent(binHistoNew,fitMean)
48 histoMean.SetBinError(binHistoNew,fitMeanErr)
49 histoSigma.SetBinContent(binHistoNew,fitSigma)
50 histoSigma.SetBinError(binHistoNew,fitSigmaErr)
53 label =
"Wheel %d" % wh
54 if wh == -2: label +=
" MB%d" % st
55 histoMean.GetXaxis().SetBinLabel(binHistoNew,label)
56 histoSigma.GetXaxis().SetBinLabel(binHistoNew,label)
58 objectsMean =
drawHisto(histoMean,title=
"Mean of residuals (cm)",
59 ymin=-0.1,ymax=0.1,option=option,draw=draw)
60 objectsSigma =
drawHisto(histoSigma,title=
"Sigma of residuals (cm)",
61 ymin=0.,ymax=0.15,option=option,draw=draw)
63 return (objectsMean,objectsSigma)