Exemplo n.º 1
0
import FWCore.ParameterSet.Config as cms

from FWCore.MessageService.MessageLogger_cfi import *
from Configuration.StandardSequences.FrontierConditions_GlobalTag_cff import *
from Configuration.StandardSequences.MagneticField_cff import *
from Configuration.Geometry.GeometryIdeal_cff import *
from TrackingTools.TransientTrack.TransientTrackBuilder_cfi import *

GlobalTag.globaltag = cms.string('GR_R_52_V9::All')

from KoSMP.CommonTools.countingSequences_cfi import *
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
myJetId = pfJetIDSelector.clone()

from KoSMP.WAnalyzer.wLeptonSelector_cfi import *
from KoSMP.WAnalyzer.triggerFilterByRun_cfi import *
from KoSMP.WAnalyzer.wHLTfilter_cff import *
from KoSMP.CommonTools.PileUpWeight_cff import *
from KoSMP.CommonTools.JetEnergyScale_cfi import *

VertexFilter = cms.EDFilter('VertexFilter',
    vertexLabel =  cms.InputTag('offlinePrimaryVertices'),
    min = cms.untracked.int32(1),
    max = cms.untracked.int32(999),
)

GenZmassFilter = cms.EDFilter('GenZmassFilter',
    genParticlesLabel = cms.InputTag('genParticles'),
    applyFilter = cms.untracked.bool( False ),
    decayMode = cms.untracked.vint32(11, 13, 15),
    min = cms.untracked.int32(0),
def selectObjects(process, cms):
    print '=' * 60
    print "Setting up selected objects"
    print '=' * 60
    ###############################
    #### Selections Setup #########
    ###############################

    ### AK5 Jets
    #calo jets
    process.selectedPatJets.cut = cms.string("pt > 20 & abs(eta) < 2.5")
    #PF jets
    process.selectedPatJetsPFlow.cut = cms.string("pt > 20 & abs(eta) < 2.5")
    process.patJetsPFlow.addTagInfos = True
    process.patJetsPFlow.tagInfoSources = cms.VInputTag(
        cms.InputTag("secondaryVertexTagInfosAODPFlow"))
    process.patJetsPFlow.userData.userFunctions = cms.vstring(
        "? hasTagInfo('secondaryVertex') && tagInfoSecondaryVertex('secondaryVertex').nVertices() > 0 ? "
        "tagInfoSecondaryVertex('secondaryVertex').secondaryVertex(0).p4().mass() : 0"
    )
    process.patJetsPFlow.userData.userFunctionLabels = cms.vstring(
        'secvtxMass')

    # electrons
    process.selectedPatElectrons.cut = cms.string('pt > 10.0 & abs(eta) < 2.5')
    process.patElectrons.embedTrack = cms.bool(True)
    process.selectedPatElectronsPFlow.cut = cms.string(
        'pt > 10.0 & abs(eta) < 2.5')
    process.patElectronsPFlow.embedTrack = cms.bool(True)
    process.selectedPatElectronsLoosePFlow.cut = cms.string(
        'pt > 10.0 & abs(eta) < 2.5')
    process.patElectronsLoosePFlow.embedTrack = cms.bool(True)
    # muons
    process.selectedPatMuons.cut = cms.string('pt > 10.0 & abs(eta) < 2.5')
    process.patMuons.embedTrack = cms.bool(True)
    process.selectedPatMuonsPFlow.cut = cms.string(
        "pt > 10.0 & abs(eta) < 2.5")
    process.patMuonsPFlow.embedTrack = cms.bool(True)
    process.selectedPatMuonsLoosePFlow.cut = cms.string(
        "pt > 10.0 & abs(eta) < 2.5")
    process.patMuonsLoosePFlow.embedTrack = cms.bool(True)
    # taus
    process.selectedPatTausPFlow.cut = cms.string("pt > 10.0 & abs(eta) < 3")
    process.selectedPatTaus.cut = cms.string("pt > 10.0 & abs(eta) < 3")
    process.patTausPFlow.isoDeposits = cms.PSet()
    process.patTaus.isoDeposits = cms.PSet()
    # photons
    process.patPhotonsPFlow.isoDeposits = cms.PSet()
    process.patPhotons.isoDeposits = cms.PSet()

    # Apply jet ID to all of the jets upstream. We aren't going to screw around
    # with this, most likely. So, we don't really to waste time with it
    # at the analysis level.
    #default is version=PURE09, quality=loose ID
    #https://twiki.cern.ch/twiki/bin/view/CMS/JetID#Documentation
    from PhysicsTools.SelectorUtils.jetIDSelector_cfi import jetIDSelector
    process.goodPatJets = cms.EDFilter("JetIDSelectionFunctorFilter",
                                       filterParams=jetIDSelector.clone(),
                                       src=cms.InputTag("selectedPatJets"))

    from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
    process.goodPatJetsPFlow = cms.EDFilter(
        "PFJetIDSelectionFunctorFilter",
        filterParams=pfJetIDSelector.clone(),
        src=cms.InputTag("selectedPatJetsPFlow"))
    process.selectedPatJetsForMETtype1p2Corr.src = cms.InputTag(
        'selectedPatJetsPFlow')
    process.selectedPatJetsForMETtype2Corr.src = cms.InputTag(
        'selectedPatJetsPFlow')
Exemplo n.º 3
0
import FWCore.ParameterSet.Config as cms

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector

S8TreeMaker = cms.EDAnalyzer(
    'S8TreeMaker',

    primaryVertices = cms.string("offlinePrimaryVertices"),
    muons = cms.string("selectedPatMuonsForPtRel"),
    electrons = cms.string("selectedPatElectronsForS8"),
    jets = cms.string("selectedPatJetsAK5PF"),
    triggers = cms.string("TriggerResults::REDIGI"),

    jetSelector = pfJetIDSelector.clone(),

    isPythia = cms.bool(False),
    saveTriggers = cms.bool(False)
)
Exemplo n.º 4
0
process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")

UseCHS=''
#UseCHS='CHS'
JetCorrection          = "ak5PFL1FastL2L3"
PFJetCollection   = 'ak5PFJets'+UseCHS
PFJetCollectionCorr   = 'ak5PFJetsCorr'

process.ak5PFJetsCorr = cms.EDProducer('PFJetCorrectionProducer',
    src = cms.InputTag(PFJetCollection),
    correctors = cms.vstring(JetCorrection) # NOTE: use "ak5PFL1FastL2L3" for MC / "ak5PFL1FastL2L3Residual" for Data
    )

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
process.tightPFJetsPFlow = cms.EDFilter("PFJetIDSelectionFunctorBasicFilter",
    filterParams = pfJetIDSelector.clone(quality=cms.string("TIGHT")),
    src = cms.InputTag(PFJetCollectionCorr)
    )

process.load('RecoJets.JetProducers.PileupJetID_cfi')
process.pileupJetIdProducer.jets = PFJetCollectionCorr
#process.pileupJetIdProducer.jets = cms.InputTag('ak5PFJets')
#process.pileupJetIdProducer.jets = cms.InputTag('selectedPatJets')
#process.pileupJetIdProducer.jets = 'selectedPatJetsPFlow'
process.pileupJetIdProducer.vertexes = "goodOfflinePrimaryVertices"
process.pileupJetIdProducer.residualsTxt  = cms.FileInPath("RecoJets/JetProducers/data/mva_JetID_v1.weights.xml")
#process.pileupJetIdProducer.jets = cms.InputTag('selectedPatJets')

### ============= NoPU and MVA MET ===============###
process.load('RecoMET.METPUSubtraction.mvaPFMET_leptons_cfi')
# No PU MET
Exemplo n.º 5
0
import FWCore.ParameterSet.Config as cm

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
from Analysis.BoostedTopAnalysis.BoostedTopWTagParams_cfi import *

Type22QCDEstimationParams = cms.PSet(Type22Selection=cms.PSet(
    pfJetIDParams=cms.PSet(
        pfJetIDSelector.clone(cutsToIgnore=cms.vstring([
            "CHF",
            "NHF",
            "CEF",
            "NEF",
            "NCH",
            "nConstituents",
        ]))),
    BoostedTopWJetParameters=boostedTopWTagParams.clone(),
    jetPt0=cms.double(200),
    jetPt1=cms.double(30),
    jetEta=cms.double(2.4),
    bTagOP=cms.double(3.3),
    bTagAlgo=cms.string("trackCountingHighEffBJetTags"),
    jetSrc=cms.InputTag("goodPatJetsCA8PrunedPF")),
                                     wMassMin=cms.double(60),
                                     wMassMax=cms.double(100),
                                     topMassMin=cms.double(140),
                                     topMassMax=cms.double(230),
                                     mistagFile=cms.string("mistag.root"),
                                     Probability=cms.double(0.15),
                                     runOnData=cms.bool(True))
import FWCore.ParameterSet.Config as cms

from PhysicsTools.SelectorUtils.jetIDSelector_cfi import jetIDSelector
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector


PATElectronNtupleMaker = cms.EDFilter(
        'PATElectronNtupleMaker',

        hltTag = cms.InputTag("TriggerResults::REDIGI"),
        MuonTag = cms.InputTag("selectedPatMuons"),
        ElectronTag = cms.InputTag("selectedPatElectrons"),
        PFElectronTag = cms.InputTag("patElectronsPFlowLoose"),
        caloJetTag= cms.InputTag("selectedPatJets"),
        JPTJetTag= cms.InputTag("selectedPatJetsAK5JPT"),
        PFJetTag= cms.InputTag("selectedPatJetsAK5PF"),
        PFlowJetTag= cms.InputTag("selectedPatJetsPFlow"),
        caloMETTag= cms.InputTag("patMETs"),
        tcMETTag= cms.InputTag("patMETsTC"),
        PFMETTag= cms.InputTag("patMETsPF"),
        PFlowMETTag = cms.InputTag("patMETsPFlow"),
        
        jetIdLoose = jetIDSelector.clone(),
        pfjetIdLoose = pfJetIDSelector.clone(),
        
        ntupleFile = cms.string("NtupleMaker.root"),
        inputType = cms.string("DATA")

)
#    process.caTopPFJets.algorithm = cms.int32(2)
# else:
#    print "Error: algorithm '%s' unknown. Use one of kt, ca, antikt." % algorithm
#    raise AttributeError()
####


# prune gen particles
## AR: is it used???
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")


from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector

process.goodPatJetsAK5PF = cms.EDFilter(
    "PFJetIDSelectionFunctorFilter", filterParams=pfJetIDSelector.clone(), src=cms.InputTag("selectedPatJetsAK5PF")
)

### rerun isolation for muons and electrons
process.load("VHbbAnalysis.HbbAnalyzer.pfIsoDeltaBeta04_cff")

process.selectedPatElectrons.cut = (
    "(ecalDrivenSeed==1) &&" + "pt > 15.0 && abs(eta) < 2.5 &&" + "(isEE || isEB) && !isEBEEGap"
)

process.HbbAnalyzerNew = cms.EDProducer(
    "HbbAnalyzerNew",
    runOnMC=cms.bool(isMC),
    hltResultsTag=cms.InputTag("TriggerResults::HLT"),
    lep_ptCutForBjets=cms.double(5),
    electronNoCutsTag=cms.InputTag("pfAllElectrons"),
from RSGraviton.RSAnalyzer.basicjethistos_cff import histograms as basicjethistos
from RSGraviton.RSAnalyzer.jethistos_cff import histograms as jethistos
from RSGraviton.RSAnalyzer.METhistos_cff import histograms as METhistos

process.load("RSGraviton.RSAnalyzer.eventCounters_cfi")

##########
# Jet ID #
##########
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
# Same jet ID as in AN-2011-228
process.jetIdCut = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                filterParams = pfJetIDSelector.clone(
                                    CHF = cms.double(0.2),
                                    NHF = cms.double(0.7),
                                    CEF = cms.double(0.7),
                                    NEF = cms.double(0.7),
                                    ),
                                src = cms.InputTag("goodPatJetsPFlow"),
                                filter = cms.bool(True)
                                )

#######
# TIV #
#######
process.load("RSGraviton.RSAnalyzer.trackerIndirectVeto_cfi")
process.TIVCut.filter = False
process.TIVStarCut = process.TIVCut.clone(excludeTracks = cms.bool(True),tracksToExclude = cms.InputTag("leadingMuon"))

#########
# Muons #
import FWCore.ParameterSet.Config as cms

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector

Type11QCDEstimationParams = cms.PSet( 
  Type11Selection = cms.PSet(
      pfJetIDParams = cms.PSet(
            pfJetIDSelector.clone(cutsToIgnore=cms.vstring([
                "CHF" ,
                "NHF" ,
                "CEF" ,
                "NEF" ,
                "NCH" ,
                "nConstituents",
                ])) ),
    caTopJetPtMin = cms.double(350),
    caTopJetEtaCut = cms.double(2.4),
    patJetCollectionInputTag = cms.InputTag( "goodPatJetsCA8PF" ),
    caTopJetCollectionInputTag = cms.InputTag( "goodPatJetsCATopTagPF" )
  ),

  caTopJetMassMin = cms.double(140),
  caTopJetMassMax = cms.double(250),
  caTopMinMassMin = cms.double(50),
  caTopMistagFileName = cms.string("top_mistag_rate_v8.root")
)

    process.caTopPFJets.algorithm = cms.int32(2)
else:
    print "Error: algorithm '%s' unknown. Use one of kt, ca, antikt." % algorithm
    raise AttributeError()
####



# prune gen particles
## AR: is it used???
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")


from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector 
process.goodPatJetsAK5PF = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                           filterParams = pfJetIDSelector.clone(), src = cms.InputTag("selectedPatJetsAK5PF") )

### rerun isolation for muons and electrons
process.load("VHbbAnalysis.HbbAnalyzer.pfIsoDeltaBeta04_cff")

process.selectedPatElectrons.cut = (
    "(ecalDrivenSeed==1) &&"                                       +
    "pt > 15.0 && abs(eta) < 2.5 &&"                               +
    "(isEE || isEB) && !isEBEEGap"                              
)

process.HbbAnalyzerNew = cms.EDProducer("HbbAnalyzerNew",
    runOnMC = cms.bool(isMC),
    hltResultsTag = cms.InputTag("TriggerResults::HLT"),
    electronTag = cms.InputTag("selectedElectronsMatched"),
#    electronTag = cms.InputTag("selectedPatElectrons"),
Exemplo n.º 11
0
def JetCollectionsPAT(process,isHEEPID):
 
  if isHEEPID:
             # Apply loose PF jet ID
             process.ak5PFGoodJets = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                                   filterParams = pfJetIDSelector.clone(),
                                                   src = cms.InputTag("selectedPatJetsPFlow"),
                                                   filter = cms.bool(True))


  else : 

       # Apply loose PileUp PF jet ID
       process.ak5PFnoPUJets = cms.EDProducer("PATPuJetIdSelector",
                                               src = cms.InputTag( "selectedPatJetsPFlow" ),
                                               idLabel = cms.string("loose"),
                                               valueMapLabel = cms.string("puJetMvaChs"))
       # Apply loose PF jet ID
       process.ak5PFGoodJets = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                             filterParams = pfJetIDSelector.clone(),
                                             src = cms.InputTag("ak5PFnoPUJets"),
                                             filter = cms.bool(True))


  ##-------- Remove electrons and muons from jet collection ----------------------
  process.ak5PFJetsClean = cms.EDProducer("PFPATJetCleaner",
                                           srcJets = cms.InputTag("ak5PFGoodJets"),
                                           module_label = cms.string(""),
                                           srcObjects = cms.VInputTag(cms.InputTag("looseElectrons"),cms.InputTag("looseMuons")),
                                           deltaRMin = cms.double(0.3))


  process.ak5PFJetsLooseIdAll = cms.EDFilter("PATJetRefSelector",
                                              src = cms.InputTag("ak5PFJetsClean"),
                                              cut = cms.string('pt > 30.0'))



  process.ak5PFJetsLooseId = cms.EDFilter("PATJetRefSelector",
                                           src = cms.InputTag("ak5PFJetsClean"),
                                           cut = cms.string('pt > 30.0 && abs(eta) < 2.4'))

  process.ak5PFJetsLooseIdVBFTag = cms.EDFilter("PATJetRefSelector",
                                                src = cms.InputTag("ak5PFJetsClean"),
                                                cut = cms.string('pt > 30.0 && abs(eta) > 2.4 && abs(eta) < 9.9'))

  ##########################################
  ## Filter to require at least two jets in the event

  process.RequireTwoJets = cms.EDFilter("PATCandViewCountFilter",
                                         minNumber = cms.uint32(2),
                                         maxNumber = cms.uint32(100),
                                         src = cms.InputTag("ak5PFJetsLooseId"),)


  ############################################
  if isHEEPID: process.PFJetPath = cms.Sequence( process.ak5PFGoodJets + process.ak5PFJetsClean + process.ak5PFJetsLooseId +  process.ak5PFJetsLooseIdAll + process.ak5PFJetsLooseIdVBFTag )

  else : process.PFJetPath = cms.Sequence( process.ak5PFnoPUJets +process.ak5PFGoodJets + process.ak5PFJetsClean + process.ak5PFJetsLooseId +  process.ak5PFJetsLooseIdAll +
                                           process.ak5PFJetsLooseIdVBFTag )

  ########################################################################
  #############  Jets in Monte Carlo  #############
  ##########################################################################


  ##################### Tag jets: Needed for MC flavor matching
  process.myPartons = cms.EDProducer("PartonSelector",
    src = cms.InputTag("genParticles"),
    withLeptons = cms.bool(False))

  process.ak5flavourByRef = cms.EDProducer("JetPartonMatcher",
    jets = cms.InputTag("selectedPatJetsPFlow"),
    coneSizeToAssociate = cms.double(0.3),
    partons = cms.InputTag("myPartons"))

  process.ak5tagJet = cms.EDProducer("JetFlavourIdentifier",
    srcByReference = cms.InputTag("ak5flavourByRef"),
    physicsDefinition = cms.bool(False))

  process.TagJetPath = cms.Sequence( process.myPartons+process.ak5flavourByRef*process.ak5tagJet) 

  process.GenJetPath = cms.Sequence( process.genParticlesForJets + process.ak5GenJets + process.genParticlesForMETAllVisible + process.genMetTrue)
Exemplo n.º 12
0
###############################################################################################################################
#                                                                                                                             #
#-------------------------------------------------------- Jet ID and JECs ----------------------------------------------------#
#                                                                                                                             #
#                                      https://twiki.cern.ch/twiki/bin/view/CMS/JECDataMC                                     #
# https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookJetEnergyCorrections?redirectedfrom=CMS.WorkBookJetEnergyCorrections #
#                                                                                                                             #
###############################################################################################################################

#Implement jet ID filter
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector

if options.runningEra == 0:
    process.goodPatJetsPFlow = cms.EDFilter(
        "PFJetIDSelectionFunctorFilter",
        filterParams=pfJetIDSelector.clone(version=cms.string('WINTER16'),
                                           quality=cms.string('TIGHTLEPVETO')),
        src=cms.InputTag("slimmedJets"),
        filter=cms.bool(True))
if options.runningEra == 1:
    process.goodPatJetsPFlow = cms.EDFilter(
        "PFJetIDSelectionFunctorFilter",
        filterParams=pfJetIDSelector.clone(version=cms.string('WINTER17'),
                                           quality=cms.string('TIGHTLEPVETO')),
        src=cms.InputTag("slimmedJets"),
        filter=cms.bool(True))

    from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD

    if options.runningOnData:
        runMetCorAndUncFromMiniAOD(
            process,
Exemplo n.º 13
0
#    process.caTopPFJets.algorithm = cms.int32(2)
#else:
#    print "Error: algorithm '%s' unknown. Use one of kt, ca, antikt." % algorithm
#    raise AttributeError()
####



# prune gen particles
## AR: is it used???
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")


from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector 
process.goodPatJetsAK5PF = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                           filterParams = pfJetIDSelector.clone(), src = cms.InputTag("selectedPatJetsAK5PF") )

### rerun isolation for muons and electrons
process.load("VHbbAnalysis.HbbAnalyzer.pfIsoDeltaBeta04_cff")

process.selectedPatElectrons.cut = (
    "(ecalDrivenSeed==1) &&"                                       +
    "pt > 5.0 && abs(eta) < 2.5 &&"                               +
    "(isEE || isEB) && !isEBEEGap"                              
)

process.HbbAnalyzerNew = cms.EDProducer("HbbAnalyzerNew",
    runOnMC = cms.bool(isMC),
    hltResultsTag = cms.InputTag("TriggerResults::HLT"),
    lep_ptCutForBjets = cms.double(5),
    electronNoCutsTag = cms.InputTag("pfAllElectrons"),
Exemplo n.º 14
0
    "PoolSource",
    fileNames=cms.untracked.vstring(
        "dcap:///pnfs/cms/WAX/11/store/user/rappocc/QCD_Pt100to250-madgraph/shyft_35x_v1/7d6b33b2c5d85d3512a9f559ea910755/multijets_1_1.root"
    ),
)
## Maximal Number of Events
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(100))

from Analysis.JetAnalysis.multijetStudies_cfi import jetStudies as inputJetStudies
from Analysis.JetAnalysis.multijetStudies_cfi import pfJetStudies as inputPFJetStudies

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector as inputPFJetIDSelector
from PhysicsTools.SelectorUtils.jetIDSelector_cfi import jetIDSelector as inputJetIDSelector

process.TFileService = cms.Service("TFileService", fileName=cms.string("multijetStudies.root"))


process.multijetAna = cms.EDAnalyzer(
    "EDMultijetAnalysis",
    pfJetIDSelector=inputPFJetIDSelector.clone(),
    jetIDSelector=inputJetIDSelector.clone(),
    jetStudies=inputJetStudies.clone(ptMin=cms.double(50.0)),
    pfJetStudies=inputPFJetStudies.clone(ptMin=cms.double(50.0)),
    plotParameters=cms.PSet(doTracks=cms.bool(False), useMC=cms.bool(False)),
)


process.p = cms.Path(process.multijetAna)

process.MessageLogger.cerr.FwkReport.reportEvery = 10000
Exemplo n.º 15
0
def addInvHiggsProcess(
        process,
        iRunOnData=True,
        iData="ParkedData",
        iHLTFilter="MET",
        iMCSignal=False,
        iFile='/store/data/Run2012C/VBF1Parked/AOD/22Jan2013-v1/20000/40F56410-D979-E211-9843-002618943849.root',
        iMaxEvent=100):

    ###--------------------------------------------------------------
    ### Load PAT, because it insists on defining the process for you
    #from PhysicsTools.PatAlgos.patTemplate_cfg import *
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Input
    process.maxEvents.input = iMaxEvent
    process.source.fileNames = [iFile]
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### GlobalTag
    if iRunOnData == True:
        process.GlobalTag.globaltag = "FT53_V21A_AN6::All"
    else:
        process.GlobalTag.globaltag = "START53_V27::All"
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Logger
    process.load("FWCore.MessageService.MessageLogger_cfi")
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport = cms.untracked.PSet(
        reportEvery=cms.untracked.int32(2000),
        limit=cms.untracked.int32(10000000))
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### L1 Trigger
    process.load('L1Trigger.Skimmer.l1Filter_cfi')
    process.l1Filter.algorithms = cms.vstring('L1_ETM40')
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### HLT Trigger(s)
    # If it's MC signal, no trigger will be applied
    if iRunOnData == False and iMCSignal == True:
        iHLTFilter = "NoTrig"

    # Load hltHighLevel
    process.load('HLTrigger.HLTfilters.hltHighLevel_cfi')
    process.hltHighLevel.TriggerResultsTag = cms.InputTag(
        "TriggerResults", "", "HLT")
    process.hltHighLevel.throw = cms.bool(
        False)  # Tolerate if triggers not available
    process.hltHighLevel.andOr = cms.bool(True)  # True = OR, False = AND
    if (iRunOnData == True and iHLTFilter.find("MET") == 0):
        process.hltHighLevel.HLTPaths = cms.vstring(
            #"HLT_DiPFJet40_PFMETnoMu65_MJJ600VBF_LeadingJets_v*",
            #"HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v*"
            "HLT_DiJet35_MJJ700_AllJets_DEta3p5_VBF_v*",
            "HLT_DiJet30_MJJ700_AllJets_DEta3p5_VBF_v*")
    elif (iHLTFilter.find("SingleMu") == 0):
        process.hltHighLevel.HLTPaths = cms.vstring("HLT_IsoMu24_eta2p1_v*",
                                                    "HLT_Mu40_eta2p1_v*")
    #elif (iHLTFilter.find("DoubleMu")==0):
    #    process.hltHighLevel.HLTPaths = cms.vstring("HLT_Mu17_Mu8_v*")
    #elif (iHLTFilter.find("SingleElectron")==0):
    #    process.hltHighLevel.HLTPaths = cms.vstring("HLT_Ele27_WP80_v*")
    #elif (iHLTFilter.find("DoubleElectron")==0):
    #    process.hltHighLevel.HLTPaths = cms.vstring("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v*")
    elif (iHLTFilter.find("NoTrig") == 0):
        process.hltHighLevel.HLTPaths = cms.vstring("*")
    else:
        process.hltHighLevel.HLTPaths = cms.vstring(
            #"HLT_DiPFJet40_PFMETnoMu65_MJJ600VBF_LeadingJets_v*",
            #"HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v*"
            "HLT_DiJet35_MJJ700_AllJets_DEta3p5_VBF_v*",
            "HLT_DiJet30_MJJ700_AllJets_DEta3p5_VBF_v*")

    ### VBF filter for MC Background
    process.vbfFilter = cms.EDFilter("HLTPFJetVBFFilter",
                                     saveTags=cms.bool(True),
                                     triggerType=cms.int32(85),
                                     inputTag=cms.InputTag("ak5PFJets"),
                                     leadingJetOnly=cms.bool(False),
                                     minPtHigh=cms.double(25.0),
                                     minPtLow=cms.double(25.0),
                                     maxEta=cms.double(5.0),
                                     etaOpposite=cms.bool(True),
                                     minDeltaEta=cms.double(3.0),
                                     minInvMass=cms.double(500.0))

    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    print "-----------------------------------------------"
    print "INVISIBLE HIGGS: Ntuple V12 for Parked Data"
    print "-----------------------------------------------"
    print "RunOnData = ", iRunOnData
    if iRunOnData == True:
        print "Dataset = ", iData
    else:
        if iMCSignal == True:
            print "Dataset = MC Signal or DYNoTrig"
        else:
            print "Dataset = MC Background"
    print "GlobalTag = ", process.GlobalTag.globaltag
    print "Trigger = ", process.hltHighLevel.HLTPaths
    print "Sample input file = ", iFile
    print "Max events = ", iMaxEvent
    print "-----------------------------------------------"
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Basic filters
    # Track quality filter
    process.noscraping = cms.EDFilter("FilterOutScraping",
                                      applyfilter=cms.untracked.bool(True),
                                      debugOn=cms.untracked.bool(False),
                                      numtrack=cms.untracked.uint32(10),
                                      thresh=cms.untracked.double(0.25))

    # Require a good vertex
    process.primaryVertexFilter = cms.EDFilter(
        "VertexSelector",
        src=cms.InputTag("offlinePrimaryVertices"),
        cut=cms.string(
            "!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
        filter=cms.bool(True))
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### MET Filters
    # The iso-based HBHE noise filter
    process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi')

    # The CSC beam halo tight filter
    process.load('RecoMET.METAnalyzers.CSCHaloFilter_cfi')

    # The HCAL laser filter
    process.load("RecoMET.METFilters.hcalLaserEventFilter_cfi")
    #process.load("EventFilter.HcalRawToDigi.hcallasereventfilter2012_cff")
    #process.hcallasereventfilter2012.eventFileName = cms.string('HCALLaser2012AllDatasets.txt.gz')
    process.load(
        "EventFilter.HcalRawToDigi.hcallaserFilterFromTriggerResult_cff")

    # The ECAL dead cell trigger primitive filter
    process.load('RecoMET.METFilters.EcalDeadCellTriggerPrimitiveFilter_cfi')

    # The EE bad SuperCrystal filter
    process.load('RecoMET.METFilters.eeBadScFilter_cfi')

    # The ECAL laser correction filter
    process.load('RecoMET.METFilters.ecalLaserCorrFilter_cfi')

    # The Good vertices collection needed by the tracking failure filter
    process.goodVertices = cms.EDFilter(
        "VertexSelector",
        filter=cms.bool(False),
        src=cms.InputTag("offlinePrimaryVertices"),
        cut=cms.string(
            "!isFake && ndof > 4 && abs(z) <= 24 && position.rho < 2"))

    # The tracking failure filter
    process.load('RecoMET.METFilters.trackingFailureFilter_cfi')

    # The tracking POG filters
    process.load('RecoMET.METFilters.trackingPOGFilters_cff')
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### customise PAT
    process.load('JetMETCorrections.Configuration.DefaultJEC_cff')

    from PhysicsTools.PatAlgos.tools.coreTools import removeMCMatching, runOnData

    if iRunOnData == True:
        removeMCMatching(process, ['All'])
        runOnData(process)

    # Add the PF MET
    from PhysicsTools.PatAlgos.tools.metTools import addPfMET
    addPfMET(process, 'PF')

    # Switch to PF jets
    from PhysicsTools.PatAlgos.tools.jetTools import switchJetCollection
    if iRunOnData == True:
        switchJetCollection(process,
                            cms.InputTag('ak5PFJets'),
                            doJTA=True,
                            doBTagging=False,
                            jetCorrLabel=('AK5PF', [
                                'L1FastJet', 'L2Relative', 'L3Absolute',
                                'L2L3Residual'
                            ]),
                            doType1MET=True,
                            genJetCollection=cms.InputTag("ak5GenJets"),
                            doJetID=False,
                            jetIdLabel="ak5")
    else:
        switchJetCollection(
            process,
            cms.InputTag('ak5PFJets'),
            doJTA=True,
            doBTagging=False,
            jetCorrLabel=('AK5PF', ['L1FastJet', 'L2Relative', 'L3Absolute']),
            doType1MET=True,
            genJetCollection=cms.InputTag("ak5GenJets"),
            doJetID=False,
            jetIdLabel="ak5")

    from PhysicsTools.PatAlgos.tools.pfTools import usePFIso
    usePFIso(process)

    process.patMuons.isoDeposits = cms.PSet()
    process.patMuons.isolationValues = cms.PSet()
    process.patElectrons.isolationValues = cms.PSet(
        pfChargedHadrons=cms.InputTag("elPFIsoValueCharged03PFIdPFIso"),
        pfChargedAll=cms.InputTag("elPFIsoValueChargedAll03PFIdPFIso"),
        pfPUChargedHadrons=cms.InputTag("elPFIsoValuePU03PFIdPFIso"),
        pfNeutralHadrons=cms.InputTag("elPFIsoValueNeutral03PFIdPFIso"),
        pfPhotons=cms.InputTag("elPFIsoValueGamma03PFIdPFIso"))
    process.patElectrons.isolationValuesNoPFId = cms.PSet(
        pfChargedHadrons=cms.InputTag("elPFIsoValueCharged03NoPFIdPFIso"),
        pfChargedAll=cms.InputTag("elPFIsoValueChargedAll03NoPFIdPFIso"),
        pfPUChargedHadrons=cms.InputTag("elPFIsoValuePU03NoPFIdPFIso"),
        pfNeutralHadrons=cms.InputTag("elPFIsoValueNeutral03NoPFIdPFIso"),
        pfPhotons=cms.InputTag("elPFIsoValueGamma03NoPFIdPFIso"))
    process.patDefaultSequence.replace(
        process.patElectrons, process.eleIsoSequence + process.patElectrons)
    process.cleanPatTaus.preselection = cms.string(
        'tauID("decayModeFinding") > 0.5 & tauID("byLooseCombinedIsolationDeltaBetaCorr") > 0.5'
    )
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Object (pre) selection
    # Jet selection
    process.selectedPatJets.cut = cms.string("pt>10. && abs(eta)<5.")

    # Remove overlaps ???
    # process.cleanPatJets.finalCut = "!hasOverlaps('electrons') && !hasOverlaps('muons')"

    # Apply loose PF jet ID
    from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
    process.goodPatJets = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                       filterParams=pfJetIDSelector.clone(),
                                       src=cms.InputTag("selectedPatJets"),
                                       filter=cms.bool(True))

    process.selectedPatMuons.cut = cms.string(
        "isGlobalMuon && pt>10. && abs(eta)<2.5")

    process.selectedPatElectrons.cut = cms.string("pt>10. && abs(eta)<2.5")
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Load the PU JetID sequence
    if iRunOnData == True:
        process.load("CMGTools.External.pujetidsequence_cff")
        process.puJetMva.jets = cms.InputTag("goodPatJets")
        process.puJetId.jets = cms.InputTag("goodPatJets")
    else:
        process.load("CMGTools.External.pujetidsequence_cff")
        process.puJetMva.jets = cms.InputTag("goodPatJets")
        process.puJetId.jets = cms.InputTag("goodPatJets")
        process.puJetMvaSmeared = process.puJetMva.clone()
        process.puJetIdSmeared = process.puJetId.clone()
        process.puJetMvaResUp = process.puJetMva.clone()
        process.puJetIdResUp = process.puJetId.clone()
        process.puJetMvaResDown = process.puJetMva.clone()
        process.puJetIdResDown = process.puJetId.clone()
        process.puJetMvaEnUp = process.puJetMva.clone()
        process.puJetIdEnUp = process.puJetId.clone()
        process.puJetMvaEnDown = process.puJetMva.clone()
        process.puJetIdEnDown = process.puJetId.clone()

        process.puJetIdSmeared.jets = cms.InputTag("smearedGoodPatJets")
        process.puJetMvaSmeared.jetids = cms.InputTag("puJetIdSmeared")
        process.puJetMvaSmeared.jets = cms.InputTag("smearedGoodPatJets")

        process.puJetIdResUp.jets = cms.InputTag("smearedGoodPatJetsResUp")
        process.puJetMvaResUp.jetids = cms.InputTag("puJetIdResUp")
        process.puJetMvaResUp.jets = cms.InputTag("smearedGoodPatJetsResUp")

        process.puJetIdResDown.jets = cms.InputTag("smearedGoodPatJetsResDown")
        process.puJetMvaResDown.jetids = cms.InputTag("puJetIdResDown")
        process.puJetMvaResDown.jets = cms.InputTag(
            "smearedGoodPatJetsResDown")

        process.puJetIdEnUp.jets = cms.InputTag(
            "shiftedGoodPatJetsEnUpForCorrMEt")
        process.puJetMvaEnUp.jetids = cms.InputTag("puJetIdEnUp")
        process.puJetMvaEnUp.jets = cms.InputTag(
            "shiftedGoodPatJetsEnUpForCorrMEt")

        process.puJetIdEnDown.jets = cms.InputTag(
            "shiftedGoodPatJetsEnDownForCorrMEt")
        process.puJetMvaEnDown.jetids = cms.InputTag("puJetIdEnDown")
        process.puJetMvaEnDown.jets = cms.InputTag(
            "shiftedGoodPatJetsEnDownForCorrMEt")
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### MET
    # Apply type 0 MET corrections based on PFCandidate
    process.load("JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi")
    process.pfType1CorrectedMet.applyType0Corrections = cms.bool(False)
    process.pfType1CorrectedMet.srcType1Corrections = cms.VInputTag(
        cms.InputTag('pfMETcorrType0'), cms.InputTag('pfJetMETcorr', 'type1'))

    # Get loose ID/Iso muons and veto ID electrons
    process.load("InvisibleHiggs.Ntuple.PhysicsObjectCandidates_cff")

    # Get PFMET from runMEtUncertainties
    from PhysicsTools.PatUtils.tools.metUncertaintyTools import runMEtUncertainties
    process.load("JetMETCorrections.Type1MET.pfMETsysShiftCorrections_cfi")

    if iRunOnData == True:
        runMEtUncertainties(
            process,
            electronCollection=cms.InputTag('selectVetoElectrons'),
            photonCollection='',
            muonCollection='selectLooseMuons',
            tauCollection='',
            jetCollection=cms.InputTag('goodPatJets'),
            jetCorrLabel='L2L3Residual',
            doSmearJets=False,
            makeType1corrPFMEt=True,
            makeType1p2corrPFMEt=False,
            makePFMEtByMVA=False,
            makeNoPileUpPFMEt=False,
            doApplyType0corr=True,
            sysShiftCorrParameter=process.
            pfMEtSysShiftCorrParameters_2012runAvsNvtx_data,
            doApplySysShiftCorr=False,
            addToPatDefaultSequence=False,
        )
        process.patPFJetMETtype1p2Corr.jetCorrLabel = cms.string(
            'L2L3Residual')
        process.patPFJetMETtype2Corr.jetCorrLabel = cms.string('L2L3Residual')
    else:
        runMEtUncertainties(
            process,
            electronCollection=cms.InputTag('selectVetoElectrons'),
            photonCollection='',
            muonCollection='selectLooseMuons',
            tauCollection='',
            jetCollection=cms.InputTag('goodPatJets'),
            jetCorrLabel='L3Absolute',
            doSmearJets=True,
            makeType1corrPFMEt=True,
            makeType1p2corrPFMEt=False,
            makePFMEtByMVA=False,
            makeNoPileUpPFMEt=False,
            doApplyType0corr=True,
            sysShiftCorrParameter=process.
            pfMEtSysShiftCorrParameters_2012runAvsNvtx_mc,
            doApplySysShiftCorr=False,
            addToPatDefaultSequence=False,
        )

    # Fix Type0 correction module
    #process.patPFMETtype0Corr.correction.par3 = cms.double(0.909209)
    #process.patPFMETtype0Corr.correction.par2 = cms.double(0.0303531)
    #process.patPFMETtype0Corr.correction.par1 = cms.double(-0.703151)
    #process.patPFMETtype0Corr.correction.par0 = cms.double(0.0)
    # Need this line for CMSSW_5_3_11
    process.producePatPFMETCorrections.replace(
        process.patPFJetMETtype2Corr, process.patPFJetMETtype2Corr +
        process.type0PFMEtCorrectionPFCandToVertexAssociation +
        process.patPFMETtype0Corr)
    #process.producePatPFMETCorrections.replace(process.patPFJetMETtype2Corr,process.patPFJetMETtype2Corr + process.patPFMETtype0Corr)
    ###--------------------------------------------------------------

    # PAT/ntuples one step
    # Z and W candidates
    process.load('InvisibleHiggs/Ntuple/WCandidates_cff')
    process.load('InvisibleHiggs/Ntuple/ZCandidates_cff')
    # Ntuple producer
    process.load('InvisibleHiggs/Ntuple/invHiggsInfo_cfi')
    if iRunOnData == False:
        # Jet/MET uncertainty
        process.invHiggsInfo.jetTag = cms.untracked.InputTag(
            "smearedGoodPatJets")
        process.invHiggsInfo.metTag = cms.untracked.InputTag(
            "patType1CorrectedPFMet")
        process.invHiggsInfo.puJetMvaTag = cms.untracked.InputTag(
            "puJetMvaSmeared", "full53xDiscriminant")
        process.invHiggsInfo.puJetIdTag = cms.untracked.InputTag(
            "puJetMvaSmeared", "full53xId")

        # PU re-weighting
        process.invHiggsInfo.puMCFile = cms.untracked.string("PUHistS10.root")
        process.invHiggsInfo.puDataFile = cms.untracked.string(
            "PUHistRun2012All_forParked.root")
        process.invHiggsInfo.puMCHist = cms.untracked.string("pileup")
        process.invHiggsInfo.puDataHist = cms.untracked.string("pileup")
        process.invHiggsInfo.mcPYTHIA = cms.untracked.bool(True)

        process.invHiggsInfo.trigCorrFile = cms.untracked.string(
            "DataMCWeight_53X_v1.root")
    # TTree output file
    process.load("CommonTools.UtilAlgos.TFileService_cfi")
    process.TFileService.fileName = cms.string('invHiggsInfo.root')
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Tau
    # removeSpecificPATObjects( process, ['Taus'] )
    # process.patDefaultSequence.remove( process.patTaus )
    process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Trigger matching
    # from PhysicsTools.PatAlgos.tools.trigTools import *

    # process.metTriggerMatch = cms.EDProducer(
    #     "PATTriggerMatcherDRLessByR"                    # match by DeltaR only, best match by DeltaR
    #     , src     = cms.InputTag( 'patMETs' )
    #     , matched = cms.InputTag( 'patTrigger' )          # default producer label as defined in PhysicsTools/PatAlgos/python/triggerLayer1/triggerProducer_cfi.py
    #     , matchedCuts = cms.string( 'path( "HLT_MET100_v*" )' )
    #     , maxDPtRel = cms.double( 0.5 )
    #     , maxDeltaR = cms.double( 0.5 )
    #     , resolveAmbiguities    = cms.bool( True )        # only one match per trigger object
    #     , resolveByMatchQuality = cms.bool( True )        # take best match found per reco object: by DeltaR here (s. above)
    # )
    # process.jetTriggerMatch = cms.EDProducer(
    #     "PATTriggerMatcherDRLessByR"                    # match by DeltaR only, best match by DeltaR
    #     , src     = cms.InputTag( 'patJets' )
    #     , matched = cms.InputTag( 'patTrigger' )          # default producer label as defined in PhysicsTools/PatAlgos/python/triggerLayer1/triggerProducer_cfi.py
    #     , matchedCuts = cms.string( 'path( "HLT_Jet30_v*" )' )
    #     , maxDPtRel = cms.double( 0.5 )
    #     , maxDeltaR = cms.double( 0.5 )
    #     , resolveAmbiguities    = cms.bool( True )        # only one match per trigger object
    #     , resolveByMatchQuality = cms.bool( True )        # take best match found per reco object: by DeltaR here (s. above)
    # )

    # switchOnTriggerMatchEmbedding( process, [ 'metTriggerMatch', 'jetTriggerMatch' ] )
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Paths
    process.p0 = cms.Path(process.HBHENoiseFilter)
    process.p1 = cms.Path(process.CSCTightHaloFilter)
    process.p2 = cms.Path(process.hcalLaserEventFilter)
    process.p3 = cms.Path(process.EcalDeadCellTriggerPrimitiveFilter)
    process.p4 = cms.Path(process.eeBadScFilter)
    process.p5 = cms.Path(process.ecalLaserCorrFilter)
    process.p6 = cms.Path(process.goodVertices * process.trackingFailureFilter)
    process.p7 = cms.Path(process.trkPOGFilters)
    if iRunOnData == True:
        #process.p8 = cms.Path( process.hcallLaserEvent2012Filter )
        process.p8 = cms.Path(process.hcalfilter)
    else:
        process.p8 = cms.Path(process.primaryVertexFilter)

    if iRunOnData == True:
        process.p = cms.Path(
            # Trigger filter
            process.l1Filter * process.hltHighLevel *

            # Basic filters
            process.noscraping * process.primaryVertexFilter *

            # MET filters (Move to be flagged)

            # MET Correction
            process.type0PFMEtCorrection *

            # Tau
            process.recoTauClassicHPSSequence *

            # Generate PAT
            process.pfParticleSelectionSequence * process.patDefaultSequence *
            process.goodPatJets * process.PhysicsObjectSequence *
            process.metUncertaintySequence * process.puJetIdSqeuence *
            process.WSequence * process.ZSequence * process.invHiggsInfo)
    elif (iMCSignal == True):
        process.p = cms.Path(
            # Trigger filter
            #process.hltHighLevel *

            # Basic filters
            process.noscraping * process.primaryVertexFilter *

            # MET filters (Move to be flags)

            # MET Correction
            process.type0PFMEtCorrection *

            # Tau
            process.recoTauClassicHPSSequence *

            # Generate PAT
            process.pfParticleSelectionSequence * process.patDefaultSequence *
            process.goodPatJets * process.PhysicsObjectSequence *
            process.metUncertaintySequence * process.puJetIdSqeuence *
            process.puJetIdSmeared * process.puJetMvaSmeared *
            process.puJetIdResUp * process.puJetMvaResUp *
            process.puJetIdResDown * process.puJetMvaResDown *
            process.puJetIdEnUp * process.puJetMvaEnUp *
            process.puJetIdEnDown * process.puJetMvaEnDown *
            process.WSequence * process.ZSequence * process.invHiggsInfo)
    else:
        process.p = cms.Path(
            # Trigger filter
            #process.hltHighLevel *
            process.vbfFilter *

            # Basic filters
            process.noscraping * process.primaryVertexFilter *

            # MET filters (Move to be flags)

            # MET Correction
            process.type0PFMEtCorrection *

            # Tau
            process.recoTauClassicHPSSequence *

            # Generate PAT
            process.pfParticleSelectionSequence * process.patDefaultSequence *
            process.goodPatJets * process.PhysicsObjectSequence *
            process.metUncertaintySequence * process.puJetIdSqeuence *
            process.puJetIdSmeared * process.puJetMvaSmeared *
            process.puJetIdResUp * process.puJetMvaResUp *
            process.puJetIdResDown * process.puJetMvaResDown *
            process.puJetIdEnUp * process.puJetMvaEnUp *
            process.puJetIdEnDown * process.puJetMvaEnDown *
            process.WSequence * process.ZSequence * process.invHiggsInfo)
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Output
    process.out.outputCommands += [
        # trigger results
        'keep edmTriggerResults_*_*_*',
        'keep *_hltTriggerSummaryAOD_*_*'
        # L1
        ,
        'keep *_l1extraParticles_MET_RECO',
        'keep *_l1extraParticles_MHT_RECO'
        # good jets
        ,
        'keep *_goodPatJets_*_*'
        # PU jet ID
        ,
        'keep *_puJetId*_*_*',
        'keep *_puJetMva*_*_*'
        # vertices
        ,
        'keep *_offlineBeamSpot_*_*',
        'keep *_offlinePrimaryVertices*_*_*',
        'keep *_goodOfflinePrimaryVertices*_*_*',
        'keep double_*_rho_*'
    ]

    if iRunOnData == False:
        process.out.outputCommands += [
            'keep GenEventInfoProduct_*_*_*', 'keep recoGenParticles_*_*_*',
            'keep GenMETs_*_*_*', 'keep *_addPileupInfo_*_*',
            'keep LHEEventProduct_*_*_*'
        ]

    process.out.fileName = 'patTuple.root'

    del (process.out)
    del (process.outpath)
def addInvHiggsProcess(process, iRunOnData=True, iData="PromptC2", iHLTFilter="MET", iMCSignal=False, iFile='/store/data/Run2012C/MET/AOD/PromptReco-v2/000/203/002/04BCEC26-AA02-E211-A81D-003048CF99BA.root', iMaxEvent=100):
    
    ###--------------------------------------------------------------
    ### Load PAT, because it insists on defining the process for you
    #from PhysicsTools.PatAlgos.patTemplate_cfg import *
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### Input
    process.maxEvents.input   = iMaxEvent
    process.source.fileNames  = [iFile]
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### GlobalTag
    if iRunOnData == True:
        if (iData.find("Jul13")==0):
            process.GlobalTag.globaltag = "FT_53_V6C_AN3::All"
        elif (iData.find("Aug06")==0):
            process.GlobalTag.globaltag = "FT_53_V6C_AN3::All"
        elif (iData.find("Aug24")==0):
            process.GlobalTag.globaltag = "FT53_V10A_AN3::All"
        elif (iData.find("PromptC2")==0):
            process.GlobalTag.globaltag = "GR_P_V42_AN3::All"
        elif (iData.find("PromptD")==0):
            process.GlobalTag.globaltag = "GR_P_V42_AN3::All"
        elif (iData.find("Dec11")==0): #Run201191
            process.GlobalTag.globaltag = "FT_P_V42C_AN3::All"
        else:
            process.GlobalTag.globaltag = "GR_P_V42_AN3::All"
    else:
        process.GlobalTag.globaltag = "START53_V7G::All"
    ###--------------------------------------------------------------

    
    ###--------------------------------------------------------------
    ### Logger
    process.load("FWCore.MessageService.MessageLogger_cfi")
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport = cms.untracked.PSet(
        reportEvery = cms.untracked.int32(2000),
        limit = cms.untracked.int32(10000000)
        )
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### HLT Trigger(s)
    # If it's MC signal, no trigger will be applied
    if iRunOnData == False and iMCSignal == True:
        iHLTFilter = "NoTrig"

    # Load hltHighLevel
    process.load('HLTrigger.HLTfilters.hltHighLevel_cfi')
    process.hltHighLevel.TriggerResultsTag = cms.InputTag("TriggerResults","","HLT")
    process.hltHighLevel.throw = cms.bool(False)  # Tolerate if triggers not available
    process.hltHighLevel.andOr = cms.bool(True)   # True = OR, False = AND
    if (iHLTFilter.find("MET")==0):
        process.hltHighLevel.HLTPaths = cms.vstring(
            "HLT_DiPFJet40_PFMETnoMu65_MJJ600VBF_LeadingJets_v*",
            "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v*"
            )
    elif (iHLTFilter.find("SingleMu")==0):
        process.hltHighLevel.HLTPaths = cms.vstring("HLT_IsoMu24_eta2p1_v*","HLT_Mu40_eta2p1_v*")
    elif (iHLTFilter.find("DoubleMu")==0):
        process.hltHighLevel.HLTPaths = cms.vstring("HLT_Mu17_Mu8_v*")
    elif (iHLTFilter.find("SingleElectron")==0):
        process.hltHighLevel.HLTPaths = cms.vstring("HLT_Ele27_WP80_v*")
    elif (iHLTFilter.find("DoubleElectron")==0):
        process.hltHighLevel.HLTPaths = cms.vstring("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v*")
    elif (iHLTFilter.find("NoTrig")==0):
        process.hltHighLevel.HLTPaths = cms.vstring("*")
    else:
        process.hltHighLevel.HLTPaths = cms.vstring(
            "HLT_DiPFJet40_PFMETnoMu65_MJJ600VBF_LeadingJets_v*",
            "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v*"
            )
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    print "-----------------------------------------------"
    print "INVISIBLE HIGGS: Ntuple V10"
    print "-----------------------------------------------"
    print "RunOnData = ", iRunOnData
    if iRunOnData == True:
        print "Dataset = ", iData
    else:
        if iMCSignal == True:
            print "Dataset = MC Signal"
        else:
            print "Dataset = MC Background"
    print "GlobalTag = ", process.GlobalTag.globaltag
    print "Trigger = ", process.hltHighLevel.HLTPaths
    print "Sample input file = ", iFile
    print "Max events = ", iMaxEvent
    print "-----------------------------------------------"
    ###--------------------------------------------------------------

    
    ###-------------------------------------------------------------- 
    ### Basic filters
    # Track quality filter
    process.noscraping = cms.EDFilter(
        "FilterOutScraping",
        applyfilter = cms.untracked.bool(True),
        debugOn = cms.untracked.bool(False),
        numtrack = cms.untracked.uint32(10),
        thresh = cms.untracked.double(0.25)
        )

    # Require a good vertex
    process.primaryVertexFilter = cms.EDFilter(
        "VertexSelector",
        src = cms.InputTag("offlinePrimaryVertices"),
        cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
        filter = cms.bool(True)
        )
    ###-------------------------------------------------------------- 


    ###--------------------------------------------------------------
    ### MET Filters
    # The iso-based HBHE noise filter
    process.load('CommonTools.RecoAlgos.HBHENoiseFilter_cfi')

    # The CSC beam halo tight filter
    process.load('RecoMET.METAnalyzers.CSCHaloFilter_cfi')
    
    # The HCAL laser filter
    process.load("RecoMET.METFilters.hcalLaserEventFilter_cfi")
    process.load("EventFilter.HcalRawToDigi.hcallasereventfilter2012_cff")
    process.hcallasereventfilter2012.eventFileName = cms.string('HCALLaser2012AllDatasets.txt.gz')
    
    # The ECAL dead cell trigger primitive filter
    process.load('RecoMET.METFilters.EcalDeadCellTriggerPrimitiveFilter_cfi')
    
    # The EE bad SuperCrystal filter
    process.load('RecoMET.METFilters.eeBadScFilter_cfi')
    
    # The ECAL laser correction filter
    process.load('RecoMET.METFilters.ecalLaserCorrFilter_cfi')
    
    # The Good vertices collection needed by the tracking failure filter
    process.goodVertices = cms.EDFilter(
        "VertexSelector",
        filter = cms.bool(False),
        src = cms.InputTag("offlinePrimaryVertices"),
        cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.rho < 2")
        )

    # The tracking failure filter
    process.load('RecoMET.METFilters.trackingFailureFilter_cfi')

    # The tracking POG filters
    process.load('RecoMET.METFilters.trackingPOGFilters_cff')
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### customise PAT
    process.load('JetMETCorrections.Configuration.DefaultJEC_cff')

    from PhysicsTools.PatAlgos.tools.coreTools import removeMCMatching,runOnData

    if iRunOnData == True:
        removeMCMatching(process, ['All'])
        runOnData(process)

    # Add the PF MET
    from PhysicsTools.PatAlgos.tools.metTools import addPfMET
    addPfMET(process, 'PF')

    # Switch to PF jets
    from PhysicsTools.PatAlgos.tools.jetTools import switchJetCollection
    if iRunOnData == True:
        switchJetCollection(process, 
                            cms.InputTag('ak5PFJets'),   
                            doJTA            = True,            
                            doBTagging       = True,            
                            jetCorrLabel     = ('AK5PF', ['L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual']),
                            doType1MET       = True,            
                            doJetID          = False,
                            jetIdLabel       = "ak5"
                            )
    else:
        switchJetCollection(process, 
                            cms.InputTag('ak5PFJets'),   
                            doJTA            = True,            
                            doBTagging       = True,            
                            jetCorrLabel     = ('AK5PF', ['L1FastJet', 'L2Relative', 'L3Absolute']),
                            doType1MET       = True,            
                            genJetCollection = cms.InputTag("ak5GenJetsNoNu"),
                            doJetID          = False,
                            jetIdLabel       = "ak5"
                            )

    from PhysicsTools.PatAlgos.tools.pfTools import usePFIso
    usePFIso(process)

    process.patMuons.isoDeposits = cms.PSet()
    process.patMuons.isolationValues = cms.PSet()
    process.patElectrons.isolationValues = cms.PSet(
        pfChargedHadrons = cms.InputTag("elPFIsoValueCharged03PFIdPFIso"),
        pfChargedAll = cms.InputTag("elPFIsoValueChargedAll03PFIdPFIso"),
        pfPUChargedHadrons = cms.InputTag("elPFIsoValuePU03PFIdPFIso"),
        pfNeutralHadrons = cms.InputTag("elPFIsoValueNeutral03PFIdPFIso"),
        pfPhotons = cms.InputTag("elPFIsoValueGamma03PFIdPFIso")
        )
    process.patElectrons.isolationValuesNoPFId = cms.PSet(
        pfChargedHadrons = cms.InputTag("elPFIsoValueCharged03NoPFIdPFIso"),
        pfChargedAll = cms.InputTag("elPFIsoValueChargedAll03NoPFIdPFIso"),
        pfPUChargedHadrons = cms.InputTag("elPFIsoValuePU03NoPFIdPFIso"),
        pfNeutralHadrons = cms.InputTag("elPFIsoValueNeutral03NoPFIdPFIso"),
        pfPhotons = cms.InputTag("elPFIsoValueGamma03NoPFIdPFIso")
        )
    process.patDefaultSequence.replace(process.patElectrons,process.eleIsoSequence+process.patElectrons)
    process.cleanPatTaus.preselection = cms.string('tauID("decayModeFinding") > 0.5 & tauID("byLooseCombinedIsolationDeltaBetaCorr") > 0.5')
    ###--------------------------------------------------------------
    

    ###--------------------------------------------------------------
    ### Object (pre) selection
    # Jet selection
    process.selectedPatJets.cut = cms.string("pt>10. && abs(eta)<5.")

    # Remove overlaps ???
    # process.cleanPatJets.finalCut = "!hasOverlaps('electrons') && !hasOverlaps('muons')"

    # Apply loose PF jet ID
    from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
    process.goodPatJets = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                       filterParams = pfJetIDSelector.clone(),
                                       src = cms.InputTag("selectedPatJets"),
                                       filter = cms.bool(True)
                                       )

    process.selectedPatMuons.cut = cms.string("isGlobalMuon && pt>10. && abs(eta)<2.5")
    
    process.selectedPatElectrons.cut = cms.string("pt>10. && abs(eta)<2.5")
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### Load the PU JetID sequence
    if iRunOnData == True:
    	process.load("CMGTools.External.pujetidsequence_cff")
    	process.puJetMva.jets = cms.InputTag("goodPatJets")
    	process.puJetId.jets = cms.InputTag("goodPatJets")
    else:
        process.load("CMGTools.External.pujetidsequence_cff")
        process.puJetMva.jets		= cms.InputTag("goodPatJets")
        process.puJetId.jets 		= cms.InputTag("goodPatJets")
	process.puJetMvaSmeared		= process.puJetMva.clone()
	process.puJetIdSmeared		= process.puJetId.clone()  
	process.puJetMvaResUp 		= process.puJetMva.clone()
	process.puJetIdResUp 		= process.puJetId.clone()
        process.puJetMvaResDown		= process.puJetMva.clone()
        process.puJetIdResDown  	= process.puJetId.clone()
        process.puJetMvaEnUp   		= process.puJetMva.clone()
        process.puJetIdEnUp    		= process.puJetId.clone()
        process.puJetMvaEnDown 		= process.puJetMva.clone()
        process.puJetIdEnDown  		= process.puJetId.clone()

        process.puJetIdSmeared.jets     = cms.InputTag("smearedGoodPatJetsWithGaussian")
        process.puJetMvaSmeared.jetids  = cms.InputTag("puJetIdSmeared")
        process.puJetMvaSmeared.jets    = cms.InputTag("smearedGoodPatJetsWithGaussian")

	process.puJetIdResUp.jets 	= cms.InputTag("smearedGoodPatJetsResUpWithGaussian")
	process.puJetMvaResUp.jetids 	= cms.InputTag("puJetIdResUp")
	process.puJetMvaResUp.jets 	= cms.InputTag("smearedGoodPatJetsResUpWithGaussian")

        process.puJetIdResDown.jets     = cms.InputTag("smearedGoodPatJetsResDownWithGaussian")
        process.puJetMvaResDown.jetids  = cms.InputTag("puJetIdResDown")
        process.puJetMvaResDown.jets    = cms.InputTag("smearedGoodPatJetsResDownWithGaussian")

        process.puJetIdEnUp.jets        = cms.InputTag("shiftedGoodPatJetsEnUpForCorrMEtWithGaussian")
        process.puJetMvaEnUp.jetids     = cms.InputTag("puJetIdEnUp")
        process.puJetMvaEnUp.jets       = cms.InputTag("shiftedGoodPatJetsEnUpForCorrMEtWithGaussian")

        process.puJetIdEnDown.jets      = cms.InputTag("shiftedGoodPatJetsEnDownForCorrMEtWithGaussian")
        process.puJetMvaEnDown.jetids   = cms.InputTag("puJetIdEnDown")
        process.puJetMvaEnDown.jets     = cms.InputTag("shiftedGoodPatJetsEnDownForCorrMEtWithGaussian")

	# For jet without Gaussian smearing collection
	process.puJetMvaSmearedNoGaussian	= process.puJetMva.clone()
	process.puJetIdSmearedNoGaussian	= process.puJetId.clone()
	process.puJetMvaResUpNoGaussian         = process.puJetMva.clone()
        process.puJetIdResUpNoGaussian          = process.puJetId.clone()
        process.puJetMvaResDownNoGaussian       = process.puJetMva.clone()
        process.puJetIdResDownNoGaussian        = process.puJetId.clone()
        process.puJetMvaEnUpNoGaussian          = process.puJetMva.clone()
        process.puJetIdEnUpNoGaussian           = process.puJetId.clone()
        process.puJetMvaEnDownNoGaussian        = process.puJetMva.clone()
        process.puJetIdEnDownNoGaussian         = process.puJetId.clone()

	process.puJetIdSmearedNoGaussian.jets     = cms.InputTag("smearedGoodPatJetsNoGaussian")
        process.puJetMvaSmearedNoGaussian.jetids  = cms.InputTag("puJetIdSmearedNoGaussian")
        process.puJetMvaSmearedNoGaussian.jets    = cms.InputTag("smearedGoodPatJetsNoGaussian")

        process.puJetIdResUpNoGaussian.jets       = cms.InputTag("smearedGoodPatJetsResUpNoGaussian")
        process.puJetMvaResUpNoGaussian.jetids    = cms.InputTag("puJetIdResUpNoGaussian")
        process.puJetMvaResUpNoGaussian.jets      = cms.InputTag("smearedGoodPatJetsResUpNoGaussian")

        process.puJetIdResDownNoGaussian.jets     = cms.InputTag("smearedGoodPatJetsResDownNoGaussian")
        process.puJetMvaResDownNoGaussian.jetids  = cms.InputTag("puJetIdResDownNoGaussian")
        process.puJetMvaResDownNoGaussian.jets    = cms.InputTag("smearedGoodPatJetsResDownNoGaussian")

        process.puJetIdEnUpNoGaussian.jets        = cms.InputTag("shiftedGoodPatJetsEnUpForCorrMEtNoGaussian")
        process.puJetMvaEnUpNoGaussian.jetids     = cms.InputTag("puJetIdEnUpNoGaussian")
        process.puJetMvaEnUpNoGaussian.jets       = cms.InputTag("shiftedGoodPatJetsEnUpForCorrMEtNoGaussian")

        process.puJetIdEnDownNoGaussian.jets      = cms.InputTag("shiftedGoodPatJetsEnDownForCorrMEtNoGaussian")
        process.puJetMvaEnDownNoGaussian.jetids   = cms.InputTag("puJetIdEnDownNoGaussian")
        process.puJetMvaEnDownNoGaussian.jets     = cms.InputTag("shiftedGoodPatJetsEnDownForCorrMEtNoGaussian")
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### MET
    # Apply type 0 MET corrections based on PFCandidate
    process.load("JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi")
    process.pfType1CorrectedMet.applyType0Corrections = cms.bool(False)
    process.pfType1CorrectedMet.srcType1Corrections = cms.VInputTag(
        cms.InputTag('pfMETcorrType0'),
        cms.InputTag('pfJetMETcorr', 'type1')
        )

    # Get loose ID/Iso muons and veto ID electrons
    process.load("InvisibleHiggs.Ntuple.PhysicsObjectCandidates_cff")

    # Get PFMET from runMEtUncertainties
    from PhysicsTools.PatUtils.tools.metUncertaintyTools import runMEtUncertainties
    process.load("JetMETCorrections.Type1MET.pfMETsysShiftCorrections_cfi")

    if iRunOnData == True:
        runMEtUncertainties(process,
                            electronCollection = cms.InputTag('selectVetoElectrons'),
                            photonCollection = '',
                            muonCollection = 'selectLooseMuons',
                            tauCollection = '',
                            jetCollection = cms.InputTag('goodPatJets'),
                            jetCorrLabel = 'L2L3Residual',
                            doSmearJets = False,
                            makeType1corrPFMEt = True,
                            makeType1p2corrPFMEt = False,
                            makePFMEtByMVA = False,
                            makeNoPileUpPFMEt = False,
                            doApplyType0corr = True,
                            sysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runAvsNvtx_data,
                            doApplySysShiftCorr = False,
			    addToPatDefaultSequence = False,
			    postfix = ''
                            )
        process.patPFJetMETtype1p2Corr.jetCorrLabel = cms.string('L2L3Residual')
        process.patPFJetMETtype2Corr.jetCorrLabel = cms.string('L2L3Residual')
    else:
        runMEtUncertainties(process,
                            electronCollection = cms.InputTag('selectVetoElectrons'),
                            photonCollection = '',
                            muonCollection = 'selectLooseMuons',
                            tauCollection = '',
                            jetCollection = cms.InputTag('goodPatJets'),
                            jetCorrLabel = 'L3Absolute',
                            doSmearJets = True,
                            makeType1corrPFMEt = True,
                            makeType1p2corrPFMEt = False,
                            makePFMEtByMVA = False,
                            makeNoPileUpPFMEt = False,
                            doApplyType0corr = True,
                            sysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runAvsNvtx_mc,
                            doApplySysShiftCorr = False,
			    addToPatDefaultSequence = False,
			    postfix = 'WithGaussian'
                            )
        runMEtUncertainties(process,
                            electronCollection = cms.InputTag('selectVetoElectrons'),
                            photonCollection = '',
                            muonCollection = 'selectLooseMuons',
                            tauCollection = '',
                            jetCollection = cms.InputTag('goodPatJets'),
                            jetCorrLabel = 'L3Absolute',
                            doSmearJets = True,
                            makeType1corrPFMEt = True,
                            makeType1p2corrPFMEt = False,
                            makePFMEtByMVA = False,
                            makeNoPileUpPFMEt = False,
                            doApplyType0corr = True,
                            sysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runAvsNvtx_mc,
                            doApplySysShiftCorr = False,
                            addToPatDefaultSequence = False,
                            postfix = 'NoGaussian'
                            )
	# Turn off gaussian smearing
    	process.smearedGoodPatJetsNoGaussian.doGaussian = cms.int32(0)
    	process.smearedGoodPatJetsResUpNoGaussian.doGaussian = cms.int32(0)
    	process.smearedGoodPatJetsResDownNoGaussian.doGaussian = cms.int32(0)

    # Fix Type0 correction module
    process.patPFMETtype0Corr.correction.par3 = cms.double(0.909209)
    process.patPFMETtype0Corr.correction.par2 = cms.double(0.0303531)
    process.patPFMETtype0Corr.correction.par1 = cms.double(-0.703151)
    process.patPFMETtype0Corr.correction.par0 = cms.double(0.0)
    ###--------------------------------------------------------------

    # PAT/ntuples one step  
    # Z and W candidates    
    process.load('InvisibleHiggs/Ntuple/WCandidates_cff')
    process.load('InvisibleHiggs/Ntuple/ZCandidates_cff')
    # Ntuple producer       
    process.load('InvisibleHiggs/Ntuple/invHiggsInfo_cfi')
    if iRunOnData == False: 
        # Jet/MET uncertainty
        process.invHiggsInfo.jetTag      = cms.untracked.InputTag("smearedGoodPatJetsWithGaussian")
        process.invHiggsInfo.metTag      = cms.untracked.InputTag("patType1CorrectedPFMetWithGaussian")
        process.invHiggsInfo.puJetMvaTag = cms.untracked.InputTag("puJetMvaSmeared", "fullDiscriminant")
        process.invHiggsInfo.puJetIdTag  = cms.untracked.InputTag("puJetMvaSmeared", "fullId")
                            
        # PU re-weighting   
        process.invHiggsInfo.puMCFile    = cms.untracked.string("PUHistS10.root")
        process.invHiggsInfo.puDataFile  = cms.untracked.string("PUHistRun2012All_forV9.root")
        process.invHiggsInfo.puMCHist    = cms.untracked.string("pileup")
        process.invHiggsInfo.puDataHist  = cms.untracked.string("pileup")
        process.invHiggsInfo.mcPYTHIA    = cms.untracked.bool(True)
        
        process.invHiggsInfo.trigCorrFile   = cms.untracked.string("DataMCWeight_53X_v1.root")

	process.invHiggsInfo.leptCorrFile   = cms.untracked.string("leptonWeights.root")
    # TTree output file     
    process.load("CommonTools.UtilAlgos.TFileService_cfi")
    process.TFileService.fileName = cms.string('invHiggsInfo_MC.root')
    ###--------------------------------------------------------------

    ###--------------------------------------------------------------
    ### Tau
    # removeSpecificPATObjects( process, ['Taus'] )
    # process.patDefaultSequence.remove( process.patTaus )
    process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### Trigger matching
    # from PhysicsTools.PatAlgos.tools.trigTools import *

    # process.metTriggerMatch = cms.EDProducer(
    #     "PATTriggerMatcherDRLessByR"                    # match by DeltaR only, best match by DeltaR
    #     , src     = cms.InputTag( 'patMETs' )
    #     , matched = cms.InputTag( 'patTrigger' )          # default producer label as defined in PhysicsTools/PatAlgos/python/triggerLayer1/triggerProducer_cfi.py
    #     , matchedCuts = cms.string( 'path( "HLT_MET100_v*" )' )
    #     , maxDPtRel = cms.double( 0.5 )
    #     , maxDeltaR = cms.double( 0.5 )
    #     , resolveAmbiguities    = cms.bool( True )        # only one match per trigger object
    #     , resolveByMatchQuality = cms.bool( True )        # take best match found per reco object: by DeltaR here (s. above)
    # )
    # process.jetTriggerMatch = cms.EDProducer(
    #     "PATTriggerMatcherDRLessByR"                    # match by DeltaR only, best match by DeltaR
    #     , src     = cms.InputTag( 'patJets' )
    #     , matched = cms.InputTag( 'patTrigger' )          # default producer label as defined in PhysicsTools/PatAlgos/python/triggerLayer1/triggerProducer_cfi.py
    #     , matchedCuts = cms.string( 'path( "HLT_Jet30_v*" )' )
    #     , maxDPtRel = cms.double( 0.5 )
    #     , maxDeltaR = cms.double( 0.5 )
    #     , resolveAmbiguities    = cms.bool( True )        # only one match per trigger object
    #     , resolveByMatchQuality = cms.bool( True )        # take best match found per reco object: by DeltaR here (s. above)
    # )
    
    # switchOnTriggerMatchEmbedding( process, [ 'metTriggerMatch', 'jetTriggerMatch' ] )
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### Paths
    process.p0 = cms.Path( process.HBHENoiseFilter )
    process.p1 = cms.Path( process.CSCTightHaloFilter )
    process.p2 = cms.Path( process.hcalLaserEventFilter )
    process.p3 = cms.Path( process.EcalDeadCellTriggerPrimitiveFilter )
    process.p4 = cms.Path( process.eeBadScFilter )
    process.p5 = cms.Path( process.ecalLaserCorrFilter )
    process.p6 = cms.Path( process.goodVertices * process.trackingFailureFilter )
    process.p7 = cms.Path( process.trkPOGFilters )
    process.p8 = cms.Path( process.hcallLaserEvent2012Filter )

    if iRunOnData == True:
    	process.p = cms.Path(    
        	# Trigger filter
        	process.hltHighLevel *
        
        	# Basic filters
        	process.noscraping *
        	process.primaryVertexFilter *
        	
        	# MET filters (Move to be flags)
        
        	# MET Correction
        	process.type0PFMEtCorrection *
        
        	# Tau
        	process.recoTauClassicHPSSequence *
        
        	# Generate PAT
        	process.pfParticleSelectionSequence *
        	process.patDefaultSequence *
        	process.goodPatJets *
		process.PhysicsObjectSequence *
		process.metUncertaintySequence *
        	process.puJetIdSqeuence *
		process.WSequence *
                process.ZSequence *
                process.invHiggsInfo
		)
    else:
        process.p = cms.Path(
                # Trigger filter
                process.hltHighLevel *

                # Basic filters
                process.noscraping *
                process.primaryVertexFilter *

                # MET filters (Move to be flags)

                # MET Correction
                process.type0PFMEtCorrection *

                # Tau
                process.recoTauClassicHPSSequence *

                # Generate PAT
                process.pfParticleSelectionSequence *
        	process.genParticlesForJetsNoNu *
                process.ak5GenJetsNoNu *
                process.patDefaultSequence *
                process.goodPatJets *
                process.PhysicsObjectSequence *
                process.metUncertaintySequenceWithGaussian *
		process.metUncertaintySequenceNoGaussian *
                process.puJetIdSqeuence *
		process.puJetIdSmeared *
		process.puJetMvaSmeared *
        	process.puJetIdResUp *
		process.puJetMvaResUp *
         	process.puJetIdResDown *
        	process.puJetMvaResDown *
        	process.puJetIdEnUp *
        	process.puJetMvaEnUp *
        	process.puJetIdEnDown *
        	process.puJetMvaEnDown *
                process.puJetIdSmearedNoGaussian *
                process.puJetMvaSmearedNoGaussian *
                process.puJetIdResUpNoGaussian *
                process.puJetMvaResUpNoGaussian *
                process.puJetIdResDownNoGaussian *
                process.puJetMvaResDownNoGaussian *
                process.puJetIdEnUpNoGaussian *
                process.puJetMvaEnUpNoGaussian *
                process.puJetIdEnDownNoGaussian *
                process.puJetMvaEnDownNoGaussian *
		process.WSequence *
        	process.ZSequence *
                process.invHiggsInfo
        	)
    ###--------------------------------------------------------------


    ###--------------------------------------------------------------
    ### Output
    process.out.outputCommands += [
        # trigger results
        'keep edmTriggerResults_*_*_*'
        ,'keep *_hltTriggerSummaryAOD_*_*'
        # L1
        ,'keep *_l1extraParticles_MET_RECO'
        ,'keep *_l1extraParticles_MHT_RECO'
        # good jets
        ,'keep *_goodPatJets_*_*'
        # PU jet ID
        ,'keep *_puJetId*_*_*'
        ,'keep *_puJetMva*_*_*'
        # vertices
        ,'keep *_offlineBeamSpot_*_*'
        ,'keep *_offlinePrimaryVertices*_*_*'
        ,'keep *_goodOfflinePrimaryVertices*_*_*'
        ,'keep double_*_rho_*'
        ]

    if iRunOnData == False:
        process.out.outputCommands += ['keep GenEventInfoProduct_*_*_*'
                                       ,'keep recoGenParticles_*_*_*'
                                       ,'keep GenMETs_*_*_*'
                                       ,'keep *_addPileupInfo_*_*'
                                       ,'keep LHEEventProduct_*_*_*'
				       ,'keep ak5GenJets_*_*_*'
                                       ,'keep ak5GenJetsNoNu_*_*_*'
                                       ]
        
    process.out.fileName = 'patTuple.root'

    del(process.out)
    del(process.outpath)
Exemplo n.º 17
0
    JetCorrectionMC_algoPF2=cms.untracked.string("ak7PFL1FastL2L3"),
    JetCorrectionData_algoPF2=cms.untracked.string("ak7PFL1FastL2L3Residual"),
    JetCorrectionMC_algoPF3=cms.untracked.string("ak5PFchsL1FastL2L3"),
    JetCorrectionData_algoPF3=cms.untracked.string(
        "ak5PFchsL1FastL2L3Residual"),
    JetVertexToProcess=cms.uint32(10),
    JetColl_algo1=cms.InputTag("ak5CaloJets"),
    JetColl_algo2=cms.InputTag("ak7CaloJets"),
    JetColl_algo3=cms.InputTag("kt4CaloJets"),
    JetColl_algoPF1=cms.InputTag("ak5PFJets"),
    JetColl_algoPF2=cms.InputTag("ak7PFJets"),
    JetColl_algoPF3=cms.InputTag("ak5PFchsJets"),
    puJetIDAlgos_algoPF1=cms.untracked.VPSet(stdalgos),
    puJetIDAlgos_algoPF2=cms.untracked.VPSet(stdalgos),
    puJetIDAlgos_algoPF3=cms.untracked.VPSet(chsalgos),
    pfLooseId=pfJetIDSelector.clone(),

    #bcBColl = cms.InputTag("hybridSuperClusters","hybridBarrelBasicClusters"),
    #bcEColl = cms.InputTag("multi5x5BasicClusters","multi5x5EndcapBasicClusters"),
    tkColl=cms.InputTag("generalTracks"),
    JetTrackAssociationColl_algo1=cms.InputTag(
        "ak5JetTracksAssociatorAtVertex"),
    JetTrackAssociationColl_algo2=cms.InputTag(
        "ak7JetTracksAssociatorAtVertex"),
    JetTrackAssociationColl_algo3=cms.InputTag(""),
    rhoCollection_algo1=cms.InputTag("kt6PFJets", "rho"),
    rhoCollection_algo2=cms.InputTag("kt6CaloJets", "rho"),
    rhoCollection_algo3=cms.InputTag("kt6CaloJetsCentral", "rho"),
    PFCandidateColl=cms.InputTag("particleFlow"),
    isolationValues03=cms.PSet(
        pfChargedHadrons=cms.InputTag('isoValPhotonWithCharged03'),
                      RelIso=cms.double(0.2),
                      cutsToIgnore=cms.vstring('Chi2', 'D0', 'ED0', 'SD0',
                                               'NHits', 'NValMuHits',
                                               'ECalVeto', 'HCalVeto'),
                      RecalcFromBeamSpot=cms.bool(False),
                      beamLineSrc=cms.InputTag("offlineBeamSpot")),
 # loose electrons
 electronIdLoose=cms.PSet(version=cms.string('FIRSTDATA'),
                          D0=cms.double(999.0),
                          ED0=cms.double(999.0),
                          SD0=cms.double(999.0),
                          RelIso=cms.double(0.2),
                          cutsToIgnore=cms.vstring('D0', 'ED0', 'SD0')),
 # loose jets
 jetIdLoose=jetIDSelector.clone(),
 pfjetIdLoose=pfJetIDSelector.clone(),
 # kinematic cuts
 minJets=cms.int32(1),
 muPlusJets=cms.bool(True),
 ePlusJets=cms.bool(False),
 muPtMin=cms.double(20.0),
 muEtaMax=cms.double(2.1),
 eleEtMin=cms.double(20.0),
 eleEtaMax=cms.double(2.4),
 muPtMinLoose=cms.double(10.0),
 muEtaMaxLoose=cms.double(2.5),
 eleEtMinLoose=cms.double(15.0),
 eleEtaMaxLoose=cms.double(2.5),
 jetPtMin=cms.double(30.0),
 jetEtaMax=cms.double(2.4),
 jetScale=cms.double(1.0),
                             newParticles     = cms.vint32(4000011, 4000013, 1000006, 1000022, 1000024, 1000025),
                             pileupCollection = cms.InputTag("addPileupInfo"),
                             VtxLabel         = cms.InputTag("offlineSlimmedPrimaryVertices"),
                             VtxBSLabel       = cms.InputTag("offlinePrimaryVerticesWithBS"),
                             rhoLabel         = cms.InputTag("fixedGridRhoFastjetAll"),
                             pfMETLabel       = cms.InputTag("slimmedMETs"),
                             electronSrc      = cms.InputTag("slimmedElectrons"),
                             photonSrc        = cms.InputTag("slimmedPhotons"),
                             muonSrc          = cms.InputTag("slimmedMuons"),
                             ebReducedRecHitCollection = cms.InputTag("reducedEgamma", "reducedEBRecHits"),
                             eeReducedRecHitCollection = cms.InputTag("reducedEgamma", "reducedEERecHits"),
                             esReducedRecHitCollection = cms.InputTag("reducedEgamma", "reducedESRecHits"),
                             recoPhotonSrc             = cms.InputTag("reducedEgamma", "reducedGedPhotonCores"),
                             TrackLabel                = cms.InputTag("generalTracks"),
                             gsfElectronLabel          = cms.InputTag("gsfElectrons"),
                             PFAllCandidates           = cms.InputTag("particleFlow"),
                             ak4JetSrc                 = cms.InputTag("slimmedJets"),
                             ak8JetSrc                 = cms.InputTag("slimmedJetsAK8"),
                             tauSrc                    = cms.InputTag("slimmedTaus"),
                             pfLooseId                 = pfJetIDSelector.clone(),

                             phoLooseIdMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-PHYS14-PU20bx25-V2-standalone-loose"),
                             phoMediumIdMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-PHYS14-PU20bx25-V2-standalone-medium"),
                             phoTightIdMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-PHYS14-PU20bx25-V2-standalone-tight"),
                             eleVetoIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-PHYS14-PU20bx25-V2-standalone-veto"),
                             eleLooseIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-PHYS14-PU20bx25-V2-standalone-loose"),
                             eleMediumIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-PHYS14-PU20bx25-V2-standalone-medium"),
                             eleTightIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-PHYS14-PU20bx25-V2-standalone-tight"),
                             eleHEEPIdMap = cms.InputTag("egmGsfElectronIDs:heepElectronID-HEEPV51")
)
    cut=cms.string("pt > 50"),
    filter=cms.bool(True),
)
from TerraNova.CommonTools.jetSelectorPSet_cff import jetSelectorPSet

process.acceptedJets = cms.EDProducer(
    "KyJetSelector",
    jetLabel=cms.InputTag("ak5PFJetsCorr"),
    PUJetDiscriminant=cms.InputTag("pileupJetIdProducer", "fullDiscriminant"),
    PUJetId=cms.InputTag("pileupJetIdProducer", "fullId"),
)
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector

process.tightPFJetsPFlow = cms.EDFilter(
    "PFJetIDSelectionFunctorBasicFilter",
    filterParams=pfJetIDSelector.clone(quality=cms.string("TIGHT")),
    src=cms.InputTag(PFJetCollectionCorr))

process.goodPhotons = cms.EDFilter(
    "PhotonSelector",
    src=cms.InputTag("photons"),
    cut=cms.string(
        "hadronicOverEm<0.15 && (abs(superCluster.eta)<2.5) && !(1.4442<abs(superCluster.eta)<1.566) && ((isEB && sigmaIetaIeta<0.01) || (isEE && sigmaIetaIeta<0.03)) && (superCluster.energy*sin(superCluster.position.theta)>30) && pt>30"
    ))

process.load('RecoJets.JetProducers.PileupJetID_cfi')
process.pileupJetIdProducer.jets = PFJetCollectionCorr
#process.pileupJetIdProducer.jets = cms.InputTag('ak5PFJets')
#process.pileupJetIdProducer.jets = cms.InputTag('selectedPatJets')
#process.pileupJetIdProducer.jets = 'selectedPatJetsPFlow'
process.pileupJetIdProducer.vertexes = "goodOfflinePrimaryVertices"
Exemplo n.º 21
0
## Maximal Number of Events
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(100) )

from Analysis.JetAnalysis.multijetStudies_cfi import jetStudies as inputJetStudies
from Analysis.JetAnalysis.multijetStudies_cfi import pfJetStudies as inputPFJetStudies

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector as inputPFJetIDSelector
from PhysicsTools.SelectorUtils.jetIDSelector_cfi import jetIDSelector as inputJetIDSelector

process.TFileService = cms.Service("TFileService",
                                   fileName = cms.string("multijetStudies.root")
                                   )


process.multijetAna = cms.EDAnalyzer('EDMultijetAnalysis',
                                     pfJetIDSelector = inputPFJetIDSelector.clone(),
                                     jetIDSelector = inputJetIDSelector.clone(),
                                     jetStudies = inputJetStudies.clone(ptMin = cms.double(50.0)),
                                     pfJetStudies = inputPFJetStudies.clone(ptMin = cms.double(50.0)),
                                     plotParameters = cms.PSet ( doTracks = cms.bool(False),
                                                                 useMC = cms.bool(False)
                                                                 )
                                     )


process.p = cms.Path(
    process.multijetAna
    )

process.MessageLogger.cerr.FwkReport.reportEvery = 10000
Exemplo n.º 22
0
import FWCore.ParameterSet.Config as cm

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
from Analysis.BoostedTopAnalysis.BoostedTopWTagParams_cfi import *

wPlusBJetAnalysis = cms.PSet(WPlusBJetEventSelection=cms.PSet(
    jetSrc=cms.InputTag("selectedPatJetsCA8PrunedPF"),
    trigSrc=cms.InputTag("patTriggerEvent"),
    trig=cms.string("HLT_Jet50U"),
    pfJetIDParams=cms.PSet(pfJetIDSelector.clone()),
    BoostedTopWJetParameters=boostedTopWTagParams.clone(),
    jetPtMin=cms.double(30.0),
    jetEtaMax=cms.double(3.0),
    bTagAlgorithm=cms.string("trackCountingHighEffBJetTags"),
    bTagOP=cms.double(3.3),
    bTagOPMedium=cms.double(3.3),
    bTagOPLoose=cms.double(1.7),
    mistagFileName=cms.string("mistag.root"),
    leadJetPtCut=cms.double(200),
    secondJetPtCut=cms.double(150),
    thirdJetPtCut=cms.double(50),
    fourthJetPtCut=cms.double(30),
    wMassMin=cms.double(60),
    wMassMax=cms.double(100),
    topMassMin=cms.double(140),
    topMassMax=cms.double(230)),
                             runOnData=cms.bool(False),
                             runOnTTbar=cms.bool(False),
                             debugOn=cms.bool(False))
Exemplo n.º 23
0
                                               src = cms.InputTag("patJetsAK4PFCHS"),
                                               cut = cms.string("pt > 15.0")
                                               )
process.selectedPatJetsAK8PFCHS =process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK8PFCHS")
process.selectedPatJetsAK10PFCHS=process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK10PFCHS")
process.selectedPatJetsAK12PFCHS=process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK12PFCHS")
process.selectedPatJetsAK15PFCHS=process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK15PFCHS")

process.selectedPatJetsAK8PFCHSFilteredPacked =process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK8PFCHSFilteredPacked")
process.selectedPatJetsAK10PFCHSFilteredPacked=process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK10PFCHSFilteredPacked")
process.selectedPatJetsAK12PFCHSFilteredPacked=process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK12PFCHSFilteredPacked")
process.selectedPatJetsAK15PFCHSFilteredPacked=process.selectedPatJetsAK4PFCHS.clone(cut="pt > 150.0", src="patJetsAK15PFCHSFilteredPacked")

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
process.goodPatJetsAK4PFCHS = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                           filterParams = pfJetIDSelector.clone(),
                                           src = cms.InputTag("selectedPatJetsAK4PFCHS")
                                           )
process.goodPatJetsAK8PFCHS=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK8PFCHS")
process.goodPatJetsAK10PFCHS=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK10PFCHS")
process.goodPatJetsAK12PFCHS=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK12PFCHS")
process.goodPatJetsAK15PFCHS=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK15PFCHS")

process.goodPatJetsAK8PFCHSFilteredPacked =process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK8PFCHSFilteredPacked")
process.goodPatJetsAK10PFCHSFilteredPacked=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK10PFCHSFilteredPacked")
process.goodPatJetsAK12PFCHSFilteredPacked=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK12PFCHSFilteredPacked")
process.goodPatJetsAK15PFCHSFilteredPacked=process.goodPatJetsAK4PFCHS.clone(src="selectedPatJetsAK15PFCHSFilteredPacked")

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#JECs for telescoping
import FWCore.ParameterSet.Config as cms

from FWCore.MessageService.MessageLogger_cfi import *
from Configuration.StandardSequences.FrontierConditions_GlobalTag_cff import *
from Configuration.StandardSequences.MagneticField_cff import *
from Configuration.Geometry.GeometryIdeal_cff import *
#from Configuration.StandardSequences.Geometry_cff import *
from TrackingTools.TransientTrack.TransientTrackBuilder_cfi import *

GlobalTag.globaltag = cms.string('START52_V10::All')

from TerraNova.CommonTools.countingSequences_cfi import *
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
myJetId = pfJetIDSelector.clone()

from TerraNova.NtupleMaker.wLeptonSelector_cfi import *
from TerraNova.NtupleMaker.triggerFilterByRun_cfi import *
from TerraNova.NtupleMaker.wHLTfilter_cff import *
from TerraNova.CommonTools.PileUpWeight_cff import *
from TerraNova.CommonTools.JetEnergyScale_cfi import *

VertexFilter = cms.EDFilter(
    'VertexFilter',
    vertexLabel=cms.InputTag('offlinePrimaryVertices'),
    min=cms.untracked.int32(1),
    max=cms.untracked.int32(999),
)

GenZmassFilter = cms.EDFilter(
    'GenZmassFilter',
    genParticlesLabel=cms.InputTag('genParticles'),
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_3_1_KJi.root',
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_4_1_eL8.root',
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_5_1_KDn.root',
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_6_1_IqT.root',
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_7_1_9vU.root',
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_8_1_sE3.root',
        ##            'dcache:/pnfs/cms/WAX/11/store/user/jstupak/snowmass/jstupak/DYToLL_M_20_TuneZ2star_14TeV_pythia6/DYToLL_M_20_TuneZ2star_14TeV_pythia6_Summer12_PU50bx25_POSTLS161_V12_v1_AODSIM/0b89362859f64009081d5401e4e9f0ea/pat_53x_test_v03_9_1_bli.root',
    ),
    skipEvents=cms.untracked.uint32(eventsToSkip),
)

##########################################
# Apply loose PF jet ID
from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
process.ak5PFGoodJets = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                     filterParams=pfJetIDSelector.clone(),
                                     src=cms.InputTag("selectedPatJetsPFlow"),
                                     filter=cms.bool(True))

process.ak5PFJetsLooseId = cms.EDFilter("PATJetRefSelector",
                                        src=cms.InputTag("ak5PFGoodJets"),
                                        cut=cms.string('pt > 20.0'))

process.SnowmassTree = cms.EDAnalyzer(
    "SnowmassTreeProducer",
    HistOutFile=cms.string(outFileName),
    srcJets=cms.InputTag("ak5PFJetsLooseId"),
)

#process.outpath.remove(process.out)
process.p = cms.Path(process.ak5PFGoodJets * process.ak5PFJetsLooseId *
Exemplo n.º 26
0
import FWCore.ParameterSet.Config as cm

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
from Analysis.BoostedTopAnalysis.BoostedTopWTagParams_cfi import *

wPlusBJetAnalysis = cms.PSet(
    WPlusBJetEventSelection = cms.PSet( 
      jetSrc = cms.InputTag( "selectedPatJetsCA8PrunedPF" ),
      trigSrc = cms.InputTag( "patTriggerEvent" ),
      trig    = cms.string( "HLT_Jet50U" ),
      pfJetIDParams = cms.PSet( pfJetIDSelector.clone() ),
      BoostedTopWJetParameters  = boostedTopWTagParams.clone( ),
      jetPtMin  = cms.double(30.0),
      jetEtaMax = cms.double(3.0),
      bTagAlgorithm = cms.string( "trackCountingHighEffBJetTags" ),
      bTagOP   = cms.double( 3.3 ),
      bTagOPMedium = cms.double( 3.3 ),
      bTagOPLoose = cms.double(1.7),
      mistagFileName = cms.string("mistag.root"),
      leadJetPtCut = cms.double(200),
      secondJetPtCut  = cms.double(150),
      thirdJetPtCut   = cms.double(50),
      fourthJetPtCut  = cms.double(30),
      wMassMin    = cms.double(60),
      wMassMax    = cms.double(100),
      topMassMin  = cms.double(140),
      topMassMax  = cms.double(230)
    ),

    runOnData = cms.bool( False ),
    runOnTTbar = cms.bool( False ),