Ejemplo n.º 1
0
  try:
      minz = float(sys.argv[1])
      maxz = float(sys.argv[2])
      filenames = sys.argv[3:]
  except ValueError:
      print "Don't change z-Axis"
      filenames = sys.argv[1:]

  print "Smoothing",filenames

  for filename in filenames:
    if filename[-5:]==".root" and not filename.count("smoothed"):
      direction = "SW"
      if filename.count('T1t1t'):direction = "EW"
      ifile = filename[:-5]
      canv = getObjFromFile(filename, 'c1') 
      if not canv:canv = getObjFromFile(filename, 'c1_n2')
      if not canv:canv = getObjFromFile(filename, 'c1_n3')
      hist2DSFunc = canv.GetPrimitive("hist2DSFunc")

      res = hist2DSFunc.Clone()
      c1 = ROOT.TCanvas()
    #  hist2DSFunc.Draw("colz")
    #  c1.Print(ifile+".png")
      #res = smooth2DHisto(hist2DSFunc, 1,1, False, 0)
      if minz<0:
        for ix in range(1, res.GetNbinsX()+1):
          for iy in range(1, res.GetNbinsY()+1):
            if res.GetBinContent(ix,iy) ==0:
              res.SetBinContent(ix,iy,2*minz)
Ejemplo n.º 2
0
        varX = h.GetXaxis().GetBinLowEdge(ix)
        varY = h.GetYaxis().GetBinLowEdge(iy)
        print varX, varY
        x0 = h.GetBinContent(h.FindBin(varX, varY, 0))
        Delta2XMaxPlus = 0
        Delta2XMaxMinus = 0
        for iUnc in range(l[pdft] / 2):
            nPlus = 1 + 2 * iUnc
            nMinus = 2 + 2 * iUnc
            xip = h.GetBinContent(h.FindBin(varX, varY, nPlus))
            xim = h.GetBinContent(h.FindBin(varX, varY, nMinus))
            Delta2XMaxPlus += max(xip - x0, xim - x0, 0)**2
            Delta2XMaxMinus += max(x0 - xip, x0 - xim, 0)**2
#        print "Setting", ix, iy, x0, 0.5*(sqrt(Delta2XMaxPlus) - sqrt(Delta2XMaxMinus))
#    if x0>0.:
        print "ref efficiency", x0, sqrt(Delta2XMaxPlus) / x0, sqrt(
            Delta2XMaxMinus) / x0, '->rel.err.:', abs(
                0.5 * (sqrt(Delta2XMaxPlus) + sqrt(Delta2XMaxMinus)) / x0)
        relErr[pdft] = abs(0.5 *
                           (sqrt(Delta2XMaxPlus) + sqrt(Delta2XMaxMinus)) / x0)
    print "sys unc.:", (relErr['cteq'] + relErr['mstw'] + relErr['nnpdf']) / 3.
    #      pdfUncert[pdft].SetBinContent(pdfUncert[pdft].FindBin(varX, varY),  abs(0.5*(sqrt(Delta2XMaxPlus) + sqrt(Delta2XMaxMinus)) / x0))
    canv = getObjFromFile(
        '/data/schoef/results2012/' + sms + '/PDF/sigPDFSys_' + sms + '_btb' +
        btb + '_ht_' + str(htb[0]) + '_' + str(htb[1]) + '_met_' +
        str(metb[0]) + '_' + str(metb[1]) + '.root', 'c1')
    hInLimit = canv.GetPrimitive('hist2DSFunc').Clone()
    b = hInLimit.FindBin(1300, 800)
    print "Used in Limit:", sms, hInLimit.GetBinContent(b)
Ejemplo n.º 3
0
##    for ix in range(1, h.GetNbinsX() + 1):
##      for iy in range(1, h.GetNbinsY() +1):
#
    ix = h.GetXaxis().FindBin(1300) 
    iy = h.GetYaxis().FindBin(800) 

    varX = h.GetXaxis().GetBinLowEdge(ix)
    varY  = h.GetYaxis().GetBinLowEdge(iy)
    print varX, varY
    x0 = h.GetBinContent(h.FindBin(varX, varY, 0))
    Delta2XMaxPlus  = 0
    Delta2XMaxMinus = 0
    for iUnc in range(l[pdft]/2):
      nPlus =  1 + 2*iUnc
      nMinus = 2 + 2*iUnc
      xip = h.GetBinContent(h.FindBin(varX, varY, nPlus))
      xim = h.GetBinContent(h.FindBin(varX, varY, nMinus))
      Delta2XMaxPlus  += max(xip - x0, xim - x0, 0)**2
      Delta2XMaxMinus += max(x0 - xip, x0 - xim, 0)**2
#        print "Setting", ix, iy, x0, 0.5*(sqrt(Delta2XMaxPlus) - sqrt(Delta2XMaxMinus))
#    if x0>0.:
    print "ref efficiency",x0, sqrt(Delta2XMaxPlus)/x0, sqrt(Delta2XMaxMinus)/x0,'->rel.err.:',abs(0.5*(sqrt(Delta2XMaxPlus) + sqrt(Delta2XMaxMinus)) / x0)
    relErr[pdft] = abs(0.5*(sqrt(Delta2XMaxPlus) + sqrt(Delta2XMaxMinus)) / x0)
  print "sys unc.:",(relErr['cteq'] + relErr['mstw'] + relErr['nnpdf'])/3.
#      pdfUncert[pdft].SetBinContent(pdfUncert[pdft].FindBin(varX, varY),  abs(0.5*(sqrt(Delta2XMaxPlus) + sqrt(Delta2XMaxMinus)) / x0))
  canv = getObjFromFile('/data/schoef/results2012/'+sms+'/PDF/sigPDFSys_'+sms+'_btb'+btb+'_ht_'+str(htb[0])+'_'+str(htb[1])+'_met_'+str(metb[0])+'_'+str(metb[1])+'.root', 'c1')
  hInLimit = canv.GetPrimitive('hist2DSFunc').Clone()
  b = hInLimit.FindBin(1300,800)
  print "Used in Limit:",sms,hInLimit.GetBinContent(b)