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 atlas/athena!69650
parents 20181664 5919dcd3
No related merge requests found
......@@ -126,7 +126,7 @@ StatusCode InDetDetailedTrackTruthMaker::execute(const EventContext &ctx) const
}
else {
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;
}
......
......@@ -75,8 +75,8 @@ StatusCode MuonDetailedTrackTruthMaker::execute(const EventContext& ctx) const {
SG::WriteHandle<DetailedTrackTruthCollection> dttc(m_detailedTrackTruthNames.at(i), ctx);
ATH_CHECK(dttc.record(std::make_unique<DetailedTrackTruthCollection>()));
dttc->setTrackCollection(tcol.cptr());
m_truthTool->buildDetailedTrackTruth(dttc.ptr(), *(tcol.cptr()), prdCollectionVector);
m_truthTool->buildDetailedTrackTruth(dttc.ptr(), *(tcol.cptr()), prdCollectionVector, ctx);
i++;
}
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
#define IDETAILEDTRACKTRUTHBUILDER_H
#ifndef TRKTOOLINTERFACES_IDETAILEDTRACKTRUTHBUILDER_H
#define TRKTOOLINTERFACES_IDETAILEDTRACKTRUTHBUILDER_H
#include <vector>
#include "GaudiKernel/IAlgTool.h"
#include "TrkTrack/TrackCollection.h" /* forward declaring the typedef would be ugly.. */
#include <vector>
// Forard declarations of types.
class PRD_MultiTruthCollection;
class DetailedTrackTruthCollection;
namespace Trk {
static const InterfaceID IID_IDetailedTrackTruthBuilder("Trk::IDetailedTrackTruthBuilder",1,0);
/** @brief Provides interface for tool to return a "detailed" track truth map.
@author Andrei Gaponenko <agaponenko@lbl.gov> */
class IDetailedTrackTruthBuilder : virtual public IAlgTool {
public:
static const InterfaceID& interfaceID() { return IID_IDetailedTrackTruthBuilder; }
/** The main tool method. Fills a pre-existing
* DetailedTrackTruthCollection pointed to by output with data for
......@@ -33,16 +30,18 @@ namespace Trk {
*
* This method does not impose a memory management model on the
* 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.)
*
*
* 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,
const TrackCollection& tracks,
const std::vector<const PRD_MultiTruthCollection*>& prdTruth) const = 0;
const TrackCollection& tracks,
const std::vector<const PRD_MultiTruthCollection*>& prdTruth,
const EventContext& ctx) const = 0;
DeclareInterfaceID(Trk::IDetailedTrackTruthBuilder,1,0);
};
} // namespace Trk
#endif/*IDETAILEDTRACKTRUTHBUILDER_H*/
#endif/*TRKTOOLINTERFACES_IDETAILEDTRACKTRUTHBUILDER_H*/
......@@ -21,9 +21,8 @@
#include "TrkTruthData/SubDetHitStatistics.h"
namespace Trk {
class DetailedTrackTruthBuilder final: virtual public IDetailedTrackTruthBuilder,
public AthAlgTool
class DetailedTrackTruthBuilder final: virtual public extends<AthAlgTool, IDetailedTrackTruthBuilder>
{
public:
DetailedTrackTruthBuilder(const std::string& type, const std::string& name, const IInterface* parent);
......@@ -32,22 +31,24 @@ namespace Trk {
/** See description for IDetailedTrackTruthBuilder::buildDetailedTrackTruth() */
virtual void buildDetailedTrackTruth(DetailedTrackTruthCollection *output,
const TrackCollection& tracks,
const std::vector<const PRD_MultiTruthCollection*>& prdTruth) const;
const TrackCollection& tracks,
const std::vector<const PRD_MultiTruthCollection*>& prdTruth,
const EventContext& ctx) const;
private:
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;
void addTrack(DetailedTrackTruthCollection *output,
const ElementLink<DataVector<Trk::Track> > &track,
const std::vector<const PRD_MultiTruthCollection*>& orderedPRD_Truth,
const PRD_InverseTruth& inverseTruth) const;
const ElementLink<DataVector<Trk::Track> > &track,
const std::vector<const PRD_MultiTruthCollection*>& orderedPRD_Truth,
const PRD_InverseTruth& inverseTruth,
const EventContext& ctx) const;
static void makeTruthToRecMap( PRD_InverseTruth& result, const PRD_MultiTruthCollection& rec2truth) ;
......@@ -55,7 +56,7 @@ namespace Trk {
const PRD_InverseTruth& inverseTruth) const;
};
} // end namespace Trk
#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