From 0f912eebe780081cd49ad475034959e537eb9703 Mon Sep 17 00:00:00 2001
From: Christos Anastopoulos <christos.anastopoulos@cern.ch>
Date: Mon, 17 Jul 2023 14:59:03 +0200
Subject: [PATCH] ParticleCaloExtensionTool rm unneeded option

ParticleCaloExtensionTool rm unneeded option
---
 .../IParticleCaloExtensionTool.h              | 12 ++++++-----
 .../TrackToCalo/python/TrackToCaloConfig.py   |  7 ++++---
 .../src/ParticleCaloExtensionTool.cxx         | 21 +++++--------------
 .../src/ParticleCaloExtensionTool.h           | 15 ++++++-------
 .../python/egammaTrackToolsFactories.py       |  1 -
 5 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h
index 258060e26f89..f2612ad673be 100644
--- a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h
+++ b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h
@@ -17,15 +17,17 @@
  * - caloExtension : extrapolate typically from parameters
  *   until the exit of the calorimeter (can be changed to be
  *   entry in the configuration). This typically uses the STEP
- *   propagator via the Extrapolator. This is the most
- *   generic case if one wants all intersections and
- *   the full path inside the calo.
+ *   propagator via the Extrapolator and  the
+ *   Tracking Geometry so to collect possible
+ *   intersections following the full path
+ *   inside the calo.
  *
  * - layersCaloExtension : Extrapolate to particular
  *   layers directly using the configured Propagator in the
- *   Extrapolator. This is faster but assumes
+ *   Extrapolator. This can be much faster and
+ *   needs just the Calo Detector Description but assumes
  *   explicit knowledge of which layer intersection to
- *   target
+ *   target.
  *
  *
  * Methods accepting  IParticle :
diff --git a/Reconstruction/RecoTools/TrackToCalo/python/TrackToCaloConfig.py b/Reconstruction/RecoTools/TrackToCalo/python/TrackToCaloConfig.py
index 2476f630693b..1657328bc69e 100644
--- a/Reconstruction/RecoTools/TrackToCalo/python/TrackToCaloConfig.py
+++ b/Reconstruction/RecoTools/TrackToCalo/python/TrackToCaloConfig.py
@@ -31,10 +31,11 @@ def EMParticleCaloExtensionToolCfg(flags,
                                    name='EMParticleCaloExtensionTool',
                                    **kwargs):
     ''' e/gamma configuration of the tool.
-    Useful when targeting a specific layer given
-    a cluster i.e "direct" extrapolation'''
+    Useful when targeting a specific layers in
+    "direct" extrapolation mode. It needs the
+    CaloSurfaceBuilder.
+    '''
     acc = ComponentAccumulator()
-    kwargs.setdefault("ParticleType", "electron")
     kwargs.setdefault("StartFromPerigee", True)
 
     if "CaloSurfaceBuilder" not in kwargs:
diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
index a6139e371da1..6a1c0de369ca 100644
--- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
+++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
  */
 
 #include "ParticleCaloExtensionTool.h"
@@ -44,8 +44,6 @@ ParticleCaloExtensionTool::initialize()
     m_particleStrategy = muon;
   } else if (m_particleTypeName == "pion") {
     m_particleStrategy = pion;
-  } else if (m_particleTypeName == "electron") {
-    m_particleStrategy = electron;
   } else {
     ATH_MSG_WARNING("Unsupported particle type, using strategy based on type "
                     << m_particleTypeName);
@@ -57,7 +55,9 @@ ParticleCaloExtensionTool::initialize()
   }
   ATH_MSG_INFO(" Using strategy based on particle type "
                << m_particleTypeName << " enum value " << m_particleStrategy);
-  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
+  if (!m_monTool.empty()) {
+    ATH_CHECK(m_monTool.retrieve());
+  }
   return StatusCode::SUCCESS;
 }
 
@@ -213,23 +213,12 @@ ParticleCaloExtensionTool::caloExtension(
    * the strategy we want to follow for muons.
    * But should also work well as a generic
    * strategy.
-   *
-   * For electrons the extrapolation will be done as
-   * a muon (we want close to non-interacting)
    */
 
   // Start with what the user opted as strategy
   ParticleHypothesis particleType = m_particleStrategy;
 
-  // special treatment when we want an electron strategy
-  if (m_particleStrategy == electron) {
-    particleType = muon;
-  }
-  if (particle.particleHypothesis() == xAOD::electron) {
-    particleType = muon;
-  }
-
-  // In principle we will extrapolate either from the perigee or
+  // wee extrapolate either from the perigee or
   // from the last measurement.
   if (m_startFromPerigee || !particle.track()) {
     bool idExit = true;
diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h
index 8e6910871fd3..cd8afd887139 100644
--- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h
+++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h
@@ -57,7 +57,8 @@ public:
   /*
    * Implement the IParticleCaloExtension methods
    * see IParticleCaloExtension.h for
-   * documentation
+   * detailed documentation of the various options
+   * and methods
    */
   virtual std::unique_ptr<Trk::CaloExtension> caloExtension(
     const EventContext& ctx,
@@ -131,13 +132,13 @@ private:
     "",
     "Tool to build calorimeter layer surfaces"
   };
+ 
   Gaudi::Property<std::string> m_particleTypeName{
-    this,
-    "ParticleType",
-    "muon",
-    "The particle type used to decide for the extrapolation strategy"
-    ": muon, pion, electron,nonInteracting"
-  };
+      this, "ParticleType", "muon",
+      "The particle type used during extrapolation when not passed via the "
+      "method interfaces"
+      ": muon, pion, nonInteracting"};
+
   Gaudi::Property<bool> m_startFromPerigee{ this,
                                             "StartFromPerigee",
                                             false,
diff --git a/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py b/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py
index aa7b836dac27..144a8b906524 100644
--- a/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py
+++ b/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py
@@ -27,7 +27,6 @@ EMParticleCaloExtensionTool = ToolFactory(
     CfgMgr.Trk__ParticleCaloExtensionTool,
     name="EMParticleCaloExtensionTool",
     Extrapolator=egammaCaloExtrapolator,
-    ParticleType="electron",
     CaloSurfaceBuilder=egCaloSurfaceBuilder,
     StartFromPerigee=True)
 
-- 
GitLab