10#include <tracking/ckf/general/findlets/OverlapResolver.dcl.h>
12#include <tracking/ckf/general/utilities/CKFFunctors.h>
14#include <tracking/trackFindingCDC/utilities/Functional.h>
15#include <tracking/trackFindingCDC/numerics/WeightComperator.h>
16#include <tracking/trackFindingCDC/utilities/Algorithms.h>
17#include <tracking/trackFindingCDC/utilities/VectorRange.h>
18#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
20#include <framework/core/ModuleParam.h>
21#include <framework/logging/Logger.h>
28 template<
class AFilter>
35 template<
class AFilter>
38 m_filter.exposeParameters(moduleParamList, prefix);
40 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"enableOverlapResolving"),
41 m_param_enableOverlapResolving,
42 "Enable the overlap resolving.",
43 m_param_enableOverlapResolving);
44 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"useBestNInSeed"),
45 m_param_useBestNInSeed,
46 "In seed mode, use only the best seeds.",
47 m_param_useBestNInSeed);
50 template<
class AFilter>
52 std::vector<typename AFilter::Object>& filteredResults)
54 if (not m_param_enableOverlapResolving or results.empty()) {
55 std::swap(results, filteredResults);
63 const auto& groupedBySeed = TrackFindingCDC::adjacent_groupby(results.begin(), results.end(),
SeedGetter());
66 m_resultsWithWeight.clear();
67 for (
Object& result : resultsWithSameSeed) {
68 TrackFindingCDC::Weight weight = m_filter(result);
69 if (std::isnan(weight)) {
72 m_resultsWithWeight.emplace_back(&result, weight);
75 if (not m_resultsWithWeight.empty()) {
79 const unsigned int useBestNResults = std::min(m_resultsWithWeight.size(), m_param_useBestNInSeed);
80 const auto& lastItemToUse = std::next(m_resultsWithWeight.begin(), useBestNResults);
81 const auto& longestElement = *(std::max_element(m_resultsWithWeight.begin(), lastItemToUse,
83 filteredResults.push_back(*(longestElement));
The Module parameter list class.
typename AFilter::Object Object
The object to filter.
AFilter m_filter
Subfindlet for filtering.
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.
A pair of iterators usable with the range base for loop.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
OverlapResolver()
Construct this findlet and add the subfindlet as listener.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters of the subfindlet.
void apply(std::vector< Object > &results, std::vector< Object > &filteredResult) override
For each seed, search for the best candidate and return it.
Abstract base class for different kinds of events.
Helper Functor to get the Seed of a given result.
Functor factory turning a binary functor and two functors into a new functor which executes the binar...