@@ -407,6 +407,11 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
407407 process , task )
408408
409409
410+ # Setup the PUPPI ValueMap that will consumed by the TagInfo producers.
411+ puppi_value_map = "puppi"
412+ if pfCandidates .value () == 'packedPFCandidates' :
413+ puppi_value_map = setupPuppiForPackedPF (process )[0 ]
414+
410415 acceptedTagInfos = list ()
411416 for btagInfo in requiredTagInfos :
412417 if hasattr (btag ,btagInfo ):
@@ -637,14 +642,9 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
637642 process , task )
638643
639644
640-
641645 if 'pfBoostedDouble' in btagInfo or 'SecondaryVertex' in btagInfo :
642- _btagInfo = getattr (process , btagPrefix + btagInfo + labelName + postfix )
643- if pfCandidates .value () == 'packedPFCandidates' :
644- packedPFPuppiLabel = setupPuppiForPackedPF (process )[0 ]
645- _btagInfo .weights = cms .InputTag (packedPFPuppiLabel )
646- else :
647- _btagInfo .weights = cms .InputTag ("puppi" )
646+ _btagInfo = getattr (process , btagPrefix + btagInfo + labelName + postfix )
647+ _btagInfo .weights = cms .InputTag (puppi_value_map )
648648
649649 if 'DeepFlavourTagInfos' in btagInfo :
650650 svUsed = svSource
@@ -659,10 +659,8 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
659659 # use right input tags when running with RECO PF candidates, which actually
660660 # depends of whether jets use "particleFlow"
661661 if pfCandidates .value () == 'packedPFCandidates' :
662- puppi_value_map = setupPuppiForPackedPF (process )[0 ]
663662 vertex_associator = cms .InputTag ("" )
664663 else :
665- puppi_value_map = cms .InputTag ("puppi" )
666664 vertex_associator = cms .InputTag ("primaryVertexAssociation" ,"original" )
667665
668666 # If this jet is a puppi jet, then set is_weighted_jet to true.
@@ -680,7 +678,7 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
680678 is_weighted_jet = is_weighted_jet ,
681679 flip = flip ),
682680 process , task )
683-
681+
684682 if ('ParticleTransformerAK4TagInfos' in btagInfo ) and ('UnifiedParticleTransformerAK4TagInfos' not in btagInfo ): #We also have to veto UParT is we select ParT
685683 svUsed = svSource
686684 if btagInfo == 'pfNegativeParticleTransformerAK4TagInfos' :
@@ -690,10 +688,8 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
690688 # use right input tags when running with RECO PF candidates, which actually
691689 # depends of whether jets use "particleFlow"
692690 if pfCandidates .value () == 'packedPFCandidates' :
693- puppi_value_map = setupPuppiForPackedPF (process )[0 ]
694691 vertex_associator = cms .InputTag ("" )
695692 else :
696- puppi_value_map = cms .InputTag ("puppi" )
697693 vertex_associator = cms .InputTag ("primaryVertexAssociation" ,"original" )
698694
699695 # If this jet is a puppi jet, then set is_weighted_jet to true.
@@ -722,10 +718,8 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
722718 # use right input tags when running with RECO PF candidates, which actually
723719 # depends of whether jets use "particleFlow"
724720 if pfCandidates .value () == 'packedPFCandidates' :
725- puppi_value_map = setupPuppiForPackedPF (process )[0 ]
726721 vertex_associator = cms .InputTag ("" )
727722 else :
728- puppi_value_map = cms .InputTag ("puppi" )
729723 vertex_associator = cms .InputTag ("primaryVertexAssociation" ,"original" )
730724
731725 # If this jet is a puppi jet, then set is_weighted_jet to true.
@@ -747,8 +741,6 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
747741 # can only run on PAT jets, so the updater needs to be used
748742 if 'updated' not in jetSource .value ().lower ():
749743 raise ValueError ("Invalid jet collection: %s. pfDeepDoubleXTagInfos only supports running via updateJetCollection." % jetSource .value ())
750- packedPFPuppiLabel = setupPuppiForPackedPF (process )[0 ]
751- puppi_value_map = cms .InputTag (packedPFPuppiLabel )
752744 addToProcessAndTask (btagPrefix + btagInfo + labelName + postfix ,
753745 btag .pfDeepDoubleXTagInfos .clone (
754746 jets = jetSource ,
@@ -759,8 +751,6 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
759751 ),
760752 process , task )
761753 if btagInfo == 'pfHiggsInteractionNetTagInfos' :
762- packedPFPuppiLabel = setupPuppiForPackedPF (process )[0 ]
763- puppi_value_map = cms .InputTag (packedPFPuppiLabel )
764754 addToProcessAndTask (btagPrefix + btagInfo + labelName + postfix ,
765755 btag .pfHiggsInteractionNetTagInfos .clone (
766756 jets = jetSource ,
@@ -776,14 +766,12 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
776766 # case 1: running over jets whose daughters are PackedCandidates (only via updateJetCollection for now)
777767 if 'updated' not in jetSource .value ().lower ():
778768 raise ValueError ("Invalid jet collection: %s. pfDeepBoostedJetTagInfos only supports running via updateJetCollection." % jetSource .value ())
779- puppi_value_map = setupPuppiForPackedPF (process )[0 ]
780769 vertex_associator = ""
781770 elif pfCandidates .value () == 'particleFlow' :
782771 raise ValueError ("Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported." )
783772 # case 2: running on new jet collection whose daughters are PFCandidates (e.g., cluster jets in RECO/AOD)
784773 # daughters are the particles used in jet clustering, so already scaled by their puppi weights
785774 # Uncomment the lines below after running pfDeepBoostedJetTagInfos with reco::PFCandidates becomes supported
786- # puppi_value_map = "puppi"
787775# vertex_associator = "primaryVertexAssociation:original"
788776 else :
789777 raise ValueError ("Invalid pfCandidates collection: %s." % pfCandidates .value ())
@@ -801,12 +789,10 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
801789 if btagInfo == 'pfParticleNetTagInfos' :
802790 if pfCandidates .value () == 'packedPFCandidates' :
803791 # case 1: running over jets whose daughters are PackedCandidates (only via updateJetCollection for now)
804- puppi_value_map = setupPuppiForPackedPF (process )[0 ]
805792 vertex_associator = ""
806793 elif pfCandidates .value () == 'particleFlow' :
807794 raise ValueError ("Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported." )
808795 # case 2: running on new jet collection whose daughters are PFCandidates (e.g., cluster jets in RECO/AOD)
809- puppi_value_map = "puppi"
810796 vertex_associator = "primaryVertexAssociation:original"
811797 else :
812798 raise ValueError ("Invalid pfCandidates collection: %s." % pfCandidates .value ())
@@ -833,12 +819,10 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
833819 sip3dSigMax = - 1
834820 if pfCandidates .value () == 'packedPFCandidates' :
835821 # case 1: running over jets whose daughters are PackedCandidates (only via updateJetCollection for now)
836- puppi_value_map = setupPuppiForPackedPF (process )[0 ]
837822 vertex_associator = ""
838823 elif pfCandidates .value () == 'particleFlow' :
839824 raise ValueError ("Running pfDeepBoostedJetTagInfos with reco::PFCandidates is currently not supported." )
840825 # case 2: running on new jet collection whose daughters are PFCandidates (e.g., cluster jets in RECO/AOD)
841- puppi_value_map = "puppi"
842826 vertex_associator = "primaryVertexAssociation:original"
843827 else :
844828 raise ValueError ("Invalid pfCandidates collection: %s." % pfCandidates .value ())
@@ -877,6 +861,7 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
877861 vertices = pvSource ,
878862 secondary_vertices = svUsed ,
879863 pf_candidates = pfCandidates ,
864+ puppi_value_map = puppi_value_map ,
880865 flip_ip_sign = flip_ip_sign ,
881866 max_sip3dsig_for_flip = max_sip3dsig_for_flip ,
882867 ),
@@ -892,12 +877,13 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
892877 vertices = pvSource ,
893878 secondary_vertices = svSource ,
894879 pf_candidates = pfCandidates ,
880+ puppi_value_map = puppi_value_map
895881 ),
896882 process , task )
897883 acceptedTagInfos .append (btagInfo )
898- elif btagInfo == 'pfParticleNetFromMiniAODAK4CHSCentralTagInfos' or btagInfo == 'pfNegativeParticleNetFromMiniAODAK4PuppiForwardTagInfos ' :
884+ elif btagInfo == 'pfParticleNetFromMiniAODAK4CHSCentralTagInfos' or btagInfo == 'pfNegativeParticleNetFromMiniAODAK4CHSCentralTagInfos ' :
899885 # ParticleNetFromMiniAOD cannot be run on RECO inputs, so need a workaround
900- if btagInfo == 'pfNegativeParticleNetFromMiniAODAK4PuppiForwardTagInfos ' :
886+ if btagInfo == 'pfNegativeParticleNetFromMiniAODAK4CHSCentralTagInfos ' :
901887 svUsed , flip_ip_sign , max_sip3dsig_for_flip = cms .InputTag (btagPrefix + 'inclusiveCandidateNegativeSecondaryVertices' + labelName + postfix ), True , 10.
902888 else :
903889 svUsed , flip_ip_sign , max_sip3dsig_for_flip = svSource , False , - 1.
@@ -909,6 +895,7 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
909895 vertices = pvSource ,
910896 secondary_vertices = svUsed ,
911897 pf_candidates = pfCandidates ,
898+ puppi_value_map = puppi_value_map ,
912899 flip_ip_sign = flip_ip_sign ,
913900 max_sip3dsig_for_flip = max_sip3dsig_for_flip ,
914901 ),
@@ -924,6 +911,7 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
924911 vertices = pvSource ,
925912 secondary_vertices = svSource ,
926913 pf_candidates = pfCandidates ,
914+ puppi_value_map = puppi_value_map ,
927915 ),
928916 process , task )
929917 acceptedTagInfos .append (btagInfo )
@@ -937,14 +925,15 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
937925 vertices = pvSource ,
938926 secondary_vertices = svSource ,
939927 pf_candidates = pfCandidates ,
928+ puppi_value_map = puppi_value_map ,
940929 ),
941930 process , task )
942931 acceptedTagInfos .append (btagInfo )
943932 else :
944933 print (' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!' % (btagInfo ))
945934 # setup all required btagDiscriminators
946935 acceptedBtagDiscriminators = list ()
947- for discriminator_name in btagDiscriminators :
936+ for discriminator_name in btagDiscriminators :
948937 btagDiscr = discriminator_name .split (':' )[0 ] #split input tag to get the producer label
949938 #print discriminator_name, '-->', btagDiscr
950939 newDiscr = btagPrefix + btagDiscr + labelName + postfix #new discriminator name
0 commit comments