237 algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, btagPrefix, postfix):
242 discriminators = set(btagDiscriminators)
243 present_meta = discriminators.intersection(set(supportedMetaDiscr.keys()))
244 discriminators -= present_meta
245 for meta_tagger
in present_meta:
246 for src
in supportedMetaDiscr[meta_tagger]:
247 discriminators.add(src)
248 btagDiscriminators =
list(discriminators)
252 requiredTagInfos =
list(btagInfos)
253 for btagDiscr
in btagDiscriminators :
254 for tagInfoList
in supportedBtagDiscr[btagDiscr] :
255 for requiredTagInfo
in tagInfoList :
256 tagInfoCovered =
False 257 for tagInfo
in requiredTagInfos :
258 if requiredTagInfo == tagInfo :
259 tagInfoCovered =
True 261 if not tagInfoCovered :
262 requiredTagInfos.append(requiredTagInfo)
264 if hasattr( process,
'candidateJetProbabilityComputer' ) ==
False :
266 process.load(
"RecoBTag.ImpactParameter.impactParameter_cff")
267 task.add(process.impactParameterTask)
268 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_cff")
269 task.add(process.secondaryVertexTask)
270 process.load(
"RecoBTag.SoftLepton.softLepton_cff")
271 task.add(process.softLeptonTask)
272 process.load(
"RecoBTag.Combined.combinedMVA_cff")
273 task.add(process.combinedMVATask)
274 process.load(
"RecoBTag.CTagging.cTagging_cff")
275 task.add(process.cTaggingTask)
277 process.load(
"RecoBTag.ImpactParameter.impactParameter_EventSetup_cff")
278 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_EventSetup_cff")
279 process.load(
"RecoBTag.SoftLepton.softLepton_EventSetup_cff")
280 process.load(
"RecoBTag.Combined.combinedMVA_EventSetup_cff")
281 process.load(
"RecoBTag.CTagging.cTagging_EventSetup_cff")
283 import RecoJets.JetProducers.caTopTaggers_cff
as toptag
287 sys.stderr.write(
"-------------------------------------------------------------------\n")
288 sys.stderr.write(
" Warning: For a complete switch to the legacy tight b-tag track\n")
289 sys.stderr.write(
" selection, please also enable the \'runIVF\' switch.\n")
290 sys.stderr.write(
"-------------------------------------------------------------------\n")
292 sys.stderr.write(
"-------------------------------------------------------------------\n")
293 sys.stderr.write(
" Warning: With the tight b-tag track selection enabled, it is\n")
294 sys.stderr.write(
" advisable to set \'btagPrefix\' to a non-empty string to\n")
295 sys.stderr.write(
" avoid unintentional modifications to the default\n")
296 sys.stderr.write(
" b tagging setup that might be loaded in the same job.\n")
297 sys.stderr.write(
"-------------------------------------------------------------------\n")
301 svSourceCvsL = copy.deepcopy(svSource)
302 svSourceCvsL.setModuleLabel(svSource.getModuleLabel()+
'CvsL')
305 runIVFforCTagOnly =
False 306 ivfcTagInfos = [
'pfInclusiveSecondaryVertexFinderCvsLTagInfos',
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos']
308 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices' and any(i
in requiredTagInfos
for i
in ivfcTagInfos)
and not runIVF:
309 runIVFforCTagOnly =
True 311 sys.stderr.write(
"-------------------------------------------------------------------\n")
312 sys.stderr.write(
" Info: To run c tagging on MiniAOD, c-tag-specific IVF secondary\n")
313 sys.stderr.write(
" vertices will be remade.\n")
314 sys.stderr.write(
"-------------------------------------------------------------------\n")
316 if runIVF
and btagPrefix !=
'':
317 if runIVFforCTagOnly:
318 svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel())
320 svSource.setModuleLabel(btagPrefix+svSource.getModuleLabel())
321 svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel())
327 runNegativeVertexing =
False 328 runNegativeCvsLVertexing =
False 329 for btagInfo
in requiredTagInfos:
331 'pfInclusiveSecondaryVertexFinderNegativeTagInfos',
332 'pfNegativeDeepFlavourTagInfos',
333 'pfNegativeParticleNetAK4TagInfos',
335 runNegativeVertexing =
True 336 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
337 runNegativeCvsLVertexing =
True 339 if runNegativeVertexing
or runNegativeCvsLVertexing:
340 import RecoVertex.AdaptiveVertexFinder.inclusiveNegativeVertexing_cff
as NegVertex
342 if runNegativeVertexing:
344 NegVertex.inclusiveCandidateNegativeVertexFinder.clone(primaryVertices = pvSource,tracks=pfCandidates),
347 NegVertex.candidateNegativeVertexMerger.clone(secondaryVertices = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeVertexFinder'+labelName+postfix)),
350 NegVertex.candidateNegativeVertexArbitrator.clone( secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexMerger'+labelName+postfix)
351 ,primaryVertices = pvSource
352 ,tracks=pfCandidates),
354 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix,
355 NegVertex.inclusiveCandidateNegativeSecondaryVertices.clone(secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexArbitrator'+labelName+postfix)),
358 if runNegativeCvsLVertexing:
359 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix,
360 NegVertex.inclusiveCandidateNegativeVertexFinderCvsL.clone(primaryVertices = pvSource,tracks=pfCandidates),
363 NegVertex.candidateNegativeVertexMergerCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix)),
366 NegVertex.candidateNegativeVertexArbitratorCvsL.clone( secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexMergerCvsL'+labelName+postfix)
367 ,primaryVertices = pvSource
368 ,tracks=pfCandidates),
370 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix,
371 NegVertex.inclusiveCandidateNegativeSecondaryVerticesCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexArbitratorCvsL'+labelName+postfix)),
375 acceptedTagInfos =
list()
376 for btagInfo
in requiredTagInfos:
377 if hasattr(btag,btagInfo):
378 if btagInfo ==
'pfImpactParameterTagInfos':
380 btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
383 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
384 _btagInfo.explicitJTA = cms.bool(explicitJTA)
386 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
387 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
388 _btagInfo.minimumNumberOfHits = cms.int32(8)
389 if btagInfo ==
'pfImpactParameterAK8TagInfos':
391 btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
394 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
395 _btagInfo.explicitJTA = cms.bool(explicitJTA)
397 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
398 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
399 _btagInfo.minimumNumberOfHits = cms.int32(8)
400 if btagInfo ==
'pfImpactParameterCA15TagInfos':
402 btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
405 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
406 _btagInfo.explicitJTA = cms.bool(explicitJTA)
408 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
409 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
410 _btagInfo.minimumNumberOfHits = cms.int32(8)
411 if btagInfo ==
'pfSecondaryVertexTagInfos':
413 btag.pfSecondaryVertexTagInfos.clone(
414 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
417 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
418 _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
419 _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
420 if btagInfo ==
'pfDeepCSVTagInfos':
422 btag.pfDeepCSVTagInfos.clone(
423 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
425 if svClustering
or fatJets != cms.InputTag(
''):
426 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
427 if btagInfo ==
'pfDeepCSVNegativeTagInfos':
429 btag.pfDeepCSVNegativeTagInfos.clone(
430 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderNegativeTagInfos'+labelName+postfix)),
432 if svClustering
or fatJets != cms.InputTag(
''):
433 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
434 if btagInfo ==
'pfDeepCSVPositiveTagInfos':
436 btag.pfDeepCSVPositiveTagInfos.clone(
437 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
439 if svClustering
or fatJets != cms.InputTag(
''):
440 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
441 if btagInfo ==
'pfDeepCMVATagInfos':
443 btag.pfDeepCMVATagInfos.clone(
444 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
445 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
446 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
447 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
449 if svClustering
or fatJets != cms.InputTag(
''):
450 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
451 if btagInfo ==
'pfDeepCMVANegativeTagInfos':
453 btag.pfDeepCMVATagInfos.clone(
454 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
455 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
456 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
457 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
459 if svClustering
or fatJets != cms.InputTag(
''):
460 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
461 if btagInfo ==
'pfDeepCMVAPositiveTagInfos':
463 btag.pfDeepCMVATagInfos.clone(
464 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
465 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
466 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
467 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
469 if svClustering
or fatJets != cms.InputTag(
''):
470 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
471 if btagInfo ==
'pfInclusiveSecondaryVertexFinderTagInfos':
473 btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(
474 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
475 extSVCollection=svSource),
477 if svClustering
or fatJets != cms.InputTag(
''):
478 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
479 if btagInfo ==
'pfInclusiveSecondaryVertexFinderAK8TagInfos':
481 btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(
482 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterAK8TagInfos'+labelName+postfix),
483 extSVCollection=svSource),
485 if svClustering
or fatJets != cms.InputTag(
''):
486 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
487 if btagInfo ==
'pfBoostedDoubleSVAK8TagInfos':
489 btag.pfBoostedDoubleSVAK8TagInfos.clone(
490 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderAK8TagInfos'+labelName+postfix)),
492 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCA15TagInfos':
494 btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(
495 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterCA15TagInfos'+labelName+postfix),
496 extSVCollection=svSource),
498 if svClustering
or fatJets != cms.InputTag(
''):
499 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
500 if btagInfo ==
'pfBoostedDoubleSVCA15TagInfos':
502 btag.pfBoostedDoubleSVCA15TagInfos.clone(
503 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderCA15TagInfos'+labelName+postfix)),
505 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCvsLTagInfos':
507 btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(
508 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
509 extSVCollection=svSourceCvsL),
511 if svClustering
or fatJets != cms.InputTag(
''):
512 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
513 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
515 btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(
516 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
517 extSVCollection = btagPrefix+
'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix),
519 if svClustering
or fatJets != cms.InputTag(
''):
520 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
521 if btagInfo ==
'pfGhostTrackVertexTagInfos':
523 btag.pfGhostTrackVertexTagInfos.clone(
524 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
526 if btagInfo ==
'pfSecondaryVertexNegativeTagInfos':
528 btag.pfSecondaryVertexNegativeTagInfos.clone(
529 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
532 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
533 _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
534 _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
535 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
537 btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(
538 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
539 extSVCollection=cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)),
541 if svClustering
or fatJets != cms.InputTag(
''):
542 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
543 if btagInfo ==
'impactParameterTagInfos':
545 btag.impactParameterTagInfos.clone(
546 jetTracks = cms.InputTag(
'jetTracksAssociatorAtVertex'+labelName+postfix),
547 primaryVertex=pvSource),
549 if btagInfo ==
'secondaryVertexTagInfos':
551 btag.secondaryVertexTagInfos.clone(
552 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
554 if btagInfo ==
'inclusiveSecondaryVertexFinderTagInfos':
556 btag.inclusiveSecondaryVertexFinderTagInfos.clone(
557 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
559 if svClustering
or fatJets != cms.InputTag(
''):
560 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
561 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredTagInfos':
563 btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(
564 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
566 if svClustering
or fatJets != cms.InputTag(
''):
567 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
568 if btagInfo ==
'secondaryVertexNegativeTagInfos':
570 btag.secondaryVertexNegativeTagInfos.clone(
571 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
573 if btagInfo ==
'inclusiveSecondaryVertexFinderNegativeTagInfos':
575 btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(
576 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
578 if svClustering
or fatJets != cms.InputTag(
''):
579 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
580 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
582 btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(
583 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
585 if svClustering
or fatJets != cms.InputTag(
''):
586 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
587 if btagInfo ==
'softMuonTagInfos':
589 btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource),
591 if btagInfo ==
'softPFMuonsTagInfos':
593 btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource),
595 if btagInfo ==
'softPFElectronsTagInfos':
597 btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource),
600 if 'DeepFlavourTagInfos' in btagInfo:
602 if btagInfo ==
'pfNegativeDeepFlavourTagInfos':
603 deep_csv_tag_infos =
'pfDeepCSVNegativeTagInfos' 604 svUsed = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)
607 deep_csv_tag_infos =
'pfDeepCSVTagInfos' 611 if not (
'limmed' in jetSource.value()):
612 puppi_value_map = cms.InputTag(
"puppi")
613 vertex_associator = cms.InputTag(
"primaryVertexAssociation",
"original")
615 puppi_value_map = cms.InputTag(
"")
616 vertex_associator = cms.InputTag(
"")
618 btag.pfDeepFlavourTagInfos.clone(
621 secondary_vertices=svUsed,
622 shallow_tag_infos = cms.InputTag(btagPrefix+deep_csv_tag_infos+labelName+postfix),
623 puppi_value_map = puppi_value_map,
624 vertex_associator = vertex_associator,
628 if btagInfo ==
'pfDeepDoubleXTagInfos':
630 btag.pfDeepDoubleXTagInfos.clone(
633 secondary_vertices=svSource,
634 shallow_tag_infos = cms.InputTag(btagPrefix+
'pfBoostedDoubleSVAK8TagInfos'+labelName+postfix),
638 if btagInfo ==
'pfHiggsInteractionNetTagInfos':
640 btag.pfHiggsInteractionNetTagInfos.clone(
643 secondary_vertices = svSource,
644 pf_candidates = pfCandidates,
648 if btagInfo ==
'pfDeepBoostedJetTagInfos':
649 if pfCandidates.value() ==
'packedPFCandidates':
651 if 'updated' not in jetSource.value().lower():
652 raise ValueError(
"Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource.value())
654 vertex_associator =
"" 655 elif pfCandidates.value() ==
'particleFlow':
656 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
663 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
665 btag.pfDeepBoostedJetTagInfos.clone(
668 secondary_vertices = svSource,
669 pf_candidates = pfCandidates,
670 puppi_value_map = puppi_value_map,
671 vertex_associator = vertex_associator,
675 if btagInfo ==
'pfParticleNetTagInfos':
676 if pfCandidates.value() ==
'packedPFCandidates':
679 vertex_associator =
"" 680 elif pfCandidates.value() ==
'particleFlow':
681 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
683 puppi_value_map =
"puppi" 684 vertex_associator =
"primaryVertexAssociation:original" 686 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
688 btag.pfParticleNetTagInfos.clone(
691 secondary_vertices = svSource,
692 pf_candidates = pfCandidates,
693 puppi_value_map = puppi_value_map,
694 vertex_associator = vertex_associator,
698 if 'ParticleNetAK4TagInfos' in btagInfo:
699 if btagInfo ==
'pfNegativeParticleNetAK4TagInfos':
700 secondary_vertices = btagPrefix + \
701 'inclusiveCandidateNegativeSecondaryVertices' + labelName + postfix
705 secondary_vertices = svSource
708 if pfCandidates.value() ==
'packedPFCandidates':
711 vertex_associator =
"" 712 elif pfCandidates.value() ==
'particleFlow':
713 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
715 puppi_value_map =
"puppi" 716 vertex_associator =
"primaryVertexAssociation:original" 718 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
720 btag.pfParticleNetAK4TagInfos.clone(
723 secondary_vertices = secondary_vertices,
724 pf_candidates = pfCandidates,
725 puppi_value_map = puppi_value_map,
726 vertex_associator = vertex_associator,
727 flip_ip_sign = flip_ip_sign,
728 sip3dSigMax = sip3dSigMax,
732 acceptedTagInfos.append(btagInfo)
733 elif hasattr(toptag, btagInfo) :
734 acceptedTagInfos.append(btagInfo)
736 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo))
738 acceptedBtagDiscriminators =
list()
739 for discriminator_name
in btagDiscriminators :
740 btagDiscr = discriminator_name.split(
':')[0]
742 if hasattr(btag,btagDiscr):
743 newDiscr = btagPrefix+btagDiscr+labelName+postfix
744 if hasattr(process, newDiscr):
746 elif hasattr(getattr(btag, btagDiscr),
'tagInfos'):
749 getattr(btag, btagDiscr).
clone(
750 tagInfos = cms.VInputTag(
751 *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
752 for x
in supportedBtagDiscr[discriminator_name][0] ]
758 elif hasattr(getattr(btag, btagDiscr),
'src'):
761 getattr(btag, btagDiscr).
clone(
762 src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
768 raise ValueError(
'I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
769 acceptedBtagDiscriminators.append(discriminator_name)
771 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr))
773 for meta_tagger
in present_meta:
774 btagDiscr = meta_tagger.split(
':')[0]
776 if hasattr(btag,btagDiscr):
777 newDiscr = btagPrefix+btagDiscr+labelName+postfix
778 if hasattr(process, newDiscr):
783 getattr(btag, btagDiscr).
clone(),
787 for dependency
in supportedMetaDiscr[meta_tagger]:
788 if ':' in dependency:
789 new_dep = btagPrefix+dependency.split(
':')[0]+labelName+postfix+
':'+dependency.split(
':')[1]
791 new_dep = btagPrefix+dependency+labelName+postfix
792 replace = MassSearchReplaceAnyInputTagVisitor(dependency, new_dep)
793 replace.doIt(getattr(process, newDiscr), newDiscr)
794 acceptedBtagDiscriminators.append(meta_tagger)
796 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr))
799 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix)
for x
in acceptedTagInfos ] )
800 patJets.discriminatorSources = cms.VInputTag(*[
801 cms.InputTag(btagPrefix+x+labelName+postfix) \
802 if ':' not in x
else \
803 cms.InputTag(btagPrefix+x.split(
':')[0]+labelName+postfix+
':'+x.split(
':')[1]) \
804 for x
in acceptedBtagDiscriminators
806 if len(acceptedBtagDiscriminators) > 0 :
807 patJets.addBTagInfo =
True 810 if not tightBTagNTkHits:
811 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
816 ivfbTagInfos = [
'pfInclusiveSecondaryVertexFinderTagInfos',
'pfInclusiveSecondaryVertexFinderAK8TagInfos',
'pfInclusiveSecondaryVertexFinderCA15TagInfos']
817 if any(i
in acceptedTagInfos
for i
in ivfbTagInfos)
and not runIVFforCTagOnly:
818 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
819 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
821 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
822 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
823 _temp.minHits = cms.uint32(8)
825 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
826 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
827 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
828 _temp.primaryVertices = pvSource
829 _temp.tracks = pfCandidates
830 if hasattr( process, btagPrefix+
'candidateVertexArbitrator' ):
831 _temp = getattr(process, btagPrefix+
'candidateVertexArbitrator')
832 _temp.primaryVertices = pvSource
833 _temp.tracks = pfCandidates
834 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVertices' )
and not hasattr( process, svSource.getModuleLabel() ):
836 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVertices').
clone(),
838 if any(i
in acceptedTagInfos
for i
in ivfcTagInfos):
839 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
840 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
842 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
843 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
844 _temp.minHits = cms.uint32(8)
846 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
847 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
848 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
849 _temp.primaryVertices = pvSource
850 _temp.tracks = pfCandidates
851 if hasattr( process, btagPrefix+
'candidateVertexArbitratorCvsL' ):
852 _temp = getattr(process, btagPrefix+
'candidateVertexArbitratorCvsL')
853 _temp.primaryVertices = pvSource
854 _temp.tracks = pfCandidates
855 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL' )
and not hasattr( process, svSourceCvsL.getModuleLabel() ):
857 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL').
clone(),
859 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
860 if not hasattr( process,
'inclusiveVertexing' ):
861 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
862 task.add(process.inclusiveVertexingTask)
863 task.add(process.inclusiveCandidateVertexingTask)
864 task.add(process.inclusiveCandidateVertexingCvsLTask)
865 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
866 if not hasattr( process,
'inclusiveVertexing' ):
867 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
868 task.add(process.inclusiveVertexingTask)
869 task.add(process.inclusiveCandidateVertexingTask)
870 task.add(process.inclusiveCandidateVertexingCvsLTask)
871 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
872 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
873 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
874 task.add(process.inclusiveSecondaryVerticesFiltered)
875 task.add(process.bVertexFilter)
876 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
877 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
878 task.add(process.bToCharmDecayVertexMerged)
879 if 'caTopTagInfos' in acceptedTagInfos :
880 patJets.addTagInfos =
True 881 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
882 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )
883 task.add(process.caTopTaggersTask)
bool any(const std::vector< T > &v, const T &what)
def addToProcessAndTask(label, module, process, task)
S & print(S &os, JobReport::InputFile const &f)
def loadWithPrefix(process, moduleName, prefix='', loadedProducersAndFilters=None)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
def getPatAlgosToolsTask(process)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run