From e96d2b9161493cf18775b0eeba432462115da1bf Mon Sep 17 00:00:00 2001
From: Fudong He <fuhe@cern.ch>
Date: Mon, 16 Mar 2020 21:58:52 +0100
Subject: [PATCH 1/2] Replace the old LeptonTagger with the new one in STDM3

---
 .../DerivationFrameworkSM/share/STDM3.py                    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py
index ebd85c416cd7..77ea216df0b2 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py
@@ -213,8 +213,8 @@ reducedJetList = ["AntiKt2PV0TrackJets", "AntiKt4PV0TrackJets", "AntiKt4TruthJet
 replaceAODReducedJets(reducedJetList, STDM3Sequence, "STDM3Jets")
 
 # FAKE LEPTON TAGGER
-import JetTagNonPromptLepton.JetTagNonPromptLeptonConfig as JetTagConfig
-STDM3Sequence += JetTagConfig.GetDecoratePromptLeptonAlgs()
+import LeptonTaggers.LeptonTaggersConfig as LepTagConfig
+STDM3Sequence += LepTagConfig.GetDecorateImprovedPromptLeptonAlgs()
 
 # ADD SEQUENCE TO JOB
 DerivationFrameworkJob += STDM3Sequence
@@ -287,7 +287,7 @@ STDM3SlimmingHelper.IncludeMuonTriggerContent = True
 
 STDM3SlimmingHelper.ExtraVariables = ExtraContentAll
 STDM3SlimmingHelper.ExtraVariables += ["AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m"]
-STDM3SlimmingHelper.ExtraVariables += JetTagConfig.GetExtraPromptVariablesForDxAOD()
+STDM3SlimmingHelper.ExtraVariables += LepTagConfig.GetExtraImprovedPromptVariablesForDxAOD(onlyBDT=True) 
 
 STDM3SlimmingHelper.AllVariables = ExtraContainersAll
 
-- 
GitLab


From 87f26c10269ed12d15f0de894e3a077992a1c877 Mon Sep 17 00:00:00 2001
From: Fudong He <fuhe@cern.ch>
Date: Mon, 16 Mar 2020 22:20:16 +0100
Subject: [PATCH 2/2] Add flag to save only LeptonTagger BDT outputs

---
 .../python/LeptonTaggersConfig.py             | 30 +++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/PhysicsAnalysis/AnalysisCommon/LeptonTaggers/python/LeptonTaggersConfig.py b/PhysicsAnalysis/AnalysisCommon/LeptonTaggers/python/LeptonTaggersConfig.py
index 61aec12c98f8..f763377d8cbd 100644
--- a/PhysicsAnalysis/AnalysisCommon/LeptonTaggers/python/LeptonTaggersConfig.py
+++ b/PhysicsAnalysis/AnalysisCommon/LeptonTaggers/python/LeptonTaggersConfig.py
@@ -66,10 +66,23 @@ def GetDecoratePromptTauAlgs():
     return algs
 
 #------------------------------------------------------------------------------
-def GetExtraPromptVariablesForDxAOD(name='', addSpectators=False):
+def GetExtraPromptVariablesForDxAOD(name='', addSpectators=False, onlyBDT=True):
 
     prompt_lep_vars = []
 
+    #
+    # Decorate lepton only with the BDT outputs when the onlyBDT flag is true.
+    #
+    if onlyBDT:
+        if name == "" or name == "Electrons":
+            prompt_lep_vars += ["Electrons.PromptLeptonVeto.PromptLeptonIso."]
+
+        if name == "" or name == "Muons":
+            prompt_lep_vars += ["Muons.PromptLeptonVeto.PromptLeptonIso."]
+
+        return prompt_lep_vars
+ 
+ 
     prompt_vars  = "PromptLeptonVeto.PromptLeptonIso."
     prompt_vars += "PromptLeptonInput_TrackJetNTrack.PromptLeptonInput_sv1_jf_ntrkv."
     prompt_vars += "PromptLeptonInput_ip2.PromptLeptonInput_ip3."
@@ -104,10 +117,23 @@ def GetExtraPromptVariablesForDxAOD(name='', addSpectators=False):
 
 
 #------------------------------------------------------------------------------
-def GetExtraImprovedPromptVariablesForDxAOD(name=''):
+def GetExtraImprovedPromptVariablesForDxAOD(name='', onlyBDT=False):
 
     prompt_lep_vars = []
 
+    #
+    # Decorate lepton only with the BDT outputs when the onlyBDT flag is true.
+    #
+    if onlyBDT:
+        if name == "" or name == "Electrons":
+            prompt_lep_vars += ["Electrons.PromptLeptonImprovedVetoBARR.PromptLeptonImprovedVetoECAP."]
+
+        if name == "" or name == "Muons":
+            prompt_lep_vars += ["Muons.PromptLeptonImprovedVeto."]
+
+        return prompt_lep_vars
+ 
+
     prompt_vars  = "PromptLeptonImprovedInput_MVAXBin."
     prompt_vars += "PromptLeptonImprovedInput_PtFrac.PromptLeptonImprovedInput_DRlj."
     prompt_vars += "PromptLeptonImprovedInput_topoetcone30rel.PromptLeptonImprovedInput_ptvarcone30rel."
-- 
GitLab