Belle II Software development
SegmentTrackCombiner.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/trackFindingCDC/findlets/combined/SegmentTrackCombiner.h>
9
10#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
11#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
12
13#include <tracking/trackFindingCDC/filters/base/ChooseableFilter.icc.h>
14
15using namespace Belle2;
16using namespace TrackFindingCDC;
17
20
22{
30
31 ModuleParamList moduleParamList;
32 const std::string prefix = "";
33 this->exposeParameters(&moduleParamList, prefix);
34 moduleParamList.getParameter<double>("sharedHitsCutValue").setDefaultValue(1.0);
35 moduleParamList.getParameter<bool>("useOnlySingleBestCandidate").setDefaultValue(false);
36 moduleParamList.getParameter<bool>("hitSelectorUseOnlySingleBestCandidate").setDefaultValue(false);
37}
38
40{
41 return "Findlet for the combination of tracks and segments.";
42}
43
45{
46 m_relations.clear();
47
49}
50
51void SegmentTrackCombiner::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
52{
53 Super::exposeParameters(moduleParamList, prefix);
54
55 m_sharedHitsMatcher.exposeParameters(moduleParamList, prefix);
56 m_selectPairsWithSharedHits.exposeParameters(moduleParamList, prefixed(prefix, "sharedHits"));
57 m_chooseableSegmentTrackSelector.exposeParameters(moduleParamList, prefixed(prefix, "segmentTrack"));
58 m_singleMatchSelector.exposeParameters(moduleParamList, prefix);
60 m_trackRejecter.exposeParameters(moduleParamList, prefixed(prefix, "track"));
61}
62
63// Do the combination work. See the SegmentTrackCombiner methods for full details.
64void SegmentTrackCombiner::apply(std::vector<TrackFindingCDC::CDCSegment2D>& segments,
65 std::vector<TrackFindingCDC::CDCTrack>& tracks)
66{
68
69 // Add a precut to add segments which are fully taken immediately at this stage
70 for (const CDCSegment2D& segment : segments) {
71 if (segment.isFullyTaken()) {
72 segment.getAutomatonCell().setTakenFlag();
73 } else {
74 segment.getAutomatonCell().unsetTakenFlag();
75 }
76 }
77
78 // After that, relations contains all pairs of segments and tracks, with the number of shared hits as weight
79 m_sharedHitsMatcher.apply(tracks, segments, m_relations);
80
81 // Require a certain (definable) amount of shared hits between segments and tracks
83
84 // Apply a (mva) filter to all combinations
86
87 // Search for the best combinations
89
90 // Add those combinations and remove all hits, that are part of other tracks (non-selected combinations)
92
93 // Reject tracks according to a (mva) filter
94 m_trackRejecter.apply(tracks);
95}
The Module parameter list class.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
Filter can delegate to a filter chosen and set up at run time by parameters.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
void apply(std::vector< WeightedRelation< CDCTrack, const CDCSegment2D > > &relations, std::vector< CDCTrack > &tracks, const std::vector< CDCSegment2D > &segment) override
Apply the findlet.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub-findlets.
void apply(std::vector< CDCSegment2D > &segments, std::vector< CDCTrack > &tracks) override
Try to combine the segments and the tracks.
FilterSelector< CDCTrack, CDCSegment2D, ChooseableFilter< SegmentTrackFilterFactory > > m_chooseableSegmentTrackSelector
Reference to the chooser to be used for matching segments and tracks in the first step.
std::vector< WeightedRelation< CDCTrack, const CDCSegment2D > > m_relations
Object pools.
CutSelector< CDCTrack, CDCSegment2D > m_selectPairsWithSharedHits
Select only those pairs, which share at least a certain amount of hits.
void beginEvent() final
Signal the beginning of a new event.
SegmentTrackCombiner()
Constructor setting up the filter parameters.
SingleMatchSelector< CDCTrack, CDCSegment2D > m_singleMatchSelector
Select only the best matching segment-track relations and remove the hits from the other ones.
std::string getDescription() final
Short description of the findlet.
TrackNormalizer m_trackNormalizer
Findlet for normalizing the tracks.
SegmentTrackAdderWithNormalization m_segmentTrackAdderWithNormalization
Add the matched segments to tracks.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
TrackRejecter m_trackRejecter
Findlet to filter out fake tracks.
SharingHitsMatcher< CDCTrack, CDCSegment2D > m_sharedHitsMatcher
Matcher for creating relations between tracks and segments based on the number of shared hits.
void apply(std::vector< CDCTrack > &tracks) final
Fit the tracks.
void apply(std::vector< CDCTrack > &tracks) final
Main algorithm.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Abstract base class for different kinds of events.