Belle II Software  release-05-01-25
NotFilter.icc.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/filters/base/NotFilter.dcl.h>
13 
14 #include <tracking/trackFindingCDC/numerics/Weight.h>
15 
16 #include <memory>
17 #include <cmath>
18 
19 namespace Belle2 {
24  namespace TrackFindingCDC {
25 
26  template <class AFilter>
27  NotFilter<AFilter>::NotFilter(std::unique_ptr<AFilter> filter)
28  : m_filter(std::move(filter))
29  {
30  this->addProcessingSignalListener(m_filter.get());
31  }
32 
33  template <class AFilter>
35 
36  template <class AFilter>
38  const std::string& prefix)
39  {
40  if (m_filter) m_filter->exposeParameters(moduleParamList, prefix);
41  }
42 
43  template <class AFilter>
44  Weight NotFilter<AFilter>::operator()(const typename AFilter::Object& obj)
45  {
46  Weight result = (*m_filter)(obj);
47  if (std::isnan(result)) {
48  return 1;
49  } else {
50  return NAN;
51  }
52  }
53  }
55 }
Belle2::TrackFindingCDC::NotFilter::NotFilter
NotFilter(std::unique_ptr< AFilter > filter)
Constructor from filter to be inverted.
Definition: NotFilter.icc.h:35
Belle2::filter
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:43
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::TrackFindingCDC::NotFilter::~NotFilter
~NotFilter()
Default destructor.
Belle2::TrackFindingCDC::NotFilter::m_filter
std::unique_ptr< AFilter > m_filter
Filter to be inverted.
Definition: NotFilter.dcl.h:59
Belle2::TrackFindingCDC::NotFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: NotFilter.icc.h:45
Belle2::TrackFindingCDC::NotFilter::operator()
Weight operator()(const typename AFilter::Object &obj) final
Accept inverse.
Definition: NotFilter.icc.h:52