File indexing completed on 2023-10-25 10:05:31
0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 import sys
0004
0005
0006 process = cms.Process("Analyzer")
0007 process.options = cms.untracked.PSet(
0008 wantSummary = cms.untracked.bool(True)
0009 )
0010
0011
0012 options = VarParsing.VarParsing ('standard')
0013 options.register('runOnAOD', True, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool, "run on AOD")
0014
0015
0016 if( hasattr(sys, "argv") ):
0017 for args in sys.argv :
0018 arg = args.split(',')
0019 for val in arg:
0020 val = val.split('=')
0021 if(len(val)==2):
0022 setattr(options,val[0], val[1])
0023
0024
0025 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0026 process.MessageLogger.cerr.threshold = 'INFO'
0027 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0028
0029
0030 if options.runOnAOD:
0031 process.source = cms.Source("PoolSource",
0032 fileNames = cms.untracked.vstring(
0033
0034
0035 '/store/mc/Spring14dr/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/AODSIM/PU_S14_POSTLS170_V6-v1/00000/00120F7A-84F5-E311-9FBE-002618943910.root',
0036
0037
0038
0039 ),
0040 skipEvents = cms.untracked.uint32(0)
0041 )
0042 else:
0043 process.source = cms.Source("PoolSource",
0044 fileNames = cms.untracked.vstring(
0045
0046
0047
0048 '/store/mc/RunIISpring15DR74/TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-scaledown-pythia8/MINIAODSIM/Asympt50ns_MCRUN2_74_V9A-v2/50000/FEA9ADAC-FB0B-E511-9B8C-00266CF9AB9C.root',
0049
0050
0051 ),
0052 skipEvents = cms.untracked.uint32(0)
0053 )
0054
0055
0056 process.maxEvents = cms.untracked.PSet(
0057 input = cms.untracked.int32(1000)
0058 )
0059
0060 process.task = cms.Task()
0061
0062
0063 genParticleCollection = ''
0064 genJetCollection = ''
0065 if options.runOnAOD:
0066 genParticleCollection = 'genParticles'
0067 genJetCollection = 'ak4GenJetsCustom'
0068
0069 from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu
0070 process.genParticlesForJetsCustom = genParticlesForJetsNoNu.clone()
0071 process.task.add(process.genParticlesForJetsCustom)
0072
0073 from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets
0074 process.ak4GenJetsCustom = ak4GenJets.clone(
0075 src = 'genParticlesForJetsCustom',
0076 rParam = cms.double(0.4),
0077 jetAlgorithm = cms.string("AntiKt")
0078 )
0079 process.task.add(process.ak4GenJetsCustom)
0080 else:
0081 genParticleCollection = 'prunedGenParticles'
0082 genJetCollection = 'slimmedGenJets'
0083
0084
0085 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0086
0087
0088
0089
0090 from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons
0091 process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone(
0092 particles = genParticleCollection
0093 )
0094 process.task.add(process.selectedHadronsAndPartons)
0095
0096
0097
0098
0099
0100 from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos
0101 process.genJetFlavourInfos = ak4JetFlavourInfos.clone(
0102 jets = genJetCollection,
0103 )
0104 process.task.add(process.genJetFlavourInfos)
0105
0106
0107
0108 from PhysicsTools.JetMCAlgos.GenHFHadronMatcher_cff import matchGenBHadron
0109 process.matchGenBHadron = matchGenBHadron.clone(
0110 genParticles = genParticleCollection,
0111 jetFlavourInfos = "genJetFlavourInfos"
0112 )
0113 process.task.add(process.matchGenBHadron)
0114
0115
0116
0117 from PhysicsTools.JetMCAlgos.GenHFHadronMatcher_cff import matchGenCHadron
0118 process.matchGenCHadron = matchGenCHadron.clone(
0119 genParticles = genParticleCollection,
0120 jetFlavourInfos = "genJetFlavourInfos"
0121 )
0122 process.task.add(process.matchGenCHadron)
0123
0124
0125
0126 from TopQuarkAnalysis.TopTools.categorizeGenTtbar_cfi import categorizeGenTtbar
0127 process.categorizeGenTtbar = categorizeGenTtbar.clone(
0128 genJetPtMin = 20.,
0129 genJetAbsEtaMax = 2.4,
0130 genJets = genJetCollection,
0131 )
0132 process.task.add(process.categorizeGenTtbar)
0133
0134
0135 process.testGenTtbarCategories = cms.EDAnalyzer("TestGenTtbarCategories",
0136 genTtbarId = cms.InputTag("categorizeGenTtbar", "genTtbarId")
0137 )
0138
0139
0140 process.TFileService = cms.Service("TFileService",
0141 fileName = cms.string("genTtbarId.root")
0142 )
0143
0144
0145 process.p1 = cms.Path(
0146 process.testGenTtbarCategories,
0147 process.task
0148 )