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();
64 std::vector<const Track*> tracks;
65 tracks.reserve(tracksCol->
size());
66 for(
const auto *e: *tracksCol){
70 std::unique_ptr<Trk::PRDtoTrackMap> tmpPrdToTrackMap;
71 if (!pPrdToTrackMap) {
72 tmpPrdToTrackMap =
m_assoTool->createPRDtoTrackMap();
78 *tmpPrdToTrackMap = *inputPrdMap;
81 pPrdToTrackMap = tmpPrdToTrackMap.get();
85 addNewTracks(trackScoreTrackMap,*pPrdToTrackMap, tracks);
93 return result.release()->asDataVector();
101 const std::vector<const Track*> &tracks)
const{
102 ATH_MSG_DEBUG (
"Number of tracks at Input: "<<tracks.size());
105 for (
const Track*a_track : tracks ) {
108 trackScoreTrackMap.insert( std::make_pair(itrack,
TrackPtr(a_track)) );
120 const std::vector<const Trk::PrepRawData*> & prds =
m_assoTool->getPrdsOnTrack(prdToTrackMap, *a_track);
123 prdSig.insert( prds.begin(),prds.end() );
125 if ( !(prdSigSet.insert(prdSig)).second ) {
136 trackScoreTrackMap.insert( std::make_pair(-score,
TrackPtr(a_track) ) );
139 ATH_MSG_DEBUG (
"Number of tracks in map:"<<trackScoreTrackMap.size());
149 const EventContext& ctx = Gaudi::Hive::currentContext();
153 if (!splitProbContainerIn.
isValid()) {
158 ? std::make_unique<ClusterSplitProbabilityContainer>(*splitProbContainerIn)
159 : std::make_unique<ClusterSplitProbabilityContainer>());
164 if (splitProbContainerHandle.
record(std::move(splitProbContainerCleanup)).isFailure()) {
167 splitProbContainer=splitProbContainerHandle.
ptr();
170 splitProbContainer=splitProbContainerCleanup.get();
175 while ( !trackScoreTrackMap.empty() ) {
176 TrackScoreMap::iterator itnext = trackScoreTrackMap.begin();
177 TrackPtr atrack( std::move(itnext->second) );
179 trackScoreTrackMap.erase(itnext);
181 std::unique_ptr<Trk::Track> cleanedTrack;
182 const auto &[cleanedTrack_tmp, keepOriginal] =
m_selectionTool->getCleanedOutTrack( atrack.
track() , -(ascore), *splitProbContainer, prdToTrackMap, -1, -1);
183 cleanedTrack.reset(cleanedTrack_tmp);
188 StatusCode
sc =
m_assoTool->addPRDs(prdToTrackMap,*atrack);
193 }
else if ( !cleanedTrack ) {
195 ATH_MSG_DEBUG (
"Track "<< atrack.
track() <<
" doesn't meet the cuts of the AmbiTrack Selection tool");
198 cleanedTrack.reset();
200 ATH_MSG_DEBUG(
"Selection tool returned a new track, cannot handle memory management of new track, deleting it. Check you configuration ");
216 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