Belle II Software development
|
name Structured creation of neighborhoods More...
#include <RelationFilterUtil.h>
Static Public Member Functions | |
template<class AObject , class ARelationFilter > | |
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. | |
template<class AObject , class ARelationFilter > | |
static void | appendUsing (ARelationFilter &relationFilter, const std::vector< AObject * > &objects, std::vector< WeightedRelation< AObject > > &weightedRelations) |
Shortcut for applying appendUsing with froms=tos. | |
name Structured creation of neighborhoods
Often one faces the problem of having to build a graph between elements of the
same kind. To find suitable neighbors in a general container it would take an amount of time
proportional to n*n to compare all available elements to each other, which is often to long.
However if we can sort the sequence we can improve look up speed to an element by a great deal.
All tracking hits / segments / tracks for which we want to build graphs are therefore made sortable.
But the improved look up speed only helps if the neighbors are not scattered around randomly over
the sorted range but are close together in a specific section of the range. The time complexity drops
than to n*log n + n * m, where n is the number of elements in the collection and m the expected number
of neighbors.
Since we already sorted out the arrangement of hits / segments / tracks during their creation, we have to define
the region where to look for neighbors. We keep the general logic for look up the same
but vary the definition of what a neighborhood is supposed to be we factor the later out into
a strategy object called the RelationFilter with the following interface methods :
Definition at line 59 of file RelationFilterUtil.h.
|
inlinestatic |
Appends relations between elements in the given AItems using the ARelationFilter.
Definition at line 63 of file RelationFilterUtil.h.
|
inlinestatic |
Shortcut for applying appendUsing with froms=tos.
Definition at line 107 of file RelationFilterUtil.h.