9#include <tracking/modules/trackSetEvaluatorVXD/SVDOverlapResolverModule.h>
11#include <framework/logging/Logger.h>
14#include <tracking/spacePointCreation/SpacePoint.h>
16#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapMatrixCreator.h>
17#include <tracking/trackFindingVXD/trackSetEvaluator/HopfieldNetwork.h>
18#include <tracking/trackFindingVXD/trackSetEvaluator/Scrooge.h>
19#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
21#include <vxd/geometry/SensorInfoBase.h>
31 setDescription(
"Module checks for overlaps of SpacePointTrackCands");
38 addParam(
"ResolveMethod",
m_resolveMethod,
"Strategy used to resolve overlaps. Currently implemented are \"greedy\" and "
39 " \"hopfield\" ", std::string(
"greedy"));
51 B2ASSERT(
"ResolveMethod has to be either 'greedy' or 'hopfield'. Selected ResolveMethod: " <<
m_resolveMethod,
62 std::vector<SpacePointTrackCand*> activeCandidates;
67 activeCandidates.reserve(requiredSpace);
71 unsigned short const nActiveCandidates = activeCandidates.size();
72 if (nActiveCandidates < 2) {
73 B2DEBUG(29,
"Less than 2 active SPTC. No reason to do SVDOverlapResolver!");
78 std::vector<std::vector<unsigned short> > svdHitRelatedTracks(nHits);
80 for (
unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
82 for (
const SpacePoint* spacePointPointer : activeCandidates.at(iCand)->getHits()) {
88 for (
SVDCluster const& svdClusterPointer : svdClusterRelations) {
89 svdHitRelatedTracks[svdClusterPointer.getArrayIndex()].push_back(iCand);
101 std::vector<OverlapResolverNodeInfo> qiTrackOverlap;
102 qiTrackOverlap.reserve(nActiveCandidates);
105 for (
unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
106 qiTrackOverlap.emplace_back(
107 activeCandidates[iCand]->getQualityIndicator(),
109 overlapMatrix.at(iCand),
122 unsigned maxIterations = 20;
123 if (hopfieldNetwork.
doHopfield(qiTrackOverlap, maxIterations) == maxIterations) {
124 B2WARNING(
"Hopfield Network failed converge.");
128 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.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
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.
void initialize() override final
State requirements of SpacePointTrackCands, SVDClusters, registers OverlapNetworks.
float m_minActivityState
Minimum of activityState of candidate required to be accepted by the algorithm.
StoreArray< SVDCluster > m_svdClusters
Stay connected to the DataStore for timing improvement.
std::string m_resolveMethod
Strategy used to resolve overlaps.
SVDOverlapResolverModule()
Constructor of the module.
void event() override final
Checks for overlaps and fills the OverlapNetwork.
unsigned short m_estimatedActiveCandidates
Estimated amount of active candidates used to reserve enough space.
std::string m_nameSVDClusters
Name of array of SVDCluster.
StoreArray< SpacePointTrackCand > m_spacePointTrackCands
Stay connected to the DataStore for timing improvement.
std::string m_nameSpacePointTrackCands
Name of array of SpacePointTrackCand.
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 addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.