예제 #1
0
 def format(sd):
     if sd.GetDimension() < 3:
         return ((sd, ) + tuple(lib.symmAnti(sd)))
     sd.SetTitle(";x;y;z")
     yz = sd.Project3D("zy e")
     yz_symm, yz_anti = lib.symmAnti(yz)
     yz_minusminus = yz.Clone(yz.GetName() + '_minusminus')
     yz_minusplus = yz.Clone(yz.GetName() + '_minusplus')
     z = sd.Project3D("ze")
     for iZ in range(1, 1 + sd.GetNbinsZ()):
         sd.GetZaxis().SetRange(iZ, iZ)
         xy = sd.Project3D("tmp%d_yxe" % iZ)
         x = xy.ProjectionX()
         M = lib.coupling(xy)
         M_symm, M_anti = lib.coupling_symmAnti(M)
         xsymm, xanti = lib.symmAnti(x)
         for iY in range(1, 1 + M.GetNbinsY()):
             yz_minusminus.SetBinContent(
                 iY, iZ,
                 sum(
                     xanti.GetBinContent(iX) * M_anti.GetBinContent(iX, iY)
                     for iX in range(1, 1 + x.GetNbinsX())))
             yz_minusplus.SetBinContent(
                 iY, iZ,
                 sum(
                     xsymm.GetBinContent(iX) * M_anti.GetBinContent(iX, iY)
                     for iX in range(1, 1 + x.GetNbinsX())))
     sd.GetZaxis().SetRange(0, sd.GetNbinsZ())
     return yz, yz_symm, yz_anti, yz_minusminus, yz_minusplus
예제 #2
0
파일: inputs.py 프로젝트: betchart/statsTA
 def format(sd):
     if sd.GetDimension()<3:
         return ((sd,) + tuple(lib.symmAnti(sd)))
     sd.SetTitle(";x;y;z")
     yz = sd.Project3D("zy e")
     yz_symm,yz_anti = lib.symmAnti(yz)
     yz_minusminus = yz.Clone(yz.GetName()+'_minusminus')
     yz_minusplus = yz.Clone(yz.GetName()+'_minusplus')
     z = sd.Project3D("ze")
     for iZ in range(1,1+sd.GetNbinsZ()):
         sd.GetZaxis().SetRange(iZ,iZ)
         xy = sd.Project3D("tmp%d_yxe"%iZ)
         x = xy.ProjectionX()
         M = lib.coupling(xy)
         M_symm,M_anti = lib.coupling_symmAnti(M)
         xsymm, xanti = lib.symmAnti(x)
         for iY in range(1,1+M.GetNbinsY()):
             yz_minusminus.SetBinContent(iY,iZ, sum(xanti.GetBinContent(iX) * M_anti.GetBinContent(iX,iY) for iX in range(1,1+x.GetNbinsX())))
             yz_minusplus.SetBinContent(iY,iZ, sum(xsymm.GetBinContent(iX) * M_anti.GetBinContent(iX,iY) for iX in range(1,1+x.GetNbinsX())))
     sd.GetZaxis().SetRange(0,sd.GetNbinsZ())
     return yz,yz_symm,yz_anti,yz_minusminus,yz_minusplus
예제 #3
0
zero = r.TF1('zero','0',-1,1)
one = r.TF1('one','1',-1,1)
one.SetLineWidth(1)
one.SetLineStyle(r.kDashed)

for item in ['ttqq','ttgg','ttqg','ttag']:
    h = tfile.Get('R03_pileUpRatios2_signalhists_/genTopQueuedBin5_fitTopQueuedBin5_TridiscriminantWTopQCD/%s'%item)

    for iC in range(1,1+h.GetZaxis().GetNbins()):
        h.GetZaxis().SetRange(iC,iC)
        hxy = h.Project3D(('exy%d'%iC))
        hxy.SetTitle('%s %d;gen;reco'%(item,iC))
        hxy_coup = lib.coupling(hxy)

        symm,anti = lib.coupling_symmAnti(hxy_coup)
        anti_devs = r.TH1D('antidevs%s%d'%(item,iC),'', 50, -5, 5)
        anti_rel = anti.Clone('_rel')

        for iX in range(2+anti.GetNbinsX()):
            for iY in range(2+anti.GetNbinsY()):
                con,err = anti.GetBinContent(iX,iY), anti.GetBinError(iX,iY)
                if not err: continue
                anti_rel.SetBinContent(iX,iY, con/err)
                anti_devs.Fill(con/err)
 
        anti.Divide(symm)
        anti_devs.Fit('gaus','Q')
        c.cd(1)
        symm.Draw('colz')
        ##
예제 #4
0
one = r.TF1('one', '1', -1, 1)
one.SetLineWidth(1)
one.SetLineStyle(r.kDashed)

for item in ['ttqq', 'ttgg', 'ttqg', 'ttag']:
    h = tfile.Get(
        'R03_pileUpRatios2_signalhists_/genTopQueuedBin5_fitTopQueuedBin5_TridiscriminantWTopQCD/%s'
        % item)

    for iC in range(1, 1 + h.GetZaxis().GetNbins()):
        h.GetZaxis().SetRange(iC, iC)
        hxy = h.Project3D(('exy%d' % iC))
        hxy.SetTitle('%s %d;gen;reco' % (item, iC))
        hxy_coup = lib.coupling(hxy)

        symm, anti = lib.coupling_symmAnti(hxy_coup)
        anti_devs = r.TH1D('antidevs%s%d' % (item, iC), '', 50, -5, 5)
        anti_rel = anti.Clone('_rel')

        for iX in range(2 + anti.GetNbinsX()):
            for iY in range(2 + anti.GetNbinsY()):
                con, err = anti.GetBinContent(iX, iY), anti.GetBinError(iX, iY)
                if not err: continue
                anti_rel.SetBinContent(iX, iY, con / err)
                anti_devs.Fill(con / err)

        anti.Divide(symm)
        anti_devs.Fit('gaus', 'Q')
        c.cd(1)
        symm.Draw('colz')
        ##