10#include <tracking/ckf/general/findlets/CKFRelationCreator.dcl.h>
11#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
13#include <tracking/trackFindingCDC/filters/base/RelationFilterUtil.h>
14#include <tracking/trackFindingCDC/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, TrackFindingCDC::prefixed(
"seed", prefix));
38 m_hitFilter.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(
"hit", prefix));
40 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"onlyUseHitStatesRelatedToSeeds"),
41 m_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 TrackFindingCDC::prefixed(prefix,
"onlyCombineRelatedHitStates") +
") should be set to true.",
46 m_onlyUseHitStatesRelatedToSeeds);
47 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"onlyCombineRelatedHitStates"),
48 m_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 TrackFindingCDC::prefixed(prefix,
"onlyUseHitStatesRelatedToSeeds") +
") is set to true.",
53 m_onlyCombineRelatedHitStates);
56 template<
class AState,
class ASeedRelationFilter,
class AHitRelationFilter>
58 std::vector<AState>& states,
61 const std::vector<AState*> seedStatePointers = TrackFindingCDC::as_pointers<AState>(seedStates);
62 const std::vector<AState*> statePointers = TrackFindingCDC::as_pointers<AState>(states);
65 relations.reserve(10000);
71 if (m_onlyUseHitStatesRelatedToSeeds) {
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());
84 if (m_onlyCombineRelatedHitStates) {
ASeedRelationFilter m_seedFilter
Subfindlet for the relation checking between seed and hits.
AHitRelationFilter m_hitFilter
Subfindlet for the relation checking between hits and hits.
The Module parameter list class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
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.
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.
void apply(std::vector< AState > &seedStates, std::vector< AState > &states, std::vector< TrackFindingCDC::WeightedRelation< AState > > &relations) override
Apply both filters for creating state-hit and hit-hit relations.
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.