From 8c9e05988f5c08649b43a1e0dde888ea61799a82 Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus759.cern.ch>
Date: Fri, 20 Mar 2020 13:13:40 +0100
Subject: [PATCH 1/7] created new Muon Isolation WPs according to the new MCP
 prescription

---
 .../TopCPTools/Root/TopIsolationCPTools.cxx   |  29 +++--
 .../Root/MuonObjectCollectionMaker.cxx        | 100 ++++++++++++++++++
 .../MuonObjectCollectionMaker.h               |  15 +++
 3 files changed, 138 insertions(+), 6 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx
index 955a8ad74d0d..2866d87dbd68 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx
@@ -80,6 +80,19 @@ namespace top {
                                              "FCTight_FixedRad",
                                              "FixedCutPflowTight",
                                              "FixedCutPflowLoose",
+					     "PflowTight_FixedRad",
+					     "PflowLoose_FixedRad",
+					     "PflowTight_VarRad",
+					     "PflowLoose_VarRad",
+					     "HighPtTrackOnly",
+					     "TightTrackOnly_VarRad",
+					     "TightTrackOnly_FixedRad",
+					     "PLVTightMuon",
+					     "PLVLooseMuon",
+					     "Tight_VarRad",
+					     "Tight_FixedRad",
+					     "Loose_VarRad",
+					     "Loose_FixedRad",
                                            }};
 
     // Electron Isolation WPs
@@ -116,15 +129,19 @@ namespace top {
 
     for (const std::string& isoWP : all_isolations) {
       std::string tool_name;
-      if (isoWP.find("PLV")!=std::string::npos){
-	tool_name = "CP::IsolationTool_LowPtPLV";
-	if(!asg::ToolStore::contains<CP::IIsolationLowPtPLVTool>(tool_name)) {
-	  CP::IIsolationLowPtPLVTool* iso_tool = new CP::IsolationLowPtPLVTool(tool_name);
-	  top::check(iso_tool->initialize(), "Failed to initialize " + tool_name);
-	  m_isolationToolsLowPtPLV.push_back(iso_tool);
+      if (isoWP.find("PLV") != std::string::npos){
+	if (!(isoWP.find("Muon") != std::string::npos)) {
+	  tool_name = "CP::IsolationTool_LowPtPLV";
+	  if(!asg::ToolStore::contains<CP::IIsolationLowPtPLVTool>(tool_name)) {
+	    CP::IIsolationLowPtPLVTool* iso_tool = new CP::IsolationLowPtPLVTool(tool_name);
+	    top::check(iso_tool->initialize(), "Failed to initialize " + tool_name);
+	    m_isolationToolsLowPtPLV.push_back(iso_tool);
+	  }
 	}
       }
       tool_name = "CP::IsolationTool_" + isoWP;
+      if (isoWP == "PLVTightMuon") tool_name = "CP::IsolationTool_PLVTight";
+      if (isoWP == "PLVLooseMuon") tool_name = "CP::IsolationTool_PLVLoose";
       if (!asg::ToolStore::contains<CP::IIsolationSelectionTool>(tool_name)) {
         CP::IIsolationSelectionTool* iso_tool = new CP::IsolationSelectionTool(tool_name);
         top::check(asg::setProperty(iso_tool, "CalibFileName", m_isolationCalibFile),
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
index 8dc709268928..029f44a7b79e 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
@@ -34,6 +34,21 @@ namespace top {
     m_isolationTool_FCTight_FixedRad("CP::IsolationTool_FCTight_FixedRad"),
     m_isolationTool_FixedCutPflowTight("CP::IsolationTool_FixedCutPflowTight"),
     m_isolationTool_FixedCutPflowLoose("CP::IsolationTool_FixedCutPflowLoose"),
+
+    m_isolationTool_PflowTight_FixedRad("CP::IsolationTool_PflowTight_FixedRad"),
+    m_isolationTool_PflowLoose_FixedRad("CP::IsolationTool_PflowLoose_FixedRad"),
+    m_isolationTool_PflowTight_VarRad("CP::IsolationTool_PflowTight_VarRad"),
+    m_isolationTool_PflowLoose_VarRad("CP::IsolationTool_PflowLoose_VarRad"),
+    m_isolationTool_HighPtTrackOnly("CP::IsolationTool_HighPtTrackOnly"),
+    m_isolationTool_TightTrackOnly_VarRad("CP::IsolationTool_TightTrackOnly_VarRad"),
+    m_isolationTool_TightTrackOnly_FixedRad("CP::IsolationTool_TightTrackOnly_FixedRad"),
+    m_isolationTool_PLVTight("CP::IsolationTool_PLVTight"),
+    m_isolationTool_PLVLoose("CP::IsolationTool_PLVLoose"),
+    m_isolationTool_Tight_VarRad("CP::IsolationTool_Tight_VarRad"),
+    m_isolationTool_Tight_FixedRad("CP::IsolationTool_Tight_FixedRad"),
+    m_isolationTool_Loose_VarRad("CP::IsolationTool_Loose_VarRad"),
+    m_isolationTool_Loose_FixedRad("CP::IsolationTool_Loose_FixedRad"),
+
     m_muonSelectionToolVeryLooseVeto("CP::MuonSelectionToolVeryLooseVeto") {
     declareProperty("config", m_config);
 
@@ -46,6 +61,19 @@ namespace top {
     declareProperty("IsolationTool_FCTight_FixedRad", m_isolationTool_FCTight_FixedRad);
     declareProperty("IsolationTool_FixedCutPflowTight", m_isolationTool_FixedCutPflowTight);
     declareProperty("IsolationTool_FixedCutPflowLoose", m_isolationTool_FixedCutPflowLoose);
+    declareProperty("IsolationTool_PflowTight_FixedRad", m_isolationTool_PflowTight_FixedRad);
+    declareProperty("IsolationTool_PflowLoose_FixedRad", m_isolationTool_PflowLoose_FixedRad);
+    declareProperty("IsolationTool_PflowTight_VarRad", m_isolationTool_PflowTight_VarRad);
+    declareProperty("IsolationTool_PflowLoose_VarRad", m_isolationTool_PflowLoose_VarRad);
+    declareProperty("IsolationTool_HighPtTrackOnly", m_isolationTool_HighPtTrackOnly);
+    declareProperty("IsolationTool_TightTrackOnly_VarRad", m_isolationTool_TightTrackOnly_VarRad);
+    declareProperty("IsolationTool_TightTrackOnly_FixedRad", m_isolationTool_TightTrackOnly_FixedRad);
+    declareProperty("IsolationTool_PLVTight", m_isolationTool_PLVTight);
+    declareProperty("IsolationTool_PLVLoose", m_isolationTool_PLVLoose);
+    declareProperty("IsolationTool_Tight_VarRad", m_isolationTool_Tight_VarRad);
+    declareProperty("IsolationTool_Tight_FixedRad", m_isolationTool_Tight_FixedRad);
+    declareProperty("IsolationTool_Loose_VarRad", m_isolationTool_Loose_VarRad);
+    declareProperty("IsolationTool_Loose_FixedRad", m_isolationTool_Loose_FixedRad);
     declareProperty("MuonSelectionToolVeryLooseVeto", m_muonSelectionToolVeryLooseVeto);
   }
 
@@ -61,6 +89,19 @@ namespace top {
     top::check(m_isolationTool_FCTight_FixedRad.retrieve(), "Failed to retrieve Isolation Tool");
     top::check(m_isolationTool_FixedCutPflowTight.retrieve(), "Failed to retrieve Isolation Tool");
     top::check(m_isolationTool_FixedCutPflowLoose.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_PflowTight_FixedRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_PflowLoose_FixedRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_PflowTight_VarRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_PflowLoose_VarRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_HighPtTrackOnly.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_TightTrackOnly_VarRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_TightTrackOnly_FixedRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_PLVTight.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_PLVLoose.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_Tight_VarRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_Tight_FixedRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_Loose_VarRad.retrieve(), "Failed to retrieve Isolation Tool");
+    top::check(m_isolationTool_Loose_FixedRad.retrieve(), "Failed to retrieve Isolation Tool");
     top::check(m_muonSelectionToolVeryLooseVeto.retrieve(), "Failed to retrieve Selection Tool");
 
     ///-- Set Systematics Information --///
@@ -153,6 +194,11 @@ namespace top {
         char passIsol_FCTightTrackOnly_FixedRad(0), passIsol_FCLoose_FixedRad(0), passIsol_FCTight_FixedRad(0);
         char passIsol_FixedCutPflowTight(0), passIsol_FixedCutPflowLoose(0);
 
+	char passIsol_PflowTight_FixedRad(0), passIsol_PflowLoose_FixedRad(0), passIsol_PflowTight_VarRad(0), passIsol_PflowLoose_VarRad(0);
+	char passIsol_HighPtTrackOnly(0), passIsol_TightTrackOnly_VarRad(0), passIsol_TightTrackOnly_FixedRad(0);
+	char passIsol_PLVTight(0), passIsol_PLVLoose(0);
+	char passIsol_Tight_VarRad(0), passIsol_Tight_FixedRad(0), passIsol_Loose_VarRad(0), passIsol_Loose_FixedRad(0);
+
         if (m_isolationTool_FCTight->accept(*muon)) {
           passIsol_FCTight = 1;
         }
@@ -178,6 +224,46 @@ namespace top {
           passIsol_FixedCutPflowLoose = 1;
         }
 
+        if (m_isolationTool_PflowTight_FixedRad->accept(*muon)) {
+          passIsol_PflowTight_FixedRad = 1;
+        }
+        if (m_isolationTool_PflowLoose_FixedRad->accept(*muon)) {
+          passIsol_PflowLoose_FixedRad = 1;
+        }
+        if (m_isolationTool_PflowTight_VarRad->accept(*muon)) {
+          passIsol_PflowTight_VarRad = 1;
+        }
+        if (m_isolationTool_PflowLoose_VarRad->accept(*muon)) {
+          passIsol_PflowLoose_VarRad = 1;
+        }
+        if (m_isolationTool_HighPtTrackOnly->accept(*muon)) {
+          passIsol_HighPtTrackOnly = 1;
+        }
+        if (m_isolationTool_TightTrackOnly_VarRad->accept(*muon)) {
+          passIsol_TightTrackOnly_VarRad = 1;
+        }
+        if (m_isolationTool_TightTrackOnly_FixedRad->accept(*muon)) {
+          passIsol_TightTrackOnly_FixedRad = 1;
+        }
+        if (m_isolationTool_PLVTight->accept(*muon)) {
+          passIsol_PLVTight = 1;
+        }
+        if (m_isolationTool_PLVLoose->accept(*muon)) {
+          passIsol_PLVLoose = 1;
+        }
+        if (m_isolationTool_Tight_VarRad->accept(*muon)) {
+          passIsol_Tight_VarRad = 1;
+        }
+        if (m_isolationTool_Tight_FixedRad->accept(*muon)) {
+          passIsol_Tight_FixedRad = 1;
+        }
+        if (m_isolationTool_Loose_VarRad->accept(*muon)) {
+          passIsol_Loose_VarRad = 1;
+        }
+        if (m_isolationTool_Loose_FixedRad->accept(*muon)) {
+          passIsol_Loose_FixedRad = 1;
+        }
+
         muon->auxdecor<char>("AnalysisTop_Isol_FCTight") = passIsol_FCTight;
         muon->auxdecor<char>("AnalysisTop_Isol_FCLoose") = passIsol_FCLoose;
         muon->auxdecor<char>("AnalysisTop_Isol_FCTightTrackOnly") = passIsol_FCTightTrackOnly;
@@ -187,6 +273,20 @@ namespace top {
         muon->auxdecor<char>("AnalysisTop_Isol_FixedCutPflowTight") = passIsol_FixedCutPflowTight;
         muon->auxdecor<char>("AnalysisTop_Isol_FixedCutPflowLoose") = passIsol_FixedCutPflowLoose;
 
+	muon->auxdecor<char>("AnalysisTop_Isol_PflowTight_FixedRad") = passIsol_PflowTight_FixedRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_PflowLoose_FixedRad") = passIsol_PflowLoose_FixedRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_PflowTight_VarRad") = passIsol_PflowTight_VarRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_PflowLoose_VarRad") = passIsol_PflowLoose_VarRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_HighPtTrackOnly") = passIsol_HighPtTrackOnly;
+	muon->auxdecor<char>("AnalysisTop_Isol_TightTrackOnly_VarRad") = passIsol_TightTrackOnly_VarRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_TightTrackOnly_FixedRad") = passIsol_TightTrackOnly_FixedRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_PLVTight") = passIsol_PLVTight;
+	muon->auxdecor<char>("AnalysisTop_Isol_PLVLoose") = passIsol_PLVLoose;
+	muon->auxdecor<char>("AnalysisTop_Isol_Tight_VarRad") = passIsol_Tight_VarRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_Tight_FixedRad") = passIsol_Tight_FixedRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_Loose_VarRad") = passIsol_Loose_VarRad;
+	muon->auxdecor<char>("AnalysisTop_Isol_Loose_FixedRad") = passIsol_Loose_FixedRad;
+
         // PromptLeptonIsolation - Some protection incase things change in R21
         if (muon->isAvailable<float>("PromptLeptonIso_TagWeight")) {
           muon->auxdecor<char>("AnalysisTop_Isol_PromptLepton") =
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h
index a1ad25570675..d8e89cdc5cd8 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h
@@ -76,6 +76,7 @@ namespace top {
     ToolHandle<CP::IMuonCalibrationAndSmearingTool> m_calibrationTool2017;
 
     ///-- Isolation --///
+    //until release 21.2.110 these are the used WPs
     ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FCTight;
     ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FCLoose;
     ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FCTightTrackOnly;
@@ -84,6 +85,20 @@ namespace top {
     ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FCTight_FixedRad;
     ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutPflowTight;
     ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutPflowLoose;
+    //since release 21.2.111 these are the used WPs
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_PflowTight_FixedRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_PflowLoose_FixedRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_PflowTight_VarRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_PflowLoose_VarRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_HighPtTrackOnly;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_TightTrackOnly_VarRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_TightTrackOnly_FixedRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_PLVTight;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_PLVLoose;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Tight_VarRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Tight_FixedRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Loose_VarRad;
+    ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Loose_FixedRad;
     // the following is needed to make sure all muons for which d0sig is calculated are at least Loose
     ToolHandle<CP::IMuonSelectionTool> m_muonSelectionToolVeryLooseVeto;
   };
-- 
GitLab


From 971760d8dd40cd4c9e4209182443815d63bfc4c0 Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus759.cern.ch>
Date: Fri, 20 Mar 2020 16:22:41 +0100
Subject: [PATCH 2/7] changed a line to be it less complex

---
 .../TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx
index 2866d87dbd68..2c95c167e1cf 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx
@@ -130,7 +130,7 @@ namespace top {
     for (const std::string& isoWP : all_isolations) {
       std::string tool_name;
       if (isoWP.find("PLV") != std::string::npos){
-	if (!(isoWP.find("Muon") != std::string::npos)) {
+	if (isoWP.find("Muon") == std::string::npos) {
 	  tool_name = "CP::IsolationTool_LowPtPLV";
 	  if(!asg::ToolStore::contains<CP::IIsolationLowPtPLVTool>(tool_name)) {
 	    CP::IIsolationLowPtPLVTool* iso_tool = new CP::IsolationLowPtPLVTool(tool_name);
-- 
GitLab


From 0f339425f8925215d1bda171b6e3f881ab2192ca Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus723.cern.ch>
Date: Mon, 23 Mar 2020 15:39:06 +0100
Subject: [PATCH 3/7] changed the names of the Iso WPs in the config file

---
 .../xAOD/TopConfiguration/Root/ConfigurationSettings.cxx  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx
index 4a7ecb36bb54..975d9962d1a4 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx
@@ -114,11 +114,11 @@ namespace top {
                       "Muon quality cut for object selection. Options are VeryLoose, Loose, Medium (default) and Tight",
                       "Medium");
     registerParameter("MuonIsolation",
-                      "Isolation to use : FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, None",
-                      "FCTight_FixedRad");
+                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad"
+		      "FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None");
     registerParameter("MuonIsolationLoose",
-                      "Isolation to use : Tight, Loose, LooseTrackOnly, FixedCutTight, FixedCutTightTrackOnly, FixedCutLoose, FCTight, FCLoose, FCTightTrackOnly, PromptLepton, None",
-                      "None");
+                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad"
+		      "FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None");
     registerParameter("MuonIsolationSF", "Force muon isolation SF (e.g. None). EXPERIMENTAL!", " ");
     registerParameter("MuonIsolationSFLoose", "Force muon isolation SF (e.g. None). EXPERIMENTAL!", " ");
     registerParameter("UseAntiMuons", "Use AntiMuons for fake estimate. Default: false", "false");
-- 
GitLab


From 8b217c90f5b4ff235d7cef8db86671cc58dfbd8e Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus723.cern.ch>
Date: Mon, 23 Mar 2020 20:19:16 +0100
Subject: [PATCH 4/7] Added the default Iso WP

---
 .../xAOD/TopConfiguration/Root/ConfigurationSettings.cxx  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx
index 975d9962d1a4..f78d561389c9 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx
@@ -114,11 +114,11 @@ namespace top {
                       "Muon quality cut for object selection. Options are VeryLoose, Loose, Medium (default) and Tight",
                       "Medium");
     registerParameter("MuonIsolation",
-                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad"
-		      "FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None");
+                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad, FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None",
+		      "PflowTight_FixedRad");
     registerParameter("MuonIsolationLoose",
-                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad"
-		      "FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None");
+                      "Isolation to use : PflowTight_VarRad, PflowTight_FixedRad, PflowLoose_VarRad, PflowLoose_FixedRad, HighPtTrackOnly, TightTrackOnly_VarRad, TightTrackOnly_FixedRad, PLVTight, PLVLoose, Tight_VarRad, Tight_FixedRad, Loose_VarRad, Loose_FixedRad, FCTight, FCLoose, FCTightTrackOnly, FCTightTrackOnly_FixedRad, FCLoose_FixedRad, FCTight_FixedRad, FixedCutPflowTight, FixedCutPflowLoose, FCTight_FixedRad, None",
+		      "None");
     registerParameter("MuonIsolationSF", "Force muon isolation SF (e.g. None). EXPERIMENTAL!", " ");
     registerParameter("MuonIsolationSFLoose", "Force muon isolation SF (e.g. None). EXPERIMENTAL!", " ");
     registerParameter("UseAntiMuons", "Use AntiMuons for fake estimate. Default: false", "false");
-- 
GitLab


From bdfe28e237f62f1af4463af0c4bc5e1fd5dfc966 Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus775.cern.ch>
Date: Tue, 31 Mar 2020 12:14:02 +0200
Subject: [PATCH 5/7] added checks to control if the variables used for the Iso
 WPs are available

---
 .../Root/MuonObjectCollectionMaker.cxx        | 63 +++++++++----------
 1 file changed, 31 insertions(+), 32 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
index 029f44a7b79e..a5ce39fbd908 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
@@ -130,6 +130,14 @@ namespace top {
   }
 
   StatusCode MuonObjectCollectionMaker::execute(bool executeNominal) {
+
+    static const SG::AuxElement::ConstAccessor<float> ptvarcone30_TightTTVA_pt1000("ptvarcone30_TightTTVA_pt1000");
+    static const SG::AuxElement::ConstAccessor<float> ptcone20_TightTTVA_pt1000("ptcone20_TightTTVA_pt1000");
+    static const SG::AuxElement::ConstAccessor<float> ptcone20_TightTTVA_pt500("ptcone20_TightTTVA_pt500");
+    static const SG::AuxElement::ConstAccessor<float> ptvarcone30_TightTTVA_pt500("ptvarcone30_TightTTVA_pt500");
+    static const SG::AuxElement::ConstAccessor<float> neflowisol20("neflowisol20");
+    static const SG::AuxElement::ConstAccessor<float> ptvarcone30_TightTTVALooseCone_pt1000("ptvarcone30_TightTTVALooseCone_pt1000");
+
     const xAOD::EventInfo* eventInfo(nullptr);
 
     top::check(evtStore()->retrieve(eventInfo, m_config->sgKeyEventInfo()), "Failed to retrieve EventInfo");
@@ -224,44 +232,35 @@ namespace top {
           passIsol_FixedCutPflowLoose = 1;
         }
 
-        if (m_isolationTool_PflowTight_FixedRad->accept(*muon)) {
-          passIsol_PflowTight_FixedRad = 1;
-        }
-        if (m_isolationTool_PflowLoose_FixedRad->accept(*muon)) {
-          passIsol_PflowLoose_FixedRad = 1;
-        }
-        if (m_isolationTool_PflowTight_VarRad->accept(*muon)) {
-          passIsol_PflowTight_VarRad = 1;
-        }
-        if (m_isolationTool_PflowLoose_VarRad->accept(*muon)) {
-          passIsol_PflowLoose_VarRad = 1;
-        }
-        if (m_isolationTool_HighPtTrackOnly->accept(*muon)) {
-          passIsol_HighPtTrackOnly = 1;
-        }
-        if (m_isolationTool_TightTrackOnly_VarRad->accept(*muon)) {
-          passIsol_TightTrackOnly_VarRad = 1;
-        }
-        if (m_isolationTool_TightTrackOnly_FixedRad->accept(*muon)) {
-          passIsol_TightTrackOnly_FixedRad = 1;
+	//new Iso WPs
+	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && neflowisol20.isAvailable(*muon) && ptcone20_TightTTVA_pt500.isAvailable(*muon)) {
+	  if (m_isolationTool_PflowTight_FixedRad->accept(*muon)) passIsol_PflowTight_FixedRad = 1;
+	  if (m_isolationTool_PflowLoose_FixedRad->accept(*muon)) passIsol_PflowLoose_FixedRad = 1;
+	}
+	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && neflowisol20.isAvailable(*muon)) {
+	  if (m_isolationTool_PflowTight_VarRad->accept(*muon)) passIsol_PflowTight_VarRad = 1;
+	  if (m_isolationTool_PflowLoose_VarRad->accept(*muon)) passIsol_PflowLoose_VarRad = 1;
         }
-        if (m_isolationTool_PLVTight->accept(*muon)) {
-          passIsol_PLVTight = 1;
+	if (ptcone20_TightTTVA_pt1000.isAvailable(*muon)) {
+	  if (m_isolationTool_HighPtTrackOnly->accept(*muon)) passIsol_HighPtTrackOnly = 1;
         }
-        if (m_isolationTool_PLVLoose->accept(*muon)) {
-          passIsol_PLVLoose = 1;
+	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon)) {
+	  if (m_isolationTool_TightTrackOnly_VarRad->accept(*muon)) passIsol_TightTrackOnly_VarRad = 1;
         }
-        if (m_isolationTool_Tight_VarRad->accept(*muon)) {
-          passIsol_Tight_VarRad = 1;
+	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) &&  ptcone20_TightTTVA_pt500.isAvailable(*muon)) {
+	  if (m_isolationTool_TightTrackOnly_FixedRad->accept(*muon)) passIsol_TightTrackOnly_FixedRad = 1;
         }
-        if (m_isolationTool_Tight_FixedRad->accept(*muon)) {
-          passIsol_Tight_FixedRad = 1;
+	if (ptvarcone30_TightTTVALooseCone_pt1000.isAvailable(*muon)) {
+	  if (m_isolationTool_PLVTight->accept(*muon)) passIsol_PLVTight = 1;
+	  if (m_isolationTool_PLVLoose->accept(*muon)) passIsol_PLVLoose = 1;
         }
-        if (m_isolationTool_Loose_VarRad->accept(*muon)) {
-          passIsol_Loose_VarRad = 1;
+	if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon) && ptcone20_TightTTVA_pt1000.isAvailable(*muon)) {
+	  if (m_isolationTool_Tight_FixedRad->accept(*muon)) passIsol_Tight_FixedRad = 1;
+	  if (m_isolationTool_Loose_FixedRad->accept(*muon)) passIsol_Loose_FixedRad = 1;
         }
-        if (m_isolationTool_Loose_FixedRad->accept(*muon)) {
-          passIsol_Loose_FixedRad = 1;
+	if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon)) {
+	  if (m_isolationTool_Tight_VarRad->accept(*muon)) passIsol_Tight_VarRad = 1;
+	  if (m_isolationTool_Loose_VarRad->accept(*muon)) passIsol_Loose_VarRad = 1;
         }
 
         muon->auxdecor<char>("AnalysisTop_Isol_FCTight") = passIsol_FCTight;
-- 
GitLab


From e5053d14520d8f4814fffbdb7f1f501f86d56b75 Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus775.cern.ch>
Date: Tue, 31 Mar 2020 15:52:54 +0200
Subject: [PATCH 6/7] changed checks to control PLV Iso WPs

---
 .../Root/MuonObjectCollectionMaker.cxx                        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
index a5ce39fbd908..b8c3bb2e46ec 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
@@ -197,7 +197,7 @@ namespace top {
           }
         }
 
-//        ///-- Isolation selection --///
+        ///-- Isolation selection --///
         char passIsol_FCTight(0), passIsol_FCLoose(0), passIsol_FCTightTrackOnly(0);
         char passIsol_FCTightTrackOnly_FixedRad(0), passIsol_FCLoose_FixedRad(0), passIsol_FCTight_FixedRad(0);
         char passIsol_FixedCutPflowTight(0), passIsol_FixedCutPflowLoose(0);
@@ -250,7 +250,7 @@ namespace top {
 	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) &&  ptcone20_TightTTVA_pt500.isAvailable(*muon)) {
 	  if (m_isolationTool_TightTrackOnly_FixedRad->accept(*muon)) passIsol_TightTrackOnly_FixedRad = 1;
         }
-	if (ptvarcone30_TightTTVALooseCone_pt1000.isAvailable(*muon)) {
+	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon)) {
 	  if (m_isolationTool_PLVTight->accept(*muon)) passIsol_PLVTight = 1;
 	  if (m_isolationTool_PLVLoose->accept(*muon)) passIsol_PLVLoose = 1;
         }
-- 
GitLab


From 59b8422cf56118d1bbb33fdc1afad857ca3c291d Mon Sep 17 00:00:00 2001
From: Luca Martinelli <lucam@lxplus775.cern.ch>
Date: Tue, 31 Mar 2020 16:26:21 +0200
Subject: [PATCH 7/7] initialised all the Iso WPs to -1 and then filled with 0
 or 1 if the WPs is available and if the muon not pass/pass the Iso criteria

---
 .../Root/MuonObjectCollectionMaker.cxx        | 83 ++++++++++---------
 1 file changed, 45 insertions(+), 38 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
index b8c3bb2e46ec..fc0ada078db8 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
  */
 
 // $Id: MuonObjectCollectionMaker.cxx 810751 2017-09-29 14:41:39Z iconnell $
@@ -207,60 +207,67 @@ namespace top {
 	char passIsol_PLVTight(0), passIsol_PLVLoose(0);
 	char passIsol_Tight_VarRad(0), passIsol_Tight_FixedRad(0), passIsol_Loose_VarRad(0), passIsol_Loose_FixedRad(0);
 
-        if (m_isolationTool_FCTight->accept(*muon)) {
-          passIsol_FCTight = 1;
-        }
-        if (m_isolationTool_FCLoose->accept(*muon)) {
-          passIsol_FCLoose = 1;
-        }
-        if (m_isolationTool_FCTightTrackOnly->accept(*muon)) {
-          passIsol_FCTightTrackOnly = 1;
-        }
-        if (m_isolationTool_FCTightTrackOnly_FixedRad->accept(*muon)) {
-          passIsol_FCTightTrackOnly_FixedRad = 1;
-        }
-        if (m_isolationTool_FCLoose_FixedRad->accept(*muon)) {
-          passIsol_FCLoose_FixedRad = 1;
-        }
-        if (m_isolationTool_FCTight_FixedRad->accept(*muon)) {
-          passIsol_FCTight_FixedRad = 1;
-        }
-        if (m_isolationTool_FixedCutPflowTight->accept(*muon)) {
-          passIsol_FixedCutPflowTight = 1;
-        }
-        if (m_isolationTool_FixedCutPflowLoose->accept(*muon)) {
-          passIsol_FixedCutPflowLoose = 1;
-        }
+	//initializing al the passIsol_* variable to -1
+	passIsol_FCTight = -1;
+	passIsol_FCLoose = -1;
+	passIsol_FCTightTrackOnly = -1;
+	passIsol_FCTightTrackOnly_FixedRad = -1;
+	passIsol_FCLoose_FixedRad = -1;
+	passIsol_FCTight_FixedRad = -1;
+	passIsol_FixedCutPflowTight = -1;
+	passIsol_FixedCutPflowLoose = -1;
+	passIsol_PflowTight_FixedRad = -1;
+	passIsol_PflowLoose_FixedRad = -1;
+	passIsol_PflowTight_VarRad = -1;
+	passIsol_PflowLoose_VarRad = -1;
+	passIsol_HighPtTrackOnly = -1;
+	passIsol_TightTrackOnly_VarRad = -1;
+	passIsol_TightTrackOnly_FixedRad = -1;
+	passIsol_PLVTight = -1;
+	passIsol_PLVLoose = -1;
+	passIsol_Tight_FixedRad = -1;
+	passIsol_Loose_FixedRad = -1;
+	passIsol_Tight_VarRad = -1;
+	passIsol_Loose_VarRad = -1;
+        
+	passIsol_FCTight = m_isolationTool_FCTight->accept(*muon) ? 1 : 0;
+	passIsol_FCLoose = m_isolationTool_FCLoose->accept(*muon) ? 1 : 0;
+	passIsol_FCTightTrackOnly = m_isolationTool_FCTightTrackOnly->accept(*muon) ? 1 : 0;
+	passIsol_FCTightTrackOnly_FixedRad = m_isolationTool_FCTightTrackOnly_FixedRad->accept(*muon) ? 1 : 0;
+	passIsol_FCLoose_FixedRad = m_isolationTool_FCLoose_FixedRad->accept(*muon) ? 1 : 0;
+	passIsol_FCTight_FixedRad = m_isolationTool_FCTight_FixedRad->accept(*muon) ? 1 : 0;
+	passIsol_FixedCutPflowTight = m_isolationTool_FixedCutPflowTight->accept(*muon) ? 1 : 0;
+	passIsol_FixedCutPflowLoose = m_isolationTool_FixedCutPflowLoose->accept(*muon) ? 1 : 0;
 
 	//new Iso WPs
 	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && neflowisol20.isAvailable(*muon) && ptcone20_TightTTVA_pt500.isAvailable(*muon)) {
-	  if (m_isolationTool_PflowTight_FixedRad->accept(*muon)) passIsol_PflowTight_FixedRad = 1;
-	  if (m_isolationTool_PflowLoose_FixedRad->accept(*muon)) passIsol_PflowLoose_FixedRad = 1;
+	  passIsol_PflowTight_FixedRad = m_isolationTool_PflowTight_FixedRad->accept(*muon) ? 1 : 0;
+	  passIsol_PflowLoose_FixedRad = m_isolationTool_PflowLoose_FixedRad->accept(*muon) ? 1 : 0;
 	}
 	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && neflowisol20.isAvailable(*muon)) {
-	  if (m_isolationTool_PflowTight_VarRad->accept(*muon)) passIsol_PflowTight_VarRad = 1;
-	  if (m_isolationTool_PflowLoose_VarRad->accept(*muon)) passIsol_PflowLoose_VarRad = 1;
+	  passIsol_PflowTight_VarRad = m_isolationTool_PflowTight_VarRad->accept(*muon) ? 1 : 0;
+	  passIsol_PflowLoose_VarRad = m_isolationTool_PflowLoose_VarRad->accept(*muon) ? 1 : 0;
         }
 	if (ptcone20_TightTTVA_pt1000.isAvailable(*muon)) {
-	  if (m_isolationTool_HighPtTrackOnly->accept(*muon)) passIsol_HighPtTrackOnly = 1;
+	  passIsol_HighPtTrackOnly = m_isolationTool_HighPtTrackOnly->accept(*muon) ? 1 : 0;
         }
 	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon)) {
-	  if (m_isolationTool_TightTrackOnly_VarRad->accept(*muon)) passIsol_TightTrackOnly_VarRad = 1;
+	  passIsol_TightTrackOnly_VarRad = m_isolationTool_TightTrackOnly_VarRad->accept(*muon) ? 1 : 0;
         }
 	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) &&  ptcone20_TightTTVA_pt500.isAvailable(*muon)) {
-	  if (m_isolationTool_TightTrackOnly_FixedRad->accept(*muon)) passIsol_TightTrackOnly_FixedRad = 1;
+	  passIsol_TightTrackOnly_FixedRad = m_isolationTool_TightTrackOnly_FixedRad->accept(*muon) ? 1 : 0;
         }
 	if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon)) {
-	  if (m_isolationTool_PLVTight->accept(*muon)) passIsol_PLVTight = 1;
-	  if (m_isolationTool_PLVLoose->accept(*muon)) passIsol_PLVLoose = 1;
+	  passIsol_PLVTight = m_isolationTool_PLVTight->accept(*muon) ? 1 : 0;
+	  passIsol_PLVLoose = m_isolationTool_PLVLoose->accept(*muon) ? 1 : 0;
         }
 	if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon) && ptcone20_TightTTVA_pt1000.isAvailable(*muon)) {
-	  if (m_isolationTool_Tight_FixedRad->accept(*muon)) passIsol_Tight_FixedRad = 1;
-	  if (m_isolationTool_Loose_FixedRad->accept(*muon)) passIsol_Loose_FixedRad = 1;
+	  passIsol_Tight_FixedRad = m_isolationTool_Tight_FixedRad->accept(*muon) ? 1 : 0;
+	  passIsol_Loose_FixedRad = m_isolationTool_Loose_FixedRad->accept(*muon) ? 1 : 0;
         }
 	if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon)) {
-	  if (m_isolationTool_Tight_VarRad->accept(*muon)) passIsol_Tight_VarRad = 1;
-	  if (m_isolationTool_Loose_VarRad->accept(*muon)) passIsol_Loose_VarRad = 1;
+	  passIsol_Tight_VarRad = m_isolationTool_Tight_VarRad->accept(*muon) ? 1 : 0;
+	  passIsol_Loose_VarRad = m_isolationTool_Loose_VarRad->accept(*muon) ? 1 : 0;
         }
 
         muon->auxdecor<char>("AnalysisTop_Isol_FCTight") = passIsol_FCTight;
-- 
GitLab