diff --git a/Reconstruction/eflowRec/CMakeLists.txt b/Reconstruction/eflowRec/CMakeLists.txt index 5e8c3e5ecc451804d8623b21ebbbe919d31af161..6bfb10d84893bca08ece88d6499b12ec74aff371 100644 --- a/Reconstruction/eflowRec/CMakeLists.txt +++ b/Reconstruction/eflowRec/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( eflowRec ) @@ -11,7 +11,7 @@ atlas_add_component( eflowRec src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CaloIdentifier CaloRecLib AthContainers AthLinks AthenaBaseComps CxxUtils AthenaKernel GeoPrimitives Identifier xAODBase xAODCaloEvent xAODCore xAODEgamma xAODMuon xAODPFlow xAODTau xAODTracking GaudiKernel InDetReadoutGeometry TRT_ReadoutGeometry Particle RecoToolInterfaces TrkParameters CaloDetDescrLib CaloUtilsLib StoreGateLib FourMomUtils PathResolver TrkCaloExtension TrkParametersIdentificationHelpers InDetTrackSelectionToolLib AthenaMonitoringKernelLib ICaloTrkMuIdTools) + LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CaloIdentifier CaloRecLib AthContainers AthLinks AthenaBaseComps CxxUtils AthenaKernel GeoPrimitives Identifier xAODBase xAODCaloEvent xAODCore xAODEgamma xAODMuon xAODPFlow xAODTau xAODTracking GaudiKernel InDetReadoutGeometry TRT_ReadoutGeometry Particle RecoToolInterfaces TrkParameters CaloDetDescrLib CaloUtilsLib StoreGateLib FourMomUtils PathResolver TrkCaloExtension TrkParametersIdentificationHelpers InDetTrackSelectionToolLib AthenaMonitoringKernelLib ICaloTrkMuIdTools tauRecToolsLib) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Reconstruction/eflowRec/src/PFTauFlowElementAssoc.cxx b/Reconstruction/eflowRec/src/PFTauFlowElementAssoc.cxx index cdd60bc234dee10b815fe4e95485e2d024c0fff8..d23d049840da27369e74024864c2c8f019b74d8c 100644 --- a/Reconstruction/eflowRec/src/PFTauFlowElementAssoc.cxx +++ b/Reconstruction/eflowRec/src/PFTauFlowElementAssoc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "eflowRec/PFTauFlowElementAssoc.h" @@ -7,6 +7,7 @@ #include "xAODTau/TauTrack.h" #include "xAODPFlow/FlowElementContainer.h" #include "xAODPFlow/FlowElement.h" +#include "tauRecTools/HelperFunctions.h" typedef ElementLink<xAOD::TauJetContainer> TauJetLink_t; typedef ElementLink<xAOD::FlowElementContainer> FELink_t; @@ -72,10 +73,16 @@ StatusCode PFTauFlowElementAssoc::execute(const EventContext &ctx) const { // Loop over the taus for (const xAOD::TauJet* tau : *tauNeutralFEWriteDecorHandle) { + // Get tau vertex + const xAOD::Vertex* tauVertex = tauRecTools::getTauVertex(*tau); // Get the clusters associated to the tau - std::vector< ElementLink<xAOD::IParticleContainer> > tauClusters = tau->clusterLinks(); - for (auto clusLink : tauClusters) { - const xAOD::IParticle* clus = *clusLink; + std::vector<const xAOD::IParticle*> tauClusters = tau->clusters(); + for (auto cluster : tauClusters) { + const xAOD::CaloCluster* clus = static_cast<const xAOD::CaloCluster*>(cluster); + // Correct cluster to tau vertex + xAOD::CaloVertexedTopoCluster vertexedClus(*clus, tauVertex->position()); + // Check if the cluster is within R = 0.2 of tau axis + if (vertexedClus.p4().DeltaR(tau->p4(xAOD::TauJetParameters::IntermediateAxis)) > 0.2) continue; // Get the index of the cluster associated to the tau size_t tauClusterIndex = clus->index(); @@ -105,7 +112,7 @@ StatusCode PFTauFlowElementAssoc::execute(const EventContext &ctx) const { // Loop over the taus for (const xAOD::TauJet* tau : *tauChargedFEWriteDecorHandle) { // Get tau tracks associated to the tau - std::vector<const xAOD::TauTrack*> tauTracks = tau->tracks(xAOD::TauJetParameters::coreTrack); + std::vector<const xAOD::TauTrack*> tauTracks = tau->tracks(); for (auto tauTrack : tauTracks) { // Get track associated to the tau track to use for matching const xAOD::TrackParticle* tauIDTrack = tauTrack->track();