Skip to content

Commit

Permalink
Merge pull request cms-sw#21 from CMSEdge/dev-marc
Browse files Browse the repository at this point in the history
Dev marc
  • Loading branch information
mdunser committed Jan 25, 2016
2 parents f980abc + a75e9a3 commit 50ddded
Show file tree
Hide file tree
Showing 68 changed files with 4,488 additions and 753 deletions.
167 changes: 60 additions & 107 deletions CMGTools/MonoXAnalysis/cfg/run_monojet_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## skim condition: MET > 200 GeV ##
##########################################################
import PhysicsTools.HeppyCore.framework.config as cfg
import re

# Load all analyzers
from CMGTools.MonoXAnalysis.analyzers.dmCore_modules_cff import *
Expand All @@ -15,8 +16,10 @@
scaleProdToLumi = float(getHeppyOption("scaleProdToLumi",-1)) # produce rough equivalent of X /pb for MC datasets
saveSuperClusterVariables = getHeppyOption("saveSuperClusterVariables",True)
removeJetReCalibration = getHeppyOption("removeJetReCalibration",False)
doT1METCorr = getHeppyOption("doT1METCorr",True)
forcedSplitFactor = getHeppyOption("splitFactor",-1)
forcedFineSplitFactor = getHeppyOption("fineSplitFactor",-1)
isTest = getHeppyOption("test",None) != None and not re.match("^\d+$",getHeppyOption("test"))

# Define skims
signalSkim = False
Expand Down Expand Up @@ -147,12 +150,20 @@
treeProducer.globalVariables.append(NTupleVariable("hbheFilterNew25ns", lambda ev: ev.hbheFilterNew25ns, int, help="new HBHE filter for 25 ns"))
treeProducer.globalVariables.append(NTupleVariable("hbheFilterIso", lambda ev: ev.hbheFilterIso, int, help="HBHE iso-based noise filter"))

#additional MET quantities
metAna.doTkMet = True
treeProducer.globalVariables.append(NTupleVariable("met_trkPt", lambda ev : ev.tkMet.pt() if hasattr(ev,'tkMet') else 0, help="tkmet p_{T}"))
treeProducer.globalVariables.append(NTupleVariable("met_trkPhi", lambda ev : ev.tkMet.phi() if hasattr(ev,'tkMet') else 0, help="tkmet phi"))
if doT1METCorr:
jetAna.calculateType1METCorrection = True
metAna.recalibrate = "type1"
metAna.old74XMiniAODs = False


#-------- SEQUENCE
sequence = cfg.Sequence(dmCoreSequence+[
monoXRazorAna,
monoXMT2Ana,
# monoXRazorAna,
# monoXMT2Ana,
ttHFatJetAna,
monoJetVarAna,
MonoJetEventAna,
Expand All @@ -177,13 +188,7 @@
'DoubleMuEl' : triggers_2mu1e,
'DoubleElMu' : triggers_2e1mu,
'SingleMu' : triggers_1mu_iso,
'SingleMu50ns' : triggers_1mu_iso_50ns,
'SingleEl' : triggers_1e,
'SingleEl50ns' : triggers_1e_50ns,
'SingleMu_8TeV' : triggers_1mu_8TeV + triggers_1mu_iso_r,
'DoubleMu_8TeV' : triggers_mumu_8TeV + triggers_mumu_run1,
'MuEG_8TeV' : triggers_mue_8TeV + triggers_mue_run1,
'DoubleEl_8TeV' : triggers_ee_8TeV + triggers_ee_run1,
'MonoJet80MET90' : triggers_Jet80MET90,
'MonoJet80MET120' : triggers_Jet80MET120,
'METMu5' : triggers_MET120Mu5,
Expand All @@ -193,6 +198,7 @@
triggerFlagsAna.checkL1Prescale = True

from CMGTools.MonoXAnalysis.samples.samples_monojet_13TeV_74X import *
from CMGTools.RootTools.samples.samples_13TeV_DATA2015 import *

selectedComponents = [];

Expand All @@ -207,7 +213,7 @@
c.splitFactor = len(c.files)
c.fineSplitFactor = 1

if runData: # For running on data
if runData and not isTest: # For running on data
json = "/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/Cert_246908-258750_13TeV_PromptReco_Collisions15_25ns_JSON.txt"
run_ranges = [ (246908,258750) ]; useAAA=False; is50ns=False

Expand Down Expand Up @@ -246,18 +252,18 @@
"/"+pd+"/"+processing+"/MINIAOD",
"CMS", ".*root",
json=json,
run_range=run_range,
triggers=triggers[:], vetoTriggers = vetos[:],
run_range=this_run_range,
#triggers=triggers[:], vetoTriggers = vetos[:],
useAAA=useAAA)
print "Will process %s (%d files)" % (comp.name, len(comp.files))
# print "\ttrigger sel %s, veto %s" % (triggers, vetos)
comp.splitFactor = len(comp.files)
print "\ttrigger sel %s, veto %s" % (triggers, vetos)
comp.splitFactor = len(comp.files)/4
comp.fineSplitFactor = 1
selectedComponents.append( comp )
vetos += triggers
iproc += 1
if json is None:
dmCoreSequence.remove(jsonAna)
iproc += 1
vetos += triggers
if json is None:
dmCoreSequence.remove(jsonAna)

if is50ns:
jetAna.mcGT = "Summer15_50nsV5_MC"
Expand All @@ -276,9 +282,13 @@
if forcedSplitFactor>0: c.splitFactor = forcedSplitFactor
if forcedFineSplitFactor>0: c.fineSplitFactor = forcedFineSplitFactor

if runData==False: # MC all
if runData==False and not isTest: # MC all
### 25 ns 74X MC samples
selectedComponents = mcSamples_monojet_Asymptotic25ns ; is50ns = False
is50ns = False
mcSamples = mcSamples_monojet_Asymptotic25ns
if signalSkim:
mcSamples += mcSamples_monojet_Asymptotic25ns_signals
selectedComponents = mcSamples

### 50 ns 74X MC samples
#selectedComponents = mcSamples_monojet_Asymptotic50ns ; is50ns = True
Expand All @@ -290,18 +300,14 @@

#-------- HOW TO RUN -----------
test = getHeppyOption('test')
if test == '1':
if test == 'DYJets':
monoJetSkim.metCut = 0
monoJetCtrlLepSkim.minLeptons = 2
comp = DYJetsToLL_M50_HT100to200
comp.files = comp.files[:1]
comp.splitFactor = 1
comp.fineSplitFactor = 1
selectedComponents = [ comp ]
elif test == '2':
for comp in selectedComponents:
comp.files = comp.files[:1]
comp.splitFactor = 1
comp.fineSplitFactor = 1
elif test == 'EOS':
comp = DYJetsToLL_M50
comp.files = comp.files[:1]
Expand All @@ -325,112 +331,58 @@
comp.files = comp.files[:5]
comp.splitFactor = 1
comp.fineSplitFactor = 5
elif test == '6':
# test data
comp = DoubleElectronAB; comp.name = "dataSamplesAll"
comp.triggers = []
jetAna.recalibrateJets = False
jetAna.smearJets = False
comp.files = [ '/afs/cern.ch/work/e/emanuele/monox/heppy/CMSSW_7_2_3_patch1/src/step5.root' ]
comp.isMC = False
comp.splitFactor = 1
comp.fineSplitFactor = 1
monoJetSkim.metCut = 0
selectedComponents = [ comp ]
elif test == 'synch-74X': # sync
from CMGTools.MonoXAnalysis.samples.samples_monojet_13TeV_74X import *
#eventSelector.toSelect = [ 11809 ]
#sequence = cfg.Sequence([eventSelector] + dmCoreSequence+[ ttHEventAna, treeProducer, ])
monoJetCtrlLepSkim.minLeptons = 0
monoJetSkim.metCut = 0
what = getHeppyOption("sample")
if what == "ADD":
comp = ADD_MJ
comp.files = [ 'root://eoscms//eos/cms/store/relval/CMSSW_7_4_1/RelValADDMonoJet_d3MD3_13/MINIAODSIM/MCRUN2_74_V9_gensim71X-v1/00000/80CF5456-B9EC-E411-93DA-002618FDA248.root' ]
if what == "TTbarDM":
comp = kreator.makeMCComponent("TTbarDM","/TTbarDMJets_pseudoscalar_Mchi-1_Mphi-100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISpring15MiniAODv2-74X_mcRun2_asymptotic_v2-v1/MINIAODSIM", "CMS", ".*root", 1.0, useAAA=True)
selectedComponents = [ comp ]
elif what == "DMS":
comp = DMS_Mchi_100_gSM_1p0_gDM_1p0
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15MiniAODv2/DMS_NNPDF30_Scalar_Mphi-300_Mchi-100_gSM-1p0_gDM-1p0_13TeV-powheg/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/10000/6872703C-7972-E511-8228-0CC47A009E26.root' ]
selectedComponents = [ comp ]
elif what == "TTLep":
comp = TTLep
comp.files = [ 'root://eoscms//eos/cms/store/relval/CMSSW_7_4_1/RelValProdTTbar_13/MINIAODSIM/MCRUN2_74_V9_gensim71X-v1/00000/0A9E2CED-C9EC-E411-A8E4-003048FFCBA8.root' ]
comp = TTLep_pow
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15MiniAODv2/TTTo2L2Nu_13TeV-powheg/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/F8910E89-C56D-E511-BD90-003048F35244.root' ]
selectedComponents = [ comp ]
elif what == "DYJets":
comp = DYJetsToLL_M50_50ns
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15DR74/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/MINIAODSIM/Asympt50ns_MCRUN2_74_V9A-v2/60000/04963444-D107-E511-B245-02163E00F339.root' ]
jetAna.mcGT = "MCRUN2_74_V9A"
comp = DYJetsToLL_M50
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/50000/00759690-D16E-E511-B29E-00261894382D.root' ]
selectedComponents = [ comp ]
elif what == "TTbar":
comp = TTbar
comp.files = [ 'root://eoscms//eos/cms/store/relval/CMSSW_7_4_1/RelValProdTTbar_13/MINIAODSIM/MCRUN2_74_V9_gensim71X-v1/00000/0A9E2CED-C9EC-E411-A8E4-003048FFCBA8.root' ]
elif what == "TTJets":
comp = TJets_LO
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15MiniAODv2/TTJets_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/30000/001F4F14-786E-E511-804F-0025905A60FE.root' ]
selectedComponents = [ comp ]
elif what == "WJets":
comp = WJetsToLNu_HT400to600
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15DR74/WJetsToLNu_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/Asympt25ns_MCRUN2_74_V9-v3/00000/6408230F-9F08-E511-A1A6-D4AE526A023A.root' ]
selectedComponents = [ comp ]
elif what == "RSGrav":
comp = RSGravGaGa
comp.files = [ 'root://eoscms//eos/cms/store/relval/CMSSW_7_4_1/RelValRSGravitonToGaGa_13TeV/MINIAODSIM/MCRUN2_74_V9_gensim71X-v1/00000/189277BA-DCEC-E411-B3B8-0025905B859E.root' ]
comp = WJetsToLNu_HT100to200
comp.files = [ 'root://eoscms//eos/cms/store/mc/RunIISpring15MiniAODv2/WJetsToLNu_HT-100To200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/10000/003F1529-D36D-E511-9E33-001E6724816F.root' ]
selectedComponents = [ comp ]
else:
selectedComponents = RelVals741
jetAna.recalibrateJets = True
selectedComponents = mcSamples_monojet_Asymptotic25ns
jetAna.smearJets = False
for comp in selectedComponents:
comp.splitFactor = 1
comp.fineSplitFactor = 10
elif test == 'SR':
selectedComponents = backgroundSamples + signalSamples
#selectedComponents = backgroundSamples
monoJetSkim.metCut = 200
monoJetCtrlLepSkim.minLeptons = 0
for comp in selectedComponents:
comp.splitFactor = 350
elif test == '74X-MC':
from CMGTools.MonoXAnalysis.samples.samples_monojet_13TeV_74X import *
what = getHeppyOption("sample")
if what == "TT":
monoJetCtrlLepSkim.minLeptons = 0
selectedComponents = TTJets_LO_50ns
elif what == "Z":
monoJetCtrlLepSkim.minLeptons = 0
monoJetSkim.metCut = 0
selectedComponents = [ DYJetsToLL_M50_50ns ]
elif what == "WJets":
monoJetSkim.metCut = 0
selectedComponents = [ WJetsToLNu_50ns ]
else:
selectedComponents = RelVals740
if not getHeppyOption("all"):
for comp in selectedComponents:
comp.files = comp.files[:1]
comp.splitFactor = 1
comp.fineSplitFactor = 1 if getHeppyOption("single") else 4
comp.fineSplitFactor = 1 if getHeppyOption("single") else 2
elif test == '74X-Data':
from CMGTools.MonoXAnalysis.samples.samples_monojet_13TeV_74X import *
from CMGTools.MonoXAnalysis.samples.samples_8TeVReReco_74X import *
what = getHeppyOption("sample")
if what == "JetHT":
monoJetSkim.metCut = 0
selectedComponents = [ JetHT_742 ]
elif what == "Z":
if what == "DoubleEG":
comp = DoubleEG_Run2015D_05Oct
comp.files = [ 'root://eoscms//eos/cms/store/data/Run2015D/DoubleEG/MINIAOD/05Oct2015-v1/50000/0014E86F-656F-E511-9D3F-002618943831.root' ]
selectedComponents = [ comp ]
monoJetCtrlLepSkim.minLeptons = 2
monoJetSkim.metCut = 0
selectedComponents = [ SingleMuZ_742, DoubleElectronZ_742 ]
elif what == "MuEG":
selectedComponents = [ MuEG_742 ]
elif what == "EGamma":
selectedComponents = [ privEGamma2015A ]
lepAna.loose_electron_id = ""
lepAna.loose_electron_relIso = 1000.
photonAna.gammaID = "POG_PHYS14_25ns_Loose_NoIso"
monoJetCtrlLepSkim.minLeptons = 1
monoJetSkim.metCut = 0
elif what == "DoubleEG":
selectedComponents = [ DoubleEG_Run2015B ]
elif what == "DoubleMuon":
comp = DoubleMuon_Run2015D_05Oct
comp.files = [ 'root://eoscms//eos/cms/store/data/Run2015D/DoubleMuon/MINIAOD/05Oct2015-v1/30000/04008DF6-8A6F-E511-B034-0025905A6136.root' ]
selectedComponents = [ comp ]
monoJetCtrlLepSkim.minLeptons = 2
else:
selectedComponents = dataSamples742
selectedComponents = dataSamples_Run2015D_05Oct
for comp in selectedComponents:
comp.splitFactor = 1
comp.fineSplitFactor = 1 if getHeppyOption("single") else 6
comp.fineSplitFactor = 1 if getHeppyOption("single") else 4
if not getHeppyOption("all"):
comp.files = comp.files[:1]

Expand All @@ -450,7 +402,8 @@
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
from CMGTools.TTHAnalysis.tools.EOSEventsWithDownload import EOSEventsWithDownload
event_class = EOSEventsWithDownload
if getHeppyOption("nofetch"):
EOSEventsWithDownload.aggressive = 2 # always fetch if running on Wigner
if getHeppyOption("nofetch") or getHeppyOption("isCrab"):
event_class = Events
config = cfg.Config( components = selectedComponents,
sequence = sequence,
Expand Down
41 changes: 41 additions & 0 deletions CMGTools/MonoXAnalysis/prod/makeSignalSamplesFromDAS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#! /usr/bin/env python

import os
import sys
import re
import optparse

def main():
usage = '''usage: %prog --prefix DMS scalar.txt'''
parser = optparse.OptionParser(usage=usage)

parser.add_option('-p', '--prefix', action='store', dest='prefix', help='the prefix to be added to the component name' , default='DMS')
parser.add_option('-n', '--compname', action='store', dest='compname', help='the name of the group of signals' , default='SM_Scalars')
(opt, args) = parser.parse_args()

if len(args) != 1:
print usage
sys.exit(1)
inputlist = args[0]

inputListfile=open(inputlist)
inputdatasets = inputListfile.readlines()

components = []
for line in inputdatasets:
dataset = line.rstrip('\n')
matchObj = re.match( r'.*_M(.*)_13TeV.*/(.*)/MINIAODSIM', dataset )
pdname = (opt.prefix+"_M"+matchObj.group(1)).replace("-","_")

compKreatorLine = pdname + " = kreator.makeMCComponent(\"" + pdname + "\",\"" + dataset + "\", \"CMS\", \".*root\", 1.0, useAAA=True)"
print compKreatorLine

components.append(pdname)

print "\n"
print opt.compname + " = [ " + ", ".join(components) + " ]\n"


if __name__ == "__main__":
main()

4 changes: 2 additions & 2 deletions CMGTools/MonoXAnalysis/python/analyzers/dmCore_modules_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
photons='slimmedPhotons',
ptMin = 15,
etaMax = 2.5,
gammaID = "POG_PHYS14_25ns_Loose",
gammaID = "POG_SPRING15_50ns_Loose",
rhoPhoton = 'fixedGridRhoFastjetAll',
gamma_isoCorr = 'rhoArea',
doFootprintRemovedIsolation = True,
Expand Down Expand Up @@ -284,7 +284,7 @@
copyJetsByValue = False, #Whether or not to copy the input jets or to work with references (should be 'True' if JetAnalyzer is run more than once)
genJetCol = 'slimmedGenJets',
rho = ('fixedGridRhoFastjetAll','',''),
jetPt = 25.,
jetPt = 15.,
jetEta = 4.7,
jetEtaCentral = 2.5,
jetLepDR = 0.4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@
##--------------------------------------------------
# MT2
##--------------------------------------------------
NTupleVariable("mt2_had", lambda ev: ev.mt2_had, float, help="mt2(j1,j2,met) with jets "),
NTupleVariable("mt2_bb", lambda ev: ev.mt2bb, float, help="mt2(b1,b2,met) with jets "),
NTupleVariable("mt2_gen", lambda ev: ev.mt2_gen, float, help="mt2(j1,j2,met) with jets at genInfo"),
NTupleVariable("mt2", lambda ev: ev.mt2, float, help="mt2(j1,j2,met) with jets and leptons"),
# NTupleVariable("mt2_had", lambda ev: ev.mt2_had, float, help="mt2(j1,j2,met) with jets "),
# NTupleVariable("mt2_bb", lambda ev: ev.mt2bb, float, help="mt2(b1,b2,met) with jets "),
# NTupleVariable("mt2_gen", lambda ev: ev.mt2_gen, float, help="mt2(j1,j2,met) with jets at genInfo"),
# NTupleVariable("mt2", lambda ev: ev.mt2, float, help="mt2(j1,j2,met) with jets and leptons"),
##--------------------------------------------------
# RAZOR
##--------------------------------------------------
NTupleVariable("mr_had", lambda ev: ev.mr_had, float, help="mr(j1,j2,met) with jets "),
NTupleVariable("mr_bb", lambda ev: ev.mr_bb, float, help="mr(b1,b2,met) with jets "),
NTupleVariable("mr_lept", lambda ev: ev.mr_lept, float, help="mr(j1,j2,met) with leptons"),
NTupleVariable("mr_gen", lambda ev: ev.mr_gen, float, help="mr(j1,j2,met) with jets at genInfo"),
NTupleVariable("mr", lambda ev: ev.mr, float, help="mr(j1,j2,met) with jets and leptons"),
NTupleVariable("mtr_had", lambda ev: ev.mtr_had, float, help="mtr(j1,j2,met) with jets "),
NTupleVariable("mtr_bb", lambda ev: ev.mtr_bb, float, help="mtr(b1,b2,met) with jets "),
NTupleVariable("mtr_lept", lambda ev: ev.mtr_lept, float, help="mtr(j1,j2,met) with leptons"),
NTupleVariable("mtr_gen", lambda ev: ev.mtr_gen, float, help="mtr(j1,j2,met) with jets at genInfo"),
NTupleVariable("mtr", lambda ev: ev.mtr, float, help="mtr(j1,j2,met) with jets and leptons"),
NTupleVariable("r_had", lambda ev: ev.r_had, float, help="r(j1,j2,met) with jets "),
NTupleVariable("r_bb", lambda ev: ev.r_bb, float, help="r(b1,b2,met) with jets "),
NTupleVariable("r_lept", lambda ev: ev.r_lept, float, help="r(j1,j2,met) with leptons"),
NTupleVariable("r_gen", lambda ev: ev.r_gen, float, help="r(j1,j2,met) with jets at genInfo"),
NTupleVariable("r", lambda ev: ev.r, float, help="r(j1,j2,met) with jets and leptons"),
# NTupleVariable("mr_had", lambda ev: ev.mr_had, float, help="mr(j1,j2,met) with jets "),
# NTupleVariable("mr_bb", lambda ev: ev.mr_bb, float, help="mr(b1,b2,met) with jets "),
# NTupleVariable("mr_lept", lambda ev: ev.mr_lept, float, help="mr(j1,j2,met) with leptons"),
# NTupleVariable("mr_gen", lambda ev: ev.mr_gen, float, help="mr(j1,j2,met) with jets at genInfo"),
# NTupleVariable("mr", lambda ev: ev.mr, float, help="mr(j1,j2,met) with jets and leptons"),
# NTupleVariable("mtr_had", lambda ev: ev.mtr_had, float, help="mtr(j1,j2,met) with jets "),
# NTupleVariable("mtr_bb", lambda ev: ev.mtr_bb, float, help="mtr(b1,b2,met) with jets "),
# NTupleVariable("mtr_lept", lambda ev: ev.mtr_lept, float, help="mtr(j1,j2,met) with leptons"),
# NTupleVariable("mtr_gen", lambda ev: ev.mtr_gen, float, help="mtr(j1,j2,met) with jets at genInfo"),
# NTupleVariable("mtr", lambda ev: ev.mtr, float, help="mtr(j1,j2,met) with jets and leptons"),
# NTupleVariable("r_had", lambda ev: ev.r_had, float, help="r(j1,j2,met) with jets "),
# NTupleVariable("r_bb", lambda ev: ev.r_bb, float, help="r(b1,b2,met) with jets "),
# NTupleVariable("r_lept", lambda ev: ev.r_lept, float, help="r(j1,j2,met) with leptons"),
# NTupleVariable("r_gen", lambda ev: ev.r_gen, float, help="r(j1,j2,met) with jets at genInfo"),
# NTupleVariable("r", lambda ev: ev.r, float, help="r(j1,j2,met) with jets and leptons"),
##--------------------------------------------------
## MonoJet specific ones
##--------------------------------------------------
Expand Down
Loading

0 comments on commit 50ddded

Please sign in to comment.