Belle II Software  release-08-01-10
TrackQualityFilterFactory.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/track/TrackQualityFilterFactory.h>
9 
10 #include <tracking/trackFindingCDC/filters/track/BestMatchedTruthVarSet.h>
11 #include <tracking/trackFindingCDC/filters/track/BasicTrackVarSet.h>
12 
13 #include <tracking/trackFindingCDC/filters/base/MVAFilter.icc.h>
14 
15 #include <tracking/trackFindingCDC/filters/base/RecordingFilter.icc.h>
16 #include <tracking/trackFindingCDC/filters/base/TruthVarFilter.icc.h>
17 #include <tracking/trackFindingCDC/filters/base/AllFilter.icc.h>
18 #include <tracking/trackFindingCDC/filters/base/NoneFilter.icc.h>
19 
20 #include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
21 #include <tracking/trackFindingCDC/filters/base/FilterVarSet.icc.h>
22 
23 #include <tracking/trackFindingCDC/varsets/VariadicUnionVarSet.h>
24 
25 using namespace Belle2;
26 using namespace TrackFindingCDC;
27 
28 // these types are the only difference to TrackFilterFactory, since here BestMatchedTruthVarSet is
29 // used whereas the base class uses TruthTrackVarSet
30 namespace {
31  using AllTrackFilter = AllFilter<BaseTrackFilter>;
32  using NoneTrackFilter = NoneFilter<BaseTrackFilter>;
33  using MCTrackFilter = TruthVarFilter<BestMatchedTruthVarSet>;
34  using RecordingTrackFilter =
36  using RecordingDataTrackFilter =
38  using MVATrackFilter = MVAFilter<BasicTrackVarSet>;
39 } // namespace
40 
42 
44 {
45  return "Track filter for getting the quality indicator for CDC tracks. It should "
46  "distinguish correct PR tracks from fake and if wanted also clone tracks. ";
47 }
48 
49 std::unique_ptr<BaseTrackFilter> TrackQualityFilterFactory::create(
50  const std::string& filterName) const
51 {
52  if (filterName == "none") {
53  return std::make_unique<NoneTrackFilter>();
54  } else if (filterName == "all") {
55  return std::make_unique<AllTrackFilter>();
56  } else if (filterName == "truth") {
57  return std::make_unique<MCTrackFilter>();
58  } else if (filterName == "recording") {
59  return std::make_unique<RecordingTrackFilter>("TrackQualityFilter.root");
60  } else if (filterName == "recording_data") {
61  return std::make_unique<RecordingDataTrackFilter>("TrackQualityFilter.root");
62  } else if (filterName == "eval") {
63  auto recordedVarSets = std::make_unique<UnionVarSet<CDCTrack>>();
64  using TrackFilterVarSet = FilterVarSet<BaseTrackFilter>;
65  recordedVarSets->push_back(std::make_unique<TrackFilterVarSet>("mva", create("mva")));
66  recordedVarSets->push_back(std::make_unique<TrackFilterVarSet>("truth", create("truth")));
67  return std::make_unique<Recording<BaseTrackFilter>>(std::move(recordedVarSets),
68  "TrackQualityFilter_eval.root");
69  } else if (filterName == "mva") {
70  return std::make_unique<MVATrackFilter>("trackfindingcdc_TrackQualityIndicator", 0.10);
71  } else {
72  return Super::create(filterName);
73  }
74 }
Filter adapter type that accepts all items (just for reference).
Definition: AllFilter.dcl.h:21
Class to compute floating point variables from a filter response which can be recorded as a flat TNtu...
Convience template to create a mva filter for a set of variables.
Definition: MVAFilter.dcl.h:92
Filter adapter type that rejects all items.
Convience template to create a recording filter for a set of variables.
std::unique_ptr< BaseTrackFilter > create(const std::string &filterName) const override
Create a filter with the given name.
std::unique_ptr< BaseTrackFilter > 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.
MC Filter Type using a VarSet and the truth variable in it.
Abstract base class for different kinds of events.