Belle II Software  release-08-01-10
PXDPairFilterFactory.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/relations/PXDPairFilterFactory.h>
9 #include <tracking/ckf/pxd/filters/relations/SensorPXDPairFilter.h>
10 #include <tracking/ckf/pxd/filters/relations/DistancePXDPairFilter.h>
11 #include <tracking/ckf/pxd/filters/relations/LoosePXDPairFilter.h>
12 
13 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
14 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
15 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
16 #include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
17 
18 using namespace Belle2;
19 using namespace TrackFindingCDC;
20 
21 
22 PXDPairFilterFactory::PXDPairFilterFactory(const std::string& defaultFilterName)
23  : Super(defaultFilterName)
24 {
25 }
26 
28 
30 {
31  return "PXDPair";
32 }
33 
35 {
36  return "Reject PXD state pairs. ";
37 }
38 
39 std::map<std::string, std::string> PXDPairFilterFactory::getValidFilterNamesAndDescriptions() const
40 {
41  return {
42  {"all", "all combinations are valid"},
43  {"none", "no combination is valid"},
44  {"sensor", "use sensor/ladder information"},
45  {"distance", "based on the position distance"},
46  {"loose", "loose prefilter"},
47  };
48 }
49 
50 std::unique_ptr<BasePXDPairFilter>
51 PXDPairFilterFactory::create(const std::string& filterName) const
52 {
53  if (filterName == "all") {
54  return std::make_unique<TrackFindingCDC::AllFilter<BasePXDPairFilter>>();
55  }
56 
57  // cppcheck-suppress knownConditionTrueFalse
58  if (filterName == "none") {
59  return std::make_unique<TrackFindingCDC::NoneFilter<BasePXDPairFilter>>();
60  }
61 
62  // cppcheck-suppress knownConditionTrueFalse
63  if (filterName == "sensor") {
64  return std::make_unique<SensorPXDPairFilter>();
65  }
66 
67  if (filterName == "distance") {
68  return std::make_unique<DistancePXDPairFilter>();
69  }
70 
71  if (filterName == "loose") {
72  return std::make_unique<LoosePXDPairFilter>();
73  }
74 
75  return Super::create(filterName);
76 }
PXDPairFilterFactory(const std::string &defaultFilterName="sensor")
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.
~PXDPairFilterFactory()
Default destructor.
std::string getIdentifier() const override
Getter for a short identifier for the factory.
std::unique_ptr< BasePXDPairFilter > create(const std::string &filterName) const override
Create a filter with the given name.
std::string getFilterPurpose() const override
Getter for a descriptive purpose of the constructed filters.
virtual std::unique_ptr< BasePXDPairFilter > create(const std::string &filterName) const
Create a filter with the given name, does not set filter specific parameters.
Abstract base class for different kinds of events.