1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
20 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff
import run2_miniAOD_80XLegacy
21 from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff
import run2_nanoAOD_92X
22 from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff
import run2_nanoAOD_94X2016
24 nanoMetadata = cms.EDProducer(
"UniqueStringProducer",
26 tag = cms.string(
"untagged"),
30 linkedObjects = cms.EDProducer(
"PATObjectCrossLinker",
31 jets=cms.InputTag(
"finalJets"),
32 muons=cms.InputTag(
"finalMuons"),
33 electrons=cms.InputTag(
"finalElectrons"),
34 taus=cms.InputTag(
"finalTaus"),
35 photons=cms.InputTag(
"finalPhotons"),
38 simpleCleanerTable = cms.EDProducer(
"NanoAODSimpleCrossCleaner",
39 name=cms.string(
"cleanmask"),
40 doc=cms.string(
"simple cleaning mask with priority to leptons"),
41 jets=cms.InputTag(
"linkedObjects",
"jets"),
42 muons=cms.InputTag(
"linkedObjects",
"muons"),
43 electrons=cms.InputTag(
"linkedObjects",
"electrons"),
44 taus=cms.InputTag(
"linkedObjects",
"taus"),
45 photons=cms.InputTag(
"linkedObjects",
"photons"),
46 jetSel=cms.string(
"pt>15"),
47 muonSel=cms.string(
"isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
48 electronSel=cms.string(
""),
49 tauSel=cms.string(
""),
50 photonSel=cms.string(
""),
51 jetName=cms.string(
"Jet"),muonName=cms.string(
"Muon"),electronName=cms.string(
"Electron"),
52 tauName=cms.string(
"Tau"),photonName=cms.string(
"Photon")
55 btagSFdir=
"PhysicsTools/NanoAOD/data/btagSF/" 57 btagWeightTable = cms.EDProducer(
"BTagSFProducer",
58 src = cms.InputTag(
"linkedObjects",
"jets"),
59 cut = cms.string(
"pt > 25. && abs(eta) < 2.5"),
60 discNames = cms.vstring(
61 "pfCombinedInclusiveSecondaryVertexV2BJetTags",
62 "pfDeepCSVJetTags:probb+pfDeepCSVJetTags:probbb",
63 "pfCombinedMVAV2BJetTags" 65 discShortNames = cms.vstring(
70 weightFiles = cms.vstring(
71 btagSFdir+
"CSVv2_94XSF_V2_B_F.csv",
72 btagSFdir+
"DeepCSV_94XSF_V2_B_F.csv",
75 operatingPoints = cms.vstring(
"3",
"3",
"3"),
76 measurementTypesB = cms.vstring(
"iterativefit",
"iterativefit",
"iterativefit"),
77 measurementTypesC = cms.vstring(
"iterativefit",
"iterativefit",
"iterativefit"),
78 measurementTypesUDSG = cms.vstring(
"iterativefit",
"iterativefit",
"iterativefit"),
79 sysTypes = cms.vstring(
"central",
"central",
"central")
82 run2_miniAOD_80XLegacy.toModify(btagWeightTable,
83 cut = cms.string(
"pt > 25. && abs(eta) < 2.4"),
84 weightFiles = cms.vstring(
85 btagSFdir+
"CSVv2_Moriond17_B_H.csv",
87 btagSFdir+
"cMVAv2_Moriond17_B_H.csv" 91 run2_nanoAOD_92X.toModify(btagWeightTable,
92 weightFiles = cms.vstring(
99 genWeightsTable = cms.EDProducer(
"GenWeightsTableProducer",
100 genEvent = cms.InputTag(
"generator"),
101 lheInfo = cms.InputTag(
"externalLHEProducer"),
102 preferredPDFs = cms.VPSet(
103 cms.PSet( name = cms.string(
"PDF4LHC15_nnlo_30_pdfas"), lhaid = cms.uint32(91400) ),
104 cms.PSet( name = cms.string(
"NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
105 cms.PSet( name = cms.string(
"NNPDF30_nlo_as_0118"), lhaid = cms.uint32(260000) ),
106 cms.PSet( name = cms.string(
"NNPDF30_lo_as_0130"), lhaid = cms.uint32(262000) ),
107 cms.PSet( name = cms.string(
"NNPDF30_nlo_nf_4_pdfas"), lhaid = cms.uint32(292000) ),
108 cms.PSet( name = cms.string(
"NNPDF30_nlo_nf_5_pdfas"), lhaid = cms.uint32(292200) ),
110 namedWeightIDs = cms.vstring(),
111 namedWeightLabels = cms.vstring(),
112 lheWeightPrecision = cms.int32(14),
113 maxPdfWeights = cms.uint32(150),
114 debug = cms.untracked.bool(
False),
116 lheInfoTable = cms.EDProducer(
"LHETablesProducer",
117 lheInfo = cms.InputTag(
"externalLHEProducer"),
118 precision = cms.int32(14),
119 storeLHEParticles = cms.bool(
True)
122 l1bits=cms.EDProducer(
"L1TriggerResultsConverter", src=cms.InputTag(
"gtStage2Digis"), legacyL1=cms.bool(
False))
124 nanoSequence = cms.Sequence(
125 nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+
128 jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + triggerObjectTables + isoTrackTables +
131 nanoSequenceMC = cms.Sequence(genParticleSequence + particleLevelSequence + nanoSequence + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable )
137 print(
"Updating process to run DeepCSV btag on legacy 80X datasets")
140 jetSource = cms.InputTag(
'slimmedJets'),
141 jetCorrections = (
'AK4PFchs', cms.vstring([
'L1FastJet',
'L2Relative',
'L3Absolute',
'L2L3Residual']),
'None'),
142 btagDiscriminators = [
'pfDeepCSVJetTags:probb',
'pfDeepCSVJetTags:probbb',
'pfDeepCSVJetTags:probc'],
145 process.load(
"Configuration.StandardSequences.MagneticField_cff")
146 process.looseJetId.src=
"selectedUpdatedPatJets" 147 process.tightJetId.src=
"selectedUpdatedPatJets" 148 process.tightJetIdLepVeto.src=
"selectedUpdatedPatJets" 149 process.bJetVars.src=
"selectedUpdatedPatJets" 150 process.slimmedJetsWithUserData.src=
"selectedUpdatedPatJets" 151 process.qgtagger80x.srcJets=
"selectedUpdatedPatJets" 153 patAlgosToolsTask .
add(process.updatedPatJets)
154 patAlgosToolsTask .
add(process.patJetCorrFactors)
155 process.additionalendpath = cms.EndPath(patAlgosToolsTask)
158 print(
"Updating process to run DeepCSV btag on 94X re-miniAOD of legacy 80X datasets")
161 jetSource = cms.InputTag(
'slimmedJets'),
162 jetCorrections = (
'AK4PFchs', cms.vstring([
'L1FastJet',
'L2Relative',
'L3Absolute',
'L2L3Residual']),
'None'),
163 btagDiscriminators = [
'pfDeepFlavourJetTags:probb',
'pfDeepFlavourJetTags:probbb',
'pfDeepFlavourJetTags:problepb'],
166 process.load(
"Configuration.StandardSequences.MagneticField_cff")
167 process.looseJetId.src=
"selectedUpdatedPatJets" 168 process.tightJetId.src=
"selectedUpdatedPatJets" 169 process.tightJetIdLepVeto.src=
"selectedUpdatedPatJets" 170 process.bJetVars.src=
"selectedUpdatedPatJets" 171 process.slimmedJetsWithUserData.src=
"selectedUpdatedPatJets" 172 process.qgtagger80x.srcJets=
"selectedUpdatedPatJets" 173 process.pfDeepFlavourJetTags.graph_path =
'RecoBTag/Combined/data/DeepFlavourV03_10X_training/constant_graph.pb' 174 process.pfDeepFlavourJetTags.lp_names = [
"cpf_input_batchnorm/keras_learning_phase"]
176 patAlgosToolsTask .
add(process.updatedPatJets)
177 patAlgosToolsTask .
add(process.patJetCorrFactors)
178 process.additionalendpath = cms.EndPath(patAlgosToolsTask)
183 run2_miniAOD_80XLegacy.toModify(process, nanoAOD_addDeepBTagFor80X)
184 run2_nanoAOD_94X2016.toModify(process, nanoAOD_addDeepFlavourTagFor94X2016)
190 if hasattr(process,
'calibratedPatElectrons80X'):
191 process.calibratedPatElectrons80X.isMC = cms.bool(
False)
192 process.calibratedPatPhotons80X.isMC = cms.bool(
False)
197 if hasattr(process,
'calibratedPatElectrons80X'):
198 process.calibratedPatElectrons80X.isMC = cms.bool(
True)
199 process.calibratedPatPhotons80X.isMC = cms.bool(
True)
203 _80x_sequence = nanoSequence.copy()
205 _80x_sequence.remove(isoTrackTable)
206 _80x_sequence.remove(isoTrackSequence)
208 _80x_sequence.insert(_80x_sequence.index(jetSequence), extraFlagsProducers)
209 _80x_sequence.insert(_80x_sequence.index(l1bits)+1, extraFlagsTable)
211 run2_miniAOD_80XLegacy.toReplaceWith( nanoSequence, _80x_sequence)
def nanoAOD_addDeepBTagFor80X(process)
S & print(S &os, JobReport::InputFile const &f)
def nanoAOD_customizeMC(process)
def nanoAOD_customizeCommon(process)
def nanoAOD_addDeepFlavourTagFor94X2016(process)
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
def getPatAlgosToolsTask(process)
def nanoAOD_customizeData(process)