Belle II Software development
TrackRejecter.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/minimal/TrackRejecter.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
19using namespace Belle2;
20using namespace TrackFindingCDC;
21using namespace TrackingUtilities;
22
25
26TrackRejecter::TrackRejecter(const std::string& defaultFilterName)
27 : m_trackFilter(defaultFilterName)
28{
30}
31
33{
34 return "Deletes fake tracks that have been rejected by a filter";
35}
36
37void TrackRejecter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
38{
39 m_trackFilter.exposeParameters(moduleParamList, prefix);
40 moduleParamList->addParameter(prefixed(prefix, "deleteRejected"),
42 "Delete the rejected tracks instead of marking them as background.",
44}
45
46void TrackRejecter::apply(std::vector<CDCTrack>& tracks)
47{
48 auto reject = [this](CDCTrack & track) {
49 double filterWeight = m_trackFilter(track);
50 track->setCellWeight(filterWeight);
51 if (std::isnan(filterWeight)) {
52 track->setBackgroundFlag();
53 track->setTakenFlag();
54 return true;
55 } else {
56 return false;
57 }
58 };
59
61 erase_remove_if(tracks, reject);
62 } else {
63 std::for_each(tracks.begin(), tracks.end(), reject);
64 }
65}
The Module parameter list class.
bool m_param_deleteRejected
Parameter : Switch to delete the tracks instead of marking them as background.
void apply(std::vector< TrackingUtilities::CDCTrack > &tracks) final
Main algorithm.
std::string getDescription() final
Short description of the findlet.
TrackRejecter(const std::string &defaultFilterName="all")
Constructor adding the filter as a subordinary processing signal listener.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
TrackingUtilities::ChooseableFilter< TrackFilterFactory > m_trackFilter
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.
Filter can delegate to a filter chosen and set up at run time by parameters.
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.