Belle II Software  release-08-01-10
PathFilterFactory.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/pathFilters/PathFilterFactory.h>
9 #include <tracking/vxdHoughTracking/filters/pathFilters/TwoHitVirtualIPFilter.h>
10 #include <tracking/vxdHoughTracking/filters/pathFilters/TwoHitVirtualIPQIFilter.h>
11 #include <tracking/vxdHoughTracking/filters/pathFilters/ThreeHitFilter.h>
12 #include <tracking/vxdHoughTracking/filters/pathFilters/FourHitFilter.h>
13 #include <tracking/vxdHoughTracking/filters/pathFilters/FiveHitFilter.h>
14 #include <tracking/vxdHoughTracking/filters/pathFilters/TwoHitVirtualIPQIFilter.h>
15 #include <tracking/vxdHoughTracking/filters/pathFilters/QualityIndicatorFilter.h>
16 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
17 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
18 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
19 #include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
20 
21 using namespace Belle2;
22 using namespace TrackFindingCDC;
23 using namespace vxdHoughTracking;
24 
25 PathFilterFactory::PathFilterFactory(const std::string& defaultFilterName)
26  : Super(defaultFilterName)
27 {
28 }
29 
31 
33 {
34  return "SVD Hit Path Filter";
35 }
36 
38 {
39  return "Rejects track candidates based on the number of hits. ";
40 }
41 
42 std::map<std::string, std::string> PathFilterFactory::getValidFilterNamesAndDescriptions() const
43 {
44  return {
45  {"all", "all combinations are valid"},
46  {"none", "no combination is valid"},
47  {"twoHitVirtualIP", "filter using two hits and a virtual IP at the origin"},
48  {"twoHitVirtualIPQI", "filter using two hits and a virtual IP at the origin based on a fit quality indicator"},
49  {"threeHit", "filter three hits (path of length 2 plus next hit)"},
50  {"fourHit", "filter four hits (path of length 3 plus next hit)"},
51  {"fiveHit", "filter five hits (path of length 4 plus next hit)"},
52  {"qualityIndicator", "filter a path of hits based on a fit quality indicator"},
53  };
54 }
55 
56 std::unique_ptr<BasePathFilter>
57 PathFilterFactory::create(const std::string& filterName) const
58 {
59  if (filterName == "all") {
60  return std::make_unique<TrackFindingCDC::AllFilter<BasePathFilter>>();
61  }
62  // cppcheck-suppress knownConditionTrueFalse
63  if (filterName == "none") {
64  return std::make_unique<TrackFindingCDC::NoneFilter<BasePathFilter>>();
65  }
66  // cppcheck-suppress knownConditionTrueFalse
67  if (filterName == "twoHitVirtualIP") {
68  return std::make_unique<TwoHitVirtualIPFilter>();
69  }
70  if (filterName == "twoHitVirtualIPQI") {
71  return std::make_unique<TwoHitVirtualIPQIFilter>();
72  }
73  if (filterName == "threeHit") {
74  return std::make_unique<ThreeHitFilter>();
75  }
76  if (filterName == "fourHit") {
77  return std::make_unique<FourHitFilter>();
78  }
79  if (filterName == "fiveHit") {
80  return std::make_unique<FiveHitFilter>();
81  }
82  if (filterName == "qualityIndicator") {
83  return std::make_unique<QualityIndicatorFilter>();
84  }
85 
86  return Super::create(filterName);
87 }
virtual std::unique_ptr< BasePathFilter > 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< BasePathFilter > 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.