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 ==
'pfDeepDoubleBTagInfos':
625 btag.pfDeepDoubleBTagInfos.clone(
628 secondary_vertices=svSource,
629 shallow_tag_infos = cms.InputTag(btagPrefix+
'pfBoostedDoubleSVAK8TagInfos'+labelName+postfix),
633 if btagInfo ==
'pfDeepBoostedJetTagInfos':
634 if pfCandidates.value() ==
'packedPFCandidates':
636 jetSrcName = jetSource.value().lower()
637 if 'updated' in jetSrcName:
639 vertex_associator =
"" 640 fix_daughters =
False 641 if 'withpuppidaughter' in jetSrcName:
645 has_puppi_weighted_daughters =
True 649 has_puppi_weighted_daughters =
False 650 if 'slimmed' in jetSrcName:
654 raise ValueError(
"Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource.value())
655 elif pfCandidates.value() ==
'particleFlow':
656 raise ValueError(
"Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported.")
665 raise ValueError(
"Invalid pfCandidates collection: %s." % pfCandidates.value())
667 btag.pfDeepBoostedJetTagInfos.clone(
670 secondary_vertices = svSource,
671 has_puppi_weighted_daughters = has_puppi_weighted_daughters,
672 fix_daughters = fix_daughters,
673 puppi_value_map = puppi_value_map,
674 vertex_associator = vertex_associator,
678 acceptedTagInfos.append(btagInfo)
679 elif hasattr(toptag, btagInfo) :
680 acceptedTagInfos.append(btagInfo)
682 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
684 acceptedBtagDiscriminators =
list()
685 for discriminator_name
in btagDiscriminators :
686 btagDiscr = discriminator_name.split(
':')[0]
688 if hasattr(btag,btagDiscr):
689 newDiscr = btagPrefix+btagDiscr+labelName+postfix
690 if hasattr(process, newDiscr):
692 elif hasattr(getattr(btag, btagDiscr),
'tagInfos'):
695 getattr(btag, btagDiscr).
clone(
696 tagInfos = cms.VInputTag(
697 *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
698 for x
in supportedBtagDiscr[discriminator_name][0] ]
704 elif hasattr(getattr(btag, btagDiscr),
'src'):
707 getattr(btag, btagDiscr).
clone(
708 src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
714 raise ValueError(
'I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
715 acceptedBtagDiscriminators.append(discriminator_name)
717 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
719 for meta_tagger
in present_meta:
720 btagDiscr = meta_tagger.split(
':')[0]
722 if hasattr(btag,btagDiscr):
723 newDiscr = btagPrefix+btagDiscr+labelName+postfix
724 if hasattr(process, newDiscr):
729 getattr(btag, btagDiscr).
clone(),
733 for dependency
in supportedMetaDiscr[meta_tagger]:
734 if ':' in dependency:
735 new_dep = btagPrefix+dependency.split(
':')[0]+labelName+postfix+
':'+dependency.split(
':')[1]
737 new_dep = btagPrefix+dependency+labelName+postfix
738 replace = MassSearchReplaceAnyInputTagVisitor(dependency, new_dep)
739 replace.doIt(getattr(process, newDiscr), newDiscr)
740 acceptedBtagDiscriminators.append(meta_tagger)
742 print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
745 patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix)
for x
in acceptedTagInfos ] )
746 patJets.discriminatorSources = cms.VInputTag(*[
747 cms.InputTag(btagPrefix+x+labelName+postfix) \
748 if ':' not in x
else \
749 cms.InputTag(btagPrefix+x.split(
':')[0]+labelName+postfix+
':'+x.split(
':')[1]) \
750 for x
in acceptedBtagDiscriminators
752 if len(acceptedBtagDiscriminators) > 0 :
753 patJets.addBTagInfo =
True 756 if not tightBTagNTkHits:
757 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
762 ivfbTagInfos = [
'pfInclusiveSecondaryVertexFinderTagInfos',
'pfInclusiveSecondaryVertexFinderAK8TagInfos',
'pfInclusiveSecondaryVertexFinderCA15TagInfos']
763 if any(i
in acceptedTagInfos
for i
in ivfbTagInfos)
and not runIVFforCTagOnly:
764 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
765 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
767 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
768 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
769 _temp.minHits = cms.uint32(8)
771 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
772 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinder' ):
773 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinder')
774 _temp.primaryVertices = pvSource
775 _temp.tracks = pfCandidates
776 if hasattr( process, btagPrefix+
'candidateVertexArbitrator' ):
777 _temp = getattr(process, btagPrefix+
'candidateVertexArbitrator')
778 _temp.primaryVertices = pvSource
779 _temp.tracks = pfCandidates
780 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVertices' )
and not hasattr( process, svSource.getModuleLabel() ):
782 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVertices').
clone(),
784 if any(i
in acceptedTagInfos
for i
in ivfcTagInfos):
785 if not hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
786 loadWithPrefix(process,
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
788 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
789 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
790 _temp.minHits = cms.uint32(8)
792 if pvSource.getModuleLabel() ==
'offlineSlimmedPrimaryVertices':
793 if hasattr( process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL' ):
794 _temp = getattr(process, btagPrefix+
'inclusiveCandidateVertexFinderCvsL')
795 _temp.primaryVertices = pvSource
796 _temp.tracks = pfCandidates
797 if hasattr( process, btagPrefix+
'candidateVertexArbitratorCvsL' ):
798 _temp = getattr(process, btagPrefix+
'candidateVertexArbitratorCvsL')
799 _temp.primaryVertices = pvSource
800 _temp.tracks = pfCandidates
801 if hasattr( process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL' )
and not hasattr( process, svSourceCvsL.getModuleLabel() ):
803 getattr(process, btagPrefix+
'inclusiveCandidateSecondaryVerticesCvsL').
clone(),
805 if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
806 if not hasattr( process,
'inclusiveVertexing' ):
807 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
808 task.add(process.inclusiveVertexingTask)
809 task.add(process.inclusiveCandidateVertexingTask)
810 task.add(process.inclusiveCandidateVertexingCvsLTask)
811 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
812 if not hasattr( process,
'inclusiveVertexing' ):
813 process.load(
'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
814 task.add(process.inclusiveVertexingTask)
815 task.add(process.inclusiveCandidateVertexingTask)
816 task.add(process.inclusiveCandidateVertexingCvsLTask)
817 if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
818 if not hasattr( process,
'inclusiveSecondaryVerticesFiltered' ):
819 process.load(
'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
820 task.add(process.inclusiveSecondaryVerticesFiltered)
821 task.add(process.bVertexFilter)
822 if not hasattr( process,
'bToCharmDecayVertexMerged' ):
823 process.load(
'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
824 task.add(process.bToCharmDecayVertexMerged)
825 if 'caTopTagInfos' in acceptedTagInfos :
826 patJets.addTagInfos =
True 827 if not hasattr( process,
'caTopTagInfos' )
and not hasattr( process,
'caTopTagInfosAK8' ):
828 process.load(
'RecoJets.JetProducers.caTopTaggers_cff' )
829 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