Belle II Software  release-08-01-10
WireHitFilterFactory.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/filters/wireHit/WireHitFilterFactory.h>
9 
10 #include <tracking/trackFindingCDC/filters/wireHit/BaseWireHitFilter.h>
11 #include <tracking/trackFindingCDC/filters/wireHit/AllWireHitFilter.h>
12 #include <tracking/trackFindingCDC/filters/wireHit/CutsFromDBWireHitFilter.h>
13 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
14 
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
20 
21 WireHitFilterFactory::WireHitFilterFactory(const std::string& defaultFilterName)
22  : Super(defaultFilterName)
23 {
24 }
25 
27 
29 {
30  return "WireHit";
31 }
32 
34 {
35  return "WireHit filter to reject background. ";
36 }
37 
38 std::map<std::string, std::string> WireHitFilterFactory::getValidFilterNamesAndDescriptions() const
39 {
40  return {
41  {"all", "all wireHits are valid."},
42  {"cuts_from_DB", "wireHits filtered by cuts from DB."}
43  };
44 }
45 
46 std::unique_ptr<Filter<CDCWireHit> >
47 WireHitFilterFactory::create(const std::string& filterName) const
48 {
49  if (filterName == "all") {
50  return std::make_unique<AllWireHitFilter>();
51  // cppcheck-suppress knownConditionTrueFalse
52  } else if (filterName == "cuts_from_DB") {
53  return std::make_unique<CutsFromDBWireHitFilter>();
54  } else {
55  return Super::create(filterName);
56  }
57 }
virtual std::unique_ptr< BaseWireHitFilter > 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< BaseWireHitFilter > 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.
WireHitFilterFactory(const std::string &defaultFilterName="all")
Constructor forwarding the default filter name.
Abstract base class for different kinds of events.