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 ==
'pfImpactParameterAK8TagInfos':
216 setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
218 _btagInfo = getattr(process, btagInfo+labelName+postfix)
219 _btagInfo.explicitJTA = cms.bool(explicitJTA)
220 if btagInfo ==
'pfImpactParameterCA15TagInfos':
221 setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterCA15TagInfos.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 ==
'pfInclusiveSecondaryVertexFinderAK8TagInfos':
232 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterAK8TagInfos'+labelName+postfix), extSVCollection=svSource))
234 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
235 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCA15TagInfos':
236 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterCA15TagInfos'+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 ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
264 btagInfo+labelName+postfix,
265 btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(
266 trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix),
267 extSVCollection=svSource
271 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
272 if btagInfo ==
'pfSecondaryVertexNegativeTagInfos':
273 setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix)))
274 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
275 setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource))
277 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
278 if btagInfo ==
'impactParameterTagInfos':
279 setattr(process, btagInfo+labelName+postfix, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag(
'jetTracksAssociatorAtVertex'+labelName+postfix), primaryVertex=pvSource))
280 if btagInfo ==
'secondaryVertexTagInfos':
281 setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
282 if btagInfo ==
'inclusiveSecondaryVertexFinderTagInfos':
283 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
285 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
286 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredTagInfos':
287 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
289 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
290 if btagInfo ==
'secondaryVertexNegativeTagInfos':
291 setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
292 if btagInfo ==
'inclusiveSecondaryVertexFinderNegativeTagInfos':
293 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
295 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
296 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
297 setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(
'impactParameterTagInfos'+labelName+postfix)))
299 setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
300 if btagInfo ==
'softMuonTagInfos':
301 setattr(process, btagInfo+labelName+postfix, btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource))
302 if btagInfo ==
'softPFMuonsTagInfos':
303 setattr(process, btagInfo+labelName+postfix, btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource))
304 if btagInfo ==
'softPFElectronsTagInfos':
305 setattr(process, btagInfo+labelName+postfix, btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource))
306 acceptedTagInfos.append(btagInfo)
307 elif hasattr(toptag, btagInfo) :
308 acceptedTagInfos.append(btagInfo)
310 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
312 acceptedBtagDiscriminators =
list()
313 for btagDiscr
in btagDiscriminators :
314 if hasattr(btag,btagDiscr):
315 setattr(process, btagDiscr+labelName+postfix, getattr(btag, btagDiscr).
clone(tagInfos = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix)
for x
in supportedBtagDiscr[btagDiscr] ] )))
316 acceptedBtagDiscriminators.append(btagDiscr)
318 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
320 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix)
for x
in acceptedTagInfos ] )
321 patJets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix)
for x
in acceptedBtagDiscriminators ] )
322 if len(acceptedBtagDiscriminators) > 0 :
323 patJets.addBTagInfo =
True
326 if 'pfInclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
327 if not hasattr( process,
'inclusiveCandidateVertexing' ):
328 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
329 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
330 if not hasattr( process,
'inclusiveVertexing' ):
331 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
332 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
333 if not hasattr( process,
'inclusiveVertexing' ):
334 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
335 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
336 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
337 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
338 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
339 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
340 if 'caTopTagInfos' in acceptedTagInfos :
341 patJets.addTagInfos =
True
342 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
343 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )