From 2f361912b456f31c3aa6b4b668feb03e1e6f4511 Mon Sep 17 00:00:00 2001
From: Luca Martinelli <luca.martinelli@cern.ch>
Date: Tue, 14 May 2024 09:07:47 +0200
Subject: [PATCH] Passing to the muon sagitta correction tool the flag
 doDirectCBCalib

Passing to the muon sagitta correction tool the flag doDirectCBCalib and change the pT according to the flag selected
---
 .../MuonMomentumCorrections/MuonCalibIntSagittaTool.h        | 5 ++++-
 .../MuonMomentumCorrections/Root/MuonCalibIntSagittaTool.cxx | 5 +++--
 .../MuonMomentumCorrections/Root/MuonCalibTool.cxx           | 3 ++-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/MuonMomentumCorrections/MuonCalibIntSagittaTool.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/MuonMomentumCorrections/MuonCalibIntSagittaTool.h
index 772cf1caaa25..e6710d7a53eb 100644
--- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/MuonMomentumCorrections/MuonCalibIntSagittaTool.h
+++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/MuonMomentumCorrections/MuonCalibIntSagittaTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef MCAST_MUONCALIBINTSAGITTATOOL_H
@@ -65,6 +65,9 @@ namespace CP {
         Gaudi::Property<bool>  m_doEtaSagittaSys{this, "doEtaSagittaSys",   false, "Do Eta dependant systematic system"};
         Gaudi::Property<bool> m_applyCorrectionOnData{this, "applyCorrectionOnData",   true, "If to apply sagitta corrections on data, or take the full effect as systematic"};
 
+        // Do direct CB calibration 
+        Gaudi::Property<bool> m_doDirectCBCalib{this, "doDirectCBCalib", true, "Apply sagitta corrections on CB tracks, otherwise, on ID+MS"};
+      
         // Rho value to be used
         Gaudi::Property<bool> m_useFixedRho{this, "useFixedRho",   true, "Force Fixed Rho"};
         Gaudi::Property<float> m_fixedRhoValue{this, "fixedRhoValue", 1,     "Value for rho, if it is forced"};
diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibIntSagittaTool.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibIntSagittaTool.cxx
index 11e95ee51552..ad2d4014812f 100644
--- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibIntSagittaTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibIntSagittaTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 // Framework include(s):
@@ -123,7 +123,8 @@ namespace CP
         // Write the pT into the object
         mu.ID.calib_pt = corrIDpT;
         mu.ME.calib_pt = corrMEpT;
-        mu.CB.calib_pt = corrCBpT;
+	if(m_doDirectCBCalib) mu.CB.calib_pt = corrCBpT;
+	else mu.CB.calib_pt = corrStatCombCBpT;
 
         // Return gracefully:
         return CorrectionCode::Ok;
diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibTool.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibTool.cxx
index 2ce1d9b07210..b0934911644c 100644
--- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 // Framework include(s):
@@ -86,6 +86,7 @@ namespace CP
             ATH_CHECK(m_MuonIntSagittaTool.setProperty("release", m_release.value()));
             ATH_CHECK(m_MuonIntSagittaTool.setProperty("systematicScheme", m_sysScheme.value()));
             ATH_CHECK(m_MuonIntSagittaTool.setProperty("applyCorrectionOnData", m_applyCorrectionOnData.value()));
+	    ATH_CHECK(m_MuonIntSagittaTool.setProperty("doDirectCBCalib", m_doDirectCBCalib.value()));
             ATH_CHECK(m_MuonIntSagittaTool.setProperty("doEtaSagittaSys", m_doEtaSagittaSys.value()));
             ATH_CHECK(m_MuonIntSagittaTool.setProperty("OutputLevel", msg().level()));
         }       
-- 
GitLab