Belle II Software  release-05-02-19
TwoHitInBoxAlgorithms.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/numerics/Weight.h>
13 #include <cmath>
14 
15 namespace Belle2 {
20  namespace TrackFindingCDC {
21 
27  template<class AHitInBoxAlgorithm, class AnotherHitInBoxAlgorithm>
28  class TwoHitInBoxAlgorithm {
29  public:
31  using HoughBox = typename AHitInBoxAlgorithm::HoughBox;
32 
36  template<class AObject>
37  Weight operator()(const AObject& object,
38  const HoughBox* box)
39  {
40  AHitInBoxAlgorithm hitInBoxAlgorithm;
41  AnotherHitInBoxAlgorithm anotherHitInBoxAlgorithm;
42 
43  const Weight& firstResult = hitInBoxAlgorithm(object, box);
44  const Weight& secondResult = anotherHitInBoxAlgorithm(object, box);
45 
46  if (std::isnan(firstResult) and std::isnan(secondResult)) {
47  return NAN;
48  } else if (std::isnan(firstResult)) {
49  return secondResult;
50  } else if (std::isnan(secondResult)) {
51  return firstResult;
52  } else {
53  return firstResult + secondResult;
54  }
55  }
56  };
57  }
59 }
Belle2::TrackFindingCDC::TwoHitInBoxAlgorithm::operator()
Weight operator()(const AObject &object, const HoughBox *box)
Returns the sum of the resulting weights of both algorithms (of not NAN).
Definition: TwoHitInBoxAlgorithms.h:45
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::TwoHitInBoxAlgorithm::HoughBox
typename AHitInBoxAlgorithm::HoughBox HoughBox
The type of the underlaying HoughBox (copied from the first underlying hit algorithm)
Definition: TwoHitInBoxAlgorithms.h:39