CMS 3D CMS Logo

nano_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
13 from PhysicsTools.NanoAOD.met_cff import *
17 
18 
19 nanoMetadata = cms.EDProducer("UniqueStringProducer",
20  strings = cms.PSet(
21  tag = cms.string("untagged"),
22  )
23 )
24 
25 linkedObjects = cms.EDProducer("PATObjectCrossLinker",
26  jets=cms.InputTag("finalJets"),
27  muons=cms.InputTag("finalMuons"),
28  electrons=cms.InputTag("finalElectrons"),
29  taus=cms.InputTag("finalTaus"),
30  photons=cms.InputTag("finalPhotons"),
31 )
32 
33 simpleCleanerTable = cms.EDProducer("NanoAODSimpleCrossCleaner",
34  name=cms.string("cleanmask"),
35  doc=cms.string("simple cleaning mask with priority to leptons"),
36  jets=cms.InputTag("linkedObjects","jets"),
37  muons=cms.InputTag("linkedObjects","muons"),
38  electrons=cms.InputTag("linkedObjects","electrons"),
39  taus=cms.InputTag("linkedObjects","taus"),
40  photons=cms.InputTag("linkedObjects","photons"),
41  jetSel=cms.string("pt>15"),
42  muonSel=cms.string("isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
43  electronSel=cms.string(""),
44  tauSel=cms.string(""),
45  photonSel=cms.string(""),
46  jetName=cms.string("Jet"),muonName=cms.string("Muon"),electronName=cms.string("Electron"),
47  tauName=cms.string("Tau"),photonName=cms.string("Photon")
48 )
49 
50 
51 genWeightsTable = cms.EDProducer("GenWeightsTableProducer",
52  genEvent = cms.InputTag("generator"),
53  lheInfo = cms.InputTag("externalLHEProducer"),
54  preferredPDFs = cms.VPSet( # see https://lhapdf.hepforge.org/pdfsets.html
55  cms.PSet( name = cms.string("PDF4LHC15_nnlo_30_pdfas"), lhaid = cms.uint32(91400) ),
56  cms.PSet( name = cms.string("NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
57  cms.PSet( name = cms.string("NNPDF30_nlo_as_0118"), lhaid = cms.uint32(260000) ), # for some 92X samples. Note that the nominal weight, 260000, is not included in the LHE ...
58  cms.PSet( name = cms.string("NNPDF30_lo_as_0130"), lhaid = cms.uint32(262000) ), # some MLM 80X samples have only this (e.g. /store/mc/RunIISummer16MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v2/120000/02A210D6-F5C3-E611-B570-008CFA197BD4.root )
59  ),
60  namedWeightIDs = cms.vstring(),
61  namedWeightLabels = cms.vstring(),
62  lheWeightPrecision = cms.int32(14),
63  maxPdfWeights = cms.uint32(150),
64  debug = cms.untracked.bool(False),
65 )
66 lheInfoTable = cms.EDProducer("LHETablesProducer",
67  lheInfo = cms.InputTag("externalLHEProducer"),
68 )
69 
70 l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False))
71 
72 nanoSequence = cms.Sequence(
73  nanoMetadata + muonSequence + jetSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+
74  isoTrackSequence + # must be after all the leptons
75  linkedObjects +
76  jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + triggerObjectTables + isoTrackTables +
77  l1bits)
78 
79 nanoSequenceMC = cms.Sequence(genParticleSequence + particleLevelSequence + nanoSequence + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + genWeightsTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable )
80 
81 
83  return process
84 
85 def nanoAOD_customizeData(process):
86  process = nanoAOD_customizeCommon(process)
87  process.calibratedPatElectrons.isMC = cms.bool(False)
88  process.calibratedPatPhotons.isMC = cms.bool(False)
89  return process
90 
91 def nanoAOD_customizeMC(process):
92  process = nanoAOD_customizeCommon(process)
93  process.calibratedPatElectrons.isMC = cms.bool(True)
94  process.calibratedPatPhotons.isMC = cms.bool(True)
95  return process
96 
97 ### Era dependent customization
98 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
99 _80x_sequence = nanoSequence.copy()
100 #remove stuff
101 _80x_sequence.remove(isoTrackTable)
102 _80x_sequence.remove(isoTrackSequence)
103 
104 run2_miniAOD_80XLegacy.toReplaceWith( nanoSequence, _80x_sequence)
105 
106 
107 
def nanoAOD_customizeMC(process)
Definition: nano_cff.py:91
def nanoAOD_customizeCommon(process)
Definition: nano_cff.py:82
def nanoAOD_customizeData(process)
Definition: nano_cff.py:85