Belle II Software  release-05-01-25
ObserverPrintResults.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jakob Lettenbichler *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/logging/Logger.h>
14 // #include <vxd/dataobjects/VxdID.h>
15 
16 #include <string>
17 #include <iostream>
18 #include <iomanip> // std::setprecision
19 
20 namespace Belle2 {
27  class ObserverPrintResults {
28  public:
30  template<class Var, class RangeType>
31  static void notify(const Var& filterType,
32  typename Var::variableType fResult,
33  const RangeType& range,
34  const typename Var::argumentType& outerHit,
35  const typename Var::argumentType& innerHit)
36  {
37 
38  std::stringstream outputStream;
39  outputStream << filterType.name()
40  << " with outer-/innerhit: "
41  << outerHit.getPosition().PrintStringXYZ()
42  << "/"
43  << innerHit.getPosition().PrintStringXYZ()
44  << " having indices "
45  << outerHit.getArrayIndex()
46  << "/"
47  << innerHit.getArrayIndex()
48  << " and VxdIDs "
49  << outerHit.getVxdID()
50  << "/"
51  << innerHit.getVxdID()
52  << " results in "
53  << (range.contains(fResult) ? std::setprecision(6) : std::setprecision(18))
54  << fResult
55  << " & accepted: "
56  << (range.contains(fResult) ? std::string(">true<") : std::string(">false<"))
57  << " in range "
58  << range.getInf()
59  << "/"
60  << range.getSup();
61 
62  B2DEBUG(5, outputStream.str());
64 // if (range.contains(fResult)) {
65 // B2INFO(outputStream.str())
66 // } else {
67 // B2WARNING(outputStream.str())
68 // }
69  }
70 
71 
74 
75 
78  template < typename ... types >
79  static void initialize(const types& ...) {};
80 
81 
84  template < typename ... types >
85  static void terminate(const types& ...) {};
86  };
88 }
Belle2::ObserverPrintResults::initialize
static void initialize(const types &...)
static method used by the observed object to initialize the observer.
Definition: ObserverPrintResults.h:87
Belle2::ObserverPrintResults::terminate
static void terminate(const types &...)
static method used by the observed object to terminate the observer.
Definition: ObserverPrintResults.h:93
Belle2::ObserverPrintResults::ObserverPrintResults
ObserverPrintResults()
empty constructor:
Definition: ObserverPrintResults.h:81
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ObserverPrintResults::notify
static void notify(const Var &filterType, typename Var::variableType fResult, const RangeType &range, const typename Var::argumentType &outerHit, const typename Var::argumentType &innerHit)
notifier producing a info message if SelectionVariable was accepted and a Warning if otherwise
Definition: ObserverPrintResults.h:39