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:
330 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos' or btagInfo ==
'pfNegativeDeepFlavourTagInfos':
331 runNegativeVertexing =
True 332 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
333 runNegativeCvsLVertexing =
True 335 if runNegativeVertexing
or runNegativeCvsLVertexing:
336 import RecoVertex.AdaptiveVertexFinder.inclusiveNegativeVertexing_cff
as NegVertex
338 if runNegativeVertexing:
340 NegVertex.inclusiveCandidateNegativeVertexFinder.clone(primaryVertices = pvSource,tracks=pfCandidates),
343 NegVertex.candidateNegativeVertexMerger.clone(secondaryVertices = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeVertexFinder'+labelName+postfix)),
346 NegVertex.candidateNegativeVertexArbitrator.clone( secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexMerger'+labelName+postfix)
347 ,primaryVertices = pvSource
348 ,tracks=pfCandidates),
350 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix,
351 NegVertex.inclusiveCandidateNegativeSecondaryVertices.clone(secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexArbitrator'+labelName+postfix)),
354 if runNegativeCvsLVertexing:
355 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix,
356 NegVertex.inclusiveCandidateNegativeVertexFinderCvsL.clone(primaryVertices = pvSource,tracks=pfCandidates),
359 NegVertex.candidateNegativeVertexMergerCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeVertexFinderCvsL'+labelName+postfix)),
362 NegVertex.candidateNegativeVertexArbitratorCvsL.clone( secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexMergerCvsL'+labelName+postfix)
363 ,primaryVertices = pvSource
364 ,tracks=pfCandidates),
366 addToProcessAndTask(btagPrefix+
'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix,
367 NegVertex.inclusiveCandidateNegativeSecondaryVerticesCvsL.clone(secondaryVertices = cms.InputTag(btagPrefix+
'candidateNegativeVertexArbitratorCvsL'+labelName+postfix)),
371 acceptedTagInfos =
list()
372 for btagInfo
in requiredTagInfos:
373 if hasattr(btag,btagInfo):
374 if btagInfo ==
'pfImpactParameterTagInfos':
376 btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
379 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
380 _btagInfo.explicitJTA = cms.bool(explicitJTA)
382 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
383 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
384 _btagInfo.minimumNumberOfHits = cms.int32(8)
385 if btagInfo ==
'pfImpactParameterAK8TagInfos':
387 btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
390 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
391 _btagInfo.explicitJTA = cms.bool(explicitJTA)
393 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
394 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
395 _btagInfo.minimumNumberOfHits = cms.int32(8)
396 if btagInfo ==
'pfImpactParameterCA15TagInfos':
398 btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
401 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
402 _btagInfo.explicitJTA = cms.bool(explicitJTA)
404 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
405 _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
406 _btagInfo.minimumNumberOfHits = cms.int32(8)
407 if btagInfo ==
'pfSecondaryVertexTagInfos':
409 btag.pfSecondaryVertexTagInfos.clone(
410 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
413 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
414 _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
415 _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
416 if btagInfo ==
'pfDeepCSVTagInfos':
418 btag.pfDeepCSVTagInfos.clone(
419 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
421 if svClustering
or fatJets != cms.InputTag(
''):
422 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
423 if btagInfo ==
'pfDeepCSVNegativeTagInfos':
425 btag.pfDeepCSVNegativeTagInfos.clone(
426 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderNegativeTagInfos'+labelName+postfix)),
428 if svClustering
or fatJets != cms.InputTag(
''):
429 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
430 if btagInfo ==
'pfDeepCSVPositiveTagInfos':
432 btag.pfDeepCSVPositiveTagInfos.clone(
433 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
435 if svClustering
or fatJets != cms.InputTag(
''):
436 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
437 if btagInfo ==
'pfDeepCMVATagInfos':
439 btag.pfDeepCMVATagInfos.clone(
440 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
441 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
442 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
443 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
445 if svClustering
or fatJets != cms.InputTag(
''):
446 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
447 if btagInfo ==
'pfDeepCMVANegativeTagInfos':
449 btag.pfDeepCMVATagInfos.clone(
450 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
451 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
452 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
453 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
455 if svClustering
or fatJets != cms.InputTag(
''):
456 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
457 if btagInfo ==
'pfDeepCMVAPositiveTagInfos':
459 btag.pfDeepCMVATagInfos.clone(
460 deepNNTagInfos = cms.InputTag(btagPrefix+
'pfDeepCSVTagInfos'+labelName+postfix),
461 ipInfoSrc = cms.InputTag(btagPrefix+
"pfImpactParameterTagInfos"+labelName+postfix),
462 muInfoSrc = cms.InputTag(btagPrefix+
"softPFMuonsTagInfos"+labelName+postfix),
463 elInfoSrc = cms.InputTag(btagPrefix+
"softPFElectronsTagInfos"+labelName+postfix)),
465 if svClustering
or fatJets != cms.InputTag(
''):
466 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
467 if btagInfo ==
'pfInclusiveSecondaryVertexFinderTagInfos':
469 btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(
470 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
471 extSVCollection=svSource),
473 if svClustering
or fatJets != cms.InputTag(
''):
474 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
475 if btagInfo ==
'pfInclusiveSecondaryVertexFinderAK8TagInfos':
477 btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(
478 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterAK8TagInfos'+labelName+postfix),
479 extSVCollection=svSource),
481 if svClustering
or fatJets != cms.InputTag(
''):
482 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
483 if btagInfo ==
'pfBoostedDoubleSVAK8TagInfos':
485 btag.pfBoostedDoubleSVAK8TagInfos.clone(
486 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderAK8TagInfos'+labelName+postfix)),
488 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCA15TagInfos':
490 btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(
491 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterCA15TagInfos'+labelName+postfix),
492 extSVCollection=svSource),
494 if svClustering
or fatJets != cms.InputTag(
''):
495 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
496 if btagInfo ==
'pfBoostedDoubleSVCA15TagInfos':
498 btag.pfBoostedDoubleSVCA15TagInfos.clone(
499 svTagInfos = cms.InputTag(btagPrefix+
'pfInclusiveSecondaryVertexFinderCA15TagInfos'+labelName+postfix)),
501 if btagInfo ==
'pfInclusiveSecondaryVertexFinderCvsLTagInfos':
503 btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(
504 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
505 extSVCollection=svSourceCvsL),
507 if svClustering
or fatJets != cms.InputTag(
''):
508 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
509 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
511 btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(
512 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
513 extSVCollection = btagPrefix+
'inclusiveCandidateNegativeSecondaryVerticesCvsL'+labelName+postfix),
515 if svClustering
or fatJets != cms.InputTag(
''):
516 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
517 if btagInfo ==
'pfGhostTrackVertexTagInfos':
519 btag.pfGhostTrackVertexTagInfos.clone(
520 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
522 if btagInfo ==
'pfSecondaryVertexNegativeTagInfos':
524 btag.pfSecondaryVertexNegativeTagInfos.clone(
525 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix)),
528 _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
529 _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
530 _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
531 if btagInfo ==
'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
533 btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(
534 trackIPTagInfos = cms.InputTag(btagPrefix+
'pfImpactParameterTagInfos'+labelName+postfix),
535 extSVCollection=cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)),
537 if svClustering
or fatJets != cms.InputTag(
''):
538 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
539 if btagInfo ==
'impactParameterTagInfos':
541 btag.impactParameterTagInfos.clone(
542 jetTracks = cms.InputTag(
'jetTracksAssociatorAtVertex'+labelName+postfix),
543 primaryVertex=pvSource),
545 if btagInfo ==
'secondaryVertexTagInfos':
547 btag.secondaryVertexTagInfos.clone(
548 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
550 if btagInfo ==
'inclusiveSecondaryVertexFinderTagInfos':
552 btag.inclusiveSecondaryVertexFinderTagInfos.clone(
553 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
555 if svClustering
or fatJets != cms.InputTag(
''):
556 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
557 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredTagInfos':
559 btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(
560 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
562 if svClustering
or fatJets != cms.InputTag(
''):
563 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
564 if btagInfo ==
'secondaryVertexNegativeTagInfos':
566 btag.secondaryVertexNegativeTagInfos.clone(
567 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
569 if btagInfo ==
'inclusiveSecondaryVertexFinderNegativeTagInfos':
571 btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(
572 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
574 if svClustering
or fatJets != cms.InputTag(
''):
575 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
576 if btagInfo ==
'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
578 btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(
579 trackIPTagInfos = cms.InputTag(btagPrefix+
'impactParameterTagInfos'+labelName+postfix)),
581 if svClustering
or fatJets != cms.InputTag(
''):
582 setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
583 if btagInfo ==
'softMuonTagInfos':
585 btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource),
587 if btagInfo ==
'softPFMuonsTagInfos':
589 btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource),
591 if btagInfo ==
'softPFElectronsTagInfos':
593 btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource),
596 if 'DeepFlavourTagInfos' in btagInfo:
598 if btagInfo ==
'pfNegativeDeepFlavourTagInfos':
599 deep_csv_tag_infos =
'pfDeepCSVNegativeTagInfos' 600 svUsed = cms.InputTag(btagPrefix+
'inclusiveCandidateNegativeSecondaryVertices'+labelName+postfix)
603 deep_csv_tag_infos =
'pfDeepCSVTagInfos' 607 if not (
'limmed' in jetSource.value()):
608 puppi_value_map = cms.InputTag(
"puppi")
609 vertex_associator = cms.InputTag(
"primaryVertexAssociation",
"original")
611 puppi_value_map = cms.InputTag(
"")
612 vertex_associator = cms.InputTag(
"")
614 btag.pfDeepFlavourTagInfos.clone(
617 secondary_vertices=svUsed,
618 shallow_tag_infos = cms.InputTag(btagPrefix+deep_csv_tag_infos+labelName+postfix),
619 puppi_value_map = puppi_value_map,
620 vertex_associator = vertex_associator,
624 if btagInfo ==
'pfDeepDoubleXTagInfos':
626 btag.pfDeepDoubleXTagInfos.clone(
629 secondary_vertices=svSource,
630 shallow_tag_infos = cms.InputTag(btagPrefix+
'pfBoostedDoubleSVAK8TagInfos'+labelName+postfix),
634 if btagInfo ==
'pfDeepBoostedJetTagInfos':
635 if pfCandidates.value() ==
'packedPFCandidates':
637 jetSrcName = jetSource.value().lower()
638 if 'updated' in jetSrcName:
640 vertex_associator =
"" 641 if 'withpuppidaughter' in jetSrcName:
645 has_puppi_weighted_daughters =
True 649 has_puppi_weighted_daughters =
False 651 raise ValueError(
"Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource.value())
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 has_puppi_weighted_daughters = has_puppi_weighted_daughters,
668 puppi_value_map = puppi_value_map,
669 vertex_associator = vertex_associator,
673 acceptedTagInfos.append(btagInfo)
674 elif hasattr(toptag, btagInfo) :
675 acceptedTagInfos.append(btagInfo)
677 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo))
679 acceptedBtagDiscriminators =
list()
680 for discriminator_name
in btagDiscriminators :
681 btagDiscr = discriminator_name.split(
':')[0]
683 if hasattr(btag,btagDiscr):
684 newDiscr = btagPrefix+btagDiscr+labelName+postfix
685 if hasattr(process, newDiscr):
687 elif hasattr(getattr(btag, btagDiscr),
'tagInfos'):
690 getattr(btag, btagDiscr).
clone(
691 tagInfos = cms.VInputTag(
692 *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
693 for x
in supportedBtagDiscr[discriminator_name][0] ]
699 elif hasattr(getattr(btag, btagDiscr),
'src'):
702 getattr(btag, btagDiscr).
clone(
703 src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
709 raise ValueError(
'I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
710 acceptedBtagDiscriminators.append(discriminator_name)
712 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr))
714 for meta_tagger
in present_meta:
715 btagDiscr = meta_tagger.split(
':')[0]
717 if hasattr(btag,btagDiscr):
718 newDiscr = btagPrefix+btagDiscr+labelName+postfix
719 if hasattr(process, newDiscr):
724 getattr(btag, btagDiscr).
clone(),
728 for dependency
in supportedMetaDiscr[meta_tagger]:
729 if ':' in dependency:
730 new_dep = btagPrefix+dependency.split(
':')[0]+labelName+postfix+
':'+dependency.split(
':')[1]
732 new_dep = btagPrefix+dependency+labelName+postfix
733 replace = MassSearchReplaceAnyInputTagVisitor(dependency, new_dep)
734 replace.doIt(getattr(process, newDiscr), newDiscr)
735 acceptedBtagDiscriminators.append(meta_tagger)
737 print(
' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr))
740 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix)
for x
in acceptedTagInfos ] )
741 patJets.discriminatorSources = cms.VInputTag(*[
742 cms.InputTag(btagPrefix+x+labelName+postfix) \
743 if ':' not in x
else \
744 cms.InputTag(btagPrefix+x.split(
':')[0]+labelName+postfix+
':'+x.split(
':')[1]) \
745 for x
in acceptedBtagDiscriminators
747 if len(acceptedBtagDiscriminators) > 0 :
748 patJets.addBTagInfo =
True 751 if not tightBTagNTkHits:
752 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
757 ivfbTagInfos = [
'pfInclusiveSecondaryVertexFinderTagInfos',
'pfInclusiveSecondaryVertexFinderAK8TagInfos',
'pfInclusiveSecondaryVertexFinderCA15TagInfos']
758 if any(i
in acceptedTagInfos
for i
in ivfbTagInfos)
and not runIVFforCTagOnly:
759 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
760 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
762 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
763 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
764 _temp.minHits = cms.uint32(8)
766 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
767 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
768 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
769 _temp.primaryVertices = pvSource
770 _temp.tracks = pfCandidates
771 if hasattr( process, btagPrefix+
'candidateVertexArbitrator' ):
772 _temp = getattr(process, btagPrefix+
'candidateVertexArbitrator')
773 _temp.primaryVertices = pvSource
774 _temp.tracks = pfCandidates
775 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVertices' )
and not hasattr( process, svSource.getModuleLabel() ):
777 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVertices').
clone(),
779 if any(i
in acceptedTagInfos
for i
in ivfcTagInfos):
780 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
781 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
783 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
784 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
785 _temp.minHits = cms.uint32(8)
787 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
788 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
789 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
790 _temp.primaryVertices = pvSource
791 _temp.tracks = pfCandidates
792 if hasattr( process, btagPrefix+
'candidateVertexArbitratorCvsL' ):
793 _temp = getattr(process, btagPrefix+
'candidateVertexArbitratorCvsL')
794 _temp.primaryVertices = pvSource
795 _temp.tracks = pfCandidates
796 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL' )
and not hasattr( process, svSourceCvsL.getModuleLabel() ):
798 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL').
clone(),
800 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
801 if not hasattr( process,
'inclusiveVertexing' ):
802 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
803 task.add(process.inclusiveVertexingTask)
804 task.add(process.inclusiveCandidateVertexingTask)
805 task.add(process.inclusiveCandidateVertexingCvsLTask)
806 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
807 if not hasattr( process,
'inclusiveVertexing' ):
808 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
809 task.add(process.inclusiveVertexingTask)
810 task.add(process.inclusiveCandidateVertexingTask)
811 task.add(process.inclusiveCandidateVertexingCvsLTask)
812 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
813 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
814 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
815 task.add(process.inclusiveSecondaryVerticesFiltered)
816 task.add(process.bVertexFilter)
817 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
818 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
819 task.add(process.bToCharmDecayVertexMerged)
820 if 'caTopTagInfos' in acceptedTagInfos :
821 patJets.addTagInfos =
True 822 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
823 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )
824 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