From 952b7a8d4d8fff61e85f1f5fe730aceaf1496523 Mon Sep 17 00:00:00 2001 From: Ruggero Turra <ruggero.turra@cern.ch> Date: Thu, 9 May 2024 22:38:32 +0200 Subject: [PATCH 1/2] add phimodcalo1 --- .../Root/egammaMVAFunctions.cxx | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx b/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx index 32758e850ac4..79cc5b47784a 100644 --- a/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx +++ b/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ @@ -12,6 +12,8 @@ using Gaudi::Units::GeV; #define GeV 1000 #endif +#include <numbers> + /** * These functions are for building the maps of functions **/ @@ -163,6 +165,24 @@ namespace egammaMVAFunctions std::fmod(compute_cl_phiCalo(*cl), TMath::Pi() / 512) : std::fmod(compute_cl_phiCalo(*cl), TMath::Pi() / 384)); }; + + // improved version of phiModCalo, proposed by G. Unal, studied by L. Nasella + // see https://its.cern.ch/jira/browse/ATLASEG-325 + // see https://indico.cern.ch/event/1364593/contributions/5843081/ + funcLibrary[prefix + "_phiModCalo1"] = funcLibrary["phiModCalo1"] = + [](const xAOD::Egamma*, const xAOD::CaloCluster* cl) { + using std::numbers::pi; + const double eta = compute_cl_eta(*cl); + const double phi = compute_cl_phiCalo(*cl); + const double pi_divisor = std::abs(eta) < 1.425 ? 512. : 384.; + + if (eta > 0.) { + if (phi > 0.) return std::fmod(phi, pi / pi_divisor); + else return std::fmod((2 * pi + phi), pi / pi_divisor); + } + else return std::fmod((pi - phi), pi / pi_divisor); + }; + funcLibrary[prefix + "_phiModCell"] = funcLibrary["phiModCell"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl) { return std::fmod(std::abs(compute_cl_phiCalo(*cl)), TMath::Pi() / 128); }; funcLibrary[prefix + "_etaModCalo"] = funcLibrary["etaModCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl) -- GitLab From 48982429f58403509941b751a03d0620a19a308f Mon Sep 17 00:00:00 2001 From: Ruggero Turra <ruggero.turra@cern.ch> Date: Thu, 9 May 2024 22:43:07 +0200 Subject: [PATCH 2/2] indent properly --- .../egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx b/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx index 79cc5b47784a..b5babddf17c8 100644 --- a/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx +++ b/Reconstruction/egamma/egammaMVACalib/Root/egammaMVAFunctions.cxx @@ -179,9 +179,9 @@ namespace egammaMVAFunctions if (eta > 0.) { if (phi > 0.) return std::fmod(phi, pi / pi_divisor); else return std::fmod((2 * pi + phi), pi / pi_divisor); - } - else return std::fmod((pi - phi), pi / pi_divisor); - }; + } + else return std::fmod((pi - phi), pi / pi_divisor); + }; funcLibrary[prefix + "_phiModCell"] = funcLibrary["phiModCell"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl) { return std::fmod(std::abs(compute_cl_phiCalo(*cl)), TMath::Pi() / 128); }; -- GitLab