Belle II Software prerelease-11-00-00a
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/trackingUtilities/eventdata/tracks/CDCTrack.h>
11
12#include <tracking/trackingUtilities/filters/base/ChooseableFilter.icc.h>
13
14#include <tracking/trackingUtilities/utilities/StringManipulation.h>
15#include <tracking/trackingUtilities/utilities/Algorithms.h>
16
17#include <framework/core/ModuleParamList.templateDetails.h>
18
19#include <tracking/trackFindingCDC/filters/track/CDCTrackDeadBoardFilter.h>
20
21using namespace Belle2;
22using namespace TrackFindingCDC;
23using namespace TrackingUtilities;
24
26
33
35{
37 // cache output of needsTruthInformation in member variable
38 m_needsTruthInformation = m_trackQualityFilter.needsTruthInformation();
39}
40
42{
43 return "Set the quality indicator for CDC tracks and, if desired, delete tracks with a too low quality value.";
44}
45
46void TrackQualityEstimator::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
47{
48 m_trackQualityFilter.exposeParameters(moduleParamList, prefix);
49 m_mcCloneLookUpFiller.exposeParameters(moduleParamList, prefix);
50
51 moduleParamList->addParameter(prefixed(prefix, "deleteTracks"),
53 "Delete tracks below cut instead of just assigning quality indicator.",
55
56 moduleParamList->addParameter(prefixed(prefix, "resetTakenFlag"),
58 "Reset taken flag for deleted tracks so that hits can be used by subsequent TFs.",
60
61 moduleParamList->addParameter(prefixed(prefix, "deactivateIfDeadBoard"),
63 "If true the filter will be deactivated for the track in case a dead CDC board is detected at a position where a hole in the track is found.",
65 moduleParamList->addParameter(prefixed(prefix, "minLayerJumpsForDeadBoards"),
67 "Minimal number of CDC layers to be jumped by the track to trigger the dead board detection. Not used if deactivateIfDeadBoard is false. Default 4 corresponding to potentially 1 SL jumped (3 wire layers).",
69}
70
71void TrackQualityEstimator::apply(std::vector<CDCTrack>& tracks)
72{
73
75 for (CDCTrack& track : tracks) {
76 const double qualityIndicator = m_trackQualityFilter(track);
77 track.setQualityIndicator(qualityIndicator);
78
79 // check for dead boards in case of rejected tracks
80 if (m_param_deactivateIfDeadBoard && std::isnan(qualityIndicator)) {
81 // set QI to infinity temporarily to prevent deletion if dead board found, will be set back to NAN later (after deletion step)
82 if (cdcTrackDeadBoardFilter(track, m_param_minLayerJumpsForDeadBoards)) track.setQualityIndicator(
83 std::numeric_limits<float>::infinity());
84 }
85 }
86
87
88 if (m_param_deleteTracks) { // delete track with QI below cut threshold
89 auto reject = [this](const CDCTrack & track) {
90 const double qualityIndicator = track.getQualityIndicator();
91 if (m_param_resetTakenFlag && std::isnan(qualityIndicator)) {
92 track.forwardTakenFlag(false);
93 }
94 return std::isnan(qualityIndicator);
95 };
96 erase_remove_if(tracks, reject);
97 }
98
99 // reset NaN for the tracks where the filter has been deactivated
100 for (auto& track : tracks) {
101 if (std::isinf(track.getQualityIndicator())) track.setQualityIndicator(NAN);
102 }
103
104}
The Module parameter list class.
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.
unsigned int m_param_minLayerJumpsForDeadBoards
Minimal number of CDC layers to be jumped by the track to trigger the dead board detection.
void initialize() override
Receive and dispatch signal before the start of the event processing.
void apply(std::vector< TrackingUtilities::CDCTrack > &tracks) final
Main algorithm.
bool m_needsTruthInformation
Store output of needsTruthInformation from filter in member variable.
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.
bool m_param_deactivateIfDeadBoard
If true the filter will be deactivated in case a bad CDC board is detected at a position where a hole...
TrackingUtilities::ChooseableFilter< TrackQualityFilterFactory > m_trackQualityFilter
Reference to the filter to be used to filter.
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:39
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
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.