12#include "GaudiKernel/MsgStream.h"
20 ISvcLocator* pSvcLocator)
38 return StatusCode::SUCCESS;
47 auto outputCol = std::make_unique<ConstDataVector<TrackCollection>>(
SG::VIEW_ELEMENTS);
51 std::vector<const TrackCollection*> trackCollections;
57 trackCollections.push_back(trackCol.
cptr());
58 ttNumber += trackCol->size();
60 std::unique_ptr<Trk::PRDtoTrackMap> pPrdToTrackMap(
m_assoTool ?
m_assoTool->createPRDtoTrackMap() :
nullptr);
62 outputCol->reserve(ttNumber);
64 for (
auto& tciter : trackCollections) {
66 if (
mergeTrack(tciter, pPrdToTrackMap.get(), outputCol.get()).isFailure()) {
70 ATH_MSG_DEBUG(
"Size of combined tracks " << outputCol->size());
73 ATH_CHECK(h_write.record(std::move(outputCol)));
77 if (write_handle.
record(
m_assoTool->reduceToStorableMap(std::move(pPrdToTrackMap))).isFailure()) {
83 return StatusCode::SUCCESS;
92 return StatusCode::SUCCESS;
104 if (trackCol && !trackCol->
empty()) {
106 if (not pPrdToTrackMap)
107 ATH_MSG_WARNING(
"No valid PRD to Track Map; was the association tool name missing?");
109 for (
const auto*
const rf : *trackCol) {
117 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
An algorithm that can be simultaneously executed in multiple threads.
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
virtual StatusCode execute(const EventContext &ctx) const override final
StatusCode mergeTrack(const TrackCollection *trackCol, Trk::PRDtoTrackMap *pPrdToTrackMap, ConstDataVector< TrackCollection > *outputCol) const
Protected methods:
SG::ReadHandleKeyArray< TrackCollection > m_tracklocation
Protected data:
SG::WriteHandleKey< ConstDataVector< TrackCollection > > m_outtracklocation
Combined track collection.
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_pileupTRT
pileup TRT PRDs, only retrieved if track overlay is on
SG::ReadHandleKey< InDet::SCT_ClusterContainer > m_pileupSCT
pileup SCT PRDs, only retrieved if track overlay is on
SG::ReadHandleKey< InDet::PixelClusterContainer > m_pileupPixel
pileup pixel PRDs, only retrieved if track overlay is on
virtual StatusCode initialize() override final
BooleanProperty m_doTrackOverlay
ToolHandle< Trk::IPRDtoTrackMapTool > m_assoTool
SG::WriteHandleKey< Trk::PRDtoTrackMap > m_assoMapName
the key given to the newly created association map
virtual StatusCode finalize() override final
TrackCollectionMerger(const std::string &name, ISvcLocator *pSvcLocator)
Standard Algotithm methods:
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())