10#include <tracking/ckf/general/findlets/CKFRelationCreator.dcl.h>
11#include <tracking/trackingUtilities/utilities/StringManipulation.h>
13#include <tracking/trackingUtilities/filters/base/RelationFilterUtil.h>
14#include <tracking/trackingUtilities/utilities/Algorithms.h>
23 template<
class AState,
class ASeedRelationFilter,
class AHitRelationFilter>
26 template<
class AState,
class ASeedRelationFilter,
class AHitRelationFilter>
33 template<
class AState,
class ASeedRelationFilter,
class AHitRelationFilter>
35 const std::string& prefix)
37 m_seedFilter.exposeParameters(moduleParamList, TrackingUtilities::prefixed(
"seed", prefix));
38 m_hitFilter.exposeParameters(moduleParamList, TrackingUtilities::prefixed(
"hit", prefix));
40 moduleParamList->
addParameter(TrackingUtilities::prefixed(prefix,
"onlyUseHitStatesRelatedToSeeds"),
42 "Only use hit states related to seed states to build the inter hit relations to reduce combinatorics. "\
43 "By default, only the \"FromStates\" will be the ones related to seeds. If also the \"ToStates\" should be "\
44 "related to the seeds, also m_onlyCombineRelatedHitStates (name in Python: " + \
45 TrackingUtilities::prefixed(prefix,
"onlyCombineRelatedHitStates") +
") should be set to true.",
47 moduleParamList->
addParameter(TrackingUtilities::prefixed(prefix,
"onlyCombineRelatedHitStates"),
49 "Only use hit states related to seed states to build the inter hit relations to reduce combinatorics. "\
50 "If true, both \"FromStates\" and \"ToStates\" will be those that are already related to seeds. "\
51 "Only works if also m_onlyUseHitStatesRelatedToSeeds (name in Python: " + \
52 TrackingUtilities::prefixed(prefix,
"onlyUseHitStatesRelatedToSeeds") +
") is set to true.",
56 template<
class AState,
class ASeedRelationFilter,
class AHitRelationFilter>
58 std::vector<AState>& states,
61 const std::vector<AState*> seedStatePointers = TrackingUtilities::as_pointers<AState>(seedStates);
62 const std::vector<AState*> statePointers = TrackingUtilities::as_pointers<AState>(states);
65 relations.reserve(10000);
73 std::vector<AState*> selectedStatePointers;
74 selectedStatePointers.reserve(relations.size());
76 for (
const auto& relation : relations) {
78 const auto it = std::find(selectedStatePointers.begin(), selectedStatePointers.end(), relation.getTo());
79 if (it == selectedStatePointers.end()) {
80 selectedStatePointers.push_back(relation.getTo());
TrackingUtilities::Findlet< AState, AState, TrackingUtilities::WeightedRelation< AState > > Super
The parent class.
bool m_onlyUseHitStatesRelatedToSeeds
ASeedRelationFilter m_seedFilter
Subfindlet for the relation checking between seed and hits.
AHitRelationFilter m_hitFilter
Subfindlet for the relation checking between hits and hits.
bool m_onlyCombineRelatedHitStates
The Module parameter list class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Type for two related objects with a weight.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
void apply(std::vector< AState > &seedStates, std::vector< AState > &states, std::vector< TrackingUtilities::WeightedRelation< AState > > &relations) override
Apply both filters for creating state-hit and hit-hit relations.
CKFRelationCreator()
Construct this findlet and add the subfindlet as listener.
~CKFRelationCreator()
Default destructor.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters of the subfindlet.
Abstract base class for different kinds of events.
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.