Skip to content
Snippets Groups Projects
Commit 79a880b2 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'CleanupDetailedTrackTruthBuilder_main' into 'main'

Modernise DetailedTrackTruthBuilder syntax

See merge request !69650
parents 20181664 5919dcd3
No related branches found
No related tags found
No related merge requests found
...@@ -126,7 +126,7 @@ StatusCode InDetDetailedTrackTruthMaker::execute(const EventContext &ctx) const ...@@ -126,7 +126,7 @@ StatusCode InDetDetailedTrackTruthMaker::execute(const EventContext &ctx) const
} }
else { else {
ATH_MSG_DEBUG ("DetailedTrackTruthCollection '" << m_detailedTrackTruthName.key() << "' is registered in StoreGate, size="<<dttc->size()); ATH_MSG_DEBUG ("DetailedTrackTruthCollection '" << m_detailedTrackTruthName.key() << "' is registered in StoreGate, size="<<dttc->size());
m_truthTool->buildDetailedTrackTruth(&(*dttc), *tracks, prdCollectionVector); m_truthTool->buildDetailedTrackTruth(&(*dttc), *tracks, prdCollectionVector, ctx);
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
......
...@@ -75,8 +75,8 @@ StatusCode MuonDetailedTrackTruthMaker::execute(const EventContext& ctx) const { ...@@ -75,8 +75,8 @@ StatusCode MuonDetailedTrackTruthMaker::execute(const EventContext& ctx) const {
SG::WriteHandle<DetailedTrackTruthCollection> dttc(m_detailedTrackTruthNames.at(i), ctx); SG::WriteHandle<DetailedTrackTruthCollection> dttc(m_detailedTrackTruthNames.at(i), ctx);
ATH_CHECK(dttc.record(std::make_unique<DetailedTrackTruthCollection>())); ATH_CHECK(dttc.record(std::make_unique<DetailedTrackTruthCollection>()));
dttc->setTrackCollection(tcol.cptr()); dttc->setTrackCollection(tcol.cptr());
m_truthTool->buildDetailedTrackTruth(dttc.ptr(), *(tcol.cptr()), prdCollectionVector); m_truthTool->buildDetailedTrackTruth(dttc.ptr(), *(tcol.cptr()), prdCollectionVector, ctx);
i++; i++;
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
\ No newline at end of file
/* /*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef IDETAILEDTRACKTRUTHBUILDER_H #ifndef TRKTOOLINTERFACES_IDETAILEDTRACKTRUTHBUILDER_H
#define IDETAILEDTRACKTRUTHBUILDER_H #define TRKTOOLINTERFACES_IDETAILEDTRACKTRUTHBUILDER_H
#include <vector>
#include "GaudiKernel/IAlgTool.h" #include "GaudiKernel/IAlgTool.h"
#include "TrkTrack/TrackCollection.h" /* forward declaring the typedef would be ugly.. */ #include "TrkTrack/TrackCollection.h" /* forward declaring the typedef would be ugly.. */
#include <vector>
// Forard declarations of types. // Forard declarations of types.
class PRD_MultiTruthCollection; class PRD_MultiTruthCollection;
class DetailedTrackTruthCollection; class DetailedTrackTruthCollection;
namespace Trk { namespace Trk {
static const InterfaceID IID_IDetailedTrackTruthBuilder("Trk::IDetailedTrackTruthBuilder",1,0);
/** @brief Provides interface for tool to return a "detailed" track truth map. /** @brief Provides interface for tool to return a "detailed" track truth map.
@author Andrei Gaponenko <agaponenko@lbl.gov> */ @author Andrei Gaponenko <agaponenko@lbl.gov> */
class IDetailedTrackTruthBuilder : virtual public IAlgTool { class IDetailedTrackTruthBuilder : virtual public IAlgTool {
public: public:
static const InterfaceID& interfaceID() { return IID_IDetailedTrackTruthBuilder; }
/** The main tool method. Fills a pre-existing /** The main tool method. Fills a pre-existing
* DetailedTrackTruthCollection pointed to by output with data for * DetailedTrackTruthCollection pointed to by output with data for
...@@ -33,16 +30,18 @@ namespace Trk { ...@@ -33,16 +30,18 @@ namespace Trk {
* *
* This method does not impose a memory management model on the * This method does not impose a memory management model on the
* caller. (As e.g. returning an object on the heap would do.) * caller. (As e.g. returning an object on the heap would do.)
* The caller can use it to work with stack or heap objects. * The caller can use it to work with stack or heap objects.
* Call with output==0 is a no-op. (But output should not be garbage, it must be initialized.) * Call with output==0 is a no-op. (But output should not be garbage, it must be initialized.)
* *
* Adding an int to tell it to only calculate the detailed track truth for certain tracks: used only by track overlay * Adding an int to tell it to only calculate the detailed track truth for certain tracks: used only by track overlay
*/ */
virtual void buildDetailedTrackTruth(DetailedTrackTruthCollection *output, virtual void buildDetailedTrackTruth(DetailedTrackTruthCollection *output,
const TrackCollection& tracks, const TrackCollection& tracks,
const std::vector<const PRD_MultiTruthCollection*>& prdTruth) const = 0; const std::vector<const PRD_MultiTruthCollection*>& prdTruth,
const EventContext& ctx) const = 0;
DeclareInterfaceID(Trk::IDetailedTrackTruthBuilder,1,0);
}; };
} // namespace Trk } // namespace Trk
#endif/*IDETAILEDTRACKTRUTHBUILDER_H*/ #endif/*TRKTOOLINTERFACES_IDETAILEDTRACKTRUTHBUILDER_H*/
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
#include "TrkTruthData/SubDetHitStatistics.h" #include "TrkTruthData/SubDetHitStatistics.h"
namespace Trk { namespace Trk {
class DetailedTrackTruthBuilder final: virtual public IDetailedTrackTruthBuilder, class DetailedTrackTruthBuilder final: virtual public extends<AthAlgTool, IDetailedTrackTruthBuilder>
public AthAlgTool
{ {
public: public:
DetailedTrackTruthBuilder(const std::string& type, const std::string& name, const IInterface* parent); DetailedTrackTruthBuilder(const std::string& type, const std::string& name, const IInterface* parent);
...@@ -32,22 +31,24 @@ namespace Trk { ...@@ -32,22 +31,24 @@ namespace Trk {
/** See description for IDetailedTrackTruthBuilder::buildDetailedTrackTruth() */ /** See description for IDetailedTrackTruthBuilder::buildDetailedTrackTruth() */
virtual void buildDetailedTrackTruth(DetailedTrackTruthCollection *output, virtual void buildDetailedTrackTruth(DetailedTrackTruthCollection *output,
const TrackCollection& tracks, const TrackCollection& tracks,
const std::vector<const PRD_MultiTruthCollection*>& prdTruth) const; const std::vector<const PRD_MultiTruthCollection*>& prdTruth,
const EventContext& ctx) const;
private: private:
typedef InverseMultiMap<PRD_MultiTruthCollection> PRD_InverseTruth; typedef InverseMultiMap<PRD_MultiTruthCollection> PRD_InverseTruth;
const AtlasDetectorID *m_idHelper; const AtlasDetectorID *m_idHelper{};
ToolHandle<Trk::ITruthTrajectoryBuilder> m_truthTrajBuilder; PublicToolHandle<Trk::ITruthTrajectoryBuilder> m_truthTrajBuilder{this, "TruthTrajectoryTool", "Trk::ElasticTruthTrajectoryBuilder"};
SubDetHitStatistics::SubDetType findSubDetType(const Identifier& id) const; SubDetHitStatistics::SubDetType findSubDetType(const Identifier& id) const;
void addTrack(DetailedTrackTruthCollection *output, void addTrack(DetailedTrackTruthCollection *output,
const ElementLink<DataVector<Trk::Track> > &track, const ElementLink<DataVector<Trk::Track> > &track,
const std::vector<const PRD_MultiTruthCollection*>& orderedPRD_Truth, const std::vector<const PRD_MultiTruthCollection*>& orderedPRD_Truth,
const PRD_InverseTruth& inverseTruth) const; const PRD_InverseTruth& inverseTruth,
const EventContext& ctx) const;
static void makeTruthToRecMap( PRD_InverseTruth& result, const PRD_MultiTruthCollection& rec2truth) ; static void makeTruthToRecMap( PRD_InverseTruth& result, const PRD_MultiTruthCollection& rec2truth) ;
...@@ -55,7 +56,7 @@ namespace Trk { ...@@ -55,7 +56,7 @@ namespace Trk {
const PRD_InverseTruth& inverseTruth) const; const PRD_InverseTruth& inverseTruth) const;
}; };
} // end namespace Trk } // end namespace Trk
#endif/*DETAILEDTRACKTRUTHBUILDER_H*/ #endif/*DETAILEDTRACKTRUTHBUILDER_H*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment