1 from __future__
import print_function
3 from fitResidual
import fitResidual
4 from drawHistoAllChambers
import drawHisto
6 def plot(fileName,sl,dir='DQMData/Run 1/DT/Run summary/DTCalibValidation',option="HISTOPE1",draw=True):
14 slStr =
"SL%d" % slType
18 ROOT.TH1.AddDirectory(
False)
20 file = ROOT.TFile(fileName,
'read')
22 wheels = (-2,-1,0,1,2)
28 if slType == 2: nBins = 180
29 histoMean = ROOT.TH1F(
"h_ResMeanAll",
"Mean of residuals",nBins,0,nBins)
30 histoSigma = ROOT.TH1F(
"h_ResSigmaAll",
"Sigma of residuals",nBins,0,nBins)
33 if st == 4: nSectors = 14
34 if st == 4
and slType == 2:
continue 35 if verbose:
print(
"Station",st)
37 if verbose:
print(
"Wheel",wh)
38 for sec
in range(1,nSectors+1):
39 if verbose:
print(
"Sector",sec)
41 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)
42 print(
"Accessing",histoName)
43 histo = file.Get(histoName)
44 (histo,fitFunc) =
fitResidual(histo,nSigmas,verbose)
45 fitMean = fitFunc.GetParameter(1)
46 fitMeanErr = fitFunc.GetParError(1)
47 fitSigma = fitFunc.GetParameter(2)
48 fitSigmaErr = fitFunc.GetParError(2)
50 binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
51 if verbose:
print(
"Bin in summary histo",binHistoNew)
52 histoMean.SetBinContent(binHistoNew,fitMean)
53 histoMean.SetBinError(binHistoNew,fitMeanErr)
54 histoSigma.SetBinContent(binHistoNew,fitSigma)
55 histoSigma.SetBinError(binHistoNew,fitSigmaErr)
58 label =
"Wheel %d" % wh
59 if wh == -2: label +=
" MB%d" % st
60 histoMean.GetXaxis().SetBinLabel(binHistoNew,label)
61 histoSigma.GetXaxis().SetBinLabel(binHistoNew,label)
63 objectsMean =
drawHisto(histoMean,title=
"Mean of residuals (cm)",
64 ymin=mean_ymin,ymax=mean_ymax,option=option,draw=draw)
65 objectsSigma =
drawHisto(histoSigma,title=
"Sigma of residuals (cm)",
66 ymin=sig_ymin,ymax=sig_ymax,option=option,draw=draw)
68 return (objectsMean,objectsSigma)
S & print(S &os, JobReport::InputFile const &f)
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)