Belle II Software  release-08-01-10
CDCPathFilterFactory.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/paths/CDCPathFilterFactory.h>
9 
10 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
11 
12 #include <tracking/ckf/cdc/filters/paths/SizeCDCPathFilter.h>
13 #include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
14 #include <tracking/trackFindingCDC/filters/base/AndFilter.icc.h>
15 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
16 #include <tracking/trackFindingCDC/filters/base/RecordingFilter.icc.h>
17 
18 #include <tracking/trackFindingCDC/varsets/VariadicUnionVarSet.h>
19 
20 #include <tracking/ckf/cdc/filters/paths/CDCPathBasicVarSet.h>
21 #include <tracking/ckf/cdc/filters/paths/CDCPathTruthVarSet.h>
22 #include <tracking/ckf/cdc/filters/paths/CDCfromEclPathTruthVarSet.h>
23 
24 #include <tracking/ckf/cdc/filters/paths/SeedChargeCDCPathFilter.h>
25 
26 using namespace Belle2;
27 using namespace TrackFindingCDC;
28 
29 namespace {
35  using AndCDCPathFilter = AndFilter<BaseCDCPathFilter>;
36 }
37 
38 CDCPathFilterFactory::CDCPathFilterFactory(const std::string& defaultFilterName)
39  : Super(defaultFilterName)
40 {
41 }
42 
44 
46 {
47  return "CDCCKFPath";
48 }
49 
51 {
52  return "Reject CDC CKF paths. ";
53 }
54 
55 std::map<std::string, std::string> CDCPathFilterFactory::getValidFilterNamesAndDescriptions() const
56 {
57  return {
58  {"none", "no track combination is valid"},
59  {"all", "set all track combinations as good"},
60  {"size", "very rough filtering"},
61  {"recording", "record variables to a TTree"},
62  {"size_and_recording", "record variables to a TTree"},
63  {"recording_fromEcl", "record variables to a TTree"},
64  {"size_and_recording_fromEcl", "record variables to a TTree"},
65  {"seedCharge", "charge of path corresponds to charge of seed"},
66  {"seedCharge_and_recording_fromEcl", "record variables to a TTree"}
67  //{"mc_truth", "Extrapolation and update"},
68  };
69 }
70 
71 std::unique_ptr<BaseCDCPathFilter>
72 CDCPathFilterFactory::create(const std::string& filterName) const
73 {
74  if (filterName == "none") {
75  return std::make_unique<TrackFindingCDC::NoneFilter<BaseCDCPathFilter>>();
76  // cppcheck-suppress knownConditionTrueFalse
77  } else if (filterName == "all") {
78  return std::make_unique<TrackFindingCDC::AllFilter<BaseCDCPathFilter>>();
79  // cppcheck-suppress knownConditionTrueFalse
80  } else if (filterName == "size") {
81  return std::make_unique<SizeCDCPathFilter>();
82  //} else if (filterName == "mc_truth") {
83  // return std::make_unique<MCTruthCDCPathFilter>();
84  // cppcheck-suppress knownConditionTrueFalse
85  } else if (filterName == "recording") {
86  return std::make_unique<RecordingCDCPathFilter>("CDCPathFilter.root");
87  // cppcheck-suppress knownConditionTrueFalse
88  } else if (filterName == "size_and_recording") {
89  return std::make_unique<AndCDCPathFilter>(
90  std::make_unique<RecordingCDCPathFilter>("CDCPathFilter.root"),
91  std::make_unique<SizeCDCPathFilter>()
92  );
93  // cppcheck-suppress knownConditionTrueFalse
94  } else if (filterName == "recording_fromEcl") {
95  return std::make_unique<RecordingCDCfromEclPathFilter>("CDCfromEclPathFilter.root");
96  // cppcheck-suppress knownConditionTrueFalse
97  } else if (filterName == "size_and_recording_fromEcl") {
98  return std::make_unique<AndCDCPathFilter>(
99  std::make_unique<RecordingCDCfromEclPathFilter>("CDCfromEclPathFilter.root"),
100  std::make_unique<SizeCDCPathFilter>()
101  );
102  // cppcheck-suppress knownConditionTrueFalse
103  } else if (filterName == "seedCharge") {
104  return std::make_unique<SeedChargeCDCPathFilter>();
105  // cppcheck-suppress knownConditionTrueFalse
106  } else if (filterName == "seedCharge_and_recording_fromEcl") {
107  return std::make_unique<AndCDCPathFilter>(
108  std::make_unique<RecordingCDCfromEclPathFilter>("CDCfromEclPathFilter.root"),
109  std::make_unique<SeedChargeCDCPathFilter>()
110  );
111 
112  } else {
113  return Super::create(filterName);
114  }
115 }
std::map< std::string, std::string > getValidFilterNamesAndDescriptions() const override
Getter for valid filter names and a description for each.
std::unique_ptr< BaseCDCPathFilter > create(const std::string &filterName) const override
Create a filter with the given name.
~CDCPathFilterFactory()
Default destructor.
std::string getIdentifier() const override
Getter for a short identifier for the factory.
CDCPathFilterFactory(const std::string &defaultFilterName="size")
Constructor forwarding the default filter name.
std::string getFilterPurpose() const override
Getter for a descriptive purpose of the constructed filters.
Filter adapter type that joins two filter results in an and like fashion.
Definition: AndFilter.dcl.h:24
virtual std::unique_ptr< BaseCDCPathFilter > create(const std::string &filterName) const
Create a filter with the given name, does not set filter specific parameters.
Convience template to create a recording filter for a set of variables.
Abstract base class for different kinds of events.