Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-23 02:25:55

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask
0004 
0005 process = cms.Process("PAT")
0006 
0007 ## MessageLogger
0008 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0009 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0010 
0011 ## Options and Output Report
0012 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
0013 
0014 ## Source
0015 process.source = cms.Source("PoolSource",
0016     fileNames = cms.untracked.vstring()
0017 )
0018 ## Maximal Number of Events
0019 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
0020 
0021 ## Geometry and Detector Conditions (needed for a few patTuple production steps)
0022 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0023 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0024 from Configuration.AlCa.GlobalTag import GlobalTag
0025 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc')
0026 process.load("Configuration.StandardSequences.MagneticField_cff")
0027 
0028 ## Output Module Configuration (expects a path 'p')
0029 from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
0030 process.out = cms.OutputModule("PoolOutputModule",
0031                                fileName = cms.untracked.string('patTuple.root'),
0032                                ## save only events passing the full path
0033                                #SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('p') ),
0034                                ## save PAT output; you need a '*' to unpack the list of commands
0035                                ## 'patEventContent'
0036                                outputCommands = cms.untracked.vstring('drop *', *patEventContentNoCleaning )
0037                                )
0038 
0039 patAlgosToolsTask = getPatAlgosToolsTask(process)
0040 process.outpath = cms.EndPath(process.out, patAlgosToolsTask)
0041 
0042 ## and add them to the event content
0043 from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection,addJetCollection
0044 
0045 ## Puppi
0046 jetSeq = cms.Sequence()
0047 process.load("CommonTools.PileupAlgos.Puppi_cff")
0048 #process.puppi.candName = cms.InputTag( 'particleFlow' ) 
0049 jetSeq += process.puppi
0050 
0051 from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJetsPuppi
0052 process.ak8PFJetsPuppi = ak4PFJetsPuppi.clone( src = cms.InputTag( 'puppi' ),
0053                                                doAreaFastjet = True, 
0054                                                rParam = 0.8, 
0055                                                jetAlgorithm = 'AntiKt' )
0056 jetSeq += process.ak8PFJetsPuppi
0057 
0058 process.jetSequence = jetSeq
0059 
0060 addJetCollection(
0061    process,
0062    #labelName = 'AK8PFCHS',
0063    labelName = 'AK8PFPuppi',
0064    #jetSource = cms.InputTag('ak8PFJetsPuppi'),
0065    jetSource = cms.InputTag('ak8PFJetsPuppi'),
0066    #pvSource = cms.InputTag('offlinePrimaryVertices'),
0067    #svSource = cms.InputTag('inclusiveCandidateSecondaryVertices'),
0068    algo = 'AK',
0069    rParam = 0.8,
0070    #jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'Type-2'),
0071    jetCorrections = ('AK8PFPuppi', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'Type-2'),
0072    btagDiscriminators = [
0073       'pfBoostedDoubleSecondaryVertexAK8BJetTags',
0074       'pfDeepDoubleBvLJetTags:probQCD', 
0075       'pfDeepDoubleBvLJetTags:probHbb', 
0076       ]
0077    )
0078 
0079 #process.patJetsAK8PFCHS.addTagInfos = True
0080 process.patJetsAK8PFPuppi.addTagInfos = True
0081 
0082 from pdb import set_trace
0083 
0084 from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpMINIAODSIM
0085 
0086 process.source.fileNames = filesRelValTTbarPileUpMINIAODSIM
0087 #process.source.fileNames = cms.untracked.vstring('root://cmsxrootd.fnal.gov//store/mc/PhaseIFall16MiniAOD/TT_TuneCUETP8M2T4_13TeV-powheg-pythia8/MINIAODSIM/PhaseIFall16PUFlat20to50_PhaseIFall16_81X_upgrade2017_realistic_v26-v1/50000/08358A47-61E3-E611-8B77-001E677928AE.root')
0088 
0089 process.source.fileNames = cms.untracked.vstring('root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_1_0_pre2/RelValTTbar_13/GEN-SIM-DIGI-RECO/100X_mcRun2_asymptotic_v2_FastSim-v1/20000/228EFC7D-351F-E811-AB67-0025905A612A.root',
0090                                                  'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_1_0_pre2/RelValTTbar_13/GEN-SIM-DIGI-RECO/100X_mcRun2_asymptotic_v2_FastSim-v1/20000/7E149C80-291F-E811-BA0C-0CC47A745250.root',
0091                                                  'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_1_0_pre2/RelValTTbar_13/GEN-SIM-DIGI-RECO/100X_mcRun2_asymptotic_v2_FastSim-v1/20000/8AE4CC80-F41E-E811-892E-0025905AA9CC.root',
0092                                                  'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_1_0_pre2/RelValTTbar_13/GEN-SIM-DIGI-RECO/100X_mcRun2_asymptotic_v2_FastSim-v1/20000/D418B3BA-B51E-E811-B2A8-0CC47A4C8E98.root',)
0093 #'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/0EA8CDD5-47B2-E611-B64D-A0369F7FC608.root',)
0094 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/1A83C5CE-92B2-E611-9BC8-00266CFCC490.root',
0095 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/1C4B543D-49B2-E611-805D-008CFA1983E0.root',
0096 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/24B383E8-3FB2-E611-B9F3-549F35AE4FFD.root',
0097 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/402CD384-4BB2-E611-A05B-A0369F7FC608.root',
0098 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/8A8BE646-4FB2-E611-BA79-008CFA05E874.root',
0099 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/E2ACFBFE-44B2-E611-B744-00266CFCC860.root',
0100 #                                                 'root://cmsxrootd.fnal.gov//store/mc/RunIISummer16DR80Premix/BulkGravTohhTohbbhbb_narrow_M-2500_13TeV-madgraph/AODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/DE3318DE-43B2-E611-93E8-A0369F7FC210.root')
0101 
0102 process.maxEvents.input = -1
0103 
0104 from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
0105 #process.out.outputCommands = MINIAODSIMEventContent.outputCommands
0106 process.out.outputCommands = patEventContentNoCleaning
0107 process.out.outputCommands.append('keep *_ak8PFJetsPuppi*_*_*')
0108 process.out.outputCommands.append('keep *_offlinePrimaryVertices*_*_*')
0109 process.out.outputCommands.append('keep *_inclusiveCandidateSecondaryVertices*_*_*')
0110 process.out.outputCommands.append('keep *_selectedPatJets*_*_*')
0111 process.out.outputCommands.append('keep *_selectedUpdatedPatJets*_*_*')
0112 process.out.outputCommands.append('keep *_pfBoostedDoubleSVAK8TagInfos*_*_*')
0113 process.out.outputCommands.append('keep *_pfDeepDoubleXTagInfos*_*_*')
0114 process.out.outputCommands.append('keep *_updatedPatJets*_*_*')
0115 
0116 print(process.out.outputCommands)
0117 process.out.fileName = 'test_deep_doubleb_AODSIM.root'
0118 
0119 #                                         ##
0120 #   process.options.wantSummary = False   ##  (to suppress the long output at the end of the job)
0121 # process.add_(cms.Service("InitRootHandlers", DebugLevel =cms.untracked.int32(3)))
0122 
0123 
0124 #Trick to make it work in >=9_1_X
0125 process.tsk = cms.Task()
0126 for mod in process.producers_().values():
0127     process.tsk.add(mod)
0128 for mod in process.filters_().values():
0129     process.tsk.add(mod)
0130 
0131 process.p = cms.Path(
0132     process.jetSequence,
0133     process.tsk
0134     )