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