1 import FWCore.ParameterSet.Config
as cms
19 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff
import run2_miniAOD_80XLegacy
20 from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff
import run2_nanoAOD_92X
22 nanoMetadata = cms.EDProducer(
"UniqueStringProducer",
24 tag = cms.string(
"untagged"),
28 linkedObjects = cms.EDProducer(
"PATObjectCrossLinker",
29 jets=cms.InputTag(
"finalJets"),
30 muons=cms.InputTag(
"finalMuons"),
31 electrons=cms.InputTag(
"finalElectrons"),
32 taus=cms.InputTag(
"finalTaus"),
33 photons=cms.InputTag(
"finalPhotons"),
36 simpleCleanerTable = cms.EDProducer(
"NanoAODSimpleCrossCleaner",
37 name=cms.string(
"cleanmask"),
38 doc=cms.string(
"simple cleaning mask with priority to leptons"),
39 jets=cms.InputTag(
"linkedObjects",
"jets"),
40 muons=cms.InputTag(
"linkedObjects",
"muons"),
41 electrons=cms.InputTag(
"linkedObjects",
"electrons"),
42 taus=cms.InputTag(
"linkedObjects",
"taus"),
43 photons=cms.InputTag(
"linkedObjects",
"photons"),
44 jetSel=cms.string(
"pt>15"),
45 muonSel=cms.string(
"isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
46 electronSel=cms.string(
""),
47 tauSel=cms.string(
""),
48 photonSel=cms.string(
""),
49 jetName=cms.string(
"Jet"),muonName=cms.string(
"Muon"),electronName=cms.string(
"Electron"),
50 tauName=cms.string(
"Tau"),photonName=cms.string(
"Photon")
53 btagSFdir=
"PhysicsTools/NanoAOD/data/btagSF/" 55 btagWeightTable = cms.EDProducer(
"BTagSFProducer",
56 src = cms.InputTag(
"linkedObjects",
"jets"),
57 cut = cms.string(
"pt > 25. && abs(eta) < 2.5"),
58 discNames = cms.vstring(
59 "pfCombinedInclusiveSecondaryVertexV2BJetTags",
60 "pfDeepCSVJetTags:probb+pfDeepCSVJetTags:probbb",
61 "pfCombinedMVAV2BJetTags" 63 discShortNames = cms.vstring(
68 weightFiles = cms.vstring(
69 btagSFdir+
"CSVv2_94XSF_V2_B_F.csv",
70 btagSFdir+
"DeepCSV_94XSF_V2_B_F.csv",
73 operatingPoints = cms.vstring(
"3",
"3",
"3"),
74 measurementTypesB = cms.vstring(
"iterativefit",
"iterativefit",
"iterativefit"),
75 measurementTypesC = cms.vstring(
"iterativefit",
"iterativefit",
"iterativefit"),
76 measurementTypesUDSG = cms.vstring(
"iterativefit",
"iterativefit",
"iterativefit"),
77 sysTypes = cms.vstring(
"central",
"central",
"central")
80 run2_miniAOD_80XLegacy.toModify(btagWeightTable,
81 cut = cms.string(
"pt > 25. && abs(eta) < 2.4"),
82 weightFiles = cms.vstring(
83 btagSFdir+
"CSVv2_Moriond17_B_H.csv",
85 btagSFdir+
"cMVAv2_Moriond17_B_H.csv" 89 run2_nanoAOD_92X.toModify(btagWeightTable,
90 weightFiles = cms.vstring(
97 genWeightsTable = cms.EDProducer(
"GenWeightsTableProducer",
98 genEvent = cms.InputTag(
"generator"),
99 lheInfo = cms.InputTag(
"externalLHEProducer"),
100 preferredPDFs = cms.VPSet(
101 cms.PSet( name = cms.string(
"PDF4LHC15_nnlo_30_pdfas"), lhaid = cms.uint32(91400) ),
102 cms.PSet( name = cms.string(
"NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
103 cms.PSet( name = cms.string(
"NNPDF30_nlo_as_0118"), lhaid = cms.uint32(260000) ),
104 cms.PSet( name = cms.string(
"NNPDF30_lo_as_0130"), lhaid = cms.uint32(262000) ),
105 cms.PSet( name = cms.string(
"NNPDF30_nlo_nf_4_pdfas"), lhaid = cms.uint32(292000) ),
106 cms.PSet( name = cms.string(
"NNPDF30_nlo_nf_5_pdfas"), lhaid = cms.uint32(292200) ),
108 namedWeightIDs = cms.vstring(),
109 namedWeightLabels = cms.vstring(),
110 lheWeightPrecision = cms.int32(14),
111 maxPdfWeights = cms.uint32(150),
112 debug = cms.untracked.bool(
False),
114 lheInfoTable = cms.EDProducer(
"LHETablesProducer",
115 lheInfo = cms.InputTag(
"externalLHEProducer"),
116 precision = cms.int32(14),
117 storeLHEParticles = cms.bool(
True)
120 l1bits=cms.EDProducer(
"L1TriggerResultsConverter", src=cms.InputTag(
"gtStage2Digis"), legacyL1=cms.bool(
False))
122 nanoSequence = cms.Sequence(
123 nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+
126 jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + triggerObjectTables + isoTrackTables +
129 nanoSequenceMC = cms.Sequence(genParticleSequence + particleLevelSequence + nanoSequence + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable )
135 print "Updating process to run DeepCSV btag on legacy 80X datasets" 138 jetSource = cms.InputTag(
'slimmedJets'),
139 jetCorrections = (
'AK4PFchs', cms.vstring([
'L1FastJet',
'L2Relative',
'L3Absolute',
'L2L3Residual']),
'None'),
140 btagDiscriminators = [
'pfDeepCSVJetTags:probb',
'pfDeepCSVJetTags:probbb',
'pfDeepCSVJetTags:probc'],
143 process.load(
"Configuration.StandardSequences.MagneticField_cff")
144 process.looseJetId.src=
"selectedUpdatedPatJets" 145 process.tightJetId.src=
"selectedUpdatedPatJets" 146 process.tightJetIdLepVeto.src=
"selectedUpdatedPatJets" 147 process.bJetVars.src=
"selectedUpdatedPatJets" 148 process.slimmedJetsWithUserData.src=
"selectedUpdatedPatJets" 149 process.qgtagger80x.srcJets=
"selectedUpdatedPatJets" 151 patAlgosToolsTask .
add(process.updatedPatJets)
152 patAlgosToolsTask .
add(process.patJetCorrFactors)
153 process.additionalendpath = cms.EndPath(patAlgosToolsTask)
157 run2_miniAOD_80XLegacy.toModify(process, nanoAOD_addDeepBTagFor80X)
163 if hasattr(process,
'calibratedPatElectrons80X'):
164 process.calibratedPatElectrons80X.isMC = cms.bool(
False)
165 process.calibratedPatPhotons80X.isMC = cms.bool(
False)
170 if hasattr(process,
'calibratedPatElectrons80X'):
171 process.calibratedPatElectrons80X.isMC = cms.bool(
True)
172 process.calibratedPatPhotons80X.isMC = cms.bool(
True)
176 _80x_sequence = nanoSequence.copy()
178 _80x_sequence.remove(isoTrackTable)
179 _80x_sequence.remove(isoTrackSequence)
181 _80x_sequence.insert(_80x_sequence.index(jetSequence), extraFlagsProducers)
182 _80x_sequence.insert(_80x_sequence.index(l1bits)+1, extraFlagsTable)
184 run2_miniAOD_80XLegacy.toReplaceWith( nanoSequence, _80x_sequence)
def nanoAOD_addDeepBTagFor80X(process)
def nanoAOD_customizeMC(process)
def nanoAOD_customizeCommon(process)
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
def getPatAlgosToolsTask(process)
def nanoAOD_customizeData(process)