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 if 'updated' not in jetSource.value().lower():
631 raise ValueError(
"Invalid jet collection: %s. pfDeepDoubleXTagInfos only supports running via updateJetCollection." % jetSource.value())
633 btag.pfDeepDoubleXTagInfos.clone(
636 secondary_vertices=svSource,
637 shallow_tag_infos = cms.InputTag(btagPrefix+
'pfBoostedDoubleSVAK8TagInfos'+labelName+postfix),
641 if btagInfo ==
'pfHiggsInteractionNetTagInfos':
643 btag.pfHiggsInteractionNetTagInfos.clone(
646 secondary_vertices = svSource,
647 pf_candidates = pfCandidates,
651 if btagInfo ==
'pfDeepBoostedJetTagInfos':
652 if pfCandidates.value() ==
'packedPFCandidates':
654 if 'updated' not in jetSource.value().lower():
655 raise ValueError(
"Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource.value())
657 vertex_associator =
"" 658 elif pfCandidates.value() ==
'particleFlow':
659 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
666 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
668 btag.pfDeepBoostedJetTagInfos.clone(
671 secondary_vertices = svSource,
672 pf_candidates = pfCandidates,
673 puppi_value_map = puppi_value_map,
674 vertex_associator = vertex_associator,
678 if btagInfo ==
'pfParticleNetTagInfos':
679 if pfCandidates.value() ==
'packedPFCandidates':
682 vertex_associator =
"" 683 elif pfCandidates.value() ==
'particleFlow':
684 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
686 puppi_value_map =
"puppi" 687 vertex_associator =
"primaryVertexAssociation:original" 689 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
691 btag.pfParticleNetTagInfos.clone(
694 secondary_vertices = svSource,
695 pf_candidates = pfCandidates,
696 puppi_value_map = puppi_value_map,
697 vertex_associator = vertex_associator,
701 if 'ParticleNetAK4TagInfos' in btagInfo:
702 if btagInfo ==
'pfNegativeParticleNetAK4TagInfos':
703 secondary_vertices = btagPrefix + \
704 'inclusiveCandidateNegativeSecondaryVertices' + labelName + postfix
708 secondary_vertices = svSource
711 if pfCandidates.value() ==
'packedPFCandidates':
714 vertex_associator =
"" 715 elif pfCandidates.value() ==
'particleFlow':
716 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
718 puppi_value_map =
"puppi" 719 vertex_associator =
"primaryVertexAssociation:original" 721 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
723 btag.pfParticleNetAK4TagInfos.clone(
726 secondary_vertices = secondary_vertices,
727 pf_candidates = pfCandidates,
728 puppi_value_map = puppi_value_map,
729 vertex_associator = vertex_associator,
730 flip_ip_sign = flip_ip_sign,
731 sip3dSigMax = sip3dSigMax,
735 acceptedTagInfos.append(btagInfo)
736 elif hasattr(toptag, btagInfo) :
737 acceptedTagInfos.append(btagInfo)
739 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo))
741 acceptedBtagDiscriminators =
list()
742 for discriminator_name
in btagDiscriminators :
743 btagDiscr = discriminator_name.split(
':')[0]
745 if hasattr(btag,btagDiscr):
746 newDiscr = btagPrefix+btagDiscr+labelName+postfix
747 if hasattr(process, newDiscr):
749 elif hasattr(getattr(btag, btagDiscr),
'tagInfos'):
752 getattr(btag, btagDiscr).
clone(
753 tagInfos = cms.VInputTag(
754 *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
755 for x
in supportedBtagDiscr[discriminator_name][0] ]
761 elif hasattr(getattr(btag, btagDiscr),
'src'):
764 getattr(btag, btagDiscr).
clone(
765 src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
771 raise ValueError(
'I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
772 acceptedBtagDiscriminators.append(discriminator_name)
774 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr))
776 for meta_tagger
in present_meta:
777 btagDiscr = meta_tagger.split(
':')[0]
779 if hasattr(btag,btagDiscr):
780 newDiscr = btagPrefix+btagDiscr+labelName+postfix
781 if hasattr(process, newDiscr):
786 getattr(btag, btagDiscr).
clone(),
790 for dependency
in supportedMetaDiscr[meta_tagger]:
791 if ':' in dependency:
792 new_dep = btagPrefix+dependency.split(
':')[0]+labelName+postfix+
':'+dependency.split(
':')[1]
794 new_dep = btagPrefix+dependency+labelName+postfix
795 replace = MassSearchReplaceAnyInputTagVisitor(dependency, new_dep)
796 replace.doIt(getattr(process, newDiscr), newDiscr)
797 acceptedBtagDiscriminators.append(meta_tagger)
799 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr))
802 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix)
for x
in acceptedTagInfos ] )
803 patJets.discriminatorSources = cms.VInputTag(*[
804 cms.InputTag(btagPrefix+x+labelName+postfix) \
805 if ':' not in x
else \
806 cms.InputTag(btagPrefix+x.split(
':')[0]+labelName+postfix+
':'+x.split(
':')[1]) \
807 for x
in acceptedBtagDiscriminators
809 if len(acceptedBtagDiscriminators) > 0 :
810 patJets.addBTagInfo =
True 813 if not tightBTagNTkHits:
814 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
819 ivfbTagInfos = [
'pfInclusiveSecondaryVertexFinderTagInfos',
'pfInclusiveSecondaryVertexFinderAK8TagInfos',
'pfInclusiveSecondaryVertexFinderCA15TagInfos']
820 if any(i
in acceptedTagInfos
for i
in ivfbTagInfos)
and not runIVFforCTagOnly:
821 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
822 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
824 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
825 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
826 _temp.minHits = cms.uint32(8)
828 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
829 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
830 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
831 _temp.primaryVertices = pvSource
832 _temp.tracks = pfCandidates
833 if hasattr( process, btagPrefix+
'candidateVertexArbitrator' ):
834 _temp = getattr(process, btagPrefix+
'candidateVertexArbitrator')
835 _temp.primaryVertices = pvSource
836 _temp.tracks = pfCandidates
837 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVertices' )
and not hasattr( process, svSource.getModuleLabel() ):
839 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVertices').
clone(),
841 if any(i
in acceptedTagInfos
for i
in ivfcTagInfos):
842 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
843 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
845 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
846 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
847 _temp.minHits = cms.uint32(8)
849 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
850 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
851 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
852 _temp.primaryVertices = pvSource
853 _temp.tracks = pfCandidates
854 if hasattr( process, btagPrefix+
'candidateVertexArbitratorCvsL' ):
855 _temp = getattr(process, btagPrefix+
'candidateVertexArbitratorCvsL')
856 _temp.primaryVertices = pvSource
857 _temp.tracks = pfCandidates
858 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL' )
and not hasattr( process, svSourceCvsL.getModuleLabel() ):
860 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL').
clone(),
862 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
863 if not hasattr( process,
'inclusiveVertexing' ):
864 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
865 task.add(process.inclusiveVertexingTask)
866 task.add(process.inclusiveCandidateVertexingTask)
867 task.add(process.inclusiveCandidateVertexingCvsLTask)
868 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
869 if not hasattr( process,
'inclusiveVertexing' ):
870 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
871 task.add(process.inclusiveVertexingTask)
872 task.add(process.inclusiveCandidateVertexingTask)
873 task.add(process.inclusiveCandidateVertexingCvsLTask)
874 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
875 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
876 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
877 task.add(process.inclusiveSecondaryVerticesFiltered)
878 task.add(process.bVertexFilter)
879 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
880 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
881 task.add(process.bToCharmDecayVertexMerged)
882 if 'caTopTagInfos' in acceptedTagInfos :
883 patJets.addTagInfos =
True 884 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
885 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )
886 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