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