Belle II Software  release-08-01-10
TrackRelationFilterFactory.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/trackRelation/TrackRelationFilterFactory.h>
9 
10 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
11 
12 #include <tracking/trackFindingCDC/filters/trackRelation/BaseTrackRelationFilter.h>
13 #include <tracking/trackFindingCDC/filters/trackRelation/AllTrackRelationFilter.h>
14 #include <tracking/trackFindingCDC/filters/trackRelation/MCTrackRelationFilter.h>
15 #include <tracking/trackFindingCDC/filters/trackRelation/UnionRecordingTrackRelationFilter.h>
16 #include <tracking/trackFindingCDC/filters/trackRelation/MVAFeasibleTrackRelationFilter.h>
17 #include <tracking/trackFindingCDC/filters/trackRelation/MVARealisticTrackRelationFilter.h>
18 #include <tracking/trackFindingCDC/filters/trackRelation/PhiTrackRelationFilter.h>
19 
20 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
21 
22 
23 using namespace Belle2;
24 using namespace TrackFindingCDC;
25 
27 
28 TrackRelationFilterFactory::TrackRelationFilterFactory(const std::string& defaultFilterName)
29  : Super(defaultFilterName)
30 {
31 }
32 
34 {
35  return "TrackRelation";
36 }
37 
39 {
40  return "Track relation filter to construct a track network for merging";
41 }
42 
43 std::map<std::string, std::string>
45 {
46  return {
47  {"none", "accepts nothing"},
48  {"all", "accepts everything"},
49  {"truth", "accepts based on monte carlo information"},
50  {"unionrecording", "record multiple choosable variable set"},
51  {"phi", "filter just based on the phi distance"},
52  {"feasible", "a rough efficient compatibility check"},
53  {"realistic", "an expensive pure compatibility check"},
54  };
55 }
56 
57 std::unique_ptr<BaseTrackRelationFilter>
58 TrackRelationFilterFactory::create(const std::string& filterName) const
59 {
60  if (filterName == "none") {
61  return std::make_unique<NoneFilter<BaseTrackRelationFilter>>();
62  // cppcheck-suppress knownConditionTrueFalse
63  } else if (filterName == "all") {
64  return std::make_unique<AllTrackRelationFilter>();
65  // cppcheck-suppress knownConditionTrueFalse
66  } else if (filterName == "truth") {
67  return std::make_unique<MCTrackRelationFilter>();
68  // cppcheck-suppress knownConditionTrueFalse
69  } else if (filterName == "unionrecording") {
70  return std::make_unique< UnionRecordingTrackRelationFilter>();
71  // cppcheck-suppress knownConditionTrueFalse
72  } else if (filterName == "feasible") {
73  return std::make_unique<MVAFeasibleTrackRelationFilter>();
74  // cppcheck-suppress knownConditionTrueFalse
75  } else if (filterName == "realistic") {
76  return std::make_unique<MVARealisticTrackRelationFilter>();
77  // cppcheck-suppress knownConditionTrueFalse
78  } else if (filterName == "phi") {
79  return std::make_unique<PhiTrackRelationFilter>();
80  } else {
81  return Super::create(filterName);
82  }
83 }
virtual std::unique_ptr< BaseTrackRelationFilter > 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 final
Getter for valid filter names and a description for each.
std::unique_ptr< BaseTrackRelationFilter > create(const std::string &filterName) const final
Create a filter with the given name.
std::string getFilterPurpose() const final
Getter for a descriptive purpose of the constructed filters.
std::string getIdentifier() const final
Getter for a short identifier for the factory.
TrackRelationFilterFactory(const std::string &defaultFilterName="realistic")
Constructor forwarding the default filter name.
Abstract base class for different kinds of events.