Belle II Software  release-08-01-10
RelationFilterFactory.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/vxdHoughTracking/filters/relations/RelationFilterFactory.h>
9 #include <tracking/vxdHoughTracking/filters/relations/AngleAndTimeRelationFilter.h>
10 #include <tracking/vxdHoughTracking/filters/relations/SimpleRelationFilter.h>
11 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
12 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
13 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
14 #include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 using namespace vxdHoughTracking;
19 
20 RelationFilterFactory::RelationFilterFactory(const std::string& defaultFilterName)
21  : Super(defaultFilterName)
22 {
23 }
24 
26 
28 {
29  return "Factory for SVD Hit Pair Relation Filters";
30 }
31 
33 {
34  return "Rejects SVD hit pairs based on their relation. ";
35 }
36 
37 std::map<std::string, std::string> RelationFilterFactory::getValidFilterNamesAndDescriptions() const
38 {
39  return {
40  {"all", "all combinations are valid"},
41  {"none", "no combination is valid"},
42  {"angleAndTime", "filter relation based on their theta value and the hit time"},
43  {"simple", "very simple filtering based on theta of the hits in question"},
44  };
45 }
46 
47 std::unique_ptr<BaseRelationFilter>
48 RelationFilterFactory::create(const std::string& filterName) const
49 {
50  if (filterName == "all") {
51  return std::make_unique<TrackFindingCDC::AllFilter<BaseRelationFilter>>();
52  }
53 
54  // cppcheck-suppress knownConditionTrueFalse
55  if (filterName == "none") {
56  return std::make_unique<TrackFindingCDC::NoneFilter<BaseRelationFilter>>();
57  }
58 
59  // cppcheck-suppress knownConditionTrueFalse
60  if (filterName == "angleAndTime") {
61  return std::make_unique<AngleAndTimeRelationFilter>();
62  }
63 
64  if (filterName == "simple") {
65  return std::make_unique<SimpleRelationFilter>();
66  }
67 
68  return Super::create(filterName);
69 }
virtual std::unique_ptr< BaseRelationFilter > create(const std::string &filterName) const
Create a filter with the given name, does not set filter specific parameters.
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.
std::unique_ptr< BaseRelationFilter > 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.
Abstract base class for different kinds of events.