Esempio n. 1
0
if options.small:
  prefixes.append('small')
prefix = '_'.join(prefixes)
if prefix!='':
  prefix+='_'
print 'maps', options.maps,'prefix',options.prefix, 'input', options.input, 'mode', options.mode
if options.maps=='all':
  maps = allMaps
else:
  exec("maps = [" +options.maps+ "]")
if options.mode=='all':
  modes=["ngoodVertices", "sumPt", "multiplicity"]
else:
  modes=[options.mode ]
if os.path.isdir(options.input):
  c = getChain(options.input, maxN=1) if options.small else getChain(options.input)
else:
  c=None
def getLinSquStr(f):
  return  "10^{-6}#upoint ("+str(round(10**6*f.GetParameter(0),1))+'#pm '+str(round(10**6*abs(f.GetParError(0)),1))+") #upoint n^{2}+10^{-3}#upoint("+str(round(10**3*f.GetParameter(1),1))+'#pm '+str(round(10**3*abs(f.GetParError(1)),1))+") #upoint n"
def getLinSquStrNoFac(f):
  return  "("+str(round(f.GetParameter(0),1))+'#pm '+str(round(abs(f.GetParError(0)),1))+") #upoint n^{2}+("+str(round(f.GetParameter(1),1))+'#pm '+str(round(abs(f.GetParError(1)),1))+") #upoint n"
def getSquStr(f):
  return  "10^{-6}#upoint ("+str(round(10**6*f.GetParameter(0),1))+'#pm '+str(round(10**6*abs(f.GetParError(0)),1))+") #upoint n^{2}"
def getPropStr(f):
  return "10^{-3} #upoint ("+str(round(10**3*f.GetParameter(0),1))+'#pm '+str(round(10**3*abs(f.GetParError(0)),1))+") #upoint n"
def getLinStr(f):
  return '10^{-2} #upoint ('+str(round(10**2*f.GetParameter(0),1))+'#pm '+str(round(10**2*abs(f.GetParError(0)),1))+") + 10^{-3}#upoint("+str(round(10**3*f.GetParameter(1),1))+'#pm '+str(round(10**3*abs(f.GetParError(1)),1))+") #upoint n"

for mode in modes:
  if mode=="ngoodVertices":
Esempio n. 2
0
import ROOT
from Workspace.HEPHYPythonTools.helpers import getObjFromFile, getChain, getChunks, getObjDict, getVarValue
from Workspace.HEPHYPythonTools.xsec import xsec
ROOT.gROOT.LoadMacro("$CMSSW_BASE/src/Workspace/HEPHYPythonTools/scripts/root/tdrstyle.C")
ROOT.setTDRStyle()
ROOT.gROOT.ProcessLine(".L $CMSSW_BASE/src/Workspace/HEPHYPythonTools/scripts/root/useNiceColorPalette.C+")
ROOT.useNiceColorPalette()

from Workspace.RA4Analysis.cmgTuples_Spring15_150809 import *

lumi=100.
small = False

samples=[ 
  {"name":"DY", "bins":[DYJetsToLL_M50_25ns_CERNRerun], "legendText":"Drell-Yan"}
]

maxN = 10 if small else -1
for s in samples:
  totalYield=0
  for b in s["bins"]:
    chunks, sumWeight = getChunks(b, maxN=maxN)
#    print "Chunks:" , chunks
    lumiScale = xsec[b['dbsName']]*lumi/float(sumWeight)
    b["lumiScale"] = lumiScale
    b["chain"]     = getChain(chunks,  histname="", treeName = b["treeName"])
    print b["name"],"xsec",xsec[b['dbsName']],"sumWeight",sumWeight

DYJetsToLL_M50_25ns_CERNRerun['chain'].Draw('Jet_pt/Jet_rawPt:Jet_eta','','COLZ')