8 def plot(fileName,sl,dir='DQMData/Run 1/DT/Run summary/DTCalibValidation',option="HISTOPE1",draw=True):
11 slStr =
"SL%d" % slType
15 ROOT.TH1.AddDirectory(
False)
17 file = ROOT.TFile(fileName,
'read')
19 wheels = (-2,-1,0,1,2)
25 if slType == 2: nBins = 180
26 histoMean = ROOT.TH1F(
"h_ResMeanAll",
"Mean of residuals",nBins,0,nBins)
27 histoSigma = ROOT.TH1F(
"h_ResSigmaAll",
"Sigma of residuals",nBins,0,nBins)
30 if st == 4: nSectors = 14
31 if st == 4
and slType == 2:
continue
32 if verbose:
print(
"Station",st)
34 if verbose:
print(
"Wheel",wh)
35 for sec
in range(1,nSectors+1):
36 if verbose:
print(
"Sector",sec)
38 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)
39 print(
"Accessing",histoName)
40 histo = file.Get(histoName)
41 (histo,fitFunc) =
fitResidual(histo,nSigmas,verbose)
42 fitMean = fitFunc.GetParameter(1)
43 fitMeanErr = fitFunc.GetParError(1)
44 fitSigma = fitFunc.GetParameter(2)
45 fitSigmaErr = fitFunc.GetParError(2)
47 binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
48 if verbose:
print(
"Bin in summary histo",binHistoNew)
49 histoMean.SetBinContent(binHistoNew,fitMean)
50 histoMean.SetBinError(binHistoNew,fitMeanErr)
51 histoSigma.SetBinContent(binHistoNew,fitSigma)
52 histoSigma.SetBinError(binHistoNew,fitSigmaErr)
55 label =
"Wheel %d" % wh
56 if wh == -2: label +=
" MB%d" % st
57 histoMean.GetXaxis().SetBinLabel(binHistoNew,label)
58 histoSigma.GetXaxis().SetBinLabel(binHistoNew,label)
60 objectsMean =
drawHisto(histoMean,title=
"Mean of residuals (cm)",
61 ymin=-0.1,ymax=0.1,option=option,draw=draw)
62 objectsSigma =
drawHisto(histoSigma,title=
"Sigma of residuals (cm)",
63 ymin=0.,ymax=0.15,option=option,draw=draw)
65 return (objectsMean,objectsSigma)
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)