Belle II Software development
TrackQualityEstimator.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/TrackQualityEstimator.h>
9
10#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11
12#include <tracking/trackFindingCDC/filters/base/ChooseableFilter.icc.h>
13
14#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
15#include <tracking/trackFindingCDC/utilities/Algorithms.h>
16
17#include <framework/core/ModuleParamList.templateDetails.h>
18
19using namespace Belle2;
20using namespace TrackFindingCDC;
21
23
24TrackQualityEstimator::TrackQualityEstimator(const std::string& defaultFilterName)
25 : m_trackQualityFilter(defaultFilterName)
26{
29}
30
32{
34 // cache output of needsTruthInformation in member variable
35 m_needsTruthInformation = m_trackQualityFilter.needsTruthInformation();
36}
37
39{
40 return "Set the quality indicator for CDC tracks and, if desired, delete tracks with a too low quality value.";
41}
42
43void TrackQualityEstimator::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
44{
45 m_trackQualityFilter.exposeParameters(moduleParamList, prefix);
46 m_mcCloneLookUpFiller.exposeParameters(moduleParamList, prefix);
47
48 moduleParamList->addParameter(prefixed(prefix, "deleteTracks"),
50 "Delete tracks below cut instead of just assigning quality indicator.",
52
53 moduleParamList->addParameter(prefixed(prefix, "resetTakenFlag"),
55 "Reset taken flag for deleted tracks so that hits can be used by subsequent TFs.",
57}
58
59void TrackQualityEstimator::apply(std::vector<CDCTrack>& tracks)
60{
61
63 for (CDCTrack& track : tracks) {
64 const double qualityIndicator = m_trackQualityFilter(track);
65 track.setQualityIndicator(qualityIndicator);
66 }
67
68 if (m_param_deleteTracks) { // delete track with QI below cut threshold
69 auto reject = [this](const CDCTrack & track) {
70 const double qualityIndicator = track.getQualityIndicator();
71 if (m_param_resetTakenFlag && std::isnan(qualityIndicator)) {
72 track.forwardTakenFlag(false);
73 }
74 return std::isnan(qualityIndicator);
75 };
76 erase_remove_if(tracks, reject);
77 }
78}
The Module parameter list class.
void apply(std::vector< CDCTrack > &cdcTracks) final
Write give tracks into track store array.
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
void initialize() override
Receive and dispatch signal before the start of the event processing.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
bool m_param_resetTakenFlag
Reset taken flag for deleted tracks so that hits can be used by subsequent TFs.
bool m_param_deleteTracks
Delete tracks below threshold instead of just assigning quality indicator.
void apply(std::vector< CDCTrack > &tracks) final
Main algorithm.
void initialize() override
Receive and dispatch signal before the start of the event processing.
bool m_needsTruthInformation
Store output of needsTruthInformation from filter in member variable.
ChooseableFilter< TrackQualityFilterFactory > m_trackQualityFilter
Reference to the filter to be used to filter.
std::string getDescription() final
Short description of the findlet.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
CDCMCCloneLookUpFiller m_mcCloneLookUpFiller
Findlet to fill CDCTracks into lookup table (singleton) with clone information.
TrackQualityEstimator(const std::string &defaultFilterName="mva")
Constructor adding the filter as a subordinary processing signal listener.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.