From dcb0b85b9976fd885430f13d2320644504057689 Mon Sep 17 00:00:00 2001
From: Mark Hodgkinson <m.hodgkinson@sheffield.ac.uk>
Date: Thu, 27 Sep 2018 11:20:32 +0100
Subject: [PATCH] Fix typo in ifdef statement in IPFClusterSelectorTool. Add
 usage of PFClusterSelectorTool in PFAlgorithm.

---
 .../eflowRec/eflowRec/IPFClusterSelectorTool.h         |  2 +-
 Reconstruction/eflowRec/eflowRec/PFAlgorithm.h         |  5 +++++
 Reconstruction/eflowRec/src/PFAlgorithm.cxx            | 10 +++++++---
 .../eflowRec/src/components/eflowRec_entries.cxx       |  2 ++
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Reconstruction/eflowRec/eflowRec/IPFClusterSelectorTool.h b/Reconstruction/eflowRec/eflowRec/IPFClusterSelectorTool.h
index 47a1415a4e2..e60e73cbafe 100644
--- a/Reconstruction/eflowRec/eflowRec/IPFClusterSelectorTool.h
+++ b/Reconstruction/eflowRec/eflowRec/IPFClusterSelectorTool.h
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef IPFCLUSTERSELECTIONTOOL_H
+#ifndef IPFCLUSTERSELECTORTOOL_H
 #define IPFCLUSTERSELECTORTOOL_H
 
 #include "GaudiKernel/IAlgTool.h"
diff --git a/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h
index 24c0f86b4e8..98e99c2f617 100644
--- a/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h
+++ b/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h
@@ -10,6 +10,7 @@
 #include "eflowRec/eflowRecTrack.h"
 
 #include "xAODCaloEvent/CaloClusterContainer.h"
+#include "eflowRec/IPFClusterSelectorTool.h"
 #include "eflowRec/IPFBaseTool.h"
 #include "eflowRec/IPFSubtractionTool.h"
 
@@ -24,6 +25,10 @@ public:
   StatusCode finalize();
 
 private:
+
+  /** ToolHandle for the PFClusterSelectorTool which creates the set of eflowRecCluster to be used */
+  ToolHandle<IPFClusterSelectorTool> m_IPFClusterSelectorTool{this,"PFClusterSelectorTool","PFClusterSelectorTool","ToolHandle for the PFClusterSelectorTool which creates the set of eflowRecCluster to be used"};
+  
   /** List of IPFSubtractionTool, which will be executed by this algorithm */
   ToolHandleArray<IPFSubtractionTool> m_IPFSubtractionTools;
 
diff --git a/Reconstruction/eflowRec/src/PFAlgorithm.cxx b/Reconstruction/eflowRec/src/PFAlgorithm.cxx
index b29952dbd42..5440326420e 100644
--- a/Reconstruction/eflowRec/src/PFAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFAlgorithm.cxx
@@ -8,6 +8,7 @@ PFAlgorithm::PFAlgorithm(const std::string& name,  ISvcLocator* pSvcLocator) : A
 
 StatusCode PFAlgorithm::initialize(){
 
+  ATH_CHECK(m_IPFClusterSelectorTool);
   ATH_CHECK(m_IPFSubtractionTools.retrieve());
   ATH_CHECK( m_IPFBaseTools.retrieve());
   
@@ -36,12 +37,16 @@ StatusCode PFAlgorithm::execute(){
 
   SG::ReadHandle<eflowRecTrackContainer> eflowRecTracksReadHandle(m_eflowRecTracksReadHandleKey);
   eflowRecTrackContainer localEFlowRecTrackContainer(*eflowRecTracksReadHandle.ptr());
+
+  xAOD::CaloClusterContainer& theCaloClusterContainerReference = *(caloClustersWriteHandle.ptr());
+  ATH_CHECK(m_IPFClusterSelectorTool->execute(theCaloClusterContainerReference));
+  
   SG::ReadHandle<eflowRecClusterContainer> eflowRecClustersReadHandle(m_eflowRecClustersReadHandleKey);
   eflowRecClusterContainer localEFlowRecClusterContainer(*eflowRecClustersReadHandle.ptr());
   
   /* Run the SubtractionTools */
   for (auto thisIPFSubtractionTool : m_IPFSubtractionTools){
-    thisIPFSubtractionTool->execute(theElowCaloObjectContainer,&localEFlowRecTrackContainer,&localEFlowRecClusterContainer,*(caloClustersWriteHandle.ptr()));
+    thisIPFSubtractionTool->execute(theElowCaloObjectContainer,&localEFlowRecTrackContainer,&localEFlowRecClusterContainer,theCaloClusterContainerReference);
   }
 
   for (auto thisEFTrack : localEFlowRecTrackContainer){
@@ -52,10 +57,9 @@ StatusCode PFAlgorithm::execute(){
     ATH_MSG_DEBUG("This efRecCluster has E,pt,eta and phi of " << thisEFCluster->getCluster()->e() << "," << thisEFCluster->getCluster()->pt() << ", " << thisEFCluster->getCluster()->eta() << " and " << thisEFCluster->getCluster()->phi());
   }
 
-
   /* Run the other AglTools */
   for (auto thisIPFBaseTool :  m_IPFBaseTools){
-    thisIPFBaseTool->execute(*theElowCaloObjectContainer,*(caloClustersWriteHandle.ptr()));
+    thisIPFBaseTool->execute(*theElowCaloObjectContainer,theCaloClusterContainerReference);
   }
     
   return StatusCode::SUCCESS;
diff --git a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx
index 312ccc01ec8..666e12792c5 100644
--- a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx
+++ b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx
@@ -8,6 +8,7 @@
 #include "eflowRec/PFLeptonSelector.h"
 #include "eflowRec/PFTrackSelector.h"
 #include "eflowRec/PFClusterSelector.h"
+#include "eflowRec/PFClusterSelectorTool.h"
 #include "eflowRec/PFAlgorithm.h"
 #include "eflowRec/PFCellLevelSubtractionTool.h"
 #include "eflowRec/PFRecoverSplitShowersTool.h"
@@ -21,6 +22,7 @@
 DECLARE_COMPONENT( eflowOverlapRemoval )
 DECLARE_COMPONENT( PFLeptonSelector )
 DECLARE_COMPONENT( PFClusterSelector )
+DECLARE_COMPONENT( PFClusterSelectorTool )
 DECLARE_COMPONENT( PFTrackSelector )
 DECLARE_COMPONENT( PFAlgorithm )
 DECLARE_COMPONENT( PFOChargedCreatorAlgorithm )
-- 
GitLab