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