Example #1
0
if len(allSamples) > 1:
    sample.name = sample.name + '_comb'

doTopPtReweighting = sample.name.startswith(
    "TTJets") or sample.name.startswith("TTLep")
if doTopPtReweighting:
    print "Sample %s will have top pt reweights!" % sample.name
topPtReweightingFunc = getUnscaledTopPairPtReweightungFunction(
) if doTopPtReweighting else None

if options.fastSim:
    leptonFastSimSF = leptonFastSimSF_()

if not options.skipVariations:
    from StopsDilepton.tools.btagEfficiency import btagEfficiency, getTagWeightDict
    btagEff_1d = btagEfficiency(method='1d')

    maxMultBTagWeight = 2
    btagEff_1b = btagEfficiency(method='1b', fastSim=options.fastSim)

if options.lheHTCut:
    try:
        float(options.lheHTCut)
    except:
        sys.exit("Float conversion of option lheHTCut failed. Got this: %s" %
                 options.lheHTCut)
    sample.name += "_lheHT" + options.lheHTCut
    skimCond += "&&lheHTIncoming<" + options.lheHTCut

if "Run2015D" in sample.name and not hasattr(sample, "vetoList"):
    sys.exit(
Example #2
0
sample=allSamples[0]
if len(allSamples)>1:
  sample.name=sample.name+'_comb'  

doTopPtReweighting = sample.name.startswith("TTJets") or sample.name.startswith("TTLep")
if doTopPtReweighting:
  print "Sample %s will have top pt reweights!"% sample.name
topPtReweightingFunc = getUnscaledTopPairPtReweightungFunction() if doTopPtReweighting else None

if options.fastSim:
  leptonFastSimSF = leptonFastSimSF_()
 
if not options.skipVariations:
  from StopsDilepton.tools.btagEfficiency import btagEfficiency, getTagWeightDict
  btagEff_1d = btagEfficiency(method='1d')

  maxMultBTagWeight = 2
  btagEff_1b = btagEfficiency(method='1b', fastSim = options.fastSim)

if options.lheHTCut:
  try:
    float(options.lheHTCut)
  except:
    sys.exit("Float conversion of option lheHTCut failed. Got this: %s"%options.lheHTCut)
  sample.name+="_lheHT"+options.lheHTCut
  skimCond+="&&lheHTIncoming<"+options.lheHTCut

if "Run2015D" in sample.name and not hasattr(sample, "vetoList"):
  sys.exit("ERROR. Sample %s seems to be data but no vetoList was provided!!" %sample.name)
    topScaleF = topScaleF['val']/float(sample.chain.GetEntries(selectionString))
    logger.info( "Found topScaleF %f", topScaleF )
else:
    topScaleF = 1
    logger.info( "Sample will NOT have top pt reweighting. topScaleF=%f",topScaleF )

if options.fastSim:
   from StopsDilepton.tools.leptonFastSimSF import leptonFastSimSF as leptonFastSimSF_
   leptonFastSimSF = leptonFastSimSF_()

# systematic variations
addSystematicVariations = (not isData) and (not options.skipSystematicVariations)
if addSystematicVariations:
    # B tagging SF
    from StopsDilepton.tools.btagEfficiency import btagEfficiency
    btagEff = btagEfficiency( fastSim = options.fastSim )

# LHE cut (DY samples)
if options.LHEHTCut>0:
    sample.name+="_lheHT"+str(options.LHEHTCut)
    logger.info( "Adding upper LHE cut at %f", options.LHEHTCut )
    skimConds.append( "lheHTIncoming<%f"%options.LHEHTCut )

# MET group veto list
if sample.isData:
    import StopsDilepton.tools.vetoList as vetoList_
    # MET group veto lists from 74X
    fileNames  = ['Run2015D/csc2015_Dec01.txt.gz', 'Run2015D/ecalscn1043093_Dec01.txt.gz']
    vetoList = vetoList_.vetoList( [os.path.join(user.veto_lists, f) for f in fileNames] )

# output directory
else:
    topScaleF = 1
    logger.info("Sample will NOT have top pt reweighting. topScaleF=%f",
                topScaleF)

if options.fastSim:
    from StopsDilepton.tools.leptonFastSimSF import leptonFastSimSF as leptonFastSimSF_
    leptonFastSimSF = leptonFastSimSF_()

# systematic variations
addSystematicVariations = (not isData) and (
    not options.skipSystematicVariations)
if addSystematicVariations:
    # B tagging SF
    from StopsDilepton.tools.btagEfficiency import btagEfficiency
    btagEff = btagEfficiency(fastSim=options.fastSim)

# LHE cut (DY samples)
if options.LHEHTCut > 0:
    sample.name += "_lheHT" + str(options.LHEHTCut)
    logger.info("Adding upper LHE cut at %f", options.LHEHTCut)
    skimConds.append("lheHTIncoming<%f" % options.LHEHTCut)

# MET group veto list
if sample.isData:
    import StopsDilepton.tools.vetoList as vetoList_
    # MET group veto lists from 74X
    fileNames = [
        'Run2015D/csc2015_Dec01.txt.gz', 'Run2015D/ecalscn1043093_Dec01.txt.gz'
    ]
    vetoList = vetoList_.vetoList(