From d39bb9d24c1a0222c4d7d8407324d1a6e4d79bee Mon Sep 17 00:00:00 2001
From: Nicolas Koehler <nicolas.koehler@cern.ch>
Date: Thu, 2 Jul 2020 16:06:00 +0000
Subject: [PATCH] Remove unused and non thread-safe maxP function

---
 .../MuidTrackIsolation.h                      |  22 +---
 .../src/MuidTrackIsolation.cxx                |  20 +---
 .../MuidInterfaces/IMuidTrackIsolation.h      | 103 +++++++++---------
 3 files changed, 55 insertions(+), 90 deletions(-)

diff --git a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h
index fae4dc9cf9a..426c42fdf1e 100755
--- a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h
+++ b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h
@@ -15,17 +15,12 @@
 #ifndef MUIDCALOISOLATIONTOOLS_MUIDTRACKISOLATION_H
 #define MUIDCALOISOLATIONTOOLS_MUIDTRACKISOLATION_H
 
-//<<<<<< INCLUDES                                                       >>>>>>
-
+#include "MuidInterfaces/IMuidTrackIsolation.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ToolHandle.h"
-#include "MuidInterfaces/IMuidTrackIsolation.h"
 #include "TrkTrack/TrackCollection.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "TrkExInterfaces/IIntersector.h"
-#include "GaudiKernel/ConcurrencyFlags.h"
-
-//<<<<<< CLASS DECLARATIONS                                             >>>>>>
 
 namespace Trk
 {
@@ -52,10 +47,6 @@ public:
        get the number of tracks and summed momentum
        in a cone at the production vertex or around the muon calo intersect*/
     std::pair<int,double>		trackIsolation(double eta, double phi) const;
-
-    /**IMuidTrackIsolation interface:
-       get the momentum of the most energetic track in the cone*/
-    double				maxP(void) const;
   
 private:
     // isolation without extrapolation to calo
@@ -76,23 +67,12 @@ private:
     SG::ReadHandleKey<TrackCollection>  m_inDetTracksLocation{this,"InDetTracksLocation","Tracks","ID tracks"};
     // FIXME: mutable
     ToolHandle<Trk::IIntersector>	m_intersector{this,"RungeKuttaIntersector","Trk::RungeKuttaIntersector/RungeKuttaIntersector"};
-    mutable std::atomic<double>	m_maxP;
     Gaudi::Property<double>	m_minPt{this,"MinPt",1.0*Gaudi::Units::GeV};
     Gaudi::Property<double>	m_trackCone{this,"TrackCone",0.2};
     Gaudi::Property<bool>		m_trackExtrapolation{this,"TrackExtrapolation",false};
     
 };
 
-//<<<<<< INLINE PUBLIC MEMBER FUNCTIONS                                 >>>>>>
-
-inline double
-MuidTrackIsolation::maxP(void) const
-{ 
-  if (Gaudi::Concurrency::ConcurrencyFlags::concurrent())
-    ATH_MSG_WARNING("MuidTrackIsolation::maxP() does not return trustable value in MT");
-  return m_maxP; 
-}
-
 }	// end of namespace
 
 #endif // MUIDCALOISOLATIONTOOLS_MUIDTRACKISOLATION_H
diff --git a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx
index 209ff643a48..bbc3f0db68e 100755
--- a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx
+++ b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx
@@ -10,12 +10,9 @@
 //  (c) ATLAS Combined Muon software
 //////////////////////////////////////////////////////////////////////////////
 
-//<<<<<< INCLUDES                                                       >>>>>>
+#include "MuidCaloIsolationTools/MuidTrackIsolation.h"
 
-#include <cmath>
-#include <iomanip>
 #include "GaudiKernel/SystemOfUnits.h"
-#include "MuidCaloIsolationTools/MuidTrackIsolation.h"
 #include "TrkExUtils/TrackSurfaceIntersection.h"
 #include "TrkParameters/TrackParameters.h"
 #include "TrkSurfaces/CylinderSurface.h"
@@ -24,7 +21,8 @@
 #include "TrkTrack/Track.h"
 #include "TrkTrack/TrackCollection.h"
 
-//<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
+#include <cmath>
+#include <iomanip>
 
 namespace Rec
 {
@@ -115,7 +113,6 @@ MuidTrackIsolation::trackIsolation(double eta, double phi) const
     }
 
     // set initial state
-    m_maxP = 0.;
     std::pair<int,double> isolation = std::make_pair(0,0.);
 
     // retrieve track collection
@@ -143,12 +140,7 @@ MuidTrackIsolation::trackIsolation(double eta, double phi) const
     }
 
     // debug result
-    ATH_MSG_DEBUG(std::endl << " Found "<< isolation.first
-		  << std::setiosflags(std::ios::fixed)
-		  << " InDet tracks with total momentum "
-		  << std::setw(8) << std::setprecision(1) << isolation.second/Gaudi::Units::GeV <<" Gaudi::Units::GeV "
-		  << "and maximum momentum "
-		  << std::setw(8) << std::setprecision(1) << m_maxP/Gaudi::Units::GeV);
+    ATH_MSG_DEBUG("Found "<<isolation.first<<std::setiosflags(std::ios::fixed)<<" InDet tracks with total momentum "<< std::setw(8)<<std::setprecision(1)<<isolation.second/Gaudi::Units::GeV<<" GeV");
     
     return isolation;
 }
@@ -157,7 +149,6 @@ std::pair<int,double>
 MuidTrackIsolation::trackVertex(const TrackCollection* inDetTracks, double eta, double phi) const
 {
     // set initial state
-    m_maxP		= 0.;
     double sumP		= 0.;
     int numberTracks	= 0;
 
@@ -192,7 +183,6 @@ MuidTrackIsolation::trackVertex(const TrackCollection* inDetTracks, double eta,
 	if ((diffPhi*diffPhi + diffEta*diffEta) > m_trackCone*m_trackCone)	continue;
 	++numberTracks;
 	double p = perigee.momentum().mag();
-	if (p > m_maxP) m_maxP = p;
 	sumP += p;
 
 	if (msgLvl(MSG::VERBOSE)) msg() << "  inside cone, track#" << std::setw(3) << numberTracks;
@@ -205,7 +195,6 @@ std::pair<int,double>
 MuidTrackIsolation::trackExtrapolated(const TrackCollection* inDetTracks, double eta, double phi) const
 {
     // set initial state
-    m_maxP		= 0.;
     double sumP		= 0.;
     int numberTracks	= 0;
 
@@ -281,7 +270,6 @@ MuidTrackIsolation::trackExtrapolated(const TrackCollection* inDetTracks, double
 	{
 	    ++numberTracks;
 	    double p = perigee.momentum().mag();
-	    if (p > m_maxP) m_maxP = p;
 	    sumP += p;
 	    
 	    if (msgLvl(MSG::VERBOSE)) msg() << "  inside cone, track#" << std::setw(3) << numberTracks;
diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h
index 35820019186..fc535ee2197 100755
--- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h
+++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h
@@ -1,56 +1,53 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-//////////////////////////////////////////////////////////////////////////////
-// IMuidTrackIsolation
-//  tool interface for estimating the number, total charged momentum and most
-//  energetic inner detector tracks in a cone surrounding a muon
-//
-//  (c) ATLAS Combined Muon software
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef MUIDINTERFACES_IMUIDTRACKISOLATION_H
-#define MUIDINTERFACES_IMUIDTRACKISOLATION_H
-
-#include <utility>
-#include "GaudiKernel/IAlgTool.h"
-
-namespace Rec
-{
- 
-/** Interface ID for IMuidTrackIsolation*/  
-static const InterfaceID IID_IMuidTrackIsolation("IMuidTrackIsolation", 1, 0);
-  
-/**@class IMuidTrackIsolation
-
-Base class for MuidTrackIsolation AlgTool
-     
-     
-@author Alan.Poppleton@cern.ch
-*/
-class IMuidTrackIsolation : virtual public IAlgTool
-{
-public:
-
-    /**Virtual destructor*/
-    virtual ~IMuidTrackIsolation() {}
-       
-    /** AlgTool and IAlgTool interface methods */
-    static const InterfaceID&	interfaceID() { return IID_IMuidTrackIsolation; }
-
-    /**IMuidTrackIsolation interface:
-       get the number of tracks and summed momentum
-       in a cone at the production vertex or around the muon calo intersect*/
-    virtual std::pair<int,double>	trackIsolation (double eta, double phi) const = 0;
-
-    /**IMuidTrackIsolation interface:
-       get the momentum of the most energetic track in the cone*/
-    virtual double			maxP (void) const = 0;
-};
-
-}	// end of namespace
-
-#endif // MUIDINTERFACES_IMUIDTRACKISOLATION_H
-
-
+//////////////////////////////////////////////////////////////////////////////
+// IMuidTrackIsolation
+//  tool interface for estimating the number, total charged momentum and most
+//  energetic inner detector tracks in a cone surrounding a muon
+//
+//  (c) ATLAS Combined Muon software
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef MUIDINTERFACES_IMUIDTRACKISOLATION_H
+#define MUIDINTERFACES_IMUIDTRACKISOLATION_H
+
+#include <utility>
+#include "GaudiKernel/IAlgTool.h"
+
+namespace Rec
+{
+ 
+/** Interface ID for IMuidTrackIsolation*/  
+static const InterfaceID IID_IMuidTrackIsolation("IMuidTrackIsolation", 1, 0);
+  
+/**@class IMuidTrackIsolation
+
+Base class for MuidTrackIsolation AlgTool
+     
+     
+@author Alan.Poppleton@cern.ch
+*/
+class IMuidTrackIsolation : virtual public IAlgTool
+{
+public:
+
+    /**Virtual destructor*/
+    virtual ~IMuidTrackIsolation() {}
+       
+    /** AlgTool and IAlgTool interface methods */
+    static const InterfaceID&	interfaceID() { return IID_IMuidTrackIsolation; }
+
+    /**IMuidTrackIsolation interface:
+       get the number of tracks and summed momentum
+       in a cone at the production vertex or around the muon calo intersect*/
+    virtual std::pair<int,double>	trackIsolation (double eta, double phi) const = 0;
+
+};
+
+}	// end of namespace
+
+#endif // MUIDINTERFACES_IMUIDTRACKISOLATION_H
+
+
-- 
GitLab