8#include <tracking/vxdHoughTracking/findlets/TrackCandidateOverlapResolver.h>
9#include <framework/core/ModuleParamList.h>
10#include <tracking/spacePointCreation/SpacePointTrackCand.h>
11#include <tracking/spacePointCreation/SpacePoint.h>
12#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapMatrixCreator.h>
13#include <tracking/trackFindingVXD/trackSetEvaluator/HopfieldNetwork.h>
14#include <tracking/trackFindingVXD/trackSetEvaluator/Scrooge.h>
15#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
16#include <tracking/trackingUtilities/utilities/StringManipulation.h>
17#include <tracking/dbobjects/SVDHoughParameters.h>
18#include <svd/dataobjects/SVDCluster.h>
21using namespace TrackingUtilities;
22using namespace vxdHoughTracking;
38 "Strategy used to resolve overlaps. Currently implemented are \"greedy\" and \"hopfield\".",
54 B2ASSERT(
"ResolveMethod has to be either 'greedy' or 'hopfield'. Selected ResolveMethod: " <<
m_resolveMethod,
62 B2FATAL(
"SVDHough - TrackCandidateOverlapResolver: SVDHoughParameter dbobject not found, using default parameters.");
64 if (
m_prefix ==
"finalOverlapResolver") {
66 }
else if (
m_prefix ==
"refinerOverlapResolver") {
78 std::vector<SpacePointTrackCand*> activeCandidates;
79 auto requiredSpace = spacePointTrackCandsToResolve.size();
80 activeCandidates.reserve(requiredSpace);
84 unsigned short const nActiveCandidates = activeCandidates.size();
85 if (nActiveCandidates < 2) {
86 B2DEBUG(29,
"Less than 2 active SPTC. No reason to do SVDOverlapResolver!");
91 std::vector<std::vector<unsigned short> > svdHitRelatedTracks(nHits);
93 for (
unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
95 for (
const SpacePoint* spacePointPointer : activeCandidates.at(iCand)->getHits()) {
101 for (
SVDCluster const& svdClusterPointer : svdClusterRelations) {
102 svdHitRelatedTracks[svdClusterPointer.getArrayIndex()].push_back(iCand);
114 std::vector<OverlapResolverNodeInfo> qiTrackOverlap;
115 qiTrackOverlap.reserve(nActiveCandidates);
118 for (
unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
119 qiTrackOverlap.emplace_back(
120 activeCandidates[iCand]->getQualityIndicator(),
122 overlapMatrix.at(iCand),
135 unsigned maxIterations = 20;
136 if (hopfieldNetwork.
doHopfield(qiTrackOverlap, maxIterations) == maxIterations) {
137 B2WARNING(
"Hopfield Network failed converge.");
141 for (
auto&& track : qiTrackOverlap) {
Hopfield Algorithm with number based inputs.
unsigned short doHopfield(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfos, unsigned short nIterations=20)
Performance of the actual algorithm.
The Module parameter list class.
Creates a vector of vectors, that knows which track is conflicting with which other.
std::vector< std::vector< unsigned short > > getOverlapMatrix(unsigned allowedOverlaps=0)
Fills and returns the overlap matrix.
Class for type safe access to objects that are referred to in relations.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Executes greedy algorithm for vector of QITrackOverlap structs.
void performSelection(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfo)
Sets the isActive flag in m_qiTrackOverlap to false, for killed tracks.
Storage for (VXD) SpacePoint-based track candidates.
@ c_isActive
bit 11: SPTC is active (i.e.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
void initialize() override
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
TrackingUtilities::Findlet< SpacePointTrackCand > Super
Parent class.
void apply(std::vector< SpacePointTrackCand > &spacePointTrackCandsToResolve) override
Reject bad SpacePointTrackCands and bad hits inside the remaining.
void initialize() override
Create the store arrays.
StoreArray< SVDCluster > m_svdClusters
Stay connected to the DataStore for timing improvement.
std::string m_prefix
parameters prefix (finalOverlapResolver, refinerOverlapResolver)
TrackCandidateOverlapResolver()
Find intercepts in the 2D Hough space.
DBObjPtr< SVDHoughParameters > m_SVDHoughParameters
DB object containing the SVDHough parameters.
std::string m_resolveMethod
Strategy used to resolve overlaps.
void beginRun() override
Check dbobject validity.
double m_minActivityState
Minimum of activityState of candidate required to be accepted by the algorithm.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
~TrackCandidateOverlapResolver()
Default destructor.
std::string m_nameSVDClusters
Name of array of SVDCluster.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.