Belle II Software development
TwoHitInBoxAlgorithms.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/numerics/Weight.h>
11#include <cmath>
12
13namespace Belle2 {
18 namespace TrackFindingCDC {
19
25 template<class AHitInBoxAlgorithm, class AnotherHitInBoxAlgorithm>
27 public:
29 using HoughBox = typename AHitInBoxAlgorithm::HoughBox;
30
34 template<class AObject>
35 Weight operator()(const AObject& object,
36 const HoughBox* box)
37 {
38 AHitInBoxAlgorithm hitInBoxAlgorithm;
39 AnotherHitInBoxAlgorithm anotherHitInBoxAlgorithm;
40
41 const Weight& firstResult = hitInBoxAlgorithm(object, box);
42 const Weight& secondResult = anotherHitInBoxAlgorithm(object, box);
43
44 if (std::isnan(firstResult) and std::isnan(secondResult)) {
45 return NAN;
46 } else if (std::isnan(firstResult)) {
47 return secondResult;
48 } else if (std::isnan(secondResult)) {
49 return firstResult;
50 } else {
51 return firstResult + secondResult;
52 }
53 }
54 };
55 }
57}
Predicate class to check for the containment of items in a hough space part with two algorithms.
typename AHitInBoxAlgorithm::HoughBox HoughBox
The type of the underlaying HoughBox (copied from the first underlying hit algorithm)
Weight operator()(const AObject &object, const HoughBox *box)
Returns the sum of the resulting weights of both algorithms (of not NAN).
Abstract base class for different kinds of events.