Ejemplo n.º 1
0
def getBaseConfig(globaltag= 'START53_V15A::All', testfile=cms.untracked.vstring(""), maxevents=100, nickname = 'SM_VBFHToTauTau_M_90_powheg_pythia_8TeV', kappaTag = 'Kappa_1_0_0'):

	from Kappa.Skimming.KSkimming_template_cfg import process
	process.source.fileNames      = testfile
	process.maxEvents.input	      = maxevents				## number of events to be processed (-1 = all in file)
	process.kappaTuple.outputFile = 'kappaTuple.root'			## name of output file
	process.kappaTuple.verbose    = cms.int32(0)				## verbosity level
	process.kappaTuple.profile    = cms.bool(True)
	if not globaltag.lower() == 'auto' :
		process.GlobalTag.globaltag   = globaltag
		print "GT (overwritten):", process.GlobalTag.globaltag
	data = datasetsHelper.isData(nickname)
	centerOfMassEnergy = datasetsHelper.getCenterOfMassEnergy(nickname)
	isEmbedded = datasetsHelper.getIsEmbedded(nickname)

	process.p = cms.Path()
	## ------------------------------------------------------------------------
	# Configure Metadata describing the file
	process.kappaTuple.active										= cms.vstring('TreeInfo')
	process.kappaTuple.TreeInfo.parameters = cms.PSet(
		dataset						= cms.string(datasetsHelper.getDatasetName(nickname)),
		generator					= cms.string(datasetsHelper.getGenerator(nickname)),
		productionProcess			= cms.string(datasetsHelper.getProcess(nickname)),
		globalTag					= cms.string(globaltag),
		prodCampaignGlobalTag	= cms.string(datasetsHelper.getProductionCampaignGlobalTag(nickname, centerOfMassEnergy)),
		runPeriod					= cms.string(datasetsHelper.getRunPeriod(nickname)),
		kappaTag						= cms.string(kappaTag),
		isEmbedded					= cms.bool(isEmbedded),
		jetMultiplicity			= cms.int32(datasetsHelper.getJetMultiplicity(nickname)),
		centerOfMassEnergy		= cms.int32(centerOfMassEnergy),
		puScenario					= cms.string(datasetsHelper.getPuScenario(nickname, centerOfMassEnergy)),
		isData						= cms.bool(data),
	)


	## ------------------------------------------------------------------------
	# General configuration

	process.kappaTuple.active += cms.vstring('VertexSummary')	## save VertexSummary,
	process.kappaTuple.active += cms.vstring('BeamSpot')		## save Beamspot,
	process.kappaTuple.active += cms.vstring('TriggerObjects')

	if not isEmbedded:
		if data:
			process.kappaTuple.active+= cms.vstring('DataInfo')		## produce Metadata for data,
		else:
			process.kappaTuple.active+= cms.vstring('GenInfo')		## produce Metadata for MC,
			process.kappaTuple.active+= cms.vstring('GenParticles')		## save GenParticles,
			process.kappaTuple.active+= cms.vstring('GenTaus')				## save GenParticles,
	
	# prune GenParticles
	if not data:
		process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
		process.prunedGenParticles = cms.EDProducer("GenParticlePruner",
			src = cms.InputTag("genParticles", "", "SIM"),
			select = cms.vstring(
				"drop  *",
				"keep status == 3",  # all status 3
				"keep++ abs(pdgId) == 23", # Z
				"keep++ abs(pdgId) == 24", # W
				"keep++ abs(pdgId) == 25", # H
				"keep abs(pdgId) == 11 || abs(pdgId) == 13",  # charged leptons
				"keep++ abs(pdgId) == 15"  # keep full tau decay chain
			)
		)
	
	process.kappaTuple.Info.hltWhitelist = cms.vstring(			## HLT selection
		# https://github.com/cms-analysis/HiggsAnalysis-KITHiggsToTauTau/blob/master/data/triggerTables-2011-2012.txt
		# https://twiki.cern.ch/twiki/bin/viewauth/CMS/HiggsToTauTauWorkingSummer2013
		# can be tested at http://regexpal.com
		# e
		"^HLT_Ele[0-9]+_CaloIdVT(_CaloIsoT)?_TrkIdT(_TrkIsoT)?_v[0-9]+$",
		"^HLT_Ele[0-9]+_WP[0-9]+_v[0-9]+$",
		# m
		"^HLT_(Iso)?Mu[0-9]+(_eta2p1)?_v[0-9]+$",
		# ee
		"^HLT_Ele[0-9]+_CaloId(L|T)(_TrkIdVL)?_CaloIsoVL(_TrkIdVL)?(_TrkIsoVL)?" +
			"_Ele[0-9]+_CaloId(L|T)(_TrkIdVL)?_CaloIsoVL(_TrkIdVL)?(_TrkIsoVL)?_v[0-9]+$",
		"^HLT_Ele[0-9]+_Ele[0-9]+_CaloId(L|T)_CaloIsoVL(_TrkIdVL_TrkIsoVL)?_v[0-9]+$",
		# mm
		"^HLT_(Double)?Mu[0-9]+(_(Mu|Jet)[0-9]+)?_v[0-9]+$",
		# em
		"^HLT_Mu[0-9]+_(Ele|Photon)[0-9]+_CaloId(L|T|VT)(_CaloIsoVL|_IsoT)?(_TrkIdVL_TrkIsoVL)?_v[0-9]+$",
		# et
		"^HLT_Ele[0-9]+_CaloIdVT(_Calo(IsoRho|Iso)T)?_TrkIdT(_TrkIsoT)?_(Loose|Medium|Tight)IsoPFTau[0-9]+_v[0-9]+$",
		"^HLT_Ele[0-9]+_eta2p1_WP[0-9]+(Rho|NoIso)_LooseIsoPFTau[0-9]+_v[0-9]+$",
		# mt
		"^HLT_(Iso)?Mu[0-9]+(_eta2p1)?_(Loose|Medium|Tight)IsoPFTau[0-9]+(_Trk[0-9]_eta2p1)?_v[0-9]+$",
		# tt
		"^HLT_Double(Medium)?IsoPFTau[0-9]+_Trk(1|5)_eta2p1_(Jet[0-9]+|Prong[0-9])?_v[0-9]+$",
		"^HLT_Double(Medium)?IsoPFTau[0-9]+_Trk(1|5)(_eta2p1)?_v[0-9]+$",
		# specials (possible generalization: Mu15, L1ETM20, Photon20, Ele8)
		"^HLT_Ele[0-9]+_CaloId(L|T|VT)_CaloIso(VL|T|VT)(_TrkIdT)?(_TrkIsoVT)?_(SC|Ele)[0-9](_Mass[0-9]+)?_v[0-9]+$",
		"^HLT_Ele8_v[0-9]+$",
		"^HLT_IsoMu15(_eta2p1)?_L1ETM20_v[0-9]+$",
		"^HLT_Photon20_CaloIdVT_IsoT_Ele8_CaloIdL_CaloIsoVL_v[0-9]+$",
		# specials for tag and probe and em fakerate studies could be added if enough bits are ensured
		#"^HLT_Ele[0-9]+_CaloId(L|T|VT)_CaloIso(VL|T|VT)(_TrkIdT_TrkIso(T|VT))?_(SC|Ele)[0-9]+(_Mass[0-9]+)?_v[0-9]+$",
		#"^HLT_Mu[0-9]+_Photon[0-9]+_CaloIdVT_IsoT_v[0-9]+$",
		#"^HLT_Ele[0-9]+_CaloId(L|T)(_TrkIdVL)?_CaloIsoVL(_TrkIdVL_TrkIsoVL)?(_TrkIsoVL)?(_Jet[0-9]+|)?_v[0-9]+$",
		)
	
	process.kappaTuple.Info.hltBlacklist = cms.vstring(
		"HLT_Mu13_Mu8", # v21 gives errors for the trigger objects
		)

	## ------------------------------------------------------------------------
	# Configure PFCandidates and offline PV
	process.load("Kappa.Skimming.KPFCandidates_cff")
	#process.kappaTuple.active += cms.vstring('PFCandidates')		## save PFCandidates for deltaBeta corrected
	process.kappaTuple.PFCandidates.whitelist = cms.vstring(                ## isolation used for electrons and muons.
##		"pfNoPileUpChargedHadrons",    ## switch to pfAllChargedParticles
		"pfAllChargedParticles",       ## same as pfNoPileUpChargedHadrons +pf_electrons + pf_muons
		"pfNoPileUpNeutralHadrons",
		"pfNoPileUpPhotons",
		"pfPileUpChargedHadrons",
		)

	process.p *= ( process.makePFBRECO * process.makePFCandidatesForDeltaBeta )
	
	## ------------------------------------------------------------------------
	# Configure Muons
	process.load("Kappa.Skimming.KMuons_cff")
	process.kappaTuple.active += cms.vstring('Muons')	                ## produce/save KappaMuons
	process.kappaTuple.Muons.minPt = cms.double(8.0)
	process.p *= process.makeKappaMuons

	## ------------------------------------------------------------------------
	# Configure Electrons
	process.load("Kappa.Skimming.KElectrons_cff")
	process.kappaTuple.active += cms.vstring('Electrons')	                ## produce/save KappaElectrons,
	process.kappaTuple.Electrons.ids = cms.vstring("mvaTrigV0",
	                                               "mvaTrigNoIPV0",
	                                               "mvaNonTrigV0")
	process.kappaTuple.Electrons.minPt = cms.double(8.0)
	process.p *= process.makeKappaElectrons
	
	## for electron/muon iso
	# https://github.com/ajgilbert/ICHiggsTauTau/blob/master/test/higgstautau_cfg.py#L418-L448
	from CommonTools.ParticleFlow.Tools.pfIsolation import setupPFElectronIso, setupPFMuonIso
	process.eleIsoSequence = setupPFElectronIso(process, 'patElectrons')
	process.muIsoSequence = setupPFMuonIso(process, 'muons')
	
	process.eleIsoSequence.remove(process.elPFIsoValueCharged03NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueChargedAll03NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueGamma03NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueNeutral03NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValuePU03NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueCharged04NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueChargedAll04NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueGamma04NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValueNeutral04NoPFIdPFIso)
	process.eleIsoSequence.remove(process.elPFIsoValuePU04NoPFIdPFIso)
	process.elPFIsoValueGamma04PFIdPFIso.deposits[0].vetos      = cms.vstring('EcalEndcaps:ConeVeto(0.08)','EcalBarrel:ConeVeto(0.08)')
	process.elPFIsoValueNeutral04PFIdPFIso.deposits[0].vetos    = cms.vstring()
	process.elPFIsoValuePU04PFIdPFIso.deposits[0].vetos         = cms.vstring()
	process.elPFIsoValueCharged04PFIdPFIso.deposits[0].vetos    = cms.vstring('EcalEndcaps:ConeVeto(0.015)')
	process.elPFIsoValueChargedAll04PFIdPFIso.deposits[0].vetos = cms.vstring('EcalEndcaps:ConeVeto(0.015)','EcalBarrel:ConeVeto(0.01)')
	process.pfiso = cms.Sequence(process.pfParticleSelectionSequence + process.eleIsoSequence + process.muIsoSequence)

	# rho for electron iso
	from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
	process.kt6PFJetsForIsolation = kt4PFJets.clone( rParam = 0.6, doRhoFastjet = True )
	process.kt6PFJetsForIsolation.Rho_EtaMax = cms.double(2.5)
	process.p *= (process.pfiso * process.kt6PFJetsForIsolation)

	## ------------------------------------------------------------------------
	# Configure Taus
	process.load("Kappa.Skimming.KTaus_cff")
	process.kappaTuple.active += cms.vstring('Taus')	                ## produce/save KappaTaus
	process.kappaTuple.Taus.minPt = cms.double(8.0)
	process.p *= process.makeKappaTaus

	## ------------------------------------------------------------------------
	## Kappa Jets
	process.load("Kappa.Skimming.KJets_cff")
	process.kappaTuple.active += cms.vstring('Jets', 'PileupDensity')
	process.kappaTuple.Jets = cms.PSet(
		process.kappaNoCut,
		process.kappaNoRegEx,
		taggers = cms.vstring(
			"QGlikelihood",
			"QGmlp",
			"TrackCountingHighEffBJetTags",
			"TrackCountingHighPurBJetTags", 
			"JetProbabilityBJetTags",
			"JetBProbabilityBJetTags", 
			"SoftElectronBJetTags",
			"SoftMuonBJetTags",
			"SoftMuonByIP3dBJetTags",
			"SoftMuonByPtBJetTags",
			"SimpleSecondaryVertexBJetTags", 
			"CombinedSecondaryVertexBJetTags",
			"CombinedSecondaryVertexMVABJetTags",
			"puJetIDFullDiscriminant",
			"puJetIDFullLoose",
			"puJetIDFullMedium",
			"puJetIDFullTight",
			"puJetIDCutbasedDiscriminant",
			"puJetIDCutbasedLoose",
			"puJetIDCutbasedMedium",
			"puJetIDCutbasedTight"
			),
		AK5PFTaggedJets = cms.PSet(
			src = cms.InputTag("ak5PFJets"),
			QGtagger = cms.InputTag("AK5PFJetsQGTagger"),
			Btagger  = cms.InputTag("ak5PF"),
			PUJetID  = cms.InputTag("ak5PFPuJetMva"),
			PUJetID_full = cms.InputTag("full"),
			),
		AK5PFTaggedJetsCHS = cms.PSet(
			src = cms.InputTag("ak5PFJetsCHS"),
			QGtagger = cms.InputTag("AK5PFJetsCHSQGTagger"),
			Btagger  = cms.InputTag("ak5PFCHS"),
			PUJetID  = cms.InputTag("ak5PFCHSPuJetMva"),
			PUJetID_full = cms.InputTag("full"),
			),
		)
	process.kappaTuple.Jets.minPt = cms.double(10.0)

	## ------------------------------------------------------------------------
	# Special settings for embedded samples
	# https://twiki.cern.ch/twiki/bin/viewauth/CMS/MuonTauReplacementWithPFlow
	if isEmbedded:
		process.load('RecoBTag/Configuration/RecoBTag_cff')
		process.load('RecoJets/JetAssociationProducers/ak5JTA_cff')
		process.ak5PFJetNewTracksAssociatorAtVertex.tracks = "tmfTracks"
		process.ak5PFCHSNewJetTracksAssociatorAtVertex.tracks = "tmfTracks"
		process.p *= process.btagging
		# disable overrideHLTCheck for embedded samples, since it triggers an Kappa error
		process.kappaTuple.Info.overrideHLTCheck = cms.untracked.bool(True)
		process.kappaTuple.active+= cms.vstring('DataInfo')
		process.kappaTuple.active+= cms.vstring('GenParticles')		## save GenParticles,
		process.kappaTuple.active+= cms.vstring('GenTaus')				## save GenParticles,
		process.kappaTuple.GenParticles.genParticles.src = cms.InputTag("genParticles","","EmbeddedRECO")
		process.kappaTuple.Info.isEmbedded = cms.bool(True)

	# Let Jets run
	process.p *= (
		process.makeKappaTaus *
		process.makePFJets *
		process.makePFJetsCHS *
		process.makeQGTagging *
		process.makeBTagging *
		process.makePUJetID
	)

	## ------------------------------------------------------------------------
	## MET
	process.load("Kappa.Skimming.KMET_cff")
	process.kappaTuple.active += cms.vstring('GenMET')                         ## produce/save KappaMET
	process.kappaTuple.active += cms.vstring('MET')                       ## produce/save KappaPFMET
	process.p *= process.makeKappaMET
	#"""
	
	if not data:
		process.load('PhysicsTools/JetMCAlgos/TauGenJets_cfi')
		process.load('PhysicsTools/JetMCAlgos/TauGenJetsDecayModeSelectorAllHadrons_cfi')
		process.p *= (process.tauGenJets+process.tauGenJetsSelectorAllHadrons)
		process.kappaTuple.GenJets.whitelist = cms.vstring("tauGenJets")
		process.kappaTuple.active += cms.vstring('GenJets')
	
	# add python config to TreeInfo
	process.kappaTuple.TreeInfo.parameters.config = cms.string(process.dumpPython())
	
	# add repository revisions to TreeInfo
	for repo, rev in tools.get_repository_revisions().iteritems():
		setattr(process.kappaTuple.TreeInfo.parameters, repo, cms.string(rev))
	

	## ------------------------------------------------------------------------
	## And let it run
	process.p *= (
		process.kappaOut
	)
	## ------------------------------------------------------------------------
	## declare edm OutputModule (expects a path 'p'), uncommented if wanted

	#process.edmOut = cms.OutputModule(
	#	"PoolOutputModule",
	#	fileName = cms.untracked.string('dump.root'),				## name of output file
	#	SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('p') ),	## save only events passing the full path
	#	outputCommands = cms.untracked.vstring('drop *', 'keep *_*_*_KAPPA')	## save each edm object that has been produced by process KAPPA
	#	)
	#process.ep = cms.EndPath(process.edmOut)

	return process
Ejemplo n.º 2
0
def getBaseConfig(
		globaltag,
		testfile,
		maxevents,
		nickname,
		outputfilename,
		kappaverbosity,
	):
	from Kappa.Skimming.KSkimming_template_cfg import process
	process.source.fileNames	  = testfile
	process.maxEvents.input		  = maxevents				## number of events to be processed (-1 = all in file)
	process.kappaTuple.outputFile = outputfilename			## name of output file
	process.kappaTuple.verbose	= cms.int32(kappaverbosity)				## verbosity level
	process.kappaTuple.profile	= cms.bool(False)
	if not globaltag.lower() == 'auto' :
		process.GlobalTag.globaltag   = globaltag
	data = datasetsHelper.isData(nickname)
	centerOfMassEnergy = datasetsHelper.getCenterOfMassEnergy(nickname)
	process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )


	## some infos
	print "\n--------CONFIGURATION----------"
	print "input:          ", testfile
	print "nickname:       ", nickname
	print "global tag:     ", process.GlobalTag.globaltag
	print "max events:     ", maxevents
	print "output filename:", outputfilename
	print "------------------\n"

	process.p = cms.Path ( )
	## ------------------------------------------------------------------------
	# Configure Metadata describing the file
	process.kappaTuple.active = cms.vstring('TreeInfo')
	process.kappaTuple.TreeInfo.parameters = cms.PSet(
		dataset						= cms.string(datasetsHelper.getDatasetName(nickname)),
		generator					= cms.string(datasetsHelper.getGenerator(nickname)),
		productionProcess			= cms.string(datasetsHelper.getProcess(nickname)),
		globalTag					= cms.string(globaltag),
		prodCampaignGlobalTag	= cms.string(datasetsHelper.getProductionCampaignGlobalTag(nickname, centerOfMassEnergy)),
		runPeriod					= cms.string(datasetsHelper.getRunPeriod(nickname)),
		jetMultiplicity			= cms.int32(datasetsHelper.getJetMultiplicity(nickname)),
		centerOfMassEnergy		= cms.int32(centerOfMassEnergy),
		puScenario					= cms.string(datasetsHelper.getPuScenario(nickname, centerOfMassEnergy)),
		isData						= cms.bool(data)
		)

	## ------------------------------------------------------------------------
	# General configuration

	process.kappaTuple.active += cms.vstring('VertexSummary')	## save VertexSummary,
	process.kappaTuple.VertexSummary.whitelist = cms.vstring('goodOfflinePrimaryVertices')
	#process.kappaTuple.active += cms.vstring('BeamSpot')		## save Beamspot,
	#process.kappaTuple.active += cms.vstring('TriggerObjects')

	if data:
		process.kappaTuple.active+= cms.vstring('DataInfo')		## produce Metadata for data,
	else:
		process.kappaTuple.active+= cms.vstring('GenInfo')		## produce Metadata for MC,
		process.kappaTuple.active+= cms.vstring('GenParticles')

	process.kappaTuple.Info.hltWhitelist = cms.vstring(			## HLT selection
		# can be tested at http://regexpal.com
		# matches 'HLT_Mu17_Mu8_v7' etc.
		'^HLT_(Double)?Mu([0-9]+)_(Double)?Mu([0-9]+)(_v[[:digit:]]+)?$',
		# matches 'HLT_DoubleMu7_v8' etc.
		'^HLT_(Double)?Mu([0-9]+)(_v[[:digit:]]+)?$',
		)



	## ------------------------------------------------------------------------
	# Configure PFCandidates and offline PV
	# PFCandidates ------------------------------------------------------------
	process.load('Kappa.Skimming.KPFCandidates_cff')
	# Modifications for new particleFlow Pointers
	#process.pfPileUp.PFCandidates = cms.InputTag('particleFlowPtrs')
	#process.pfPileUpIso.PFCandidates = cms.InputTag('particleFlowPtrs')
	#process.pfNoPileUp.bottomCollection = cms.InputTag('particleFlowPtrs')
	#process.pfNoPileUpIso.bottomCollection = cms.InputTag('particleFlowPtrs')
	process.pfJetTracksAssociatorAtVertex.jets= cms.InputTag('ak5PFJets')

	process.p *= (process.goodOfflinePrimaryVertices * process.pfPileUp * process.pfNoPileUp)# process.makePFBRECO * process.makeKappaPFCandidates)


	## ------------------------------------------------------------------------
	# Configure Muons
	process.load('Kappa.Skimming.KMuons_cff')
	process.kappaTuple.active += cms.vstring('Muons')					## produce/save KappaMuons
	#process.kappaTuple.Muons.minPt = cms.double(8.0)

	process.goodMuons = cms.EDFilter('CandViewSelector',
		src = cms.InputTag('muons'),
		cut = cms.string("pt > 15.0 & abs(eta) < 8.0"),# & isGlobalMuon()"),
	)
	process.twoGoodMuons = cms.EDFilter('CandViewCountFilter',
		src = cms.InputTag('goodMuons'),
		minNumber = cms.uint32(2),
	)
	process.p *= (#process.goodMuons * process.twoGoodMuons * 
		process.makeKappaMuons)

	## for muon iso
	# https://github.com/ajgilbert/ICHiggsTauTau/blob/master/test/higgstautau_new_cfg.py#L430-L460
	process.load('CommonTools.ParticleFlow.Isolation.pfMuonIsolation_cff')
	process.muPFIsoValueCharged04PFIso = process.muPFIsoValueCharged04.clone()
	process.muPFIsoValueChargedAll04PFIso = process.muPFIsoValueChargedAll04.clone()
	process.muPFIsoValueGamma04PFIso = process.muPFIsoValueGamma04.clone()
	process.muPFIsoValueNeutral04PFIso = process.muPFIsoValueNeutral04.clone()
	process.muPFIsoValuePU04PFIso = process.muPFIsoValuePU04.clone()

	process.muonPFIsolationValuesSequence = cms.Sequence(
		process.muPFIsoValueCharged04PFIso+
		process.muPFIsoValueChargedAll04PFIso+
		process.muPFIsoValueGamma04PFIso+
		process.muPFIsoValueNeutral04PFIso+
		process.muPFIsoValuePU04PFIso
	)
	process.muPFIsoDepositCharged.src = cms.InputTag('muons')
	process.muPFIsoDepositChargedAll.src = cms.InputTag('muons')
	process.muPFIsoDepositNeutral.src = cms.InputTag('muons')
	process.muPFIsoDepositGamma.src = cms.InputTag('muons')
	process.muPFIsoDepositPU.src = cms.InputTag('muons')

	## ------------------------------------------------------------------------
	## KappaJets
	process.load('Kappa.Skimming.KJets_cff')
	process.kappaTuple.active += cms.vstring('Jets', 'PileupDensity')
	process.kappaTuple.Jets = cms.PSet(
		process.kappaNoCut,
		process.kappaNoRegEx,
		taggers = cms.vstring(
	#		'QGlikelihood',
	#		'QGmlp',
			'TrackCountingHighEffBJetTags',
			'TrackCountingHighPurBJetTags',
			'JetProbabilityBJetTags',
			'JetBProbabilityBJetTags',
			'SoftElectronBJetTags',
			'SoftMuonBJetTags',
			'SoftMuonByIP3dBJetTags',
			'SoftMuonByPtBJetTags',
			'SimpleSecondaryVertexBJetTags',
			'CombinedSecondaryVertexBJetTags',
			'CombinedSecondaryVertexMVABJetTags',
			'puJetIDFullDiscriminant',
			'puJetIDFullLoose',
			'puJetIDFullMedium',
			'puJetIDFullTight',
			#'puJetIDCutbasedDiscriminant',
			#'puJetIDCutbasedLoose',
			#'puJetIDCutbasedMedium',
			#'puJetIDCutbasedTight'
			),
		AK5PFTaggedJets = cms.PSet(
			src = cms.InputTag('ak5PFJets'),
			#QGtagger = cms.InputTag('AK5PFJetsQGTagger'),
			QGtagger = cms.InputTag(''),
			Btagger  = cms.InputTag('ak5PF'),
			PUJetID  = cms.InputTag('ak5PFPuJetMva'),
			PUJetID_full = cms.InputTag('full'),
			),
		AK5PFTaggedJetsCHS = cms.PSet(
			src = cms.InputTag('ak5PFJetsCHS'),
			#QGtagger = cms.InputTag('AK5PFJetsCHSQGTagger'),
			QGtagger = cms.InputTag(''),
			Btagger  = cms.InputTag('ak5PFCHS'),
			PUJetID  = cms.InputTag('ak5PFCHSPuJetMva'),
			PUJetID_full = cms.InputTag('full'),
			),
		)
	#process.kappaTuple.Jets.minPt = cms.double(5.0)

	if not data:
		process.kappaTuple.active += cms.vstring('GenJets')
		process.kappaTuple.GenJets.whitelist = cms.vstring('ak5GenJets')
		process.kappaTuple.GenJets.rename = cms.vstring('ak => AK')


	# add kt6PFJets, needed for the PileupDensity
	from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
	process.kt6PFJets = kt4PFJets.clone( rParam = 0.6, doRhoFastjet = True )
	process.kt6PFJets.Rho_EtaMax = cms.double(2.5)

	process.p *= (
		process.makePFJets *
		process.makePFJetsCHS *
		process.kt6PFJets *
	#	process.makeQGTagging *
		process.makeBTagging *
		process.makePUJetID
	)

	## ------------------------------------------------------------------------
	## MET
	# MET correction ----------------------------------------------------------
	process.load('JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi')
	process.p *= (
		process.type0PFMEtCorrection
	)
	#TODO check type 0 corrections
	process.kappaTuple.active += cms.vstring('MET')					   ## produce/save KappaPFMET
	process.kappaTuple.MET.whitelist = cms.vstring('pfChMet', '_pfMet_')
	#process.kappaTuple.MET.rename = cms.vstring('pfChMet => PFMETCHS', 'pfMet => PFMET')

	# MET correction ----------------------------------------------------------
	process.load("JetMETCorrections.Type1MET.pfMETCorrections_cff")
	process.pfchsMETcorr.src = cms.InputTag('goodOfflinePrimaryVertices')
	# Type-0
	process.pfMETCHS = process.pfType1CorrectedMet.clone(
		applyType1Corrections = cms.bool(False),
		applyType0Corrections = cms.bool(True)
	)
	# MET Path
	process.p *= (
		process.producePFMETCorrections * process.pfMETCHS
	)
	process.kappaTuple.MET.whitelist += cms.vstring("pfMETCHS")





	## ------------------------------------------------------------------------
	## And let it run
	process.p *= (
		process.kappaOut
	)

	print process.p

	return process
Ejemplo n.º 3
0
def getBaseConfig(
		globaltag,
		testfile,
		maxevents,
		nickname,
		outputfilename,
		kappaverbosity,
		channel='mm'
	):
	from Kappa.Skimming.KSkimming_template_cfg import process
	process.source.fileNames	  = testfile
	process.maxEvents.input		  = maxevents				## number of events to be processed (-1 = all in file)
	process.kappaTuple.outputFile = outputfilename			## name of output file
	process.kappaTuple.verbose	= cms.int32(kappaverbosity)				## verbosity level
	process.kappaTuple.profile	= cms.bool(False)
	if not globaltag.lower() == 'auto' :
		process.GlobalTag.globaltag = globaltag
	data = datasetsHelper.isData(nickname)
	centerOfMassEnergy = datasetsHelper.getCenterOfMassEnergy(nickname)
	process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )

	# TODO is there a better way to do this?
	cmssw_version = os.environ["CMSSW_RELEASE_BASE"].split('/')[-1]
	cmssw_version_number = cmssw_version.split("CMSSW_")[1]

	## some infos
	print "\n--------CONFIGURATION----------"
	print "input:          ", testfile
	print "nickname:       ", nickname
	print "global tag:     ", process.GlobalTag.globaltag
	print "max events:     ", maxevents
	print "output filename:", outputfilename
	print "cmssw version:  ", cmssw_version
	print "channel:        ", channel
	print "-------------------------------\n"

	process.p = cms.Path ( )
	## ------------------------------------------------------------------------
	# Configure Metadata describing the file
	process.kappaTuple.active = cms.vstring('TreeInfo')
	process.kappaTuple.TreeInfo.parameters = cms.PSet(
		dataset						= cms.string(datasetsHelper.getDatasetName(nickname)),
		generator					= cms.string(datasetsHelper.getGenerator(nickname)),
		productionProcess			= cms.string(datasetsHelper.getProcess(nickname)),
		globalTag					= cms.string(globaltag),
		prodCampaignGlobalTag	= cms.string(datasetsHelper.getProductionCampaignGlobalTag(nickname, centerOfMassEnergy)),
		runPeriod					= cms.string(datasetsHelper.getRunPeriod(nickname)),
		jetMultiplicity			= cms.int32(datasetsHelper.getJetMultiplicity(nickname)),
		centerOfMassEnergy		= cms.int32(centerOfMassEnergy),
		puScenario					= cms.string(datasetsHelper.getPuScenario(nickname, centerOfMassEnergy)),
		isData						= cms.bool(data)
		)

	## ------------------------------------------------------------------------
	# General configuration

	process.kappaTuple.active += cms.vstring('VertexSummary')	## save VertexSummary,
	process.kappaTuple.VertexSummary.whitelist = cms.vstring('goodOfflinePrimaryVertices')
	#process.kappaTuple.active += cms.vstring('BeamSpot')		## save Beamspot,
	#process.kappaTuple.active += cms.vstring('TriggerObjects')

	if data:
		process.kappaTuple.active+= cms.vstring('DataInfo')		## produce Metadata for data,
	else:
		process.kappaTuple.active+= cms.vstring('GenInfo')		## produce Metadata for MC,
		process.kappaTuple.active+= cms.vstring('GenParticles')

	if channel == 'mm':
		process.kappaTuple.Info.hltWhitelist = cms.vstring(			## HLT selection
			# can be tested at http://regexpal.com
			# matches 'HLT_Mu17_Mu8_v7' etc.
			'^HLT_(Double)?Mu([0-9]+)_(Double)?Mu([0-9]+)(_v[[:digit:]]+)?$',
			# matches 'HLT_DoubleMu7_v8' etc.
			'^HLT_(Double)?Mu([0-9]+)(_v[[:digit:]]+)?$',
			)



	## ------------------------------------------------------------------------
	# Configure PFCandidates and offline PV
	# PFCandidates ------------------------------------------------------------
	#
	process.load('Kappa.Skimming.KPFCandidates_cff')
	if cmssw_version_number.startswith("7"):
		# Modifications for new particleFlow Pointers
		#process.pfPileUp.PFCandidates = cms.InputTag('particleFlowPtrs')
		#process.pfPileUpIso.PFCandidates = cms.InputTag('particleFlowPtrs')
		#process.pfNoPileUp.bottomCollection = cms.InputTag('particleFlowPtrs')
		#process.pfNoPileUpIso.bottomCollection = cms.InputTag('particleFlowPtrs')
		process.pfJetTracksAssociatorAtVertex.jets= cms.InputTag('ak5PFJets')


	#process.p *= (process.goodOfflinePrimaryVertices * process.pfPileUp * process.pfNoPileUp)
	process.p *= (process.goodOfflinePrimaryVertices * process.pfPileUp * process.pfNoPileUp * process.makePFBRECO * process.makeKappaPFCandidates)

	## ------------------------------------------------------------------------
	if channel == 'mm':
		# Configure Muons
		process.load('Kappa.Skimming.KMuons_cff')
		process.kappaTuple.active += cms.vstring('Muons')					## produce/save KappaMuons
		process.kappaTuple.Muons.minPt = cms.double(8.0)

		process.goodMuons = cms.EDFilter('CandViewSelector',
			src = cms.InputTag('muons'),
			cut = cms.string("pt > 15.0 & abs(eta) < 8.0"),# & isGlobalMuon()"),
		)
		process.twoGoodMuons = cms.EDFilter('CandViewCountFilter',
			src = cms.InputTag('goodMuons'),
			minNumber = cms.uint32(2),
		)
		process.p *= (process.goodMuons * process.twoGoodMuons * process.makeKappaMuons)

		## for muon iso
		# https://github.com/ajgilbert/ICHiggsTauTau/blob/master/test/higgstautau_new_cfg.py#L430-L460
		process.load('CommonTools.ParticleFlow.Isolation.pfMuonIsolation_cff')
		process.muPFIsoValueCharged04PFIso = process.muPFIsoValueCharged04.clone()
		process.muPFIsoValueChargedAll04PFIso = process.muPFIsoValueChargedAll04.clone()
		process.muPFIsoValueGamma04PFIso = process.muPFIsoValueGamma04.clone()
		process.muPFIsoValueNeutral04PFIso = process.muPFIsoValueNeutral04.clone()
		process.muPFIsoValuePU04PFIso = process.muPFIsoValuePU04.clone()

		process.muonPFIsolationValuesSequence = cms.Sequence(
			process.muPFIsoValueCharged04PFIso+
			process.muPFIsoValueChargedAll04PFIso+
			process.muPFIsoValueGamma04PFIso+
			process.muPFIsoValueNeutral04PFIso+
			process.muPFIsoValuePU04PFIso
		)
		process.muPFIsoDepositCharged.src = cms.InputTag('muons')
		process.muPFIsoDepositChargedAll.src = cms.InputTag('muons')
		process.muPFIsoDepositNeutral.src = cms.InputTag('muons')
		process.muPFIsoDepositGamma.src = cms.InputTag('muons')
		process.muPFIsoDepositPU.src = cms.InputTag('muons')

	## ------------------------------------------------------------------------
	## KappaJets
	process.load('Kappa.Skimming.KJets{0}_cff'.format('_run2' if cmssw_version_number.startswith("7") else ''))
	process.kappaTuple.active += cms.vstring('Jets', 'PileupDensity')
	process.kappaTuple.Jets = cms.PSet(
		process.kappaNoCut,
		process.kappaNoRegEx,
		taggers = cms.vstring(
	#		'QGlikelihood',
	#		'QGmlp',
			'TrackCountingHighEffBJetTags',
			'TrackCountingHighPurBJetTags',
			'JetProbabilityBJetTags',
			'JetBProbabilityBJetTags',
			'SoftElectronBJetTags',
			'SoftMuonBJetTags',
			'SoftMuonByIP3dBJetTags',
			'SoftMuonByPtBJetTags',
			#'SimpleSecondaryVertexBJetTags',
			'CombinedSecondaryVertexBJetTags',
			#'CombinedSecondaryVertexMVABJetTags',
			'puJetIDFullDiscriminant',
			'puJetIDFullLoose',
			'puJetIDFullMedium',
			'puJetIDFullTight',
			#'puJetIDCutbasedDiscriminant',
			#'puJetIDCutbasedLoose',
			#'puJetIDCutbasedMedium',
			#'puJetIDCutbasedTight'
			),
		AK5PFTaggedJets = cms.PSet(
			src = cms.InputTag('ak5PFJets'),
			#QGtagger = cms.InputTag('AK5PFJetsQGTagger'),
			QGtagger = cms.InputTag(''),
			Btagger  = cms.InputTag('ak5PF'),
			PUJetID  = cms.InputTag('ak5PFPuJetMva'),
			PUJetID_full = cms.InputTag('full'),
			),
		AK5PFTaggedJetsCHS = cms.PSet(
			src = cms.InputTag('ak5PFJetsCHS'),
			#QGtagger = cms.InputTag('AK5PFJetsCHSQGTagger'),
			QGtagger = cms.InputTag(''),
			Btagger  = cms.InputTag('ak5PFCHS'),
			PUJetID  = cms.InputTag('ak5PFCHSPuJetMva'),
			PUJetID_full = cms.InputTag('full'),
			),
		)
	process.kappaTuple.Jets.minPt = cms.double(5.0)

	if not data:
		process.kappaTuple.active += cms.vstring('GenJets')
		process.kappaTuple.GenJets.whitelist = cms.vstring('ak5GenJets')
		process.kappaTuple.GenJets.rename = cms.vstring('ak => AK')


	# add kt6PFJets, needed for the PileupDensity
	from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
	process.kt6PFJets = kt4PFJets.clone( rParam = 0.6, doRhoFastjet = True )
	process.kt6PFJets.Rho_EtaMax = cms.double(2.5)

	process.p *= (
		process.makePFJets *
		process.makePFJetsCHS *
		process.kt6PFJets *
	#	process.makeQGTagging *
		process.makeBTagging *
		process.makePUJetID
	)

	## ------------------------------------------------------------------------
	## MET
	# MET correction ----------------------------------------------------------
	process.load('JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi')
	process.p *= (
		process.type0PFMEtCorrection
	)
	#TODO check type 0 corrections
	process.kappaTuple.active += cms.vstring('MET')					   ## produce/save KappaPFMET
	process.kappaTuple.MET.whitelist = cms.vstring('pfChMet', '_pfMet_')

	if cmssw_version_number.startswith("5"):
		# MET correction ----------------------------------------------------------
		process.load("JetMETCorrections.Type1MET.pfMETCorrections_cff")
		process.pfchsMETcorr.src = cms.InputTag('goodOfflinePrimaryVertices')
		# Type-0
		process.pfMETCHS = process.pfType1CorrectedMet.clone(
			applyType1Corrections = cms.bool(False),
			applyType0Corrections = cms.bool(True)
		)
		# MET Path
		process.p *= (
			process.producePFMETCorrections * process.pfMETCHS
		)
		process.kappaTuple.MET.whitelist += cms.vstring("pfMETCHS")

	## ------------------------------------------------------------------------
	## And let it run
	process.p *= (
		process.kappaOut
	)

	return process
Ejemplo n.º 4
0
def getBaseConfig(globaltag= 'START53_V15A::All', testfile=cms.untracked.vstring(""), maxevents=100, nickname = 'SM_VBFHToTauTau_M_90_powheg_pythia_8TeV', kappaTag = 'Kappa_1_0_0'):
	print "getBaseConfig", globaltag, testfile, maxevents, nickname, kappaTag
	from Kappa.Skimming.KSkimming_template_cfg import process
	process.source.fileNames      = testfile
	process.maxEvents.input	      = maxevents				## number of events to be processed (-1 = all in file)
	process.kappaTuple.outputFile = 'kappaTuple.root'			## name of output file
	process.kappaTuple.verbose    = cms.int32(0)				## verbosity level
	if not globaltag.lower() == 'auto' :
		process.GlobalTag.globaltag   = globaltag
		print "GT (overwritten):", process.GlobalTag.globaltag
	data = datasetsHelper.isData(nickname)
	centerOfMassEnergy = datasetsHelper.getCenterOfMassEnergy(nickname)
	isEmbedded = datasetsHelper.getIsEmbedded(nickname)
	process.p = cms.Path ( )
	## ------------------------------------------------------------------------
	# Configure Metadata describing the file
	process.kappaTuple.active										= cms.vstring('TreeInfo')
	process.kappaTuple.TreeInfo.parameters = cms.PSet(
		dataset						= cms.string(datasetsHelper.getDatasetName(nickname)),
		generator					= cms.string(datasetsHelper.getGenerator(nickname)),
		productionProcess			= cms.string(datasetsHelper.getProcess(nickname)),
		globalTag					= cms.string(globaltag),
		prodCampaignGlobalTag	= cms.string(datasetsHelper.getProductionCampaignGlobalTag(nickname, centerOfMassEnergy)),
		runPeriod					= cms.string(datasetsHelper.getRunPeriod(nickname)),
		kappaTag						= cms.string(kappaTag),
		isEmbedded					= cms.bool(isEmbedded),
		jetMultiplicity			= cms.int32(datasetsHelper.getJetMultiplicity(nickname)),
		centerOfMassEnergy		= cms.int32(centerOfMassEnergy),
		puScenario					= cms.string(datasetsHelper.getPuScenario(nickname, centerOfMassEnergy)),
		isData						= cms.bool(data)
		)


	## ------------------------------------------------------------------------
	# General configuration
	process.kappaTuple.active += cms.vstring('VertexSummary')	## save VertexSummary,
	process.kappaTuple.active += cms.vstring('BeamSpot')		## save Beamspot,
	process.kappaTuple.active += cms.vstring('TriggerObjects')

	if not isEmbedded:
		if data:
			process.kappaTuple.active+= cms.vstring('DataMetadata')		## produce Metadata for data,
		else:
			process.kappaTuple.active+= cms.vstring('GenMetadata')		## produce Metadata for MC,
			process.kappaTuple.active+= cms.vstring('GenParticles')		## save GenParticles,
			process.kappaTuple.active+= cms.vstring('GenTaus')				## save GenParticles,

	process.kappaTuple.Metadata.hltWhitelist = cms.vstring(			## HLT selection
		# https://github.com/cms-analysis/HiggsAnalysis-KITHiggsToTauTau/blob/master/data/triggerTables-2011-2012.txt
		# https://twiki.cern.ch/twiki/bin/viewauth/CMS/HiggsToTauTauWorkingSummer2013
		# can be tested at http://regexpal.com
		# e
		"^HLT_Ele[0-9]+_CaloIdVT(_CaloIsoT)?_TrkIdT(_TrkIsoT)?_v[0-9]+$",
		"^HLT_Ele[0-9]+_WP[0-9]+_v[0-9]+$",
		# m
		"^HLT_(Iso)?Mu[0-9]+(_eta2p1)?_v[0-9]+$",
		# ee
		"^HLT_Ele[0-9]+_CaloId(L|T)(_TrkIdVL)?_CaloIsoVL(_TrkIdVL)?(_TrkIsoVL)?" +
			"_Ele[0-9]+_CaloId(L|T)(_TrkIdVL)?_CaloIsoVL(_TrkIdVL)?(_TrkIsoVL)?_v[0-9]+$",
		"^HLT_Ele[0-9]+_Ele[0-9]+_CaloId(L|T)_CaloIsoVL(_TrkIdVL_TrkIsoVL)?_v[0-9]+$",
		# mm
		"^HLT_(Double)?Mu[0-9]+(_(Mu|Jet)[0-9]+)?_v[0-9]+$",
		# em
		"^HLT_Mu[0-9]+_(Ele|Photon)[0-9]+_CaloId(L|T|VT)(_CaloIsoVL|_IsoT)?(_TrkIdVL_TrkIsoVL)?_v[0-9]+$",
		# et
		"^HLT_Ele[0-9]+_CaloIdVT(_Calo(IsoRho|Iso)T)?_TrkIdT(_TrkIsoT)?_(Loose|Medium|Tight)IsoPFTau[0-9]+_v[0-9]+$",
		"^HLT_Ele[0-9]+_eta2p1_WP[0-9]+(Rho|NoIso)_LooseIsoPFTau[0-9]+_v[0-9]+$",
		# mt
		"^HLT_(Iso)?Mu[0-9]+(_eta2p1)?_(Loose|Medium|Tight)IsoPFTau[0-9]+(_Trk[0-9]_eta2p1)?_v[0-9]+$",
		# tt
		"^HLT_Double(Medium)?IsoPFTau[0-9]+_Trk(1|5)_eta2p1_(Jet[0-9]+|Prong[0-9])?_v[0-9]+$",
		"^HLT_Double(Medium)?IsoPFTau[0-9]+_Trk(1|5)(_eta2p1)?_v[0-9]+$",
		# specials (possible generalization: Mu15, L1ETM20, Photon20, Ele8)
		"^HLT_Ele[0-9]+_CaloId(L|T|VT)_CaloIso(VL|T|VT)(_TrkIdT)?(_TrkIsoVT)?_(SC|Ele)[0-9](_Mass[0-9]+)?_v[0-9]+$",
		"^HLT_Ele8_v[0-9]+$",
		"^HLT_IsoMu15(_eta2p1)?_L1ETM20_v[0-9]+$",
		"^HLT_Photon20_CaloIdVT_IsoT_Ele8_CaloIdL_CaloIsoVL_v[0-9]+$",
		# specials for tag and probe and em fakerate studies could be added if enough bits are ensured
		#"^HLT_Ele[0-9]+_CaloId(L|T|VT)_CaloIso(VL|T|VT)(_TrkIdT_TrkIso(T|VT))?_(SC|Ele)[0-9]+(_Mass[0-9]+)?_v[0-9]+$",
		#"^HLT_Mu[0-9]+_Photon[0-9]+_CaloIdVT_IsoT_v[0-9]+$",
		#"^HLT_Ele[0-9]+_CaloId(L|T)(_TrkIdVL)?_CaloIsoVL(_TrkIdVL_TrkIsoVL)?(_TrkIsoVL)?(_Jet[0-9]+|)?_v[0-9]+$",
		)

	process.kappaTuple.Metadata.hltBlacklist = cms.vstring(
		"HLT_Mu13_Mu8", # v21 gives errors for the trigger objects
		)

	process.kappaTuple.Metadata.hltFailToleranceList = cms.vstring(
		"hltDoubleL2Tau25eta2p1",
		"hltDoubleL2Tau30eta2p1",
		"hltDoubleL2Tau35eta2p1",
		"hltL2Tau25eta2p1",
		"hltL2Tau35eta2p1",
		"hltL2fL1sMu16Eta2p1L1f0L2Filtered16Q",
		"hltL1sL1DoubleEG137", # problematic in HLT_Mu17_Mu8_v21
		"hltL1sL1Mu3p5EG12ORL1MuOpenEG12", # problematic in HLT_Ele22_eta2p1_WP90Rho_LooseIsoPFTau20_v7
		"hltL3fL1sMu16Eta2p1L1f0L2f16QL3Filtered40Q", # problematic in HLT_Ele22_eta2p1_WP90Rho_LooseIsoPFTau20_v7
		"hltL2fL1sMu16L1f0L2Filtered16Q", # problematic in HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v7
		"hltL1sL1SingleMu7", # problematic in HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_Jet30_v5
		"hltL1Mu3p5EG12L2Filtered12", # problematic in HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_Jet30_v5
		"hltTripleL2Jets30eta3", # problematic in HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_v4
		"hltDiMuonGlb17Glb8DzFiltered0p2", # problematic in HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v18
		"hltL1sL1DoubleMu10MuOpenORDoubleMu103p5", # 
		)

	## ------------------------------------------------------------------------
	# Configure PFCandidates and offline PV
	process.load("Kappa.Skimming.KPFCandidates_cff")
	process.kappaTuple.active += cms.vstring('PFCandidates')		## save PFCandidates for deltaBeta corrected 
	process.kappaTuple.PFCandidates.whitelist = cms.vstring(                ## isolation used for electrons and muons.
##		"pfNoPileUpChargedHadrons",    ## switch to pfAllChargedParticles
		"pfAllChargedParticles",       ## same as pfNoPileUpChargedHadrons +pf_electrons + pf_muons
		"pfNoPileUpNeutralHadrons",
		"pfNoPileUpPhotons",
		"pfPileUpChargedHadrons",
		)

	process.p *= ( process.makePFBRECO * process.makePFCandidatesForDeltaBeta )

	## ------------------------------------------------------------------------
	# Configure Muons
	process.load("Kappa.Skimming.KMuons_cff")
	process.kappaTuple.active += cms.vstring('Muons')	                ## produce/save KappaMuons
	process.p *= process.makeKappaMuons

	## ------------------------------------------------------------------------
	# Configure Electrons
	process.load("Kappa.Skimming.KElectrons_cff")
	process.kappaTuple.active += cms.vstring('Electrons')	                ## produce/save KappaElectrons,
	process.p *= process.makeKappaElectrons

	## ------------------------------------------------------------------------
	# Configure Taus
	process.load("Kappa.Skimming.KTaus_cff")
	process.kappaTuple.active += cms.vstring('Taus')	                ## produce/save KappaTaus
	process.kappaTuple.PFTaus.hpsPFTaus.binaryDiscrWhitelist = cms.vstring(
		"hpsPFTauDiscriminationByDecayModeFinding",
		"hpsPFTauDiscriminationByDecayModeFindingOldDMs",
		"hpsPFTauDiscriminationByDecayModeFindingNewDMs",
		#against electrons
		"hpsPFTauDiscriminationByLooseElectronRejection",
		"hpsPFTauDiscriminationByMediumElectronRejection",
		"hpsPFTauDiscriminationByTightElectronRejection",
		"hpsPFTauDiscriminationByMVA5VLooseElectronRejection",
		"hpsPFTauDiscriminationByMVA5LooseElectronRejection",
		"hpsPFTauDiscriminationByMVA5MediumElectronRejection",
		"hpsPFTauDiscriminationByMVA5TightElectronRejection",
		"hpsPFTauDiscriminationByMVA5VTightElectronRejection",
		#against muons
		"hpsPFTauDiscriminationByMVALooseMuonRejection",
		"hpsPFTauDiscriminationByMVAMediumMuonRejection",
		"hpsPFTauDiscriminationByMVATightMuonRejection",
		"hpsPFTauDiscriminationByLooseMuonRejection3",
		"hpsPFTauDiscriminationByTightMuonRejection3",
		#isolation
		"hpsPFTauDiscriminationByVLooseIsolation",
		
		"hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr",
		"hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr",
		"hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr",
		"hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr",
		
		"hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits",
		"hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits"
		"hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits",
		
		"hpsPFTauDiscriminationByVLooseIsolationMVA3oldDMwoLT",
		"hpsPFTauDiscriminationByLooseIsolationMVA3oldDMwoLT",
		"hpsPFTauDiscriminationByMediumIsolationMVA3oldDMwoLT",
		"hpsPFTauDiscriminationByTightIsolationMVA3oldDMwoLT",
		"hpsPFTauDiscriminationByVTightIsolationMVA3oldDMwoLT",
		"hpsPFTauDiscriminationByVVTightIsolationMVA3oldDMwoLT",
		
		"hpsPFTauDiscriminationByVLooseIsolationMVA3oldDMwLT",
		"hpsPFTauDiscriminationByLooseIsolationMVA3oldDMwLT",
		"hpsPFTauDiscriminationByMediumIsolationMVA3oldDMwLT",
		"hpsPFTauDiscriminationByTightIsolationMVA3oldDMwLT",
		"hpsPFTauDiscriminationByVTightIsolationMVA3oldDMwLT",
		"hpsPFTauDiscriminationByVVTightIsolationMVA3oldDMwLT",
		
		"hpsPFTauDiscriminationByVLooseIsolationMVA3newDMwoLT",
		"hpsPFTauDiscriminationByLooseIsolationMVA3newDMwoLT",
		"hpsPFTauDiscriminationByMediumIsolationMVA3newDMwoLT",
		"hpsPFTauDiscriminationByTightIsolationMVA3newDMwoLT",
		"hpsPFTauDiscriminationByVTightIsolationMVA3newDMwoLT",
		"hpsPFTauDiscriminationByVVTightIsolationMVA3newDMwoLT",
		
		"hpsPFTauDiscriminationByVLooseIsolationMVA3newDMwLT",
		"hpsPFTauDiscriminationByLooseIsolationMVA3newDMwLT",
		"hpsPFTauDiscriminationByMediumIsolationMVA3newDMwLT",
		"hpsPFTauDiscriminationByTightIsolationMVA3newDMwLT",
		"hpsPFTauDiscriminationByVTightIsolationMVA3newDMwLT",
		"hpsPFTauDiscriminationByVVTightIsolationMVA3newDMwLT",

		#old (and not in new)
		#"hpsPFTauDiscriminationByMVA3LooseElectronRejection", #not working
		#"hpsPFTauDiscriminationByMVA3MediumElectronRejection", #not working
		
		"hpsPFTauDiscriminationByLooseMuonRejection",
		"hpsPFTauDiscriminationByTightMuonRejection",
		)
	process.p *= process.makeKappaTaus

	## ------------------------------------------------------------------------
	## KappaPFTaggedJets
	process.load("Kappa.Skimming.KPFTaggedJets_cff")
	process.kappaTuple.active += cms.vstring('Jets')           ## produce KappaPFTaggedJets
	process.kappaTuple.PFTaggedJets = cms.PSet(
		process.kappaNoCut,
		process.kappaNoRegEx,
		taggers = cms.vstring(
			"QGlikelihood",
			"QGmlp",
			"TrackCountingHighEffBJetTags",
			"TrackCountingHighPurBJetTags", 
			"JetProbabilityBJetTags",
			"JetBProbabilityBJetTags", 
			"SoftElectronBJetTags",
			"SoftMuonBJetTags",
			"SoftMuonByIP3dBJetTags",
			"SoftMuonByPtBJetTags",
			"SimpleSecondaryVertexBJetTags", 
			"CombinedSecondaryVertexBJetTags",
			"CombinedSecondaryVertexMVABJetTags",
			"puJetIDFullLoose",
			"puJetIDFullMedium",
			"puJetIDFullTight",
			"puJetIDCutbasedLoose",
			"puJetIDCutbasedMedium",
			"puJetIDCutbasedTight" 
			),
		AK5PFTaggedJets = cms.PSet(
			src = cms.InputTag("ak5PFJets"),
			QGtagger = cms.InputTag("AK5PFJetsQGTagger"),
			Btagger  = cms.InputTag("ak5PF"),
			PUJetID  = cms.InputTag("ak5PFPuJetMva"),
			PUJetID_full = cms.InputTag("full"),
			),
		AK5PFTaggedJetsCHS = cms.PSet(
			src = cms.InputTag("ak5PFJetsCHS"),
			QGtagger = cms.InputTag("AK5PFJetsCHSQGTagger"),
			Btagger  = cms.InputTag("ak5PFCHS"),
			PUJetID  = cms.InputTag("ak5PFCHSPuJetMva"),
			PUJetID_full = cms.InputTag("full"),
			),
		)
	process.kappaTuple.active += cms.vstring('JetArea')

	## ------------------------------------------------------------------------
	# Special settings for embedded samples
	# https://twiki.cern.ch/twiki/bin/viewauth/CMS/MuonTauReplacementWithPFlow
	if isEmbedded:
		process.load('RecoBTag/Configuration/RecoBTag_cff')
		process.load('RecoJets/JetAssociationProducers/ak5JTA_cff')
		process.ak5PFJetNewTracksAssociatorAtVertex.tracks = "tmfTracks"
		process.ak5PFCHSNewJetTracksAssociatorAtVertex.tracks = "tmfTracks"
		process.p *= process.btagging
		# disable overrideHLTCheck for embedded samples, since it triggers an Kappa error
		process.kappaTuple.Metadata.overrideHLTCheck = cms.untracked.bool(True)
		process.kappaTuple.active+= cms.vstring('DataMetadata')
		process.kappaTuple.active+= cms.vstring('GenParticles')		## save GenParticles,
		process.kappaTuple.active+= cms.vstring('GenTaus')				## save GenParticles,
		process.kappaTuple.GenParticles.genParticles.src = cms.InputTag("genParticles","","EmbeddedRECO")
		process.kappaTuple.Metadata.isEmbedded = cms.bool(True)

	# Let Jets run
	process.p *= (
		process.makeKappaTaus *
		process.makePFJets *
		process.makePFJetsCHS *
		process.makeQGTagging *
		process.makeBTagging *
		process.makePUJetID
	)

	## ------------------------------------------------------------------------
	## MET
	process.load("Kappa.Skimming.KMET_mssm_cff")
	process.kappaTuple.active += cms.vstring('BasicMET')                         ## produce/save KappaMET
	process.kappaTuple.active += cms.vstring('MET')                       ## produce/save KappaPFMET
	process.p *= process.makeKappaMET

	## ------------------------------------------------------------------------
	## And let it run
	process.p *= (
		process.kappaOut
	)
	## ------------------------------------------------------------------------
	## declare edm OutputModule (expects a path 'p'), uncommented if wanted

	#process.edmOut = cms.OutputModule(
	#	"PoolOutputModule",
	#	fileName = cms.untracked.string('dump.root'),				## name of output file
	#	SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('p') ),	## save only events passing the full path
	#	outputCommands = cms.untracked.vstring('drop *', 'keep *_*_*_KAPPA')	## save each edm object that has been produced by process KAPPA
	#	)
	#process.ep = cms.EndPath(process.edmOut)

	return process
Ejemplo n.º 5
0
centerOfMassEnergy = 8
nickname = "SM_VBFHToTauTau_M_90_powheg_pythia_8TeV"
kappaTag = "Kappa_1_0_0"
globaltag = ""



process.kappaTuple.active										= cms.vstring('TreeInfo')
process.kappaTuple.TreeInfo.parameters = cms.PSet(
															dataset						= cms.string(datasetsHelper.getDatasetName(nickname)),
															generator					= cms.string(datasetsHelper.getGenerator(nickname)),
															productionProcess			= cms.string(datasetsHelper.getProcess(nickname)),
															globalTag					= cms.string(globaltag),
															prodCampaignGlobalTag	= cms.string(datasetsHelper.getProductionCampaignGlobalTag(nickname, centerOfMassEnergy)),
															runPeriod					= cms.string(datasetsHelper.getRunPeriod(nickname)),
															kappaTag						= cms.string(kappaTag),
															isEmbedded					= cms.bool(datasetsHelper.getIsEmbedded(nickname)),
															jetMultiplicity			= cms.int32(datasetsHelper.getJetMultiplicity(nickname)),
															centerOfMassEnergy		= cms.int32(centerOfMassEnergy),
															puScenario					= cms.string(datasetsHelper.getPuScenario(nickname, centerOfMassEnergy))
															)
process.kappaTuple.active+= cms.vstring('GenMetadata')		## produce Metadata for MC,
process.kappaTuple.active+= cms.vstring('GenParticles')		## save GenParticles,
process.edmOut = cms.OutputModule("PoolOutputModule",
										fileName = cms.untracked.string('patTuple_muons.root'),						## name of output file 
										SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('p') ),	## save only events passing the full path
										outputCommands = cms.untracked.vstring('drop *', 'keep *_*_*_KAPPA')		## save each edm object that has been produced by process KAPPA 
										)
process.kappaOut+=process.edmOut