Belle II Software development
AndFilter.icc.h
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#pragma once
9
10#include <tracking/trackFindingCDC/filters/base/AndFilter.dcl.h>
11
12#include <tracking/trackFindingCDC/numerics/Weight.h>
13
14#include <cmath>
15
16namespace Belle2 {
21 namespace TrackFindingCDC {
22
23 template <class AFilter>
24 AndFilter<AFilter>::AndFilter(std::unique_ptr<AFilter> lhsFilter,
25 std::unique_ptr<AFilter> rhsFilter)
26 : m_lhsFilter(std::move(lhsFilter))
27 , m_rhsFilter(std::move(rhsFilter))
28 {
29 this->addProcessingSignalListener(m_lhsFilter.get());
30 this->addProcessingSignalListener(m_rhsFilter.get());
31 }
32
33 template <class AFilter>
35
36 template <class AFilter>
38 const std::string& prefix)
39 {
40 if (m_lhsFilter) m_lhsFilter->exposeParameters(moduleParamList, prefix);
41 if (m_rhsFilter) m_rhsFilter->exposeParameters(moduleParamList, prefix);
42 }
43
44 template<class AFilter>
45 Weight AndFilter<AFilter>::operator()(const typename AFilter::Object& obj)
46 {
47 Weight lhsResult = (*m_lhsFilter)(obj);
48
49 if (std::isnan(lhsResult)) {
50 return NAN;
51 } else {
52 Weight rhsResult = (*m_rhsFilter)(obj);
53 return rhsResult;
54 }
55 }
56 }
58}
The Module parameter list class.
AndFilter(std::unique_ptr< AFilter > lhsFilter, std::unique_ptr< AFilter > rhsFilter)
Constructor from two filters to be joined.
Definition: AndFilter.icc.h:24
std::unique_ptr< AFilter > m_rhsFilter
Right hand side filter.
Definition: AndFilter.dcl.h:48
Weight operator()(const typename AFilter::Object &obj) final
Return result of right hand side filter if left hand side filter acknowledges.
Definition: AndFilter.icc.h:45
~AndFilter()
Default destructor.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: AndFilter.icc.h:37
std::unique_ptr< AFilter > m_lhsFilter
Left hand side filter.
Definition: AndFilter.dcl.h:45
Abstract base class for different kinds of events.
STL namespace.