10#include <tracking/trackFindingCDC/findlets/base/Findlet.h>
12#include <tracking/trackFindingCDC/eventdata/utils/ClassMnemomics.h>
14#include <tracking/trackFindingCDC/filters/base/RelationFilterUtil.h>
16#include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
18#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
19#include <tracking/trackFindingCDC/utilities/Functional.h>
21#include <framework/core/ModuleParamList.h>
22#include <framework/logging/Logger.h>
35 namespace TrackFindingCDC {
47 template <
class AObject,
class ARelationFilter>
63 return "Constructs geometrically constrained relations between " +
65 " filter by some acceptance criterion.";
71 moduleParamList->addParameter(prefixed(prefix,
"onlyBest"),
73 "Maximal number of the best relation to keep from each " +
79 void apply(
const std::vector<AObject*>& inputObjects,
82 B2ASSERT(
"Expected the objects on which relations are constructed to be sorted",
83 std::is_sorted(inputObjects.begin(), inputObjects.end(),
LessOf<Deref>()));
90 int nCurrentRepetitions = 1;
95 if (relation.getFrom() == otherRelation.getFrom())
97 ++nCurrentRepetitions;
98 return nCurrentRepetitions > nMaxRepetitions;
101 nCurrentRepetitions = 1;
106 auto itLast = std::unique(weightedRelations.begin(), weightedRelations.end(), sameFrom);
107 weightedRelations.erase(itLast, weightedRelations.end());
The Module parameter list class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Findlet that combines geometrical constrained pairs of objects to relations and selects them by the f...
std::string getDescription() final
Short description of the findlet.
WeightedRelationCreator()
Constructor registering the subordinary findlets to the processing signal distribution machinery.
void apply(const std::vector< AObject * > &inputObjects, std::vector< WeightedRelation< AObject > > &weightedRelations) final
Main function.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
ARelationFilter m_relationFilter
Relation filter used to select relations.
int m_param_onlyBest
Parameter : Maximal number of the best relations from each item to keep.
Type for two related objects with a weight.
std::string getClassMnemomicParameterDescription(const RecoTrack *dispatchTag)
Returns a short description for class RecoTrack to be used in descriptions of parameters.
Abstract base class for different kinds of events.
Functor factory turning a binary functor and two functors into a new functor which executes the binar...
static void appendUsing(ARelationFilter &relationFilter, const std::vector< AObject * > &froms, const std::vector< AObject * > &tos, std::vector< WeightedRelation< AObject > > &weightedRelations, unsigned int maximumNumberOfRelations=std::numeric_limits< unsigned int >::max())
Appends relations between elements in the given AItems using the ARelationFilter.