Skip to content

Instantly share code, notes, and snippets.

@nsahoo
Last active August 29, 2015 13:56
Show Gist options
  • Save nsahoo/8842665 to your computer and use it in GitHub Desktop.
Save nsahoo/8842665 to your computer and use it in GitHub Desktop.
python script for 2011 MC
import FWCore.ParameterSet.Config as cms
from btokstarmumu_cfi import process
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(500) )
#process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
#'file:/afs/cern.ch/user/x/xshi/work/cms/afb/dat/aod/mc/BuToKstarMuMu_7TeV_PYTHIA6.root',
# 'file:/afs/cern.ch/user/x/xshi/work/cms/afb/dat/aod/mc/BuToKstarMuMu_7TeV_PYTHIA6_1_1_96m.root',
# 'file:/afs/cern.ch/user/x/xshi/work/cms/afb/dat/aod/mc/BuToKstarMuMu_7TeV_PYTHIA6_2_1_dfI.root',
# 'file:/afs/cern.ch/user/x/xshi/work/cms/afb/dat/aod/mc/BuToKstarMuMu_7TeV_PYTHIA6_3_1_ud5.root',
# 'file:/afs/cern.ch/user/x/xshi/work/cms/afb/dat/aod/mc/BuToKstarMuMu_7TeV_PYTHIA6_4_1_neu.root',
# 'file:/afs/cern.ch/user/x/xshi/work/cms/afb/dat/aod/mc/BuToKstarMuMu_7TeV_PYTHIA6_5_1_8Kc.root',
# 'file:/afs/cern.ch/work/n/nsahoo/BPH-ANALYSIS/afb/SE/aod/mc/2012_test_BuToKstarJPsi_500.root',
# 'file:/afs/cern.ch/work/n/nsahoo/BPH-ANALYSIS/afb/SE/aod/mc/2012_test_BuToKstarMuMu_500.root',
# 'file:/afs/cern.ch/work/n/nsahoo/BPH-ANALYSIS/afb/SE/aod/mc/2012_test_BuToKstarPsi2S_500.root',
# 'file:/afs/cern.ch/work/n/nsahoo/BPH-ANALYSIS/afb/SE/aod/mc/2011_test_BuToKstarJPsi_500.root',
'file:/afs/cern.ch/work/n/nsahoo/BPH-ANALYSIS/afb/SE/aod/mc/2011_test_BuToKstarMuMu_500.root',
)
)
#process.GlobalTag.globaltag = cms.string('GR_R_42_V25::All')
#process.GlobalTag.globaltag = cms.string('START42_V14A::All')
#process.GlobalTag.globaltag = cms.string('START53_V19F::All')
process.GlobalTag.globaltag = cms.string('START42_V14B::All')
# do trigger matching for muons
triggerProcessName = 'HLT'
process.cleanMuonTriggerMatchHLT0 = cms.EDProducer(
# match by DeltaR only (best match by DeltaR)
'PATTriggerMatcherDRLessByR',
src = cms.InputTag('cleanPatMuons'),
# default producer label as defined in
# PhysicsTools/PatAlgos/python/triggerLayer1/triggerProducer_cfi.py
matched = cms.InputTag('patTrigger'),
matchedCuts = cms.string('path("HLT_Dimuon6p5_LowMass_Displaced_v*",0,0)'),
maxDeltaR = cms.double(0.1),
# only one match per trigger object
resolveAmbiguities = cms.bool(True),
# take best match found per reco object (by DeltaR here, see above)
resolveByMatchQuality = cms.bool(False))
process.cleanMuonTriggerMatchHLT1 = cms.EDProducer(
'PATTriggerMatcherDRLessByR',
src = cms.InputTag('cleanPatMuons'),
matched = cms.InputTag('patTrigger'),
matchedCuts = cms.string('path("HLT_Dimuon7_LowMass_Displaced_v*")'),
maxDeltaR = cms.double(0.1),
resolveAmbiguities = cms.bool(True),
resolveByMatchQuality = cms.bool(False))
process.cleanMuonTriggerMatchHLT2 = cms.EDProducer(
'PATTriggerMatcherDRLessByR',
src = cms.InputTag('cleanPatMuons'),
matched = cms.InputTag('patTrigger'),
matchedCuts = cms.string('path("HLT_DoubleMu4_LowMass_Displaced_v*")'),
maxDeltaR = cms.double(0.1),
resolveAmbiguities = cms.bool(True),
resolveByMatchQuality = cms.bool(False))
process.cleanMuonTriggerMatchHLT3 = cms.EDProducer(
'PATTriggerMatcherDRLessByR',
src = cms.InputTag('cleanPatMuons'),
matched = cms.InputTag('patTrigger'),
matchedCuts = cms.string('path("HLT_DoubleMu4p5_LowMass_Displaced_v*")'),
maxDeltaR = cms.double(0.1),
resolveAmbiguities = cms.bool(True),
resolveByMatchQuality = cms.bool(False))
process.cleanMuonTriggerMatchHLT4 = cms.EDProducer(
'PATTriggerMatcherDRLessByR',
src = cms.InputTag('cleanPatMuons'),
matched = cms.InputTag('patTrigger'),
matchedCuts = cms.string('path("HLT_DoubleMu5_LowMass_Displaced_v*")'),
maxDeltaR = cms.double(0.1),
resolveAmbiguities = cms.bool(True),
resolveByMatchQuality = cms.bool(False))
from PhysicsTools.PatAlgos.tools.trigTools import *
# switchOnTriggerMatchEmbedding(process, triggerMatchers = ['cleanMuonTriggerMatchHLT0'],
# hltProcess = triggerProcessName, outputModule = '')
switchOnTriggerMatchEmbedding(process, triggerMatchers = ['cleanMuonTriggerMatchHLT1','cleanMuonTriggerMatchHLT2','cleanMuonTriggerMatchHLT3','cleanMuonTriggerMatchHL\
T4'], hltProcess = triggerProcessName, outputModule = '')
g_TriggerNames_LastFilterNames = [
('HLT_Dimuon6p5_LowMass_Displaced',
'hltDisplacedmumuFilterLowMass'), #5E32
('HLT_Dimuon7_LowMass_Displaced',
'hltDisplacedmumuFilterLowMass'), #1E33, 1.4E33
('HLT_DoubleMu4_LowMass_Displaced',
'hltDisplacedmumuFilterLowMass'), #2E33
('HLT_DoubleMu4p5_LowMass_Displaced',
'hltDisplacedmumuFilterDoubleMu4p5LowMass'), #3E33, 5E33
('HLT_DoubleMu5_LowMass_Displaced',
'hltDisplacedmumuFilterDoubleMu5LowMass'), #3E33, 5E33
]
g_TriggerNames = [i[0] for i in g_TriggerNames_LastFilterNames]
g_LastFilterNames = [i[1] for i in g_TriggerNames_LastFilterNames]
process.ntuple.TriggerNames = cms.vstring(g_TriggerNames)
process.ntuple.LastFilterNames = cms.vstring(g_LastFilterNames)
process.ntuple.IsMonteCarlo = cms.untracked.bool(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment