00006 :
00007
00008 mean_ymin = -0.02
00009 mean_ymax = 0.02
00010 sig_ymin = 0.
00011 sig_ymax = 0.07
00012
00013 slType = sl
00014 slStr = "SL%d" % slType
00015 verbose = False
00016 nSigmas = 2
00017
00018 ROOT.TH1.AddDirectory(False)
00019
00020 file = ROOT.TFile(fileName,'read')
00021
00022 wheels = (-2,-1,0,1,2)
00023 stations = (1,2,3,4)
00024
00025
00026
00027 nBins = 250
00028 if slType == 2: nBins = 180
00029 histoMean = ROOT.TH1F("h_ResMeanAll","Mean of residuals",nBins,0,nBins)
00030 histoSigma = ROOT.TH1F("h_ResSigmaAll","Sigma of residuals",nBins,0,nBins)
00031 for st in stations:
00032 nSectors = 12
00033 if st == 4: nSectors = 14
00034 if st == 4 and slType == 2: continue
00035 if verbose: print "Station",st
00036 for wh in wheels:
00037 if verbose: print "Wheel",wh
00038 for sec in range(1,nSectors+1):
00039 if verbose: print "Sector",sec
00040
00041 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)
00042 print "Accessing",histoName
00043 histo = file.Get(histoName)
00044 (histo,fitFunc) = fitResidual(histo,nSigmas,verbose)
00045 fitMean = fitFunc.GetParameter(1)
00046 fitMeanErr = fitFunc.GetParError(1)
00047 fitSigma = fitFunc.GetParameter(2)
00048 fitSigmaErr = fitFunc.GetParError(2)
00049
00050 binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
00051 if verbose: print "Bin in summary histo",binHistoNew
00052 histoMean.SetBinContent(binHistoNew,fitMean)
00053 histoMean.SetBinError(binHistoNew,fitMeanErr)
00054 histoSigma.SetBinContent(binHistoNew,fitSigma)
00055 histoSigma.SetBinError(binHistoNew,fitSigmaErr)
00056
00057 if sec == 1:
00058 label = "Wheel %d" % wh
00059 if wh == -2: label += " MB%d" % st
00060 histoMean.GetXaxis().SetBinLabel(binHistoNew,label)
00061 histoSigma.GetXaxis().SetBinLabel(binHistoNew,label)
00062
00063 objectsMean = drawHisto(histoMean,title="Mean of residuals (cm)",
00064 ymin=mean_ymin,ymax=mean_ymax,option=option,draw=draw)
00065 objectsSigma = drawHisto(histoSigma,title="Sigma of residuals (cm)",
00066 ymin=sig_ymin,ymax=sig_ymax,option=option,draw=draw)
00067
00068 return (objectsMean,objectsSigma)