Belle II Software development
TruthVarFilter.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/TruthVarFilter.dcl.h>
11
12#include <tracking/trackFindingCDC/filters/base/ChoosableFromVarSetFilter.icc.h>
13
14#include <tracking/trackFindingCDC/numerics/Weight.h>
15
16#include <cmath>
17
18namespace Belle2 {
23 namespace TrackFindingCDC {
24
25 template <class ATruthVarSet>
27 : Super("truth")
28 {
29 }
30
31 template <class ATruthVarSet>
33
34 template<class ATruthVarSet>
35 auto TruthVarFilter<ATruthVarSet>::operator()(const Object& object) -> Weight {
36 Weight value = Super::operator()(object);
37 if (std::isnan(value) or value == 0) return NAN;
38 return 1.0;
39 }
40 }
42}
Convince template to create a filter returning on variable from a set of variables.
typename Super::Object Object
Type of the handled object.
Weight operator()(const Object &object) override
Reject an item if the truth variable is 0, else accept it.
Abstract base class for different kinds of events.