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  precision = cms.int32(14),
69  storeLHEParticles = cms.bool(True)
70 )
71 
72 l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False))
73 
74 nanoSequence = cms.Sequence(
75  nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+
76  isoTrackSequence + # must be after all the leptons
77  linkedObjects +
78  jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + triggerObjectTables + isoTrackTables +
79  l1bits)
80 
81 nanoSequenceMC = cms.Sequence(genParticleSequence + particleLevelSequence + nanoSequence + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + genWeightsTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable )
82 
83 
85  return process
86 
87 def nanoAOD_customizeData(process):
88  process = nanoAOD_customizeCommon(process)
89  if hasattr(process,'calibratedPatElectrons80X'):
90  process.calibratedPatElectrons80X.isMC = cms.bool(False)
91  process.calibratedPatPhotons80X.isMC = cms.bool(False)
92  return process
93 
94 def nanoAOD_customizeMC(process):
95  process = nanoAOD_customizeCommon(process)
96  if hasattr(process,'calibratedPatElectrons80X'):
97  process.calibratedPatElectrons80X.isMC = cms.bool(True)
98  process.calibratedPatPhotons80X.isMC = cms.bool(True)
99  return process
100 
101 ### Era dependent customization
102 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
103 _80x_sequence = nanoSequence.copy()
104 #remove stuff
105 _80x_sequence.remove(isoTrackTable)
106 _80x_sequence.remove(isoTrackSequence)
107 
108 run2_miniAOD_80XLegacy.toReplaceWith( nanoSequence, _80x_sequence)
109 
110 
111 
def nanoAOD_customizeMC(process)
Definition: nano_cff.py:94
def nanoAOD_customizeCommon(process)
Definition: nano_cff.py:84
def nanoAOD_customizeData(process)
Definition: nano_cff.py:87