Belle II Software  release-08-01-10
CDCPathPairFilterFactory.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/cdc/filters/pathPairs/CDCPathPairFilterFactory.h>
9 
10 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
11 
12 #include <tracking/ckf/cdc/filters/pathPairs/DistanceBasedCDCPathPairFilter.h>
13 #include <tracking/ckf/cdc/filters/pathPairs/DuplicateCDCPathPairFilter.h>
14 #include <tracking/ckf/cdc/filters/pathPairs/Chi2BasedCDCPathPairFilter.h>
15 #include <tracking/ckf/cdc/filters/pathPairs/HitDistanceBasedCDCPathPairFilter.h>
16 #include <tracking/ckf/cdc/filters/pathPairs/ArcLengthBasedCDCPathPairFilter.h>
17 #include <tracking/ckf/cdc/filters/pathPairs/ArcLengthBasedCDCfromEclPathPairFilter.h>
18 #include <tracking/ckf/cdc/filters/pathPairs/MCTruthCDCPathPairFilter.h>
19 
20 #include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
21 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
22 
23 using namespace Belle2;
24 using namespace TrackFindingCDC;
25 
26 
27 CDCPathPairFilterFactory::CDCPathPairFilterFactory(const std::string& defaultFilterName)
28  : Super(defaultFilterName)
29 {
30 }
31 
33 
35 {
36  return "CDCCKFPathPair";
37 }
38 
40 {
41  return "Order CDC CKF path pairs. ";
42 }
43 
44 std::map<std::string, std::string> CDCPathPairFilterFactory::getValidFilterNamesAndDescriptions() const
45 {
46  return {
47  {"none", "no track combination is valid"},
48  {"all", "set all track combinations as good"},
49  {"distance", "ordering based on distance"},
50  {"chi2", "ordering based on chi2"},
51  {"duplicateHits", "compares last hits of both tracks to check for duplicates"},
52  {"hitDistance", "ordering based on hitDistance"},
53  {"arc_length", "ordering based on arc_length"},
54  {"arc_length_fromEcl", "ordering based on arc_length; track from Ecl seed"},
55  {"mc_truth", "ordering based on mc truth information"},
56  };
57 }
58 
59 std::unique_ptr<BaseCDCPathPairFilter>
60 CDCPathPairFilterFactory::create(const std::string& filterName) const
61 {
62  if (filterName == "none") {
63  return std::make_unique<TrackFindingCDC::NoneFilter<BaseCDCPathPairFilter>>();
64  // cppcheck-suppress knownConditionTrueFalse
65  } else if (filterName == "all") {
66  return std::make_unique<TrackFindingCDC::AllFilter<BaseCDCPathPairFilter>>();
67  // cppcheck-suppress knownConditionTrueFalse
68  } else if (filterName == "distance") {
69  return std::make_unique<DistanceBasedCDCPathPairFilter>();
70  // cppcheck-suppress knownConditionTrueFalse
71  } else if (filterName == "chi2") {
72  return std::make_unique<Chi2BasedCDCPathPairFilter>();
73  // cppcheck-suppress knownConditionTrueFalse
74  } else if (filterName == "duplicateHits") {
75  return std::make_unique<DuplicateCDCPathPairFilter>();
76  // cppcheck-suppress knownConditionTrueFalse
77  } else if (filterName == "hitDistance") {
78  return std::make_unique<HitDistanceBasedCDCPathPairFilter>();
79  // cppcheck-suppress knownConditionTrueFalse
80  } else if (filterName == "arc_length") {
81  return std::make_unique<ArcLengthBasedCDCPathPairFilter>();
82  // cppcheck-suppress knownConditionTrueFalse
83  } else if (filterName == "arc_length_fromEcl") {
84  return std::make_unique<ArcLengthBasedCDCfromEclPathPairFilter>();
85  // cppcheck-suppress knownConditionTrueFalse
86  } else if (filterName == "mc_truth") {
87  return std::make_unique<MCTruthCDCPathPairFilter>();
88  } else {
89  return Super::create(filterName);
90  }
91 }
CDCPathPairFilterFactory(const std::string &defaultFilterName="distance")
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.
std::unique_ptr< BaseCDCPathPairFilter > create(const std::string &filterName) const override
Create a filter with the given name.
~CDCPathPairFilterFactory()
Default destructor.
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.
virtual std::unique_ptr< BaseCDCPathPairFilter > 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.