Belle II Software  release-08-01-10
PXDResultFilterFactory.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/pxd/filters/results/PXDResultFilterFactory.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/pxd/filters/results/PXDResultVarSet.h>
20 #include <tracking/ckf/pxd/filters/results/PXDResultTruthVarSet.h>
21 #include <tracking/ckf/pxd/filters/results/SizePXDResultFilter.h>
22 
23 
24 using namespace Belle2;
25 using namespace TrackFindingCDC;
26 
27 namespace {
29  using ChooseableTruthPXDResultFilter = ChoosableFromVarSetFilter<PXDResultTruthVarSet>;
30 
33 
35  using MVAPXDResultFilter = MVAFilter<PXDResultVarSet>;
36 }
37 
38 
39 PXDResultFilterFactory::PXDResultFilterFactory(const std::string& defaultFilterName)
40  : Super(defaultFilterName)
41 {
42 }
43 
45 
47 {
48  return "PXDResult";
49 }
50 
52 {
53  return "Reject PXD CKF results. ";
54 }
55 
56 std::map<std::string, std::string> PXDResultFilterFactory::getValidFilterNamesAndDescriptions() const
57 {
58  return {
59  {"none", "no combination is valid"},
60  {"all", "all combination are valid"},
61  {"recording", "record variables to a TTree"},
62  {"mva", "filter based on the trained MVA method"},
63  {"size", "ordering accoring to size"},
64  {"truth", "monte carlo truth"},
65  {"truth_teacher", "monte carlo truth returning the result of the teacher"},
66  };
67 }
68 
69 std::unique_ptr<BasePXDResultFilter>
70 PXDResultFilterFactory::create(const std::string& filterName) const
71 {
72  if (filterName == "none") {
73  return std::make_unique<TrackFindingCDC::NoneFilter<BasePXDResultFilter>>();
74  // cppcheck-suppress knownConditionTrueFalse
75  } else if (filterName == "all") {
76  return std::make_unique<TrackFindingCDC::AllFilter<BasePXDResultFilter>>();
77  // cppcheck-suppress knownConditionTrueFalse
78  } else if (filterName == "recording") {
79  return std::make_unique<RecordingPXDResultFilter>();
80  // cppcheck-suppress knownConditionTrueFalse
81  } else if (filterName == "mva") {
82  return std::make_unique<MVAPXDResultFilter>("ckf_CDCToPXDResult");
83  // cppcheck-suppress knownConditionTrueFalse
84  } else if (filterName == "truth") {
85  return std::make_unique<ChooseableTruthPXDResultFilter>("truth");
86  // cppcheck-suppress knownConditionTrueFalse
87  } else if (filterName == "truth_teacher") {
88  return std::make_unique<ChooseableTruthPXDResultFilter>("truth_teacher");
89  // cppcheck-suppress knownConditionTrueFalse
90  } else if (filterName == "size") {
91  return std::make_unique<SizePXDResultFilter>();
92  } else {
93  return Super::create(filterName);
94  }
95 }
std::unique_ptr< BasePXDResultFilter > create(const std::string &filterName) const override
Create a filter with the given name.
std::map< std::string, std::string > getValidFilterNamesAndDescriptions() const override
Getter for valid filter names and a description for each.
~PXDResultFilterFactory()
Default destructor.
PXDResultFilterFactory(const std::string &defaultFilterName="all")
Constructor forwarding the default filter name.
std::string getIdentifier() const override
Getter for a short identifier for the factory.
std::string getFilterPurpose() const override
Getter for a descriptive purpose of the constructed filters.
Convience template to create a filter returning on variable from a set of variables.
virtual std::unique_ptr< BasePXDResultFilter > create(const std::string &filterName) const
Create a filter with the given name, does not set filter specific parameters.
Convience template to create a mva filter for a set of variables.
Definition: MVAFilter.dcl.h:92
Convience template to create a recording filter for a set of variables.
Abstract base class for different kinds of events.