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' in jetSrcName:
649 vertex_associator =
"" 650 fix_daughters =
False 651 if 'withpuppidaughter' in jetSrcName:
655 has_puppi_weighted_daughters =
True 659 has_puppi_weighted_daughters =
False 660 if 'slimmed' in jetSrcName:
664 raise ValueError(
"Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource.value())
665 elif pfCandidates.value() ==
'particleFlow':
666 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
675 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
677 btag.pfDeepBoostedJetTagInfos.clone(
680 secondary_vertices = svSource,
681 has_puppi_weighted_daughters = has_puppi_weighted_daughters,
682 fix_daughters = fix_daughters,
683 puppi_value_map = puppi_value_map,
684 vertex_associator = vertex_associator,
688 acceptedTagInfos.append(btagInfo)
689 elif hasattr(toptag, btagInfo) :
690 acceptedTagInfos.append(btagInfo)
692 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
694 acceptedBtagDiscriminators =
list()
695 for discriminator_name
in btagDiscriminators :
696 btagDiscr = discriminator_name.split(
':')[0]
698 if hasattr(btag,btagDiscr):
699 newDiscr = btagPrefix+btagDiscr+labelName+postfix
700 if hasattr(process, newDiscr):
702 elif hasattr(getattr(btag, btagDiscr),
'tagInfos'):
705 getattr(btag, btagDiscr).
clone(
706 tagInfos = cms.VInputTag(
707 *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
708 for x
in supportedBtagDiscr[discriminator_name][0] ]
714 elif hasattr(getattr(btag, btagDiscr),
'src'):
717 getattr(btag, btagDiscr).
clone(
718 src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
724 raise ValueError(
'I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
725 acceptedBtagDiscriminators.append(discriminator_name)
727 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
729 for meta_tagger
in present_meta:
730 btagDiscr = meta_tagger.split(
':')[0]
732 if hasattr(btag,btagDiscr):
733 newDiscr = btagPrefix+btagDiscr+labelName+postfix
734 if hasattr(process, newDiscr):
739 getattr(btag, btagDiscr).
clone(),
743 for dependency
in supportedMetaDiscr[meta_tagger]:
744 if ':' in dependency:
745 new_dep = btagPrefix+dependency.split(
':')[0]+labelName+postfix+
':'+dependency.split(
':')[1]
747 new_dep = btagPrefix+dependency+labelName+postfix
748 replace = MassSearchReplaceAnyInputTagVisitor(dependency, new_dep)
749 replace.doIt(getattr(process, newDiscr), newDiscr)
750 acceptedBtagDiscriminators.append(meta_tagger)
752 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
755 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix)
for x
in acceptedTagInfos ] )
756 patJets.discriminatorSources = cms.VInputTag(*[
757 cms.InputTag(btagPrefix+x+labelName+postfix) \
758 if ':' not in x
else \
759 cms.InputTag(btagPrefix+x.split(
':')[0]+labelName+postfix+
':'+x.split(
':')[1]) \
760 for x
in acceptedBtagDiscriminators
762 if len(acceptedBtagDiscriminators) > 0 :
763 patJets.addBTagInfo =
True 766 if not tightBTagNTkHits:
767 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
772 ivfbTagInfos = [
'pfInclusiveSecondaryVertexFinderTagInfos',
'pfInclusiveSecondaryVertexFinderAK8TagInfos',
'pfInclusiveSecondaryVertexFinderCA15TagInfos']
773 if any(i
in acceptedTagInfos
for i
in ivfbTagInfos)
and not runIVFforCTagOnly:
774 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
775 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
777 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
778 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
779 _temp.minHits = cms.uint32(8)
781 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
782 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
783 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
784 _temp.primaryVertices = pvSource
785 _temp.tracks = pfCandidates
786 if hasattr( process, btagPrefix+
'candidateVertexArbitrator' ):
787 _temp = getattr(process, btagPrefix+
'candidateVertexArbitrator')
788 _temp.primaryVertices = pvSource
789 _temp.tracks = pfCandidates
790 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVertices' )
and not hasattr( process, svSource.getModuleLabel() ):
792 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVertices').
clone(),
794 if any(i
in acceptedTagInfos
for i
in ivfcTagInfos):
795 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
796 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
798 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
799 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
800 _temp.minHits = cms.uint32(8)
802 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
803 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
804 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
805 _temp.primaryVertices = pvSource
806 _temp.tracks = pfCandidates
807 if hasattr( process, btagPrefix+
'candidateVertexArbitratorCvsL' ):
808 _temp = getattr(process, btagPrefix+
'candidateVertexArbitratorCvsL')
809 _temp.primaryVertices = pvSource
810 _temp.tracks = pfCandidates
811 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL' )
and not hasattr( process, svSourceCvsL.getModuleLabel() ):
813 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL').
clone(),
815 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
816 if not hasattr( process,
'inclusiveVertexing' ):
817 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
818 task.add(process.inclusiveVertexingTask)
819 task.add(process.inclusiveCandidateVertexingTask)
820 task.add(process.inclusiveCandidateVertexingCvsLTask)
821 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
822 if not hasattr( process,
'inclusiveVertexing' ):
823 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
824 task.add(process.inclusiveVertexingTask)
825 task.add(process.inclusiveCandidateVertexingTask)
826 task.add(process.inclusiveCandidateVertexingCvsLTask)
827 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
828 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
829 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
830 task.add(process.inclusiveSecondaryVerticesFiltered)
831 task.add(process.bVertexFilter)
832 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
833 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
834 task.add(process.bToCharmDecayVertexMerged)
835 if 'caTopTagInfos' in acceptedTagInfos :
836 patJets.addTagInfos =
True 837 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
838 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )
839 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