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