236 algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, btagPrefix, postfix):
241 discriminators = set(btagDiscriminators)
242 present_meta = discriminators.intersection(set(supportedMetaDiscr.keys()))
243 discriminators -= present_meta
244 for meta_tagger
in present_meta:
245 for src
in supportedMetaDiscr[meta_tagger]:
246 discriminators.add(src)
247 btagDiscriminators =
list(discriminators)
251 requiredTagInfos =
list(btagInfos)
252 for btagDiscr
in btagDiscriminators :
253 for tagInfoList
in supportedBtagDiscr[btagDiscr] :
254 for requiredTagInfo
in tagInfoList :
255 tagInfoCovered =
False 256 for tagInfo
in requiredTagInfos :
257 if requiredTagInfo == tagInfo :
258 tagInfoCovered =
True 260 if not tagInfoCovered :
261 requiredTagInfos.append(requiredTagInfo)
263 if hasattr( process,
'candidateJetProbabilityComputer' ) ==
False :
265 process.load(
"RecoBTag.ImpactParameter.impactParameter_cff")
266 task.add(process.impactParameterTask)
267 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_cff")
268 task.add(process.secondaryVertexTask)
269 process.load(
"RecoBTag.SoftLepton.softLepton_cff")
270 task.add(process.softLeptonTask)
271 process.load(
"RecoBTag.Combined.combinedMVA_cff")
272 task.add(process.combinedMVATask)
273 process.load(
"RecoBTag.CTagging.cTagging_cff")
274 task.add(process.cTaggingTask)
276 process.load(
"RecoBTag.ImpactParameter.impactParameter_EventSetup_cff")
277 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_EventSetup_cff")
278 process.load(
"RecoBTag.SoftLepton.softLepton_EventSetup_cff")
279 process.load(
"RecoBTag.Combined.combinedMVA_EventSetup_cff")
280 process.load(
"RecoBTag.CTagging.cTagging_EventSetup_cff")
282 import RecoJets.JetProducers.caTopTaggers_cff
as toptag
286 sys.stderr.write(
"-------------------------------------------------------------------\n")
287 sys.stderr.write(
" Warning: For a complete switch to the legacy tight b-tag track\n")
288 sys.stderr.write(
" selection, please also enable the \'runIVF\' switch.\n")
289 sys.stderr.write(
"-------------------------------------------------------------------\n")
291 sys.stderr.write(
"-------------------------------------------------------------------\n")
292 sys.stderr.write(
" Warning: With the tight b-tag track selection enabled, it is\n")
293 sys.stderr.write(
" advisable to set \'btagPrefix\' to a non-empty string to\n")
294 sys.stderr.write(
" avoid unintentional modifications to the default\n")
295 sys.stderr.write(
" b tagging setup that might be loaded in the same job.\n")
296 sys.stderr.write(
"-------------------------------------------------------------------\n")
300 svSourceCvsL = copy.deepcopy(svSource)
301 svSourceCvsL.setModuleLabel(svSource.getModuleLabel()+
'CvsL')
304 runIVFforCTagOnly =
False 305 ivfcTagInfos = [
'pfInclusiveSecondaryVertexFinderCvsLTagInfos',
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos']
307 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices' and any(i
in requiredTagInfos
for i
in ivfcTagInfos)
and not runIVF:
308 runIVFforCTagOnly =
True 310 sys.stderr.write(
"-------------------------------------------------------------------\n")
311 sys.stderr.write(
" Info: To run c tagging on MiniAOD, c-tag-specific IVF secondary\n")
312 sys.stderr.write(
" vertices will be remade.\n")
313 sys.stderr.write(
"-------------------------------------------------------------------\n")
315 if runIVF
and btagPrefix !=
'':
316 if runIVFforCTagOnly:
317 svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel())
319 svSource.setModuleLabel(btagPrefix+svSource.getModuleLabel())
320 svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel())
326 runNegativeVertexing =
False 327 runNegativeCvsLVertexing =
False 328 for btagInfo
in requiredTagInfos:
329 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos' or btagInfo ==
'pfNegativeDeepFlavourTagInfos':
330 runNegativeVertexing =
True 331 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
332 runNegativeCvsLVertexing =
True 334 if runNegativeVertexing
or runNegativeCvsLVertexing:
335 import RecoVertex.AdaptiveVertexFinder.inclusiveNegativeVertexing_cff
as NegVertex
337 if runNegativeVertexing:
339 NegVertex.inclusiveCandidateNegativeVertexFinder.clone(primaryVertices = pvSource,tracks=pfCandidates),
342 NegVertex.candidateNegativeVertexMerger.clone(secondaryVertices = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeVertexFinder'+labelName+postfix)),
345 NegVertex.candidateNegativeVertexArbitrator.clone( secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexMerger'+labelName+postfix)
346 ,primaryVertices = pvSource
347 ,tracks=pfCandidates),
349 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix,
350 NegVertex.inclusiveCandidateNegativeSecondaryVertices.clone(secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexArbitrator'+labelName+postfix)),
353 if runNegativeCvsLVertexing:
354 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix,
355 NegVertex.inclusiveCandidateNegativeVertexFinderCvsL.clone(primaryVertices = pvSource,tracks=pfCandidates),
358 NegVertex.candidateNegativeVertexMergerCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix)),
361 NegVertex.candidateNegativeVertexArbitratorCvsL.clone( secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexMergerCvsL'+labelName+postfix)
362 ,primaryVertices = pvSource
363 ,tracks=pfCandidates),
365 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix,
366 NegVertex.inclusiveCandidateNegativeSecondaryVerticesCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexArbitratorCvsL'+labelName+postfix)),
370 acceptedTagInfos =
list()
371 for btagInfo
in requiredTagInfos:
372 if hasattr(btag,btagInfo):
373 if btagInfo ==
'pfImpactParameterTagInfos':
375 btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
378 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
379 _btagInfo.explicitJTA = cms.bool(explicitJTA)
381 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
382 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
383 _btagInfo.minimumNumberOfHits = cms.int32(8)
384 if btagInfo ==
'pfImpactParameterAK8TagInfos':
386 btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
389 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
390 _btagInfo.explicitJTA = cms.bool(explicitJTA)
392 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
393 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
394 _btagInfo.minimumNumberOfHits = cms.int32(8)
395 if btagInfo ==
'pfImpactParameterCA15TagInfos':
397 btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
400 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
401 _btagInfo.explicitJTA = cms.bool(explicitJTA)
403 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
404 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
405 _btagInfo.minimumNumberOfHits = cms.int32(8)
406 if btagInfo ==
'pfSecondaryVertexTagInfos':
408 btag.pfSecondaryVertexTagInfos.clone(
409 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
412 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
413 _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
414 _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
415 if btagInfo ==
'pfDeepCSVTagInfos':
417 btag.pfDeepCSVTagInfos.clone(
418 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
420 if svClustering
or fatJets != cms.InputTag(
''):
421 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
422 if btagInfo ==
'pfDeepCSVNegativeTagInfos':
424 btag.pfDeepCSVNegativeTagInfos.clone(
425 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderNegativeTagInfos'+labelName+postfix)),
427 if svClustering
or fatJets != cms.InputTag(
''):
428 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
429 if btagInfo ==
'pfDeepCSVPositiveTagInfos':
431 btag.pfDeepCSVPositiveTagInfos.clone(
432 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
434 if svClustering
or fatJets != cms.InputTag(
''):
435 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
436 if btagInfo ==
'pfDeepCMVATagInfos':
438 btag.pfDeepCMVATagInfos.clone(
439 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
440 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
441 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
442 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
444 if svClustering
or fatJets != cms.InputTag(
''):
445 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
446 if btagInfo ==
'pfDeepCMVANegativeTagInfos':
448 btag.pfDeepCMVATagInfos.clone(
449 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
450 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
451 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
452 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
454 if svClustering
or fatJets != cms.InputTag(
''):
455 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
456 if btagInfo ==
'pfDeepCMVAPositiveTagInfos':
458 btag.pfDeepCMVATagInfos.clone(
459 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
460 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
461 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
462 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
464 if svClustering
or fatJets != cms.InputTag(
''):
465 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
466 if btagInfo ==
'pfInclusiveSecondaryVertexFinderTagInfos':
468 btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(
469 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
470 extSVCollection=svSource),
472 if svClustering
or fatJets != cms.InputTag(
''):
473 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
474 if btagInfo ==
'pfInclusiveSecondaryVertexFinderAK8TagInfos':
476 btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(
477 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterAK8TagInfos'+labelName+postfix),
478 extSVCollection=svSource),
480 if svClustering
or fatJets != cms.InputTag(
''):
481 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
482 if btagInfo ==
'pfBoostedDoubleSVAK8TagInfos':
484 btag.pfBoostedDoubleSVAK8TagInfos.clone(
485 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderAK8TagInfos'+labelName+postfix)),
487 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCA15TagInfos':
489 btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(
490 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterCA15TagInfos'+labelName+postfix),
491 extSVCollection=svSource),
493 if svClustering
or fatJets != cms.InputTag(
''):
494 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
495 if btagInfo ==
'pfBoostedDoubleSVCA15TagInfos':
497 btag.pfBoostedDoubleSVCA15TagInfos.clone(
498 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderCA15TagInfos'+labelName+postfix)),
500 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCvsLTagInfos':
502 btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(
503 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
504 extSVCollection=svSourceCvsL),
506 if svClustering
or fatJets != cms.InputTag(
''):
507 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
508 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
510 btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(
511 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
512 extSVCollection = btagPrefix+
'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix),
514 if svClustering
or fatJets != cms.InputTag(
''):
515 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
516 if btagInfo ==
'pfGhostTrackVertexTagInfos':
518 btag.pfGhostTrackVertexTagInfos.clone(
519 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
521 if btagInfo ==
'pfSecondaryVertexNegativeTagInfos':
523 btag.pfSecondaryVertexNegativeTagInfos.clone(
524 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
527 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
528 _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
529 _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
530 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
532 btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(
533 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
534 extSVCollection=cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)),
536 if svClustering
or fatJets != cms.InputTag(
''):
537 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
538 if btagInfo ==
'impactParameterTagInfos':
540 btag.impactParameterTagInfos.clone(
541 jetTracks = cms.InputTag(
'jetTracksAssociatorAtVertex'+labelName+postfix),
542 primaryVertex=pvSource),
544 if btagInfo ==
'secondaryVertexTagInfos':
546 btag.secondaryVertexTagInfos.clone(
547 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
549 if btagInfo ==
'inclusiveSecondaryVertexFinderTagInfos':
551 btag.inclusiveSecondaryVertexFinderTagInfos.clone(
552 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
554 if svClustering
or fatJets != cms.InputTag(
''):
555 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
556 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredTagInfos':
558 btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(
559 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
561 if svClustering
or fatJets != cms.InputTag(
''):
562 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
563 if btagInfo ==
'secondaryVertexNegativeTagInfos':
565 btag.secondaryVertexNegativeTagInfos.clone(
566 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
568 if btagInfo ==
'inclusiveSecondaryVertexFinderNegativeTagInfos':
570 btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(
571 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
573 if svClustering
or fatJets != cms.InputTag(
''):
574 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
575 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
577 btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(
578 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
580 if svClustering
or fatJets != cms.InputTag(
''):
581 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
582 if btagInfo ==
'softMuonTagInfos':
584 btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource),
586 if btagInfo ==
'softPFMuonsTagInfos':
588 btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource),
590 if btagInfo ==
'softPFElectronsTagInfos':
592 btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource),
595 if 'DeepFlavourTagInfos' in btagInfo:
597 if btagInfo ==
'pfNegativeDeepFlavourTagInfos':
598 deep_csv_tag_infos =
'pfDeepCSVNegativeTagInfos' 599 svUsed = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)
602 deep_csv_tag_infos =
'pfDeepCSVTagInfos' 606 if not (
'limmed' in jetSource.value()):
607 puppi_value_map = cms.InputTag(
"puppi")
608 vertex_associator = cms.InputTag(
"primaryVertexAssociation",
"original")
610 puppi_value_map = cms.InputTag(
"")
611 vertex_associator = cms.InputTag(
"")
613 btag.pfDeepFlavourTagInfos.clone(
616 secondary_vertices=svUsed,
617 shallow_tag_infos = cms.InputTag(btagPrefix+deep_csv_tag_infos+labelName+postfix),
618 puppi_value_map = puppi_value_map,
619 vertex_associator = vertex_associator,
623 if btagInfo ==
'pfDeepDoubleXTagInfos':
625 btag.pfDeepDoubleXTagInfos.clone(
628 secondary_vertices=svSource,
629 shallow_tag_infos = cms.InputTag(btagPrefix+
'pfBoostedDoubleSVAK8TagInfos'+labelName+postfix),
633 if btagInfo ==
'pfDeepDoubleXTagInfosNopt':
635 btag.pfDeepDoubleXTagInfosNopt.clone(
638 secondary_vertices=svSource,
639 shallow_tag_infos = cms.InputTag(btagPrefix+
'pfBoostedDoubleSVAK8TagInfos'+labelName+postfix),
643 if btagInfo ==
'pfDeepBoostedJetTagInfos':
644 if pfCandidates.value() ==
'packedPFCandidates':
646 jetSrcName = jetSource.value().lower()
647 if 'updated' not in jetSrcName:
648 raise ValueError(
"Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource.value())
650 vertex_associator =
"" 651 fix_daughters = (
'slimmed' in jetSrcName)
652 elif pfCandidates.value() ==
'particleFlow':
653 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
661 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
663 btag.pfDeepBoostedJetTagInfos.clone(
666 secondary_vertices = svSource,
667 pf_candidates = pfCandidates,
668 fix_daughters = fix_daughters,
669 puppi_value_map = puppi_value_map,
670 vertex_associator = vertex_associator,
674 if btagInfo ==
'pfParticleNetTagInfos':
675 if pfCandidates.value() ==
'packedPFCandidates':
678 vertex_associator =
"" 679 fix_daughters = (
'slimmed' in jetSource.value().lower())
680 elif pfCandidates.value() ==
'particleFlow':
681 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
687 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
689 btag.pfParticleNetTagInfos.clone(
692 secondary_vertices = svSource,
693 pf_candidates = pfCandidates,
694 fix_daughters = fix_daughters,
695 puppi_value_map = puppi_value_map,
696 vertex_associator = vertex_associator,
700 acceptedTagInfos.append(btagInfo)
701 elif hasattr(toptag, btagInfo) :
702 acceptedTagInfos.append(btagInfo)
704 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
706 acceptedBtagDiscriminators =
list()
707 for discriminator_name
in btagDiscriminators :
708 btagDiscr = discriminator_name.split(
':')[0]
710 if hasattr(btag,btagDiscr):
711 newDiscr = btagPrefix+btagDiscr+labelName+postfix
712 if hasattr(process, newDiscr):
714 elif hasattr(getattr(btag, btagDiscr),
'tagInfos'):
717 getattr(btag, btagDiscr).
clone(
718 tagInfos = cms.VInputTag(
719 *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
720 for x
in supportedBtagDiscr[discriminator_name][0] ]
726 elif hasattr(getattr(btag, btagDiscr),
'src'):
729 getattr(btag, btagDiscr).
clone(
730 src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
736 raise ValueError(
'I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
737 acceptedBtagDiscriminators.append(discriminator_name)
739 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
741 for meta_tagger
in present_meta:
742 btagDiscr = meta_tagger.split(
':')[0]
744 if hasattr(btag,btagDiscr):
745 newDiscr = btagPrefix+btagDiscr+labelName+postfix
746 if hasattr(process, newDiscr):
751 getattr(btag, btagDiscr).
clone(),
755 for dependency
in supportedMetaDiscr[meta_tagger]:
756 if ':' in dependency:
757 new_dep = btagPrefix+dependency.split(
':')[0]+labelName+postfix+
':'+dependency.split(
':')[1]
759 new_dep = btagPrefix+dependency+labelName+postfix
760 replace = MassSearchReplaceAnyInputTagVisitor(dependency, new_dep)
761 replace.doIt(getattr(process, newDiscr), newDiscr)
762 acceptedBtagDiscriminators.append(meta_tagger)
764 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
767 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix)
for x
in acceptedTagInfos ] )
768 patJets.discriminatorSources = cms.VInputTag(*[
769 cms.InputTag(btagPrefix+x+labelName+postfix) \
770 if ':' not in x
else \
771 cms.InputTag(btagPrefix+x.split(
':')[0]+labelName+postfix+
':'+x.split(
':')[1]) \
772 for x
in acceptedBtagDiscriminators
774 if len(acceptedBtagDiscriminators) > 0 :
775 patJets.addBTagInfo =
True 778 if not tightBTagNTkHits:
779 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
784 ivfbTagInfos = [
'pfInclusiveSecondaryVertexFinderTagInfos',
'pfInclusiveSecondaryVertexFinderAK8TagInfos',
'pfInclusiveSecondaryVertexFinderCA15TagInfos']
785 if any(i
in acceptedTagInfos
for i
in ivfbTagInfos)
and not runIVFforCTagOnly:
786 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
787 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
789 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
790 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
791 _temp.minHits = cms.uint32(8)
793 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
794 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
795 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
796 _temp.primaryVertices = pvSource
797 _temp.tracks = pfCandidates
798 if hasattr( process, btagPrefix+
'candidateVertexArbitrator' ):
799 _temp = getattr(process, btagPrefix+
'candidateVertexArbitrator')
800 _temp.primaryVertices = pvSource
801 _temp.tracks = pfCandidates
802 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVertices' )
and not hasattr( process, svSource.getModuleLabel() ):
804 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVertices').
clone(),
806 if any(i
in acceptedTagInfos
for i
in ivfcTagInfos):
807 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
808 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
810 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
811 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
812 _temp.minHits = cms.uint32(8)
814 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
815 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
816 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
817 _temp.primaryVertices = pvSource
818 _temp.tracks = pfCandidates
819 if hasattr( process, btagPrefix+
'candidateVertexArbitratorCvsL' ):
820 _temp = getattr(process, btagPrefix+
'candidateVertexArbitratorCvsL')
821 _temp.primaryVertices = pvSource
822 _temp.tracks = pfCandidates
823 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL' )
and not hasattr( process, svSourceCvsL.getModuleLabel() ):
825 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL').
clone(),
827 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
828 if not hasattr( process,
'inclusiveVertexing' ):
829 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
830 task.add(process.inclusiveVertexingTask)
831 task.add(process.inclusiveCandidateVertexingTask)
832 task.add(process.inclusiveCandidateVertexingCvsLTask)
833 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
834 if not hasattr( process,
'inclusiveVertexing' ):
835 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
836 task.add(process.inclusiveVertexingTask)
837 task.add(process.inclusiveCandidateVertexingTask)
838 task.add(process.inclusiveCandidateVertexingCvsLTask)
839 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
840 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
841 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
842 task.add(process.inclusiveSecondaryVerticesFiltered)
843 task.add(process.bVertexFilter)
844 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
845 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
846 task.add(process.bToCharmDecayVertexMerged)
847 if 'caTopTagInfos' in acceptedTagInfos :
848 patJets.addTagInfos =
True 849 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
850 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )
851 task.add(process.caTopTaggersTask)
bool any(const std::vector< T > &v, const T &what)
def addToProcessAndTask(label, module, process, task)
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