Belle II Software development
SVDResultFilterFactory.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/ckf/svd/filters/results/SVDResultFilterFactory.h>
9
10#include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
11#include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
12#include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
13#include <tracking/trackFindingCDC/filters/base/ChoosableFromVarSetFilter.icc.h>
14#include <tracking/trackFindingCDC/filters/base/RecordingFilter.icc.h>
15#include <tracking/trackFindingCDC/filters/base/MVAFilter.icc.h>
16
17#include <tracking/trackFindingCDC/varsets/VariadicUnionVarSet.h>
18
19#include <tracking/ckf/svd/filters/results/SVDResultVarSet.h>
20#include <tracking/ckf/svd/filters/results/RelationSVDResultVarSet.h>
21#include <tracking/ckf/svd/filters/results/SVDResultTruthVarSet.h>
22#include <tracking/ckf/svd/filters/results/SizeSVDResultFilter.h>
23#include <tracking/ckf/svd/filters/results/WeightSVDResultFilter.h>
24
25using namespace Belle2;
26using namespace TrackFindingCDC;
27
28namespace {
30 using ChooseableTruthSVDResultFilter = ChoosableFromVarSetFilter<SVDResultTruthVarSet>;
31
33 using RecordingSVDResultFilter =
35
37 using RecordingSVDSeededResultFilter =
39
41 using MVASVDResultFilter = MVAFilter<SVDResultVarSet>;
42
45}
46
47
48SVDResultFilterFactory::SVDResultFilterFactory(const std::string& defaultFilterName)
49 : Super(defaultFilterName)
50{
51}
52
54
56{
57 return "SVDResult";
58}
59
61{
62 return "Reject SVD CKF results. ";
63}
64
65std::map<std::string, std::string> SVDResultFilterFactory::getValidFilterNamesAndDescriptions() const
66{
67 return {
68 {"none", "no combination is valid"},
69 {"all", "all combination are valid"},
70 {"recording", "record variables to a TTree"},
71 {"recording_with_relations", "record variables to a TTree"},
72 {"mva", "filter based on the trained MVA method"},
73 {"mva_with_relations", "filter based on the trained MVA method"},
74 {"size", "ordering according to size"},
75 {"weight", "ordering according to weight"},
76 {"truth", "monte carlo truth"},
77 {"truth_svd_cdc_relation", "monte carlo truth on the related CDC and SVD tracks"},
78 };
79}
80
81std::unique_ptr<BaseSVDResultFilter>
82SVDResultFilterFactory::create(const std::string& filterName) const
83{
84 if (filterName == "none") {
85 return std::make_unique<TrackFindingCDC::NoneFilter<BaseSVDResultFilter>>();
86 // cppcheck-suppress knownConditionTrueFalse
87 } else if (filterName == "all") {
88 return std::make_unique<TrackFindingCDC::AllFilter<BaseSVDResultFilter>>();
89 // cppcheck-suppress knownConditionTrueFalse
90 } else if (filterName == "recording") {
91 return std::make_unique<RecordingSVDResultFilter>();
92 // cppcheck-suppress knownConditionTrueFalse
93 } else if (filterName == "recording_with_relations") {
94 return std::make_unique<RecordingSVDSeededResultFilter>();
95 // cppcheck-suppress knownConditionTrueFalse
96 } else if (filterName == "mva") {
97 return std::make_unique<MVASVDResultFilter>("ckf_CDCToSVDResult");
98 // cppcheck-suppress knownConditionTrueFalse
99 } else if (filterName == "mva_with_relations") {
100 return std::make_unique<MVASVDSeededResultFilter>("ckf_SeededCDCToSVDResult");
101 // cppcheck-suppress knownConditionTrueFalse
102 } else if (filterName == "truth") {
103 return std::make_unique<ChooseableTruthSVDResultFilter>("truth");
104 // cppcheck-suppress knownConditionTrueFalse
105 } else if (filterName == "truth_svd_cdc_relation") {
106 return std::make_unique<ChooseableTruthSVDResultFilter>("truth_svd_cdc_relation");
107 // cppcheck-suppress knownConditionTrueFalse
108 } else if (filterName == "size") {
109 return std::make_unique<SizeSVDResultFilter>();
110 // cppcheck-suppress knownConditionTrueFalse
111 } else if (filterName == "weight") {
112 return std::make_unique<WeightSVDResultFilter>();
113 } else {
114 return Super::create(filterName);
115 }
116}
SVDResultFilterFactory(const std::string &defaultFilterName="all")
Constructor forwarding the default filter name.
std::map< std::string, std::string > getValidFilterNamesAndDescriptions() const override
Getter for valid filter names and a description for each.
std::string getIdentifier() const override
Getter for a short identifier for the factory.
~SVDResultFilterFactory()
Default destructor.
std::string getFilterPurpose() const override
Getter for a descriptive purpose of the constructed filters.
std::unique_ptr< BaseSVDResultFilter > create(const std::string &filterName) const override
Create a filter with the given name.
Convince template to create a filter returning on variable from a set of variables.
virtual std::unique_ptr< BaseSVDResultFilter > create(const std::string &filterName) const
Create a filter with the given name, does not set filter specific parameters.
Convenience template to create a mva filter for a set of variables.
Convenience template to create a recording filter for a set of variables.
Abstract base class for different kinds of events.