174 algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, postfix):
177 requiredTagInfos =
list(btagInfos)
178 for btagDiscr
in btagDiscriminators :
179 for requiredTagInfo
in supportedBtagDiscr[btagDiscr] :
180 tagInfoCovered =
False
181 for tagInfo
in requiredTagInfos :
182 if requiredTagInfo == tagInfo :
183 tagInfoCovered =
True
185 if not tagInfoCovered :
186 requiredTagInfos.append(requiredTagInfo)
188 if hasattr( process,
'candidateJetProbabilityComputer' ) ==
False :
190 process.load(
"RecoBTag.ImpactParameter.impactParameter_cff")
191 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_cff")
192 process.load(
"RecoBTag.SoftLepton.softLepton_cff")
193 process.load(
"RecoBTag.Combined.combinedMVA_cff")
194 process.load(
"RecoBTag.CTagging.cTagging_cff")
196 process.load(
"RecoBTag.ImpactParameter.impactParameter_EventSetup_cff")
197 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_EventSetup_cff")
198 process.load(
"RecoBTag.SoftLepton.softLepton_EventSetup_cff")
199 process.load(
"RecoBTag.Combined.combinedMVA_EventSetup_cff")
200 process.load(
"RecoBTag.CTagging.cTagging_EventSetup_cff")
207 acceptedTagInfos =
list()
208 for btagInfo
in requiredTagInfos:
209 if hasattr(btag,btagInfo):
210 if btagInfo ==
'pfImpactParameterTagInfos':
211 setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
213 _btagInfo = getattr(process, btagInfo+labelName+postfix)
214 _btagInfo.explicitJTA = cms.bool(explicitJTA)
215 if btagInfo ==
'pfImpactParameterTagInfosAK8':
216 setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterTagInfosAK8.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
218 _btagInfo = getattr(process, btagInfo+labelName+postfix)
219 _btagInfo.explicitJTA = cms.bool(explicitJTA)
220 if btagInfo ==
'pfImpactParameterTagInfosCA15':
221 setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterTagInfosCA15.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
223 _btagInfo = getattr(process, btagInfo+labelName+postfix)
224 _btagInfo.explicitJTA = cms.bool(explicitJTA)
225 if btagInfo ==
'pfSecondaryVertexTagInfos':
226 setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix)))
227 if btagInfo ==
'pfInclusiveSecondaryVertexFinderTagInfos':
228 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource))
230 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
231 if btagInfo ==
'pfInclusiveSecondaryVertexFinderTagInfosAK8':
232 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderTagInfosAK8.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfosAK8'+labelName+postfix), extSVCollection=svSource))
234 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
235 if btagInfo ==
'pfInclusiveSecondaryVertexFinderTagInfosCA15':
236 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderTagInfosCA15.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfosCA15'+labelName+postfix), extSVCollection=svSource))
238 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
239 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCvsLTagInfos':
242 btagInfo+labelName+postfix,
243 btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(
244 trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix),
245 extSVCollection=svSource
249 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
250 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCvsBTagInfos':
253 btagInfo+labelName+postfix,
254 btag.pfInclusiveSecondaryVertexFinderCvsBTagInfos.clone(
255 trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix),
256 extSVCollection=svSource
260 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
261 if btagInfo ==
'pfSecondaryVertexNegativeTagInfos':
262 setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix)))
263 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
264 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource))
266 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
267 if btagInfo ==
'impactParameterTagInfos':
268 setattr(process, btagInfo+labelName+postfix, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag(
'jetTracksAssociatorAtVertex'+labelName+postfix), primaryVertex=pvSource))
269 if btagInfo ==
'secondaryVertexTagInfos':
270 setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
271 if btagInfo ==
'inclusiveSecondaryVertexFinderTagInfos':
272 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
274 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
275 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredTagInfos':
276 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
278 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
279 if btagInfo ==
'secondaryVertexNegativeTagInfos':
280 setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
281 if btagInfo ==
'inclusiveSecondaryVertexFinderNegativeTagInfos':
282 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
284 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
285 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
286 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
288 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
289 if btagInfo ==
'softMuonTagInfos':
290 setattr(process, btagInfo+labelName+postfix, btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource))
291 if btagInfo ==
'softPFMuonsTagInfos':
292 setattr(process, btagInfo+labelName+postfix, btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource))
293 if btagInfo ==
'softPFElectronsTagInfos':
294 setattr(process, btagInfo+labelName+postfix, btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource))
295 acceptedTagInfos.append(btagInfo)
296 elif hasattr(toptag, btagInfo) :
297 acceptedTagInfos.append(btagInfo)
299 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
301 acceptedBtagDiscriminators =
list()
302 for btagDiscr
in btagDiscriminators :
303 if hasattr(btag,btagDiscr):
304 setattr(process, btagDiscr+labelName+postfix, getattr(btag, btagDiscr).
clone(tagInfos = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix)
for x
in supportedBtagDiscr[btagDiscr] ] )))
305 acceptedBtagDiscriminators.append(btagDiscr)
307 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
309 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix)
for x
in acceptedTagInfos ] )
310 patJets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix)
for x
in acceptedBtagDiscriminators ] )
311 if len(acceptedBtagDiscriminators) > 0 :
312 patJets.addBTagInfo =
True
315 if 'pfInclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
316 if not hasattr( process,
'inclusiveCandidateVertexing' ):
317 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
318 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
319 if not hasattr( process,
'inclusiveVertexing' ):
320 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
321 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
322 if not hasattr( process,
'inclusiveVertexing' ):
323 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
324 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
325 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
326 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
327 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
328 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
329 if 'caTopTagInfos' in acceptedTagInfos :
330 patJets.addTagInfos =
True
331 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
332 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )