Belle II Software development
NotFilter.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/NotFilter.dcl.h>
11
12#include <tracking/trackFindingCDC/numerics/Weight.h>
13
14#include <memory>
15#include <cmath>
16
17namespace Belle2 {
22 namespace TrackFindingCDC {
23
24 template <class AFilter>
25 NotFilter<AFilter>::NotFilter(std::unique_ptr<AFilter> filter)
26 : m_filter(std::move(filter))
27 {
28 this->addProcessingSignalListener(m_filter.get());
29 }
30
31 template <class AFilter>
33
34 template <class AFilter>
36 const std::string& prefix)
37 {
38 if (m_filter) m_filter->exposeParameters(moduleParamList, prefix);
39 }
40
41 template <class AFilter>
42 Weight NotFilter<AFilter>::operator()(const typename AFilter::Object& obj)
43 {
44 Weight result = (*m_filter)(obj);
45 if (std::isnan(result)) {
46 return 1;
47 } else {
48 return NAN;
49 }
50 }
51 }
53}
The Module parameter list class.
std::unique_ptr< AFilter > m_filter
Filter to be inverted.
Definition: NotFilter.dcl.h:49
NotFilter(std::unique_ptr< AFilter > filter)
Constructor from filter to be inverted.
Definition: NotFilter.icc.h:25
Weight operator()(const typename AFilter::Object &obj) final
Accept inverse.
Definition: NotFilter.icc.h:42
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: NotFilter.icc.h:35
~NotFilter()
Default destructor.
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:38
Abstract base class for different kinds of events.
STL namespace.