8#include <tracking/vxdHoughTracking/findlets/TrackCandidateOverlapResolver.h>
9#include <framework/core/ModuleParamList.h>
10#include <framework/core/ModuleParamList.templateDetails.h>
11#include <tracking/spacePointCreation/SpacePointTrackCand.h>
12#include <tracking/spacePointCreation/SpacePoint.h>
13#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapMatrixCreator.h>
14#include <tracking/trackFindingVXD/trackSetEvaluator/HopfieldNetwork.h>
15#include <tracking/trackFindingVXD/trackSetEvaluator/Scrooge.h>
16#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
17#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
20using namespace TrackFindingCDC;
21using namespace vxdHoughTracking;
35 "Strategy used to resolve overlaps. Currently implemented are \"greedy\" and \"hopfield\".",
50 B2ASSERT(
"ResolveMethod has to be either 'greedy' or 'hopfield'. Selected ResolveMethod: " <<
m_resolveMethod,
61 std::vector<SpacePointTrackCand*> activeCandidates;
62 auto requiredSpace = spacePointTrackCandsToResolve.size();
63 activeCandidates.reserve(requiredSpace);
67 unsigned short const nActiveCandidates = activeCandidates.size();
68 if (nActiveCandidates < 2) {
69 B2DEBUG(29,
"Less than 2 active SPTC. No reason to do SVDOverlapResolver!");
74 std::vector<std::vector<unsigned short> > svdHitRelatedTracks(nHits);
76 for (
unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
78 for (
const SpacePoint* spacePointPointer : activeCandidates.at(iCand)->getHits()) {
84 for (
SVDCluster const& svdClusterPointer : svdClusterRelations) {
85 svdHitRelatedTracks[svdClusterPointer.getArrayIndex()].push_back(iCand);
97 std::vector<OverlapResolverNodeInfo> qiTrackOverlap;
98 qiTrackOverlap.reserve(nActiveCandidates);
101 for (
unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
102 qiTrackOverlap.emplace_back(
103 activeCandidates[iCand]->getQualityIndicator(),
105 overlapMatrix.at(iCand),
118 unsigned maxIterations = 20;
119 if (hopfieldNetwork.
doHopfield(qiTrackOverlap, maxIterations) == maxIterations) {
120 B2WARNING(
"Hopfield Network failed converge.");
124 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.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
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.
TrackCandidateOverlapResolver()
Find intercepts in the 2D Hough space.
std::string m_resolveMethod
Strategy used to resolve overlaps.
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.