 |
Belle II Software
release-05-01-25
|
12 #include <tracking/trackFindingCDC/findlets/base/Findlet.h>
14 #include <tracking/trackFindingCDC/eventdata/utils/ClassMnemomics.h>
16 #include <tracking/trackFindingCDC/filters/base/RelationFilterUtil.h>
18 #include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
20 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
21 #include <tracking/trackFindingCDC/utilities/Functional.h>
23 #include <framework/core/ModuleParamList.h>
24 #include <framework/logging/Logger.h>
37 namespace TrackFindingCDC {
49 template <
class AObject,
class ARelationFilter>
50 class WeightedRelationCreator :
public Findlet<AObject* const, WeightedRelation<AObject>> {
54 using Super = Findlet<AObject, WeightedRelation<AObject> >;
65 return "Constructs geometrically constrained relations between " +
67 " filter by some acceptance criterion.";
73 moduleParamList->addParameter(prefixed(prefix,
"onlyBest"),
75 "Maximal number of the best relation to keep from each " +
81 void apply(
const std::vector<AObject*>& inputObjects,
84 B2ASSERT(
"Expected the objects on which relations are constructed to be sorted",
85 std::is_sorted(inputObjects.begin(), inputObjects.end(),
LessOf<Deref>()));
92 int nCurrentRepetitions = 1;
97 if (relation.getFrom() == otherRelation.getFrom())
99 ++nCurrentRepetitions;
100 return nCurrentRepetitions > nMaxRepetitions;
103 nCurrentRepetitions = 1;
108 auto itLast = std::unique(weightedRelations.begin(), weightedRelations.end(), sameFrom);
109 weightedRelations.erase(itLast, weightedRelations.end());
Functor factory turning a binary functor and two functors into a new functor which executes the binar...
Findlet< AObject, WeightedRelation< AObject > > Super
Type of the base class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
std::string getDescription() final
Short description of the findlet.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
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.
std::string getClassMnemomicParameterDescription(const RecoTrack *dispatchTag __attribute__((unused)))
Returns a short description for class RecoTrack to be used in descriptions of parameters.
int m_param_onlyBest
Parameter : Maximal number of the best relations from each item to keep.
Abstract base class for different kinds of events.
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.
ARelationFilter m_relationFilter
Relation filter used to select relations.
Type for two related objects with a weight.
The Module parameter list class.