From e672f80dc1f6a5a94b2ac1ff178859ccb74b9457 Mon Sep 17 00:00:00 2001 From: Will Leight <wleight@cern.ch> Date: Wed, 26 Apr 2017 16:36:33 +0200 Subject: [PATCH] Fix for ATLASRECTS-3796 plus smaller technical changes This change should fix ATLASRECTS-3796 by adding dummy truth links to xAOD::Muon objects and muon tracks that are not truth-matched, thus avoiding ELReset errors. It also brings in a memory leak fix (ATLASRECTS-3925) that was present in MuonTruthAlgs-02-12-16-00 and never made it to release 21. Finally, it adds the migration of MuonDecayTruthTrajectoryBuilder to const interfaces and of the TrackParticleTruthAlg to DataHandles. This occurred because the development started in svn and these changes were present in the most up-to-date tags, so they got added by accident. If not desired, these particular changes can be reverted: however, as they should have no effect on the performance, I left them in. Tier0 test results can be found at /afs/cern.ch/work/w/wleight/public/MuonSW/ATLASRECTS-3796_git/: no T0 violation was observed. The only changes that would be involved here are adding dummy values for cases when truth-matching fails. For the element-links, I don't know if this would be caught by the diff-root. However, as dummy values are also added for the truthOrigin and truthType, there would be in principle some T0 violation (though for MC only of course). Since these are dummy values and so will not be used by analyzers, I don't think it's a significant violation. AODtoTAG also reported many more errors for q221: since there were no changes at all in any of the other substeps, I assume this is a glitch of some sort. --- .../src/MuonDecayTruthTrajectoryBuilder.cxx | 14 ++--- .../src/MuonDecayTruthTrajectoryBuilder.h | 8 +-- .../src/MuonTruthAssociationAlg.cxx | 13 ++-- .../src/MuonTruthDecorationAlg.cxx | 4 -- .../TrkTruthAlgs/TrackTruthSelector.h | 12 ++-- .../TrackTruthSimilaritySelector.h | 10 ++-- .../src/TrackParticleTruthAlg.cxx | 60 ++++++++++--------- .../TrkTruthAlgs/src/TrackParticleTruthAlg.h | 19 +++--- .../TrkTruthAlgs/src/TrackTruthSelector.cxx | 31 ++++------ .../src/TrackTruthSimilaritySelector.cxx | 38 +++++------- 10 files changed, 96 insertions(+), 113 deletions(-) diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx index ceaaa755dced..2603c1ad87f9 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - // Niels van Eldik 2010 #include "MuonDecayTruthTrajectoryBuilder.h" @@ -23,8 +19,8 @@ namespace Muon { MuonDecayTruthTrajectoryBuilder(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type,name,parent), - m_isDecayIntoTwoMuons(false) + : AthAlgTool(type,name,parent) + // ,m_isDecayIntoTwoMuons(false) { declareInterface<Trk::ITruthTrajectoryBuilder>(this); } @@ -86,7 +82,7 @@ namespace Muon { //================================================================ MuonDecayTruthTrajectoryBuilder::MotherDaughter - MuonDecayTruthTrajectoryBuilder::truthTrajectoryCuts(const HepMC::GenVertex *vtx) + MuonDecayTruthTrajectoryBuilder::truthTrajectoryCuts(const HepMC::GenVertex *vtx) const { const HepMC::GenParticle *mother(0), *daughter(0); @@ -139,7 +135,7 @@ namespace Muon { daughter = passed_cuts; if( nDecayMuons == 2 ){ ATH_MSG_DEBUG( " decay into two muons "); - m_isDecayIntoTwoMuons = true; + // m_isDecayIntoTwoMuons = true; } } } // if( mother && (mother->status() == 1) ) @@ -173,7 +169,7 @@ namespace Muon { if(daughter) { MotherDaughter res = truthTrajectoryCuts(daughter->production_vertex()); mother = res.first; - m_isDecayIntoTwoMuons = false; + // m_isDecayIntoTwoMuons = false; // Don't think this does anything? EJWM. } return mother; diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h index fc450825d19b..5b5c2b97719a 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.h @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - // Dear emacs, this is -*-c++-*- #ifndef MUONDECAYTRUTHTRAJECTORYBUILDER_H @@ -47,9 +43,9 @@ namespace Muon { * between mother and daughter particles; i.e. TruthTrajectories * are not allowed to branch. */ - MotherDaughter truthTrajectoryCuts(const HepMC::GenVertex *vtx); + MotherDaughter truthTrajectoryCuts(const HepMC::GenVertex *vtx) const; - bool m_isDecayIntoTwoMuons; + // mutable bool m_isDecayIntoTwoMuons; // Really don't think this does anything? EJWM. }; } // end namespace Trk diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx index 7b28a22dac14..90b46c031173 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - /////////////////////////////////////////////////////////////////// // MuonTruthAssociationAlg.cxx // Implementation file for class MuonTruthAssociationAlg @@ -290,13 +286,16 @@ void MuonTruthAssociationAlg::addMuon( const xAOD::TruthParticleContainer& truth break; } } - else{ + else{ //no truth link, add a dummy ATH_MSG_VERBOSE(" Reco muon has no truth association"); - } + const_cast<xAOD::Muon&>(*muon).auxdata<ElementLink<xAOD::TruthParticleContainer> >("truthParticleLink" )=ElementLink<xAOD::TruthParticleContainer>(); + const_cast<xAOD::Muon&>(*muon).auxdata<int>("truthType") = -99999; + const_cast<xAOD::Muon&>(*muon).auxdata<int>("truthOrigin") = -99999; + } } catch ( SG::ExcBadAuxVar& ) { ATH_MSG_WARNING("Track particle is missing truthParticleLink variable!"); } - } + } } muonLink.toPersistent(); const_cast<xAOD::TruthParticle&>(*truthParticle).auxdata<ElementLink< xAOD::MuonContainer > >("recoMuonLink") = muonLink; diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx index af5864e4630b..939cfbc896eb 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - /////////////////////////////////////////////////////////////////// // MuonTruthDecorationAlg.cxx // Implementation file for class MuonTruthDecorationAlg diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSelector.h b/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSelector.h index c95726146fda..6519c113373b 100755 --- a/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSelector.h +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSelector.h @@ -16,16 +16,18 @@ class TrackTruthSelector: public AthAlgorithm { public: TrackTruthSelector(const std::string &name,ISvcLocator *pSvcLocator); - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; private: + + // DetailedTrackTruthCollection input name - std::string m_detailedTrackTruthName; + SG::ReadHandle<DetailedTrackTruthCollection> m_detailed; // std::string m_detailedTrackTruthName; // TrackTruthCollection output name - std::string m_outputName; + SG::WriteHandle<TrackTruthCollection> m_out; //std::string m_outputName; // Subdetector weights std::vector<double> m_subDetWeights; diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSimilaritySelector.h b/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSimilaritySelector.h index 866e049340b8..2dba50d928b0 100644 --- a/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSimilaritySelector.h +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/TrackTruthSimilaritySelector.h @@ -19,16 +19,16 @@ class TrackTruthSimilaritySelector: public AthAlgorithm { public: TrackTruthSimilaritySelector(const std::string &name,ISvcLocator *pSvcLocator); - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; private: // DetailedTrackTruthCollection input name - std::string m_detailedTrackTruthName; + SG::ReadHandle<DetailedTrackTruthCollection> m_detailed; //std::string m_detailedTrackTruthName; // TrackTruthCollection output name - std::string m_outputName; + SG::WriteHandle<TrackTruthCollection> m_out; //std::string m_outputName; // Match quality tool ToolHandle<Trk::IDetailedTrackTruthSimilarity> m_matchTool; diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.cxx b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.cxx index 8f7ab8a94019..152e4a4b6959 100644 --- a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.cxx +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.cxx @@ -4,23 +4,23 @@ #include "TrackParticleTruthAlg.h" -#include "TrkTruthData/TrackTruthCollection.h" -#include "TrkTruthData/TrackTruthKey.h" -#include "GeneratorObjects/xAODTruthParticleLink.h" -#include "xAODTracking/TrackParticleContainer.h" +#include "TrkTruthData/TrackTruthKey.h" #include "xAODCore/AuxStoreAccessorMacros.h" #include "GeneratorObjects/McEventCollection.h" #include "MCTruthClassifier/IMCTruthClassifier.h" TrackParticleTruthAlg::TrackParticleTruthAlg(const std::string &name,ISvcLocator *pSvcLocator) : AthAlgorithm(name,pSvcLocator), + m_particles("InDetTrackParticles"), + m_truthParticleLinkVec("xAODTruthLinks"), + m_truthTracks("TrackTruthCollection"), m_truthClassifier("MCTruthClassifier/MCTruthClassifier") { declareProperty("MCTruthClassifier", m_truthClassifier); - declareProperty("TrackTruthName", m_truthName="TrackTruthCollection"); - declareProperty("TrackParticleName", m_trackParticleName="InDetTrackParticles"); - declareProperty("xAODTruthLinkVector",m_truthLinkVecName="xAODTruthLinks"); + declareProperty("TrackTruthName", m_truthTracks); + declareProperty("TrackParticleName", m_particles); + declareProperty("xAODTruthLinkVector",m_truthParticleLinkVec); } // ----------------------------------------------------------------------------------------------------- @@ -38,24 +38,24 @@ StatusCode TrackParticleTruthAlg::finalize() { // ----------------------------------------------------------------------------------------------------- StatusCode TrackParticleTruthAlg::execute() { - xAOD::TrackParticleContainer* particles = 0; - if(evtStore()->contains<xAOD::TrackParticleContainer>(m_trackParticleName)){ - ATH_CHECK(evtStore()->retrieve(particles, m_trackParticleName)); - }else return StatusCode::SUCCESS; + + if(!m_particles.isValid()){ + ATH_MSG_ERROR("Could not read " << m_particles.name()); + return StatusCode::FAILURE; + } + if(!m_truthParticleLinkVec.isValid()){ + ATH_MSG_ERROR("Could not read " << m_truthParticleLinkVec.name()); + return StatusCode::FAILURE; + } - const xAODTruthParticleLinkVector* truthParticleLinkVec = 0; - if(evtStore()->contains<xAODTruthParticleLinkVector>(m_truthLinkVecName)){ - ATH_CHECK(evtStore()->retrieve(truthParticleLinkVec, m_truthLinkVecName)); - }else return StatusCode::SUCCESS; - - const TrackTruthCollection* truthTracks = 0; - // Retrieve the input - if( evtStore()->contains<TrackTruthCollection>(m_truthName)){ - ATH_CHECK(evtStore()->retrieve(truthTracks, m_truthName)); - }else return StatusCode::SUCCESS; + if(!m_truthTracks.isValid()){ + ATH_MSG_ERROR("Could not read " << m_truthTracks.name()); + return StatusCode::FAILURE; + } - for( auto particle : *particles ){ + + for( auto particle : *m_particles ){ if( !particle->trackLink().isValid() ){ ATH_MSG_WARNING("Found TrackParticle with Invalid element link, skipping"); @@ -68,12 +68,12 @@ StatusCode TrackParticleTruthAlg::execute() { ElementLink<xAOD::TruthParticleContainer> link; // look-up associdated truth particle Trk::TrackTruthKey key(particle->trackLink()); - auto result = truthTracks->find(key); + auto result = m_truthTracks->find(key); // if we found a match use it - if( result != truthTracks->end() ){ + if( result != m_truthTracks->end() ){ ATH_MSG_VERBOSE("Found track Truth: barcode " << result->second.particleLink().barcode() << " evt " << result->second.particleLink().eventIndex()); - link = truthParticleLinkVec->find(result->second.particleLink()); + link = m_truthParticleLinkVec->find(result->second.particleLink()); // if configured also get truth classification if( link.isValid()&& !m_truthClassifier.empty() ){ @@ -84,16 +84,18 @@ StatusCode TrackParticleTruthAlg::execute() { } } - ElementLink<xAOD::TruthParticleContainer>& theLink = particle->auxdata<ElementLink<xAOD::TruthParticleContainer> >("truthParticleLink" ); + if( link.isValid() ){ ATH_MSG_DEBUG("Found matching xAOD Truth: barcode " << (*link)->barcode() << " pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi()); // set element link link.toPersistent(); - theLink = link; + //BREAKS THREAD SAFETY FIX LATER + const_cast<xAOD::TrackParticle*>(particle)->auxdata<ElementLink<xAOD::TruthParticleContainer> >("truthParticleLink" ) = link; } if( !m_truthClassifier.empty() ){ - particle->auxdata<int>("truthType") = static_cast<int>(type); - particle->auxdata<int>("truthOrigin") = static_cast<int>(origin); + //BREAKS THREAD SAFETY FIX LATER + const_cast<xAOD::TrackParticle*>(particle)->auxdata<int>("truthType") = static_cast<int>(type); + const_cast<xAOD::TrackParticle*>(particle)->auxdata<int>("truthOrigin") = static_cast<int>(origin); } } return StatusCode::SUCCESS; diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.h b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.h index e1bb807faede..b6ceb69e28e5 100644 --- a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.h +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackParticleTruthAlg.h @@ -5,11 +5,12 @@ #ifndef TRACKPARTICLETRUTHALG_H #define TRACKPARTICLETRUTHALG_H -#include <string> -#include <vector> #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "TrkTruthData/TrackTruthCollection.h" +#include "GeneratorObjects/xAODTruthParticleLink.h" class IMCTruthClassifier; @@ -17,15 +18,17 @@ class TrackParticleTruthAlg: public AthAlgorithm { public: TrackParticleTruthAlg(const std::string &name,ISvcLocator *pSvcLocator); - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; private: + + + SG::ReadHandle<xAOD::TrackParticleContainer> m_particles;//std::string m_trackParticleName; /// TrackParticle input name + SG::ReadHandle<xAODTruthParticleLinkVector> m_truthParticleLinkVec;//std::string m_truthLinkVecName; /// link vector to map HepMC onto xAOD truth + SG::ReadHandle<TrackTruthCollection> m_truthTracks;//std::string m_truthName; /// Track(Particle)TruthCollection input name - std::string m_truthName; /// Track(Particle)TruthCollection input name - std::string m_trackParticleName; /// TrackParticle input name - std::string m_truthLinkVecName; /// link vector to map HepMC onto xAOD truth ToolHandle<IMCTruthClassifier> m_truthClassifier; }; diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx index 7a671f2f3f7d..1bf293e95ee5 100755 --- a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSelector.cxx @@ -6,10 +6,12 @@ TrackTruthSelector::TrackTruthSelector(const std::string &name,ISvcLocator *pSvcLocator) : AthAlgorithm(name,pSvcLocator), + m_detailed("DetailedTrackTruth"), + m_out("TrackTruthNew"), m_subDetWeights(SubDetHitStatistics::NUM_SUBDETECTORS, 1.) { - declareProperty("DetailedTrackTruthName", m_detailedTrackTruthName="DetailedTrackTruth"); - declareProperty("OutputName", m_outputName="TrackTruthNew"); + declareProperty("DetailedTrackTruthName", m_detailed); + declareProperty("OutputName", m_out); declareProperty("WeightPixel", m_subDetWeights[SubDetHitStatistics::Pixel]); declareProperty("WeightSCT", m_subDetWeights[SubDetHitStatistics::SCT]); @@ -37,34 +39,27 @@ StatusCode TrackTruthSelector::finalize() { StatusCode TrackTruthSelector::execute() { ATH_MSG_DEBUG ("TrackTruthSelector::execute()"); - StatusCode sc; - //---------------------------------------------------------------- // Retrieve the input - const DetailedTrackTruthCollection *detailed = 0; - sc = evtStore()->retrieve(detailed, m_detailedTrackTruthName); - if (sc.isFailure()){ - ATH_MSG_WARNING ("DetailedTrackTruthCollection "<<m_detailedTrackTruthName<<" NOT found"); + + if (!m_detailed.isValid()){ + ATH_MSG_WARNING ("DetailedTrackTruthCollection "<<m_detailed.name()<<" NOT found"); return StatusCode::SUCCESS; } else { - ATH_MSG_DEBUG ("Got DetailedTrackTruthCollection "<<m_detailedTrackTruthName); + ATH_MSG_DEBUG ("Got DetailedTrackTruthCollection "<<m_detailed.name()); } //---------------------------------------------------------------- // Produce and store the output. - TrackTruthCollection *out = new TrackTruthCollection(detailed->trackCollectionLink()); + m_out = std::unique_ptr<TrackTruthCollection>(new TrackTruthCollection(m_detailed->trackCollectionLink())); - fillOutput(out, detailed); + fillOutput(m_out.ptr(), m_detailed.cptr()); - sc=evtStore()->record(out, m_outputName, false); - if (sc.isFailure()) { - ATH_MSG_ERROR ("TrackTruthCollection '" << m_outputName << "' could not be registered in StoreGate !"); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG ("TrackTruthCollection '" << m_outputName << "' is registered in StoreGate, size="<<out->size()); - } + + ATH_MSG_DEBUG ("TrackTruthCollection '" << m_out.name() << "' is registered in StoreGate, size="<<m_out->size()); + return StatusCode::SUCCESS; diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSimilaritySelector.cxx b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSimilaritySelector.cxx index 3f66a57fa463..6cb78f496802 100644 --- a/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSimilaritySelector.cxx +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/src/TrackTruthSimilaritySelector.cxx @@ -6,18 +6,19 @@ #include "TrkToolInterfaces/IDetailedTrackTruthSimilarity.h" TrackTruthSimilaritySelector::TrackTruthSimilaritySelector(const std::string &name,ISvcLocator *pSvcLocator) - : AthAlgorithm(name,pSvcLocator) + : AthAlgorithm(name,pSvcLocator), + m_detailed("DetailedTrackTruth"), m_out("TrackTruthNew") , m_matchTool("Trk::TruthMatchRatio") { declareProperty("TrackTruthSimilarityTool", m_matchTool, "Track-truth similarity tool"); - declareProperty("DetailedTrackTruthName", m_detailedTrackTruthName="DetailedTrackTruth"); - declareProperty("OutputName", m_outputName="TrackTruthNew"); + declareProperty("DetailedTrackTruthName", m_detailed); + declareProperty("OutputName", m_out); } // ----------------------------------------------------------------------------------------------------- StatusCode TrackTruthSimilaritySelector::initialize() { - ATH_MSG_INFO ("TrackTruthSimilaritySelector::initialize(), output " << m_outputName); + ATH_MSG_INFO ("TrackTruthSimilaritySelector::initialize(), output " << m_out.name()); return StatusCode::SUCCESS; } @@ -32,33 +33,26 @@ StatusCode TrackTruthSimilaritySelector::execute() { ATH_MSG_DEBUG ("TrackTruthSimilaritySelector::execute()"); - StatusCode sc; - //---------------------------------------------------------------- // Retrieve the input - const DetailedTrackTruthCollection *detailed = 0; - sc = evtStore()->retrieve(detailed, m_detailedTrackTruthName); - if (!sc.isSuccess()){ - ATH_MSG_ERROR ("DetailedTrackTruthCollection "<<m_detailedTrackTruthName<<" NOT found"); - return sc; + + if (!m_detailed.isValid()){ + ATH_MSG_ERROR ("DetailedTrackTruthCollection "<<m_detailed.name()<<" NOT found"); + return StatusCode::FAILURE; } else { - ATH_MSG_DEBUG ("Got DetailedTrackTruthCollection "<<m_detailedTrackTruthName); + ATH_MSG_DEBUG ("Got DetailedTrackTruthCollection "<<m_detailed.name()); } //---------------------------------------------------------------- // Produce and store the output. - TrackTruthCollection *out = new TrackTruthCollection(detailed->trackCollectionLink()); + m_out = std::unique_ptr<TrackTruthCollection> + (new TrackTruthCollection(m_detailed->trackCollectionLink())); - fillOutput(out, detailed); - - sc=evtStore()->record(out, m_outputName, false); - if (!sc.isSuccess()) { - ATH_MSG_ERROR ("TrackTruthCollection '"<<m_outputName<<"' could not be registered in StoreGate !"); - return sc; - } else { - ATH_MSG_DEBUG ("TrackTruthCollection '"<<m_outputName<<"' is registered in StoreGate, size="<<out->size()); - } + fillOutput(m_out.ptr(), m_detailed.cptr()); + + ATH_MSG_DEBUG ("TrackTruthCollection '"<<m_out.name()<<"' is registered in StoreGate, size="<<m_out->size()); + return StatusCode::SUCCESS; } -- GitLab