Beispiel #1
0
# Set the process options -- Display summary at the end, enable unscheduled execution
process.options.allowUnscheduled = cms.untracked.bool(True)
process.options.wantSummary = cms.untracked.bool(False)

# How many events to process
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(10))

#configurable options =======================================================================
usePrivateSQlite = False  #use external JECs (sqlite file)
useHFCandidates = True  #create an additionnal NoHF slimmed MET collection if the option is set to false
redoPuppi = False  # rebuild puppiMET
#===================================================================

### External JECs =====================================================================================================
process.load(
    'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.autoCond import autoCond
if runOnData:
    process.GlobalTag.globaltag = autoCond['run2_data']
else:
    process.GlobalTag.globaltag = autoCond['run2_mc']

if usePrivateSQlite:
    from CondCore.DBCommon.CondDBSetup_cfi import *
    import os
    if runOnData:
        era = "Summer15_25nsV6_DATA"
    else:
        era = "Summer15_25nsV6_MC"

    process.jec = cms.ESSource(
## import skeleton process
from PhysicsTools.PatAlgos.patTemplate_cfg import cms, process, patAlgosToolsTask
#process.Tracer = cms.Service("Tracer")

process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff")
patAlgosToolsTask.add(process.patCandidatesTask)

process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff")
patAlgosToolsTask.add(process.selectedPatCandidatesTask)

process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff")
patAlgosToolsTask.add(process.inclusiveVertexingTask)
patAlgosToolsTask.add(process.inclusiveCandidateVertexingTask)
patAlgosToolsTask.add(process.inclusiveCandidateVertexingCvsLTask)

process.load("PhysicsTools.PatAlgos.slimming.slimming_cff")
patAlgosToolsTask.add(process.slimmingTask)

from PhysicsTools.PatAlgos.slimming.miniAOD_tools import miniAOD_customizeCommon, miniAOD_customizeMC
miniAOD_customizeCommon(process)
miniAOD_customizeMC(process)

## add command line parsing for cmsRun
## ussage is:
## cmsRun RecoTauTag/Configuration/test/edmTauVariables_slimmed_cfg.py inputFiles_load==RecoTauTag/Configuration/test/ZTT-validation.py \
## outputFile=MyOutputFile.root maxEvents=100
##
## get more inof here: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideAboutPythonConfigFile#Passing_Command_Line_Arguments_T
from FWCore.ParameterSet.VarParsing import VarParsing
def createProcess(runOnMC, runCHS, correctMETWithT1, processCaloJets, processCA8Jets, globalTag):

  ## import skeleton process
  from PhysicsTools.PatAlgos.patTemplate_cfg import process

  # load the PAT config
  process.load("PhysicsTools.PatAlgos.patSequences_cff")
  process.load("JetMETCorrections.Configuration.JetCorrectionProducers_cff")

  # Do some CHS stuff
  process.ak5PFchsL1Fastjet  = process.ak5PFL1Fastjet.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsL2Relative = process.ak5PFL2Relative.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsL3Absolute = process.ak5PFL3Absolute.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsResidual   = process.ak5PFResidual.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsL1FastL2L3 = cms.ESProducer(
      'JetCorrectionESChain',
      correctors = cms.vstring('ak5PFchsL1Fastjet', 'ak5PFchsL2Relative','ak5PFchsL3Absolute')
      )


  from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector

  ## The good primary vertex filter ____________________________________________||
  ## This filter throw events with no primary 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)
      )

  process.goodOfflinePrimaryVertices = cms.EDFilter("PrimaryVertexObjectFilter",
      filterParams = pvSelector.clone( minNdof = cms.double(4.0), maxZ = cms.double(24.0) ),
      src = cms.InputTag('offlinePrimaryVertices')
      )

  # Configure PAT to use PF2PAT instead of AOD sources
  # this function will modify the PAT sequences.
  from PhysicsTools.PatAlgos.tools.coreTools import removeSpecificPATObjects, removeMCMatching
  from PhysicsTools.PatAlgos.tools.pfTools import usePF2PAT, adaptPFIsoElectrons, adaptPVs, usePFIso
  #from PhysicsTools.PatAlgos.tools.metTools import *

  def usePF2PATForAnalysis(jetAlgo, postfix, useTypeIMET, usePFNoPU):

    # Jet corrections
    # No L2L3 Residual on purpose
    if usePFNoPU:
      jetCorrections = ("%sPFchs" % algo, ['L1FastJet', 'L2Relative', 'L3Absolute'])
      postfix += "chs"
    else:
      jetCorrections = ("%sPF" % algo, ['L1FastJet', 'L2Relative', 'L3Absolute'])

    #if not runOnMC:
    #  jetCorrections[1].append('L2L3Residual')

    p = postfix

    usePF2PAT(process, runPF2PAT=True, jetAlgo=jetAlgo, runOnMC=runOnMC, postfix=p, jetCorrections=jetCorrections, typeIMetCorrections = useTypeIMET)
    getattr(process, "pfPileUp" + p).Enable = True
    getattr(process, "pfPileUp" + p).Vertices = 'goodOfflinePrimaryVertices'
    getattr(process, "pfPileUp" + p).checkClosestZVertex = cms.bool(False)

    getattr(process, "pfJets" + p).doAreaFastjet = cms.bool(True)
    getattr(process, "pfJets" + p).doRhoFastjet = False
    getattr(process, 'patJetCorrFactors' + p).rho = cms.InputTag("kt6PFJets", "rho") # Do not use kt6PFJetsPFlowAK5, it's not ok for L1FastJet.

    # top projections in PF2PAT:
    getattr(process,"pfNoPileUp" + p).enable = cms.bool(usePFNoPU)
    getattr(process,"pfNoMuon" + p).enable = True
    getattr(process,"pfNoElectron" + p).enable = True
    getattr(process,"pfNoTau" + p).enable = True
    getattr(process,"pfNoJet" + p).enable = True

    getattr(process,"patElectrons" + p).embedTrack = True

    getattr(process,"patMuons" + p).embedTrack = True
    # enable delta beta correction for muon selection in PF2PAT?
    getattr(process,"pfIsolatedMuons" + p).doDeltaBetaCorrection = True

    getattr(process, "patJets" + p).embedPFCandidates = False
    # Keep only jets with pt > 2 Gev
    getattr(process, "selectedPatJets" + p).cut = "pt > 2";

    # Use a cone of 0.3 for photon isolation
    #adaptPFIsoPhotons(process, applyPostfix(process, "patPhotons", postfix), postfix, "03")

    # 2012 Photon ID

    # Electron conversion
    setattr(process, "patConversions" + p, cms.EDProducer("PATConversionProducer",
        # input collection
        electronSource = cms.InputTag("selectedPatElectrons" + p)
    ))

    # Switch electron isolation to dR = 0.3, for PF2PAT
    getattr(process, "pfIsolatedElectrons" + p).isolationValueMapsCharged = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFId" + p))
    getattr(process, "pfIsolatedElectrons" + p).deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFId" + p)
    getattr(process, "pfIsolatedElectrons" + p).isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("elPFIsoValueNeutral03PFId" + p), cms.InputTag("elPFIsoValueGamma03PFId" + p))

    getattr(process, "pfElectrons" + p).isolationValueMapsCharged  = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFId" + p))
    getattr(process, "pfElectrons" + p).deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFId" + p)
    getattr(process, "pfElectrons" + p).isolationValueMapsNeutral  = cms.VInputTag(cms.InputTag( "elPFIsoValueNeutral03PFId" + p), cms.InputTag("elPFIsoValueGamma03PFId" + p))

    # ... And for PAT
    adaptPFIsoElectrons(process, getattr(process, "pfElectrons" + p), p, "03")

    
    if runOnMC:
      cloneProcessingSnippet(process, getattr(process, "makePatMuons" + p), "Loose" + p, p)
      getattr(process, "muonMatchLoose" + p).src = cms.InputTag("pfMuons" + p)
      getattr(process, "patMuonsLoose" + p).pfMuonSource = cms.InputTag("pfMuons" + p)
      getattr(process, "patDefaultSequence" + p).replace(getattr(process, "makePatMuons" + p), getattr(process, "makePatMuons" + p) + getattr(process, "makePatMuonsLoose" + p))
    else:
      setattr(process, "patMuonsLoose" + p, getattr(process, "patMuons" + p).clone(
          pfMuonSource = cms.InputTag("pfMuons" + p)
        )
      )

    setattr(process, "selectedPatMuonsLoose" + p, getattr(process, "selectedPatMuons" + p).clone(
        src = cms.InputTag("patMuonsLoose" + p)
      )
    )
    sequence = getattr(process, "patDefaultSequence" + p)

    if not runOnMC:
      sequence += getattr(process, "patMuonsLoose" + p)

    sequence += (getattr(process, "selectedPatMuonsLoose" + p))

    setattr(process, "patElectronsLoose" + p, getattr(process, "patElectrons" + p).clone(
        pfElectronSource = cms.InputTag("pfElectrons" + p)
      )
    )
    setattr(process, "selectedPatElectronsLoose" + p, getattr(process, "selectedPatElectrons" + p).clone(
        src = cms.InputTag("patElectronsLoose" + p)
      )
    )
    adaptPFIsoElectrons(process, getattr(process, "patElectronsLoose" + p), postfix, "03")
    sequence = getattr(process, "patDefaultSequence" + p)
    sequence += (getattr(process, "patElectronsLoose" + p) * getattr(process, "selectedPatElectronsLoose" + p))


    #giulia turn off qg tagger
    ## Setup quark gluon tagger
    #process.load('QuarkGluonTagger.EightTeV.QGTagger_RecoJets_cff')
    #cloneProcessingSnippet(process, process.QuarkGluonTagger, p)
    #getattr(process, "QGTagger" + p).srcJets = cms.InputTag("selectedPatJets" + p)
    #getattr(process, "QGTagger" + p).isPatJet = cms.untracked.bool(True)
    #getattr(process, "QGTagger" + p).useCHS = cms.untracked.bool(usePFNoPU)

    ## Remove the processing of primary vertices, as it's already what we do here
    #getattr(process, 'QGTagger' + p).srcPV = cms.InputTag('goodOfflinePrimaryVertices')
    #getattr(process, 'QuarkGluonTagger' + p).remove(getattr(process, 'goodOfflinePrimaryVerticesQG' + p))

    if not runOnMC:
      if 'L2L3Residual' in jetCorrections:
        getattr(process, 'patPFJetMETtype1p2Corr' + p).jetCorrLabel = 'L2L3Residual'
      getattr(process, 'patPFMet' + p).addGenMET = cms.bool(False)

    names = ["Taus"]
    #if jetAlgo != "AK5":
      #names += ["Electrons", "Muons"]
    if len(names) > 0:
      removeSpecificPATObjects(process, names = names, outputModules = ['out'], postfix = p) 

    adaptPVs(process, pvCollection = cms.InputTag("goodOfflinePrimaryVertices"), postfix = p)

    getattr(process, "patDefaultSequence" + p).replace(getattr(process, "selectedPatElectrons" + p), getattr(process, "selectedPatElectrons" + p) + getattr(process, "patConversions" + p))

    #getattr(process, "patDefaultSequence" + p).replace(getattr(process, "selectedPatJets" + p), getattr(process, "selectedPatJets" + p) + getattr(process, "QuarkGluonTagger" + p))

    return getattr(process, "patPF2PATSequence" + p)

  if correctMETWithT1:
    process.load("PhysicsTools.PatUtils.patPFMETCorrections_cff")
    
  from PhysicsTools.PatAlgos.tools.helpers import cloneProcessingSnippet

  print "##########################"
  print "PF jets with PF2PAT"
  print "Using Type I met" if correctMETWithT1 else "NOT using Type I met"
  print "##########################"

  #runCHS = False

  postfixes = {'PFlowAK5': 'AK5'}
  #postfixes = {'PFlowAK5': 'AK5', 'PFlowAK7': 'AK7', 'PFlowCA8': 'CA8'}
  #postfixes = {'PFlowCA8': 'CA8'}

  ##giulia turn off qg tagger
  ## Setup quark gluon tagger
  #process.load('QuarkGluonTagger.EightTeV.QGTagger_RecoJets_cff')

  process.sequence_chs = cms.Sequence()
  process.sequence_nochs = cms.Sequence()
  for p, algo in postfixes.items():
    process.sequence_nochs += usePF2PATForAnalysis(jetAlgo=algo, postfix=p, usePFNoPU=False, useTypeIMET=correctMETWithT1)
    if runCHS:
      process.sequence_chs   += usePF2PATForAnalysis(jetAlgo=algo, postfix=p, usePFNoPU=True, useTypeIMET=correctMETWithT1)

  #  setattr(process, 'QGTagger' + p, process.QGTagger.clone())
  #  getattr(process, "QGTagger" + p).srcJets = cms.InputTag("selectedPatJets" + p)
  #  getattr(process, "QGTagger" + p).isPatJet = cms.untracked.bool(True)
  #  getattr(process, "QGTagger" + p).useCHS = cms.untracked.bool(False)
  #
  #  process.QuarkGluonTagger.replace(process.QGTagger, getattr(process, 'QGTagger' + p))

    if runCHS:
      chsP = p + "chs"
  
  #    setattr(process, 'QGTagger' + chsP, process.QGTagger.clone())
  #    getattr(process, "QGTagger" + chsP).srcJets = cms.InputTag("selectedPatJets" + chsP)
  #    getattr(process, "QGTagger" + chsP).isPatJet = cms.untracked.bool(True)
  #    getattr(process, "QGTagger" + chsP).useCHS = cms.untracked.bool(True)
  
  #    process.QuarkGluonTagger.replace(getattr(process, 'QGTagger' + p), getattr(process, 'QGTagger' + p) + getattr(process, 'QGTagger' + chsP))
  
  print "##########################"
  print "Calo jets" if processCaloJets else "No processing of calo jets"
  print "##########################"

  usePFIso(process, "")
  #adaptPFIsoPhotons(process,  process.patPhotons, "", "03")

  # chiara init ----------------------------------
  print "##########################"
  print "CA8 Jets" if processCA8Jets else "No processing of CA8 jets collection"
  print "##########################"

  if processCA8Jets:

    from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection

    # Reco CA 0.8 jets 
    # non sapendo quali parametri usare esattamente lascerei i default della reco per ora.
    # Per doAreaFastjet e doRhoFastjet per il momento usiamo quanto e' ridefinito sopra
    from RecoJets.JetProducers.ca4PFJets_cfi import ca4PFJets
    process.ca8PFJetsPFlow = ca4PFJets.clone(
      rParam = cms.double(0.8)
      # src = cms.InputTag('pfNoElectron'+postfix),    
      # doAreaFastjet = cms.bool(True),   
      # doRhoFastjet = cms.bool(True),    
      # Rho_EtaMax = cms.double(6.0),    
      # Ghost_EtaMax = cms.double(7.0)   
      )

    # Gen CA 0.8 jets
    from RecoJets.JetProducers.ca4GenJets_cfi import ca4GenJets
    process.ca8GenJetsNoNu = ca4GenJets.clone(
      rParam = cms.double(0.8),
      src = cms.InputTag("genParticlesForJetsNoNu")
      )
  # chiara end ----------------------------------

  
  if processCaloJets:

    # No L2L3 Residual on purpose
    jetCorrections = ('AK5Calo', ['L1Offset', 'L2Relative', 'L3Absolute'])

    addJetCollection(process, cms.InputTag('ak7CaloJets'),
        'AK7',
        'Calo',
        doJTA            = True,
        doBTagging       = True,
        jetCorrLabel     = jetCorrections,
        doType1MET       = correctMETWithT1,
        doL1Cleaning     = False,
        doL1Counters     = False,
        genJetCollection = cms.InputTag("ak7GenJets"),
        doJetID          = True,
        jetIdLabel       = "ak7"
        )



    switchJetCollection(process, cms.InputTag('ak5CaloJets'),
        doJTA            = True,
        doBTagging       = True,
        jetCorrLabel     = jetCorrections,
        doType1MET       = correctMETWithT1,
        genJetCollection = cms.InputTag("ak5GenJets"),
        doJetID          = True,
        jetIdLabel       = "ak5"
        )

    process.selectedPatJets.cut = "pt > 2"
    process.selectedPatJetsAK7Calo.cut = "pt > 2"

  else:
    removeSpecificPATObjects(process, names = ['Jets', 'METs'])

  if not runOnMC:
    # Remove MC Matching
    removeMCMatching(process, names = ["All"])

  removeSpecificPATObjects(process, names = ['Electrons', 'Muons', 'Taus'])

  if runCHS:
    print "##########################"
    print "Running CHS sequence"
    print "##########################"

  process.analysisSequence = cms.Sequence()

  process.analysisSequence *= process.sequence_nochs
  #if runCHS:
  #  process.analysisSequence *= process.sequence_chs

  # chiara init ----------------------------------
  if processCA8Jets:
    process.analysisSequence *= process.ca8PFJetsPFlow
    print("done process.ca8PFJetsPFlow")
    process.analysisSequence *= process.ca8GenJetsNoNu
    print("done process.ca8GenJetsNoNu")

    # nuovo


  # chiara end ----------------------------------


  #GIULIA
  # Quark Gluon tagging
  #process.analysisSequence *= process.QuarkGluonTagger

  # Add default pat sequence to our path
  # This brings to life TcMET, Calo jets and Photons
  ########process.analysisSequence *= process.patDefaultSequence

  # Add our PhotonIsolationProducer to the analysisSequence. This producer compute pf isolations
  # for our photons
  process.photonPFIsolation = cms.EDProducer("PhotonIsolationProducer",
      src = cms.InputTag("selectedPatPhotons")
      )

  ##########process.analysisSequence *= process.photonPFIsolation

  # Filtering

  # require physics declared
  process.load('HLTrigger.special.hltPhysicsDeclared_cfi')
  process.hltPhysicsDeclared.L1GtReadoutRecordTag = 'gtDigis'

  # require scraping filter
  process.scrapingVeto = cms.EDFilter("FilterOutScraping",
      applyfilter = cms.untracked.bool(True),
      debugOn = cms.untracked.bool(False),
      numtrack = cms.untracked.uint32(10),
      thresh = cms.untracked.double(0.25)
      )

  # Count events
  process.nEventsTotal    = cms.EDProducer("EventCountProducer")
  process.nEventsFiltered = cms.EDProducer("EventCountProducer")

  # MET Filters
  process.load("RecoMET.METFilters.metFilters_cff")

  # HCAL Laser filter : work only on Winter13 rereco
  process.load("EventFilter.HcalRawToDigi.hcallaserFilterFromTriggerResult_cff")

  # Let it run
  process.p = cms.Path(
      process.nEventsTotal +

      # Filters
      process.hcalfilter +
      process.primaryVertexFilter +
      process.scrapingVeto +
      process.metFilters +

      process.goodOfflinePrimaryVertices +

      # Physics
      process.analysisSequence +

      process.nEventsFiltered
      )

  if runOnMC:
    process.p.remove(process.hcalfilter)
    process.p.remove(process.scrapingVeto)

  # Add PF2PAT output to the created file
  from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
  #process.load("CommonTools.ParticleFlow.PF2PAT_EventContent_cff")
  process.out.outputCommands = cms.untracked.vstring('drop *',    
                                                     #process.out.outputCommands = cms.untracked.vstring('keep *')   #'drop *',
                                                     'keep *_*_*_SIM',
                                                     'keep *_*_*_HLT',
                                                     'keep *_*_*_RECO',
                                                     'keep *_*ca8*_*_PAT')
      #'keep *_photonCore_*_*',
      #'keep double_kt6*Jets*_rho_*',
      #'keep *_goodOfflinePrimaryVertices_*_*',
      #'keep recoPFCandidates_particleFlow_*_*',

      # Content of *patEventContentNoCleaning
      #'keep *_selectedPatPhotons*_*_*', 'keep *_selectedPatElectrons*_*_*', 'keep *_selectedPatMuons*_*_*', 'keep *_selectedPatTaus*_*_*', 'keep *_selectedPatJets*_*_*', 'drop *_selectedPatJets_pfCandidates_*', 'drop *_*PF_caloTowers_*', 'drop *_*JPT_pfCandidates_*', 'drop *_*Calo_pfCandidates_*', 'keep *_patMETs*_*_*', 'keep *_selectedPatPFParticles*_*_*', 'keep *_selectedPatTrackCands*_*_*',
      #'keep *_cleanPatPhotons*_*_*', 'keep *_cleanPatElectrons*_*_*', 'keep *_cleanPatMuons*_*_*', 'keep *_cleanPatTaus*_*_*',
      #'keep *_cleanPatJets*_*_*', 'keep *_cleanPatHemispheres*_*_*', 'keep *_cleanPatPFParticles*_*_*',
      #'keep *_cleanPatTrackCands*_*_*',
      #'drop *_*PFlow_caloTowers_*',
                                                     
      # Type I residual
      #'drop *_selectedPatJetsForMET*_*_PAT',
      #'keep *_patPFMet*_*_PAT', # Keep raw met

      # Trigger
      #'keep *_TriggerResults_*_HLT',

      # Debug
      #'keep *_pf*_*_PAT'

      # Photon ID
      #'keep *_patConversions*_*_*',
      #'keep *_photonPFIsolation*_*_*',

      # Quark Gluon tagging
      #'keep *_QGTagger*_*_*',
      #'drop *_kt6PFJetsIsoQG_*_PAT',
      #'drop *_kt6PFJetsQG_*_PAT',
      # MC truth
      #'keep *_genParticles_*_*'
      #)

  if runOnMC:
    process.out.outputCommands.extend(['keep *_addPileupInfo_*_*', 'keep *_generator_*_*'])

  # switch on PAT trigger
  # from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
  # switchOnTrigger( process )

  ## ------------------------------------------------------
  #  In addition you usually want to change the following
  #  parameters:
  ## ------------------------------------------------------
  #
  process.GlobalTag.globaltag = "%s::All" % (globalTag) ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
  #                                         ##
  #process.source.fileNames =  cms.untracked.vstring('file:input_data.root')  ##  (e.g. 'file:AOD.root')
  #                                         ##
  #process.maxEvents.input = 2500
  process.maxEvents.input = 5000
  #                                         ##
  #   process.out.outputCommands = [ ... ]  ##  (e.g. taken from PhysicsTools/PatAlgos/python/patEventContent_cff.py)
  #                                         ##
  process.options.wantSummary = False   ##  (to suppress the long output at the end of the job)
  process.MessageLogger.cerr.FwkReport.reportEvery = 1000

  # Remove annoying ecalLaser messages
  process.MessageLogger.suppressError = cms.untracked.vstring ('ecalLaserCorrFilter')

  return process
## import skeleton process
from PhysicsTools.PatAlgos.patTemplate_cfg import cms, process
## switch to uncheduled mode
process.options.allowUnscheduled = cms.untracked.bool(True)
#process.Tracer = cms.Service("Tracer")

process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff")
process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff")

## ------------------------------------------------------
#  In addition you usually want to change the following
#  parameters:
## ------------------------------------------------------
#
#   process.GlobalTag.globaltag =  ...    ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
#                                         ##
#process.source.fileNames = {'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU25ns_POSTLS170_V3-v2/00000/5A98DF7C-C998-E311-8FF8-003048FEADBC.root'}
process.source.fileNames = [
    '/store/relval/CMSSW_7_1_0_pre6/RelValTTbar_13/GEN-SIM-RECO/PRE_LS171_V5-v1/00000/064AD022-51C7-E311-9714-003048679228.root',
    '/store/relval/CMSSW_7_1_0_pre6/RelValTTbar_13/GEN-SIM-RECO/PRE_LS171_V5-v1/00000/A43E68DF-3CC7-E311-A17E-002618943811.root',
]

##'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/36598DF8-D098-E311-972E-02163E00E744.root'}
#                                         ##
process.maxEvents.input = 100

process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")

process.load("PhysicsTools.PatAlgos.slimming.slimming_cff")
process.load("RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff")
Beispiel #5
0
## import skeleton process
from PhysicsTools.PatAlgos.patTemplate_cfg import cms, process
## switch to uncheduled mode
process.options.allowUnscheduled = cms.untracked.bool(True)
#process.Tracer = cms.Service("Tracer")

process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff")
process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff")

## ------------------------------------------------------
#  In addition you usually want to change the following
#  parameters:
## ------------------------------------------------------
#
#   process.GlobalTag.globaltag =  ...    ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
#                                         ##
#process.source.fileNames = {'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU25ns_POSTLS170_V3-v2/00000/5A98DF7C-C998-E311-8FF8-003048FEADBC.root'}
process.source.fileNames = {
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/265B9219-FF98-E311-BF4A-02163E00EA95.root',
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/36598DF8-D098-E311-972E-02163E00E744.root',
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/542AC938-CA98-E311-8928-02163E00E5F5.root',
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/6A95EE20-CD98-E311-8FAE-02163E00A1F2.root',
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/822E181D-D898-E311-8A29-02163E00E928.root',
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/E00EF5A1-CE98-E311-B221-02163E00E8AE.root',
'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/F60ED2AC-CB98-E311-ACBA-02163E00E62F.root'
}

##'/store/relval/CMSSW_7_0_0/RelValTTbar_13/GEN-SIM-RECO/PU50ns_POSTLS170_V4-v2/00000/36598DF8-D098-E311-972E-02163E00E744.root'}
#                                         ##
process.maxEvents.input = -1
Beispiel #6
0
def runTree(process) :
        process.load('SUSYBSMAnalysis.DesySusy.SusyDESY_RunTreeMaker_cfi')
        return cms.Path(process.runTree)
## This cfg file sets up the process object, loads the geometry & detector
## conditions, and calls the standard PAT sequences.
from PhysicsTools.PatAlgos.patTemplate_cfg import process

## Load functions to tailor PAT for our needs
from UserAnalysis.WZAnalysis.wzPatTools import *

## The 'analysis mode' selected below will determine selections about modules
## and filters to include.  For generated samples, mode should be "MC"; for
## data, mode should be "EG" or "Mu" depending on the dataset.  The hltMuFilter
## will be used to ensure no overlap between the EG and Mu datasets.
mode = analysisMode("EG")

## MessageLogger
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 50
process.MessageLogger.suppressWarning += ["patTrigger"]
process.MessageLogger.cerr.limit = cms.uint32(1)

## Options and Output Report
process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True))

## Maximal Number of Events
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000))

## GlobalTag
#process.GlobalTag.globaltag = 'GR_P_V14::All'
process.GlobalTag.globaltag = 'GR_R_311_V2::All'

## Source
# Set the process options -- Display summary at the end, enable unscheduled execution
process.options.allowUnscheduled = cms.untracked.bool(True)
process.options.wantSummary = cms.untracked.bool(False)

# How many events to process
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(10))

#configurable options =======================================================================
runOnData = False  #data/MC switch
usePrivateSQlite = False  #use external JECs (sqlite file)
useHFCandidates = True  #create an additionnal NoHF slimmed MET collection if the option is set to false
redoPuppi = False  # rebuild puppiMET
#===================================================================

### External JECs =====================================================================================================
process.load(
    'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.autoCond import autoCond
if runOnData:
    process.GlobalTag.globaltag = autoCond['run2_data']
else:
    process.GlobalTag.globaltag = autoCond['run2_mc']

if usePrivateSQlite:
    from CondCore.DBCommon.CondDBSetup_cfi import *
    import os
    if runOnData:
        era = "Summer15_25nsV6_DATA"
    else:
        era = "Summer15_25nsV6_MC"

    process.jec = cms.ESSource(
def createProcess(runOnMC, runCHS, correctMETWithT1, processCaloJets, globalTag):

  ## import skeleton process
  from PhysicsTools.PatAlgos.patTemplate_cfg import process

  # load the PAT config
  process.load("PhysicsTools.PatAlgos.patSequences_cff")
  process.load("JetMETCorrections.Configuration.JetCorrectionProducers_cff")

  # Do some CHS stuff
  process.ak5PFchsL1Fastjet  = process.ak5PFL1Fastjet.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsL2Relative = process.ak5PFL2Relative.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsL3Absolute = process.ak5PFL3Absolute.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsResidual   = process.ak5PFResidual.clone(algorithm = 'AK5PFchs')
  process.ak5PFchsL1FastL2L3 = cms.ESProducer(
      'JetCorrectionESChain',
      correctors = cms.vstring('ak5PFchsL1Fastjet', 'ak5PFchsL2Relative','ak5PFchsL3Absolute')
      )


  from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector

  ## The good primary vertex filter ____________________________________________||
  ## This filter throw events with no primary 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)
      )

  process.goodOfflinePrimaryVertices = cms.EDFilter("PrimaryVertexObjectFilter",
      filterParams = pvSelector.clone( minNdof = cms.double(4.0), maxZ = cms.double(24.0) ),
      src = cms.InputTag('offlinePrimaryVertices')
      )

  # Configure PAT to use PF2PAT instead of AOD sources
  # this function will modify the PAT sequences.
  from PhysicsTools.PatAlgos.tools.coreTools import removeSpecificPATObjects, removeMCMatching
  from PhysicsTools.PatAlgos.tools.pfTools import usePF2PAT, adaptPFIsoElectrons, adaptPVs, usePFIso
  #from PhysicsTools.PatAlgos.tools.metTools import *

  def usePF2PATForAnalysis(jetAlgo, postfix, useTypeIMET, usePFNoPU):

    # Jet corrections
    # No L2L3 Residual on purpose
    if usePFNoPU:
      jetCorrections = ("%sPFchs" % algo, ['L1FastJet', 'L2Relative', 'L3Absolute'])
      postfix += "chs"
    else:
      jetCorrections = ("%sPF" % algo, ['L1FastJet', 'L2Relative', 'L3Absolute'])

    #if not runOnMC:
    #  jetCorrections[1].append('L2L3Residual')

    p = postfix

    usePF2PAT(process, runPF2PAT=True, jetAlgo=jetAlgo, runOnMC=runOnMC, postfix=p, jetCorrections=jetCorrections, typeIMetCorrections = useTypeIMET)
    getattr(process, "pfPileUp" + p).Enable = True
    getattr(process, "pfPileUp" + p).Vertices = 'goodOfflinePrimaryVertices'
    getattr(process, "pfPileUp" + p).checkClosestZVertex = cms.bool(False)

    getattr(process, "pfJets" + p).doAreaFastjet = cms.bool(True)
    getattr(process, "pfJets" + p).doRhoFastjet = False
    getattr(process, 'patJetCorrFactors' + p).rho = cms.InputTag("kt6PFJets", "rho") # Do not use kt6PFJetsPFlowAK5, it's not ok for L1FastJet.

    # top projections in PF2PAT:
    getattr(process,"pfNoPileUp" + p).enable = cms.bool(usePFNoPU)
    getattr(process,"pfNoMuon" + p).enable = True
    getattr(process,"pfNoElectron" + p).enable = True
    getattr(process,"pfNoTau" + p).enable = True
    getattr(process,"pfNoJet" + p).enable = True

    getattr(process,"patElectrons" + p).embedTrack = True

    getattr(process,"patMuons" + p).embedTrack = True
    # enable delta beta correction for muon selection in PF2PAT?
    getattr(process,"pfIsolatedMuons" + p).doDeltaBetaCorrection = True

    getattr(process, "patJets" + p).embedPFCandidates = False
    # Keep only jets with pt > 2 Gev
    getattr(process, "selectedPatJets" + p).cut = "pt > 2";

    # Use a cone of 0.3 for photon isolation
    #adaptPFIsoPhotons(process, applyPostfix(process, "patPhotons", postfix), postfix, "03")

    # 2012 Photon ID

    # Electron conversion
    setattr(process, "patConversions" + p, cms.EDProducer("PATConversionProducer",
        # input collection
        electronSource = cms.InputTag("selectedPatElectrons" + p)
    ))

    # Switch electron isolation to dR = 0.3, for PF2PAT
    getattr(process, "pfIsolatedElectrons" + p).isolationValueMapsCharged = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFId" + p))
    getattr(process, "pfIsolatedElectrons" + p).deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFId" + p)
    getattr(process, "pfIsolatedElectrons" + p).isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("elPFIsoValueNeutral03PFId" + p), cms.InputTag("elPFIsoValueGamma03PFId" + p))

    getattr(process, "pfElectrons" + p).isolationValueMapsCharged  = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFId" + p))
    getattr(process, "pfElectrons" + p).deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFId" + p)
    getattr(process, "pfElectrons" + p).isolationValueMapsNeutral  = cms.VInputTag(cms.InputTag( "elPFIsoValueNeutral03PFId" + p), cms.InputTag("elPFIsoValueGamma03PFId" + p))

    # ... And for PAT
    adaptPFIsoElectrons(process, getattr(process, "pfElectrons" + p), p, "03")

##there used to be a modulo to keep track of muons gen info, doesnt work anymore and we don't use that info - so removed for now.
    setattr(process, "patMuonsLoose" + p, getattr(process, "patMuons" + p).clone(
        pfMuonSource = cms.InputTag("pfMuons" + p),
        embedGenMatch = False,
        addGenMatch = False
      )
    )

    setattr(process, "selectedPatMuonsLoose" + p, getattr(process, "selectedPatMuons" + p).clone(
        src = cms.InputTag("patMuonsLoose" + p)
      )
    )
    sequence = getattr(process, "patDefaultSequence" + p)

    sequence += getattr(process, "patMuonsLoose" + p)

    sequence += (getattr(process, "selectedPatMuonsLoose" + p))

    setattr(process, "patElectronsLoose" + p, getattr(process, "patElectrons" + p).clone(
        pfElectronSource = cms.InputTag("pfElectrons" + p)
      )
    )
    setattr(process, "selectedPatElectronsLoose" + p, getattr(process, "selectedPatElectrons" + p).clone(
        src = cms.InputTag("patElectronsLoose" + p)
      )
    )
    adaptPFIsoElectrons(process, getattr(process, "patElectronsLoose" + p), postfix, "03")
    sequence = getattr(process, "patDefaultSequence" + p)
    sequence += (getattr(process, "patElectronsLoose" + p) * getattr(process, "selectedPatElectronsLoose" + p))


    # Setup quark gluon tagger
    #process.load('QuarkGluonTagger.EightTeV.QGTagger_RecoJets_cff')
    #cloneProcessingSnippet(process, process.QuarkGluonTagger, p)
    #getattr(process, "QGTagger" + p).srcJets = cms.InputTag("selectedPatJets" + p)
    #getattr(process, "QGTagger" + p).isPatJet = cms.untracked.bool(True)
    #getattr(process, "QGTagger" + p).useCHS = cms.untracked.bool(usePFNoPU)

    ## Remove the processing of primary vertices, as it's already what we do here
    #getattr(process, 'QGTagger' + p).srcPV = cms.InputTag('goodOfflinePrimaryVertices')
    #getattr(process, 'QuarkGluonTagger' + p).remove(getattr(process, 'goodOfflinePrimaryVerticesQG' + p))

    if not runOnMC:
      if 'L2L3Residual' in jetCorrections:
        getattr(process, 'patPFJetMETtype1p2Corr' + p).jetCorrLabel = 'L2L3Residual'
      getattr(process, 'patPFMet' + p).addGenMET = cms.bool(False)

    names = ["Taus"]
    #if jetAlgo != "AK5":
      #names += ["Electrons", "Muons"]
    if len(names) > 0:
      removeSpecificPATObjects(process, names = names, outputModules = ['out'], postfix = p) 

    adaptPVs(process, pvCollection = cms.InputTag("goodOfflinePrimaryVertices"), postfix = p)

    getattr(process, "patDefaultSequence" + p).replace(getattr(process, "selectedPatElectrons" + p), getattr(process, "selectedPatElectrons" + p) + getattr(process, "patConversions" + p))

    #getattr(process, "patDefaultSequence" + p).replace(getattr(process, "selectedPatJets" + p), getattr(process, "selectedPatJets" + p) + getattr(process, "QuarkGluonTagger" + p))

    return getattr(process, "patPF2PATSequence" + p)

  if correctMETWithT1:
    process.load("PhysicsTools.PatUtils.patPFMETCorrections_cff")
    
  from PhysicsTools.PatAlgos.tools.helpers import cloneProcessingSnippet

  print "##########################"
  print "PF jets with PF2PAT"
  print "Using Type I met" if correctMETWithT1 else "NOT using Type I met"
  print "##########################"

  #runCHS = False

  #postfixes = {'PFlowAK5': 'AK5', 'PFlowAK7': 'AK7'}
  postfixes = {'PFlowAK5': 'AK5'}

  # Setup quark gluon tagger
  process.load('QuarkGluonTagger.EightTeV.QGTagger_RecoJets_cff')

  process.sequence_chs = cms.Sequence()
  process.sequence_nochs = cms.Sequence()
  for p, algo in postfixes.items():
    process.sequence_nochs += usePF2PATForAnalysis(jetAlgo=algo, postfix=p, usePFNoPU=False, useTypeIMET=correctMETWithT1)
    if runCHS:
      process.sequence_chs   += usePF2PATForAnalysis(jetAlgo=algo, postfix=p, usePFNoPU=True, useTypeIMET=correctMETWithT1)

    setattr(process, 'QGTagger' + p, process.QGTagger.clone())
    getattr(process, "QGTagger" + p).srcJets = cms.InputTag("selectedPatJets" + p)
    getattr(process, "QGTagger" + p).isPatJet = cms.untracked.bool(True)
    getattr(process, "QGTagger" + p).useCHS = cms.untracked.bool(False)

    process.QuarkGluonTagger.replace(process.QGTagger, getattr(process, 'QGTagger' + p))

    if runCHS:
      chsP = p + "chs"

      setattr(process, 'QGTagger' + chsP, process.QGTagger.clone())
      getattr(process, "QGTagger" + chsP).srcJets = cms.InputTag("selectedPatJets" + chsP)
      getattr(process, "QGTagger" + chsP).isPatJet = cms.untracked.bool(True)
      getattr(process, "QGTagger" + chsP).useCHS = cms.untracked.bool(True)

      process.QuarkGluonTagger.replace(getattr(process, 'QGTagger' + p), getattr(process, 'QGTagger' + p) + getattr(process, 'QGTagger' + chsP))

  print "##########################"
  print "Calo jets" if processCaloJets else "No processing of calo jets"
  print "##########################"

  usePFIso(process, "")
  #adaptPFIsoPhotons(process,  process.patPhotons, "", "03")

  if processCaloJets:

    # No L2L3 Residual on purpose
    jetCorrections = ('AK5Calo', ['L1Offset', 'L2Relative', 'L3Absolute'])

    addJetCollection(process, cms.InputTag('ak7CaloJets'),
        'AK7',
        'Calo',
        doJTA            = True,
        doBTagging       = True,
        jetCorrLabel     = jetCorrections,
        doType1MET       = correctMETWithT1,
        doL1Cleaning     = False,
        doL1Counters     = False,
        genJetCollection = cms.InputTag("ak7GenJets"),
        doJetID          = True,
        jetIdLabel       = "ak7"
        )

    switchJetCollection(process, cms.InputTag('ak5CaloJets'),
        doJTA            = True,
        doBTagging       = True,
        jetCorrLabel     = jetCorrections,
        doType1MET       = correctMETWithT1,
        genJetCollection = cms.InputTag("ak5GenJets"),
        doJetID          = True,
        jetIdLabel       = "ak5"
        )

    process.selectedPatJets.cut = "pt > 2"
    process.selectedPatJetsAK7Calo.cut = "pt > 2"

  else:
    removeSpecificPATObjects(process, names = ['Jets', 'METs'])

  if not runOnMC:
    # Remove MC Matching
    removeMCMatching(process, names = ["All"])

  removeSpecificPATObjects(process, names = ['Electrons', 'Muons', 'Taus'])

  if runCHS:
    print "##########################"
    print "Running CHS sequence"
    print "##########################"

  process.analysisSequence = cms.Sequence()

  process.analysisSequence *= process.sequence_nochs
  if runCHS:
    process.analysisSequence *= process.sequence_chs

  # Quark Gluon tagging
  process.analysisSequence *= process.QuarkGluonTagger

  # Add default pat sequence to our path
  # This brings to life TcMET, Calo jets and Photons
  process.analysisSequence *= process.patDefaultSequence

  # Add our PhotonIsolationProducer to the analysisSequence. This producer compute pf isolations
  # for our photons
  process.photonPFIsolation = cms.EDProducer("PhotonIsolationProducer",
      src = cms.InputTag("selectedPatPhotons")
      )

  process.analysisSequence *= process.photonPFIsolation

  # Filtering

  # require physics declared
  process.load('HLTrigger.special.hltPhysicsDeclared_cfi')
  process.hltPhysicsDeclared.L1GtReadoutRecordTag = 'gtDigis'

  # require scraping filter
  process.scrapingVeto = cms.EDFilter("FilterOutScraping",
      applyfilter = cms.untracked.bool(True),
      debugOn = cms.untracked.bool(False),
      numtrack = cms.untracked.uint32(10),
      thresh = cms.untracked.double(0.25)
      )

  # Count events
  process.nEventsTotal    = cms.EDProducer("EventCountProducer")
  process.nEventsFiltered = cms.EDProducer("EventCountProducer")

  # MET Filters
  process.load("RecoMET.METFilters.metFilters_cff")

  # HCAL Laser filter : work only on Winter13 rereco
  process.load("EventFilter.HcalRawToDigi.hcallaserFilterFromTriggerResult_cff")

  #needed fot photon energy regression calculation
  process.load('Calibration.EleNewEnergiesProducer.elenewenergiesproducer_cfi')
  #getattr(process,"patPhotons" + p)
  process.patPhotons.userData.userFloats.src = [
        cms.InputTag("eleNewEnergiesProducer","energySCEleJoshPhoSemiParamV5ecorr")
            ]
## uncomment to run interactive
##  process.eleNewEnergiesProducer.regrPhoJoshV5_SemiParamFile = cms.string('../../../../src/HiggsAnalysis/GBRLikelihoodEGTools/data/regweights_v5_forest_ph.root')
##  process.eleNewEnergiesProducer.regrEleJoshV5_SemiParamFile = cms.string('../../../../src/HiggsAnalysis/GBRLikelihoodEGTools/data/regweights_v5_forest_ele.root')

        
  process.eleNewEnergiesProducer.electronCollection = getattr(process,"patPhotons" + p).photonSource

  # Let it run
  process.p = cms.Path(
      process.nEventsTotal +

      # Filters
      process.hcalfilter +
      process.primaryVertexFilter +
      process.scrapingVeto +
      process.metFilters +

      process.goodOfflinePrimaryVertices +
      # photon energy regression
      process.eleNewEnergiesProducer +
      # Physics
      process.analysisSequence +

      process.nEventsFiltered
      )

  if runOnMC:
    process.p.remove(process.hcalfilter)
    process.p.remove(process.scrapingVeto)

  # Add PF2PAT output to the created file
  from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
  #process.load("CommonTools.ParticleFlow.PF2PAT_EventContent_cff")
  process.out.outputCommands = cms.untracked.vstring('drop *',
      'keep *_photonCore_*_*',
      'keep double_kt6*Jets*_rho_*',
      'keep *_goodOfflinePrimaryVertices_*_*',
      'keep recoPFCandidates_particleFlow_*_*',
      # Content of *patEventContentNoCleaning
      'keep *_selectedPatPhotons*_*_*', 'keep *_selectedPatElectrons*_*_*', 'keep *_selectedPatMuons*_*_*', 'keep *_selectedPatTaus*_*_*', 'keep *_selectedPatJets*_*_*', 'drop *_selectedPatJets_pfCandidates_*', 'drop *_*PF_caloTowers_*', 'drop *_*JPT_pfCandidates_*', 'drop *_*Calo_pfCandidates_*', 'keep *_patMETs*_*_*', 'keep *_selectedPatPFParticles*_*_*', 'keep *_selectedPatTrackCands*_*_*',
      'keep *_cleanPatPhotons*_*_*', 'keep *_cleanPatElectrons*_*_*', 'keep *_cleanPatMuons*_*_*', 'keep *_cleanPatTaus*_*_*',
      'keep *_cleanPatJets*_*_*', 'keep *_cleanPatHemispheres*_*_*', 'keep *_cleanPatPFParticles*_*_*',
      'keep *_cleanPatTrackCands*_*_*',
      'drop *_*PFlow_caloTowers_*',
      # Type I residual
      'drop *_selectedPatJetsForMET*_*_PAT',
      'keep *_patPFMet*_*_PAT', # Keep raw met
      # Trigger
      'keep *_TriggerResults_*_HLT',
      # Debug
      #'keep *_pf*_*_PAT'
      # Photon ID
      'keep *_patConversions*_*_*',
      'keep *_photonPFIsolation*_*_*',
      # Quark Gluon tagging
      'keep *_QGTagger*_*_*',
      'drop *_kt6PFJetsIsoQG_*_PAT',
      'drop *_kt6PFJetsQG_*_PAT',
      # MC truth
      'keep *_genParticles_*_*',
      # RecHits
      'keep *EcalRecHit*_*_*_*',
      # Beam spot
      'keep *_offlineBeamSpot_*_*',
      #photon energy regression
      'keep *_eleNewEnergiesProducer_*_*' 
      )

  if runOnMC:
    process.out.outputCommands.extend(['keep *_addPileupInfo_*_*', 'keep *_generator_*_*'])

  # switch on PAT trigger
  # from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
  # switchOnTrigger( process )

  ## ------------------------------------------------------
  #  In addition you usually want to change the following
  #  parameters:
  ## ------------------------------------------------------
  #
  process.GlobalTag.globaltag = "%s::All" % (globalTag) ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
  #                                         ##
  #process.source.fileNames =  cms.untracked.vstring('file:input_data.root')  ##  (e.g. 'file:AOD.root')
  #                                         ##
  process.maxEvents.input = 2500
  #                                         ##
  #   process.out.outputCommands = [ ... ]  ##  (e.g. taken from PhysicsTools/PatAlgos/python/patEventContent_cff.py)
  #                                         ##
  process.options.wantSummary = False   ##  (to suppress the long output at the end of the job)
  process.MessageLogger.cerr.FwkReport.reportEvery = 1000

  # Remove annoying ecalLaser messages
  process.MessageLogger.suppressError = cms.untracked.vstring ('ecalLaserCorrFilter')

  return process
Beispiel #10
0
# How many events to process
process.maxEvents = cms.untracked.PSet( 
   input = cms.untracked.int32(10)
)

#configurable options =======================================================================
runOnData=False #data/MC switch
usePrivateSQlite=False #use external JECs (sqlite file)
useHFCandidates=True #create an additionnal NoHF slimmed MET collection if the option is set to false
redoPuppi=False # rebuild puppiMET
#===================================================================


### External JECs =====================================================================================================
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.autoCond import autoCond
if runOnData:
  process.GlobalTag.globaltag = autoCond['run2_data']
else:
  process.GlobalTag.globaltag = autoCond['run2_mc']

if usePrivateSQlite:
    from CondCore.DBCommon.CondDBSetup_cfi import *
    import os
    if runOnData:
      era="Summer15_25nsV6_DATA"
    else:
      era="Summer15_25nsV6_MC"
      
    process.jec = cms.ESSource("PoolDBESSource",CondDBSetup,
Beispiel #11
0
process.options.wantSummary = cms.untracked.bool(False) 

# How many events to process
process.maxEvents = cms.untracked.PSet( 
   input = cms.untracked.int32(10)
)

#configurable options =======================================================================
usePrivateSQlite=False #use external JECs (sqlite file)
useHFCandidates=True #create an additionnal NoHF slimmed MET collection if the option is set to false
redoPuppi=False # rebuild puppiMET
#===================================================================


### External JECs =====================================================================================================
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.autoCond import autoCond
if runOnData:
  process.GlobalTag.globaltag = autoCond['run2_data']
else:
  process.GlobalTag.globaltag = autoCond['run2_mc']

if usePrivateSQlite:
    from CondCore.DBCommon.CondDBSetup_cfi import *
    import os
    if runOnData:
      era="Summer15_25nsV6_DATA"
    else:
      era="Summer15_25nsV6_MC"
      
    process.jec = cms.ESSource("PoolDBESSource",CondDBSetup,