From 6eaee9c56e753d378892fcf06a2a0bd07a7096d8 Mon Sep 17 00:00:00 2001
From: Mark Hodgkinson <m.hodgkinson@sheffield.ac.uk>
Date: Thu, 8 Nov 2018 12:58:03 +0000
Subject: [PATCH] Remove association of tracks to vertex from
 PFOChargedCreatorAlgorithm, because the vertex subsequently attached to the
 PFO is never used. JetETMiss has agreed there is no likelihood that it will
 be used.

---
 .../eflowRec/PFOChargedCreatorAlgorithm.h     | 13 +-------
 .../eflowRec/share/PFlowMTConfig.py           |  4 ---
 .../src/PFOChargedCreatorAlgorithm.cxx        | 31 +------------------
 3 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h
index 36f1341519b..04b8c515966 100644
--- a/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h
+++ b/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h
@@ -7,10 +7,7 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "StoreGate/DataHandle.h"
 
-#include "TrackVertexAssociationTool/ITrackVertexAssociationTool.h"
-
 #include "xAODPFlow/PFOContainer.h"
-#include "xAODTracking/VertexContainer.h"
 
 class PFOChargedCreatorAlgorithm : public AthAlgorithm {
   
@@ -21,7 +18,6 @@ public:
   ~PFOChargedCreatorAlgorithm() {}
 
   StatusCode initialize();
-  void execute(const eflowCaloObject& energyFlowCaloObject, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle);
   StatusCode execute();
   StatusCode finalize();
 
@@ -34,18 +30,11 @@ private:
   /** Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed */
   Gaudi::Property<bool> m_eOverPMode{this,"EOverPMode",false,"Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"};
 
-  /** ToolHandle to tracking CP loose vertex selection tool */
-  ToolHandle<CP::ITrackVertexAssociationTool> m_trackVertexAssociationTool{this,"TrackVertexAssociationTool","","ToolHandle to tracking CP loose vertex selection tool"};
-
-  /** ReadHandleKey for vertex container */
-  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexContainerReadHandleKey{this,"VertexContainerName","PrimaryVertices","ReadHandleKey for vertex container"};
-
   /** ReadHandleKey for eflowCaloObjectContainer */
   SG::ReadHandleKey<eflowCaloObjectContainer> m_eflowCaloObjectContainerReadHandleKey{this,"eflowCaloObjectContainerName","eflowCaloObjects","ReadHandleKey for eflowCaloObjectContainer"};
   
   /** WriteHandleKey for charged PFO */
   SG::WriteHandleKey<xAOD::PFOContainer> m_chargedPFOContainerWriteHandleKey{this,"PFOOutputName","JetETMissChargedParticleFlowObjects","WriteHandleKey for charged PFO"};
-  
-  
+    
 };
 #endif
diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py
index 56ac6950246..d66a7a19d59 100644
--- a/Reconstruction/eflowRec/share/PFlowMTConfig.py
+++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py
@@ -187,10 +187,6 @@ topSequence += PFAlgorithm
 from eflowRec.eflowRecConf import PFOChargedCreatorAlgorithm
 PFOChargedCreatorAlgorithm = PFOChargedCreatorAlgorithm("PFOChargedCreatorAlgorithm")
 
-from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TightTrackVertexAssociationTool        
-PFlowTrackVertexAssociationTool = CP__TightTrackVertexAssociationTool(name="PFlowTightCPTool", dzSinTheta_cut=2.0, doPV=True)
-PFOChargedCreatorAlgorithm.TrackVertexAssociationTool = PFlowTrackVertexAssociationTool
-
 topSequence += PFOChargedCreatorAlgorithm
 
 from eflowRec.eflowRecConf import PFONeutralCreatorAlgorithm
diff --git a/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
index dde38be0878..bbca23ca894 100644
--- a/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
@@ -17,9 +17,6 @@ PFOChargedCreatorAlgorithm::PFOChargedCreatorAlgorithm(const std::string& name,
 
 StatusCode PFOChargedCreatorAlgorithm::initialize(){
 
-  ATH_CHECK(m_trackVertexAssociationTool.retrieve());
-
-  ATH_CHECK(m_vertexContainerReadHandleKey.initialize());
   ATH_CHECK(m_eflowCaloObjectContainerReadHandleKey.initialize());
 
   ATH_CHECK(m_chargedPFOContainerWriteHandleKey.initialize());
@@ -27,18 +24,6 @@ StatusCode PFOChargedCreatorAlgorithm::initialize(){
   return StatusCode::SUCCESS;
 }
 
-void PFOChargedCreatorAlgorithm::execute(const eflowCaloObject& energyFlowCaloObject, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle){
-
-  ATH_MSG_DEBUG("Processing eflowCaloObject");
-  
-  createChargedPFO(energyFlowCaloObject, true, chargedPFOContainerWriteHandle);
-
-  SG::ReadHandle<xAOD::VertexContainer> vertexContainerReadHandle(m_vertexContainerReadHandleKey);
-  const xAOD::VertexContainer* theVertexContainer = vertexContainerReadHandle.ptr();  
-  addVertexLinksToChargedPFO(theVertexContainer, chargedPFOContainerWriteHandle);
-  
-}
-
 StatusCode  PFOChargedCreatorAlgorithm::execute(){
 
   ATH_MSG_DEBUG("Processing eflowCaloObjectContainer");
@@ -48,7 +33,7 @@ StatusCode  PFOChargedCreatorAlgorithm::execute(){
   
   /* Create Charged PFOs from all eflowCaloObjects */
   SG::ReadHandle<eflowCaloObjectContainer> eflowCaloObjectContainerReadHandle(m_eflowCaloObjectContainerReadHandleKey);
-  for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) execute(*thisEflowCaloObject,chargedPFOContainerWriteHandle);
+  for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) createChargedPFO(*thisEflowCaloObject,true,chargedPFOContainerWriteHandle);
 
   return StatusCode::SUCCESS;  
 }
@@ -151,17 +136,3 @@ void PFOChargedCreatorAlgorithm::createChargedPFO(const eflowCaloObject& energyF
 
   }//loop over the tracks on the eflowCaloObject
 }
-
-void PFOChargedCreatorAlgorithm::addVertexLinksToChargedPFO(const xAOD::VertexContainer* theVertexContainer, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle){
-
-  //This is a loop on all xAOD::PFO with non-zero charge
-  for (auto theChargedPFO : *(chargedPFOContainerWriteHandle.ptr())){
-    const xAOD::TrackParticle* theTrack = theChargedPFO->track(0);
-    if (theTrack){
-      ElementLink< xAOD::VertexContainer> theVertexLink = m_trackVertexAssociationTool->getUniqueMatchVertexLink(*theTrack,*theVertexContainer);
-      bool haveSetLink = theChargedPFO->setVertexLink(theVertexLink);
-      if (!haveSetLink) ATH_MSG_WARNING(" Could not set vertex link on charged PFO");
-    }//if valid pointer to xAOD::TrackParticle
-  }
-
-}
-- 
GitLab