From 810204ff55ac343e130df4fce714bf9c9e00ceee Mon Sep 17 00:00:00 2001
From: Mark Hodgkinson <m.hodgkinson@sheffield.ac.uk>
Date: Tue, 16 Jan 2018 11:28:08 +0000
Subject: [PATCH] Adjust cluster links, that we set, to point at "sister"
 clusters - i.e. those that are in the CaloCalTopoCluster container (which is
 the only one retained in xAOD files).

---
 Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx | 3 ++-
 Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
index a4783f0ddbf2..6b8067531678 100644
--- a/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
@@ -120,7 +120,8 @@ void PFOChargedCreatorAlgorithm::createChargedPFO(const eflowCaloObject& energyF
       for (auto trackClusterLink : trackClusterLinks){
 	eflowRecCluster* efRecCluster = trackClusterLink->getCluster();
 	ElementLink<xAOD::CaloClusterContainer> theOriginalClusterLink = efRecCluster->getOriginalClusElementLink();
-	bool isSet = thisPFO->addClusterLink(theOriginalClusterLink);
+	ElementLink<xAOD::CaloClusterContainer> theSisterClusterLink = (*theOriginalClusterLink)->getSisterClusterLink();
+	bool isSet = thisPFO->addClusterLink(theSisterClusterLink);
 	 if (!isSet) ATH_MSG_WARNING("Could not set Cluster in PFO");
       }//track-cluster link loop
     }//addClusters is set to true - so we added the clusters to the xAOD::PFO   
diff --git a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx
index 45b5a574f0a8..95ac4dbd0a6a 100644
--- a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx
@@ -69,7 +69,8 @@ void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyF
     }
 
     ElementLink<xAOD::CaloClusterContainer> theOriginalClusterLink = thisEfRecCluster->getOriginalClusElementLink();
-    bool isSet = thisPFO->setClusterLink(theOriginalClusterLink);
+    ElementLink<xAOD::CaloClusterContainer> theSisterClusterLink = (*theOriginalClusterLink)->getSisterClusterLink();
+    bool isSet = thisPFO->setClusterLink(theSisterClusterLink);
     if (!isSet) { msg(MSG::WARNING) << "Could not set Cluster in PFO " << endmsg; }
 
     const xAOD::CaloCluster* cluster = thisEfRecCluster->getCluster();
-- 
GitLab