CMS 3D CMS Logo

nano_cff.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import FWCore.ParameterSet.Config as cms
15 from PhysicsTools.NanoAOD.met_cff import *
19 
20 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
21 from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016
22 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1
23 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2
24 from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1
25 
26 nanoMetadata = cms.EDProducer("UniqueStringProducer",
27  strings = cms.PSet(
28  tag = cms.string("untagged"),
29  )
30 )
31 
32 linkedObjects = cms.EDProducer("PATObjectCrossLinker",
33  jets=cms.InputTag("finalJets"),
34  muons=cms.InputTag("finalMuons"),
35  electrons=cms.InputTag("finalElectrons"),
36  taus=cms.InputTag("finalTaus"),
37  photons=cms.InputTag("finalPhotons"),
38 )
39 
40 simpleCleanerTable = cms.EDProducer("NanoAODSimpleCrossCleaner",
41  name=cms.string("cleanmask"),
42  doc=cms.string("simple cleaning mask with priority to leptons"),
43  jets=cms.InputTag("linkedObjects","jets"),
44  muons=cms.InputTag("linkedObjects","muons"),
45  electrons=cms.InputTag("linkedObjects","electrons"),
46  taus=cms.InputTag("linkedObjects","taus"),
47  photons=cms.InputTag("linkedObjects","photons"),
48  jetSel=cms.string("pt>15"),
49  muonSel=cms.string("track.isNonnull && isLooseMuon && isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
50  electronSel=cms.string(""),
51  tauSel=cms.string(""),
52  photonSel=cms.string(""),
53  jetName=cms.string("Jet"),muonName=cms.string("Muon"),electronName=cms.string("Electron"),
54  tauName=cms.string("Tau"),photonName=cms.string("Photon")
55 )
56 
57 btagSFdir="PhysicsTools/NanoAOD/data/btagSF/"
58 
59 btagWeightTable = cms.EDProducer("BTagSFProducer",
60  src = cms.InputTag("linkedObjects","jets"),
61  cut = cms.string("pt > 25. && abs(eta) < 2.5"),
62  discNames = cms.vstring(
63  "pfCombinedInclusiveSecondaryVertexV2BJetTags",
64  "pfDeepCSVJetTags:probb+pfDeepCSVJetTags:probbb", #if multiple MiniAOD branches need to be summed up (e.g., DeepCSV b+bb), separate them using '+' delimiter
65  "pfCombinedMVAV2BJetTags"
66  ),
67  discShortNames = cms.vstring(
68  "CSVV2",
69  "DeepCSVB",
70  "CMVA"
71  ),
72  weightFiles = cms.vstring( #default settings are for 2017 94X. toModify function is called later for other eras.
73  btagSFdir+"CSVv2_94XSF_V2_B_F.csv",
74  btagSFdir+"DeepCSV_94XSF_V2_B_F.csv",
75  "unavailable" #if SFs for an algorithm in an era is unavailable, the corresponding branch will not be stored
76  ),
77  operatingPoints = cms.vstring("3","3","3"), #loose = 0, medium = 1, tight = 2, reshaping = 3
78  measurementTypesB = cms.vstring("iterativefit","iterativefit","iterativefit"), #e.g. "comb", "incl", "ttbar", "iterativefit"
79  measurementTypesC = cms.vstring("iterativefit","iterativefit","iterativefit"),
80  measurementTypesUDSG = cms.vstring("iterativefit","iterativefit","iterativefit"),
81  sysTypes = cms.vstring("central","central","central")
82 )
83 
84 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: # to be updated when SF for Summer16MiniAODv3 MC will be available
85  modifier.toModify(btagWeightTable,
86  cut = cms.string("pt > 25. && abs(eta) < 2.4"), #80X corresponds to 2016, |eta| < 2.4
87  weightFiles = cms.vstring( #80X corresponds to 2016 SFs
88  btagSFdir+"CSVv2_Moriond17_B_H.csv",
89  "unavailable",
90  btagSFdir+"cMVAv2_Moriond17_B_H.csv"
91  )
92  )
93 
94 
95 genWeightsTable = cms.EDProducer("GenWeightsTableProducer",
96  genEvent = cms.InputTag("generator"),
97  genLumiInfoHeader = cms.InputTag("generator"),
98  lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")),
99  preferredPDFs = cms.VPSet( # see https://lhapdf.hepforge.org/pdfsets.html
100  cms.PSet( name = cms.string("PDF4LHC15_nnlo_30_pdfas"), lhaid = cms.uint32(91400) ),
101  cms.PSet( name = cms.string("NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
102  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 ...
103  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 )
104  cms.PSet( name = cms.string("NNPDF30_nlo_nf_4_pdfas"), lhaid = cms.uint32(292000) ), # some FXFX 80X samples have only this (e.g. WWTo1L1Nu2Q, WWTo4Q)
105  cms.PSet( name = cms.string("NNPDF30_nlo_nf_5_pdfas"), lhaid = cms.uint32(292200) ), # some FXFX 80X samples have only this (e.g. DYJetsToLL_Pt, WJetsToLNu_Pt, DYJetsToNuNu_Pt)
106  cms.PSet( name = cms.string("NNPDF31_lo_as_0130"), lhaid = cms.uint32(315200) ), # SUSY signal samples use this
107  ),
108  namedWeightIDs = cms.vstring(),
109  namedWeightLabels = cms.vstring(),
110  lheWeightPrecision = cms.int32(14),
111  keepAllPSWeights = cms.bool(False),
112  maxPdfWeights = cms.uint32(150),
113  debug = cms.untracked.bool(False),
114 )
115 lheInfoTable = cms.EDProducer("LHETablesProducer",
116  lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")),
117  precision = cms.int32(14),
118  storeLHEParticles = cms.bool(True)
119 )
120 
121 l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False))
122 
123 nanoSequenceCommon = cms.Sequence(
124  nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+
125  isoTrackSequence + jetLepSequence + # must be after all the leptons
126  linkedObjects +
127  jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables
128  )
129 nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTables + l1bits)
130 
131 nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyFullSim)
132 
133 nanoSequenceFS = cms.Sequence(genParticleSequence + particleLevelSequence + nanoSequenceCommon + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable )
134 
135 nanoSequenceMC = nanoSequenceFS.copy()
136 nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim)
137 
138 # modify extraFlagsTable to store ecalBadCalibFilter decision which is re-run with updated bad crystal list for 2017 and 2018 samples
139 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1:
140  modifier.toModify(extraFlagsTable, variables= cms.PSet())
141  modifier.toModify(extraFlagsTable, variables = dict(Flag_ecalBadCalibFilterV2 = ExtVar(cms.InputTag("ecalBadCalibFilterNanoTagger"), bool, doc = "Bad ECAL calib flag (updated xtal list)")))
142 
143 # modifier which adds new tauIDs (currently only deepTauId2017v2p1 is being added)
144 import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig
145 def nanoAOD_addTauIds(process):
146  updatedTauName = "slimmedTausUpdated"
147  tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, cms, debug = False, updatedTauName = updatedTauName,
148  toKeep = [ "deepTau2017v2p1" ])
149  tauIdEmbedder.runTauID()
150  process.patTauMVAIDsSeq.insert(process.patTauMVAIDsSeq.index(getattr(process, updatedTauName)),
151  process.rerunMvaIsolationSequence)
152  return process
153 
154 from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
155 def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour):
156  _btagDiscriminators=[]
157  if addDeepBTag:
158  print("Updating process to run DeepCSV btag")
159  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb','pfDeepCSVJetTags:probc']
160  if addDeepFlavour:
161  print("Updating process to run DeepFlavour btag")
162  _btagDiscriminators += ['pfDeepFlavourJetTags:probb','pfDeepFlavourJetTags:probbb','pfDeepFlavourJetTags:problepb','pfDeepFlavourJetTags:probc']
163  if len(_btagDiscriminators)==0: return process
164  print("Will recalculate the following discriminators: "+", ".join(_btagDiscriminators))
165  updateJetCollection(
166  process,
167  jetSource = cms.InputTag('slimmedJets'),
168  jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual']), 'None'),
169  btagDiscriminators = _btagDiscriminators,
170  postfix = 'WithDeepInfo',
171  )
172  process.load("Configuration.StandardSequences.MagneticField_cff")
173  process.jetCorrFactorsNano.src="selectedUpdatedPatJetsWithDeepInfo"
174  process.updatedJets.jetSource="selectedUpdatedPatJetsWithDeepInfo"
175  if addDeepFlavour:
176  process.pfDeepFlavourJetTagsWithDeepInfo.graph_path = 'RecoBTag/Combined/data/DeepFlavourV03_10X_training/constant_graph.pb'
177  process.pfDeepFlavourJetTagsWithDeepInfo.lp_names = ["cpf_input_batchnorm/keras_learning_phase"]
178  return process
179 
180 from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
181 #from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
182 def nanoAOD_recalibrateMETs(process,isData):
183  runMetCorAndUncFromMiniAOD(process,isData=isData)
184  process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.fullPatMetSequence))
185  process.basicJetsForMetForT1METNano = process.basicJetsForMet.clone(
186  src = process.updatedJetsWithUserData.src,
187  skipEM = False,
188  type1JetPtThreshold = 0.0,
189  calcMuonSubtrRawPtAsValueMap = cms.bool(True),
190  )
191  process.jetSequence.insert(process.jetSequence.index(process.updatedJetsWithUserData),cms.Sequence(process.basicJetsForMetForT1METNano))
192  process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt")
193  process.corrT1METJetTable.src = process.finalJets.src
194  process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9"
195  for table in process.jetTable, process.corrT1METJetTable:
196  table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6)
197  process.metTables += process.corrT1METJetTable
198 # makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID
199 # runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi")
200 # process.puppiNoLep.useExistingWeights = False
201 # process.puppi.useExistingWeights = False
202 # process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
203  return process
204 
206 def nanoAOD_activateVID(process):
207  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD)
208  for modname in electron_id_modules_WorkingPoints_nanoAOD.modules:
209  setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection)
210  process.electronSequence.insert(process.electronSequence.index(bitmapVIDForEle),process.egmGsfElectronIDSequence)
211  for modifier in run2_miniAOD_80XLegacy, :
212  modifier.toModify(process.electronMVAValueMapProducer, srcMiniAOD = "slimmedElectronsUpdated")
213  modifier.toModify(process.electronMVAVariableHelper, srcMiniAOD = "slimmedElectronsUpdated")
214  modifier.toModify(process.egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated")
215  if hasattr(process,"heepIDVarValueMaps"):
216  modifier.toModify(process.heepIDVarValueMaps, elesMiniAOD = "slimmedElectronsUpdated")
217  switchOnVIDPhotonIdProducer(process,DataFormat.MiniAOD) # do not call this to avoid resetting photon IDs in VID, if called before inside makePuppiesFromMiniAOD
218  for modname in photon_id_modules_WorkingPoints_nanoAOD.modules:
219  setupAllVIDIdsInModule(process,modname,setupVIDPhotonSelection)
220  process.photonSequence.insert(process.photonSequence.index(bitmapVIDForPho),process.egmPhotonIDSequence)
221  return process
222 
223 def nanoAOD_addDeepInfoAK8(process,addDeepBTag,addDeepBoostedJet, addDeepDoubleX, jecPayload):
224  _btagDiscriminators=[]
225  if addDeepBTag:
226  print("Updating process to run DeepCSV btag to AK8 jets")
227  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb']
228  if addDeepBoostedJet:
229  print("Updating process to run DeepBoostedJet on datasets before 103X")
230  from RecoBTag.MXNet.pfDeepBoostedJet_cff import pfDeepBoostedJetTags, pfMassDecorrelatedDeepBoostedJetTags
231  from RecoBTag.MXNet.pfDeepBoostedDiscriminatorsJetTags_cfi import pfDeepBoostedDiscriminatorsJetTags
232  from RecoBTag.MXNet.pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags_cfi import pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags
233  from RecoBTag.MXNet.Parameters.V02.pfDeepBoostedJetPreprocessParams_cfi import pfDeepBoostedJetPreprocessParams as pfDeepBoostedJetPreprocessParamsV02
234  from RecoBTag.MXNet.Parameters.V02.pfMassDecorrelatedDeepBoostedJetPreprocessParams_cfi import pfMassDecorrelatedDeepBoostedJetPreprocessParams as pfMassDecorrelatedDeepBoostedJetPreprocessParamsV02
235  pfDeepBoostedJetTags.preprocessParams = pfDeepBoostedJetPreprocessParamsV02
236  pfDeepBoostedJetTags.model_path = 'RecoBTag/Combined/data/DeepBoostedJet/V02/full/resnet-symbol.json'
237  pfDeepBoostedJetTags.param_path = 'RecoBTag/Combined/data/DeepBoostedJet/V02/full/resnet-0000.params'
238  pfMassDecorrelatedDeepBoostedJetTags.preprocessParams = pfMassDecorrelatedDeepBoostedJetPreprocessParamsV02
239  pfMassDecorrelatedDeepBoostedJetTags.model_path = 'RecoBTag/Combined/data/DeepBoostedJet/V02/decorrelated/resnet-symbol.json'
240  pfMassDecorrelatedDeepBoostedJetTags.param_path = 'RecoBTag/Combined/data/DeepBoostedJet/V02/decorrelated/resnet-0000.params'
241  # build sequence of taggers and discriminators as in RecoBTag.MXNet.pfDeepBoostedJet_cff
242  pfDeepBoostedJetTagsProbs = ['pfDeepBoostedJetTags:' + flav_name
243  for flav_name in pfDeepBoostedJetTags.flav_names]
244  pfDeepBoostedJetTagsMetaDiscrs = ['pfDeepBoostedDiscriminatorsJetTags:' + disc.name.value()
245  for disc in pfDeepBoostedDiscriminatorsJetTags.discriminators]
246  pfMassDecorrelatedDeepBoostedJetTagsProbs = ['pfMassDecorrelatedDeepBoostedJetTags:' + flav_name
247  for flav_name in pfMassDecorrelatedDeepBoostedJetTags.flav_names]
248  pfMassDecorrelatedDeepBoostedJetTagsMetaDiscrs = ['pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:' + disc.name.value()
249  for disc in pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags.discriminators]
250  pfDeepBoostedJetTagsAll = pfDeepBoostedJetTagsProbs + pfDeepBoostedJetTagsMetaDiscrs + \
251  pfMassDecorrelatedDeepBoostedJetTagsProbs + pfMassDecorrelatedDeepBoostedJetTagsMetaDiscrs
252  _btagDiscriminators += pfDeepBoostedJetTagsAll
253  if addDeepDoubleX:
254  print("Updating process to run DeepDoubleX on datasets before 104X")
255  _btagDiscriminators += ['pfDeepDoubleBvLJetTags:probHbb', \
256  'pfDeepDoubleCvLJetTags:probHcc', \
257  'pfDeepDoubleCvBJetTags:probHcc', \
258  'pfMassIndependentDeepDoubleBvLJetTags:probHbb', 'pfMassIndependentDeepDoubleCvLJetTags:probHcc', 'pfMassIndependentDeepDoubleCvBJetTags:probHcc']
259  if len(_btagDiscriminators)==0: return process
260  print("Will recalculate the following discriminators on AK8 jets: "+", ".join(_btagDiscriminators))
261  updateJetCollection(
262  process,
263  jetSource = cms.InputTag('slimmedJetsAK8'),
264  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
265  svSource = cms.InputTag('slimmedSecondaryVertices'),
266  rParam = 0.8,
267  jetCorrections = (jecPayload.value(), cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual']), 'None'),
268  btagDiscriminators = _btagDiscriminators,
269  postfix='AK8WithDeepInfo',
270  printWarning = False
271  )
272  process.jetCorrFactorsAK8.src="selectedUpdatedPatJetsAK8WithDeepInfo"
273  process.updatedJetsAK8.jetSource="selectedUpdatedPatJetsAK8WithDeepInfo"
274  return process
275 
276 from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
277 def nanoAOD_runMETfixEE2017(process,isData):
278  runMetCorAndUncFromMiniAOD(process,isData=isData,
279  fixEE2017 = True,
280  fixEE2017Params = {'userawPt': True, 'ptThreshold':50.0, 'minEtaThreshold':2.65, 'maxEtaThreshold': 3.139},
281  postfix = "FixEE2017")
282  process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),process.fullPatMetSequenceFixEE2017)
283 
285 # makePuppiesFromMiniAOD(process,True) # call this here as it calls switchOnVIDPhotonIdProducer
286  process = nanoAOD_activateVID(process)
287  nanoAOD_addDeepInfo_switch = cms.PSet(
288  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
289  nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(False),
290  )
291  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepBTag_switch = cms.untracked.bool(True))
292  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
293  modifier.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(True))
294  process = nanoAOD_addDeepInfo(process,
295  addDeepBTag=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepBTag_switch,
296  addDeepFlavour=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepFlavourTag_switch)
297  nanoAOD_addDeepInfoAK8_switch = cms.PSet(
298  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
299  nanoAOD_addDeepBoostedJet_switch = cms.untracked.bool(True), # will deactivate this in future miniAOD releases
300  nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(True),
301  jecPayload = cms.untracked.string('AK8PFPuppi')
302  )
303  # deepAK8 should not run on 80X, that contains ak8PFJetsCHS jets
304  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfoAK8_switch,
305  nanoAOD_addDeepBTag_switch = cms.untracked.bool(True),
306  nanoAOD_addDeepBoostedJet_switch = cms.untracked.bool(False),
307  nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(False),
308  jecPayload = cms.untracked.string('AK8PFchs'))
309  process = nanoAOD_addDeepInfoAK8(process,
310  addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
311  addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
312  addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
313  jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload)
314  (~run2_miniAOD_80XLegacy).toModify(process, lambda p : nanoAOD_addTauIds(p))
315  return process
316 
318  process = nanoAOD_customizeCommon(process)
319  process = nanoAOD_recalibrateMETs(process,isData=True)
320  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
321  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True))
322  return process
323 
324 def nanoAOD_customizeMC(process):
325  process = nanoAOD_customizeCommon(process)
326  process = nanoAOD_recalibrateMETs(process,isData=False)
327  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
328  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False))
329  return process
330 
331 ### Era dependent customization
332 _80x_sequence = nanoSequenceCommon.copy()
333 #remove stuff
334 _80x_sequence.remove(isoTrackTables)
335 _80x_sequence.remove(isoTrackSequence)
336 #add stuff
337 _80x_sequence.insert(_80x_sequence.index(jetSequence), extraFlagsProducers)
338 _80x_sequence.insert(_80x_sequence.index(simpleCleanerTable)+1, extraFlagsTable)
339 
340 run2_miniAOD_80XLegacy.toReplaceWith( nanoSequenceCommon, _80x_sequence)
341 
342 _102x_sequence = nanoSequenceCommon.copy()
343 #add stuff
344 _102x_sequence.insert(_102x_sequence.index(jetSequence),extraFlagsProducers102x)
345 _102x_sequence.insert(_102x_sequence.index(simpleCleanerTable)+1,extraFlagsTable)
346 
347 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1:
348  modifier.toReplaceWith(nanoSequenceCommon, _102x_sequence)
def nanoAOD_addDeepInfo(process, addDeepBTag, addDeepFlavour)
Definition: nano_cff.py:155
def switchOnVIDElectronIdProducer(process, dataFormat, task=None)
Electrons.
Definition: vid_id_tools.py:66
def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:31
def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, jecPayload)
Definition: nano_cff.py:223
def setupAllVIDIdsInModule(process, id_module_name, setupFunction, patProducer=None, addUserData=True, task=None)
Definition: vid_id_tools.py:49
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def nanoAOD_customizeMC(process)
Definition: nano_cff.py:324
def nanoAOD_activateVID(process)
Definition: nano_cff.py:206
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
def nanoAOD_customizeCommon(process)
Definition: nano_cff.py:284
def nanoAOD_recalibrateMETs(process, isData)
Definition: nano_cff.py:182
def nanoAOD_runMETfixEE2017(process, isData)
Definition: nano_cff.py:277
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def nanoAOD_addTauIds(process)
Definition: nano_cff.py:145
def switchOnVIDPhotonIdProducer(process, dataFormat, task=None)
Photons.
def runMetCorAndUncFromMiniAOD(process, metType="PF", jetCollUnskimmed="slimmedJets", photonColl="slimmedPhotons", electronColl="slimmedElectrons", muonColl="slimmedMuons", tauColl="slimmedTaus", pfCandColl="packedPFCandidates", jetFlavor="AK4PFchs", jetCleaning="LepClean", isData=False, manualJetConfig=False, reclusterJets=None, jetSelection="pt>15 && abs(eta)<9.9", recoMetFromPFCs=None, jetCorLabelL3="ak4PFCHSL1FastL2L3Corrector", jetCorLabelRes="ak4PFCHSL1FastL2L3ResidualCorrector", CHS=False, reapplyJEC=True, jecUncFile="", computeMETSignificance=True, fixEE2017=False, fixEE2017Params=None, postfix="")
def nanoAOD_customizeData(process)
Definition: nano_cff.py:317