Belle II Software development
WireHitFilterFactory.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/wireHit/WireHitFilterFactory.h>
9
10#include <tracking/trackFindingCDC/filters/wireHit/BaseWireHitFilter.h>
11#include <tracking/trackFindingCDC/filters/wireHit/AllWireHitFilter.h>
12#include <tracking/trackFindingCDC/filters/wireHit/CDCWireHitVarSet.h>
13#include <tracking/trackFindingCDC/filters/wireHit/CutsFromDBWireHitFilter.h>
14#include <tracking/trackFindingCDC/filters/base/FilterFactory.icc.h>
15#include <tracking/trackFindingCDC/filters/base/MVAFilter.icc.h>
16
17
18using namespace Belle2;
19using namespace TrackFindingCDC;
20
21namespace {
23 using MVACDCWireHitFilter = MVAFilter<CDCWireHitVarSet>;
24}
25
27
28WireHitFilterFactory::WireHitFilterFactory(const std::string& defaultFilterName)
29 : Super(defaultFilterName)
30{
31}
32
34
36{
37 return "WireHit";
38}
39
41{
42 return "WireHit filter to reject background. ";
43}
44
45std::map<std::string, std::string> WireHitFilterFactory::getValidFilterNamesAndDescriptions() const
46{
47 return {
48 {"all", "all wireHits are valid."},
49 {"cuts_from_DB", "wireHits filtered by cuts from DB."},
50 {"mva", "MVA filter using TOT, ADC, TDC to tag background hits."}
51 };
52}
53
54std::unique_ptr<Filter<CDCWireHit> >
55WireHitFilterFactory::create(const std::string& filterName) const
56{
57 if (filterName == "all") {
58 return std::make_unique<AllWireHitFilter>();
59 // cppcheck-suppress knownConditionTrueFalse
60 } else if (filterName == "cuts_from_DB") {
61 return std::make_unique<CutsFromDBWireHitFilter>();
62 // cppcheck-suppress knownConditionTrueFalse
63 } else if (filterName == "mva") {
64 return std::make_unique<MVACDCWireHitFilter>();
65 } else {
66 return Super::create(filterName);
67 }
68}
Factory that can create apropriate filter instances from a name.
virtual std::unique_ptr< BaseWireHitFilter > create(const std::string &filterName) const
Create a filter with the given name, does not set filter specific parameters.
Convience template to create a mva filter for a set of variables.
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< BaseWireHitFilter > 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.
WireHitFilterFactory(const std::string &defaultFilterName="all")
Constructor forwarding the default filter name.
Abstract base class for different kinds of events.