diff --git a/Reconstruction/MET/METReconstruction/CMakeLists.txt b/Reconstruction/MET/METReconstruction/CMakeLists.txt index bc017c940cb126e97ce62d93a1666066b4ddf719..56ea0513dc7efa2e7ee206687740cc42e21b133e 100644 --- a/Reconstruction/MET/METReconstruction/CMakeLists.txt +++ b/Reconstruction/MET/METReconstruction/CMakeLists.txt @@ -12,7 +12,7 @@ include_directories(src) atlas_add_component( METReconstruction Root/*.cxx src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools FourMomUtils xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODPFlow xAODTracking xAODTruth GaudiKernel RecoToolInterfaces CaloEvent CaloConditions AthContainers AthenaBaseComps EventPrimitives xAODTau TruthUtils METRecoInterface PFlowUtilsLib StoreGateLib InDetTrackSelectionToolLib TrackVertexAssociationToolLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools FourMomUtils xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODPFlow xAODTracking xAODTruth GaudiKernel RecoToolInterfaces CaloEvent CaloConditions AthContainers AthenaBaseComps EventPrimitives xAODTau TruthUtils METRecoInterface PFlowUtilsLib StoreGateLib InDetTrackSelectionToolLib TrackVertexAssociationToolLib tauRecToolsLib) # Install files from the package: atlas_install_python_modules( python/*.py python/LegacyRunII/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx index 149e97afa359376d4903b95d647db5785074776b..d5b0abf104c5dbecc541e92038ef20fd49f1e566 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx @@ -29,6 +29,8 @@ // DeltaR calculation #include "FourMomUtils/xAODP4Helpers.h" +#include "tauRecTools/HelperFunctions.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "PFlowUtils/IWeightPFOTool.h" namespace met { @@ -108,8 +110,26 @@ namespace met { const met::METAssociator::ConstitHolder& /*tcCont*/) const { const TauJet* tau = static_cast<const TauJet*>(obj); - tclist = xAOD::TauHelpers::clusters(*tau, 0.2); - + TLorentzVector tauAxis = tauRecTools::getTauAxis(*tau); + const xAOD::Vertex* tauVertex = tauRecTools::getTauVertex(*tau); + + auto clusterList = tau->clusters(); + for (const xAOD::IParticle* particle : clusterList) { + const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>(particle); + + TLorentzVector clusterP4 = cluster->p4(); + + // Correct the four momentum to point at the tau vertex + if (tauVertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, tauVertex->position()); + clusterP4 = vertexedCluster.p4(); + } + + if (clusterP4.DeltaR(tauAxis) > 0.2) continue; + + tclist.push_back(particle); + } + return StatusCode::SUCCESS; }