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

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

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

#process.load("PhysicsTools.PatUtils.patPFMETCorrections_cff")

# apply type I PFMEt corrections to pat::MET object
# and estimate systematic uncertainties on MET
from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD

runMetCorAndUncFromMiniAOD(process)
    

## ------------------------------------------------------
#  In addition you usually want to change the following
#  parameters:
## ------------------------------------------------------
#
#   process.GlobalTag.globaltag =  ...    ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
#                                         ##
## switch to RECO input
from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpMINIAODSIM
process.source.fileNames = filesRelValTTbarPileUpMINIAODSIM
#                                         ##
process.maxEvents.input = 10
#                                         ##
#   process.out.outputCommands = [ ... ]  ##  (e.g. taken from PhysicsTools/PatAlgos/python/patEventContent_cff.py)
#    
  
from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
process.out.outputCommands = MINIAODSIMEventContent.outputCommands
process.out.outputCommands.append("keep *_slimmedMETs_*_*")
process.out.outputCommands.append("keep *_patPFMet_*_*")
process.out.outputCommands.append("keep *_patCHSMet_*_*")
process.out.outputCommands.append("keep *_patTrkMet_*_*")
process.out.outputCommands.append("keep *_patPFMetT1_*_*")
process.out.outputCommands.append("keep *_patPFMetT1JetResDown_*_*")
process.out.outputCommands.append("keep *_patPFMetT1JetResUp_*_*")
                                   ##
process.out.fileName = 'patTuple_updateMet_fromMiniAOD.root'
#                                         ##
#   process.options.wantSummary = False   ##  (to suppress the long output at the end of the job)
