8#include "GaudiKernel/MsgStream.h"
17 m_selectionTool(
"InDet::InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool")
19 declareInterface<ITrackAmbiguityProcessorTool>(
this);
31 StatusCode
sc = AthAlgTool::initialize();
34 return StatusCode::FAILURE;
51 StatusCode
sc = AlgTool::finalize();
65 std::vector<const Track*> tracks;
66 tracks.reserve(tracksCol->
size());
67 for(
const auto *e: *tracksCol){
71 std::unique_ptr<Trk::PRDtoTrackMap> tmpPrdToTrackMap;
72 if (!pPrdToTrackMap) {
73 tmpPrdToTrackMap =
m_assoTool->createPRDtoTrackMap();
79 *tmpPrdToTrackMap = *inputPrdMap;
82 pPrdToTrackMap = tmpPrdToTrackMap.get();
86 addNewTracks(trackScoreTrackMap,*pPrdToTrackMap, tracks);
92 solveTracks(ctx, trackScoreTrackMap, *pPrdToTrackMap, *result);
94 return result.release()->asDataVector();
102 const std::vector<const Track*> &tracks)
const{
103 ATH_MSG_DEBUG (
"Number of tracks at Input: "<<tracks.size());
106 for (
const Track*a_track : tracks ) {
109 trackScoreTrackMap.insert( std::make_pair(itrack,
TrackPtr(a_track)) );
121 const std::vector<const Trk::PrepRawData*> & prds =
m_assoTool->getPrdsOnTrack(prdToTrackMap, *a_track);
124 prdSig.insert( prds.begin(),prds.end() );
126 if ( !(prdSigSet.insert(prdSig)).second ) {
137 trackScoreTrackMap.insert( std::make_pair(-score,
TrackPtr(a_track) ) );
140 ATH_MSG_DEBUG (
"Number of tracks in map:"<<trackScoreTrackMap.size());
154 if (!splitProbContainerIn.
isValid()) {
159 ? std::make_unique<ClusterSplitProbabilityContainer>(*splitProbContainerIn)
160 : std::make_unique<ClusterSplitProbabilityContainer>());
165 if (splitProbContainerHandle.
record(std::move(splitProbContainerCleanup)).isFailure()) {
168 splitProbContainer=splitProbContainerHandle.
ptr();
171 splitProbContainer=splitProbContainerCleanup.get();
176 while ( !trackScoreTrackMap.empty() ) {
177 TrackScoreMap::iterator itnext = trackScoreTrackMap.begin();
178 TrackPtr atrack( std::move(itnext->second) );
180 trackScoreTrackMap.erase(itnext);
182 std::unique_ptr<Trk::Track> cleanedTrack;
183 const auto &[cleanedTrack_tmp, keepOriginal] =
m_selectionTool->getCleanedOutTrack( atrack.
track() , -(ascore), *splitProbContainer, prdToTrackMap, -1, -1);
184 cleanedTrack.reset(cleanedTrack_tmp);
189 StatusCode
sc =
m_assoTool->addPRDs(prdToTrackMap,*atrack);
192 result.push_back( atrack.
track() );
194 }
else if ( !cleanedTrack ) {
196 ATH_MSG_DEBUG (
"Track "<< atrack.
track() <<
" doesn't meet the cuts of the AmbiTrack Selection tool");
199 cleanedTrack.reset();
201 ATH_MSG_DEBUG(
"Selection tool returned a new track, cannot handle memory management of new track, deleting it. Check you configuration ");
205 ATH_MSG_DEBUG (
"Finished, number of track on output: "<<result.size());
217 for (; it != itEnd ; ++it){
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
DataVector adapter that acts like it holds const pointers.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool msgLvl(const MSG::Level lvl) const
DataVector adapter that acts like it holds const pointers.
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
Container to associate Cluster with cluster splitting probabilities.
const Trk::Track * track() const
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts