Belle II Software  release-08-01-10
ObserverPrintResults.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 
9 #pragma once
10 
11 #include <framework/logging/Logger.h>
12 // #include <vxd/dataobjects/VxdID.h>
13 
14 #include <string>
15 #include <iostream>
16 #include <iomanip> // std::setprecision
17 
18 namespace Belle2 {
26  public:
28  template<class Var, class RangeType>
29  static void notify(const Var& filterType,
30  typename Var::variableType fResult,
31  const RangeType& range,
32  const typename Var::argumentType& outerHit,
33  const typename Var::argumentType& innerHit)
34  {
35 
36  std::stringstream outputStream;
37  outputStream << filterType.name()
38  << " with outer-/innerhit: "
39  << outerHit.getPosition().PrintStringXYZ()
40  << "/"
41  << innerHit.getPosition().PrintStringXYZ()
42  << " having indices "
43  << outerHit.getArrayIndex()
44  << "/"
45  << innerHit.getArrayIndex()
46  << " and VxdIDs "
47  << outerHit.getVxdID()
48  << "/"
49  << innerHit.getVxdID()
50  << " results in "
51  << (range.contains(fResult) ? std::setprecision(6) : std::setprecision(18))
52  << fResult
53  << " & accepted: "
54  << (range.contains(fResult) ? std::string(">true<") : std::string(">false<"))
55  << " in range "
56  << range.getInf()
57  << "/"
58  << range.getSup();
59 
60  B2DEBUG(5, outputStream.str());
62 // if (range.contains(fResult)) {
63 // B2INFO(outputStream.str())
64 // } else {
65 // B2WARNING(outputStream.str())
66 // }
67  }
68 
69 
72 
73 
76  template < typename ... types >
77  static void initialize(const types& ...) {};
78 
79 
82  template < typename ... types >
83  static void terminate(const types& ...) {};
84  };
86 }
this observer does simply print the name of the SelectionVariable and the result of its value-functio...
static void terminate(const types &...)
static method used by the observed object to terminate the observer.
static void initialize(const types &...)
static method used by the observed object to initialize the observer.
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
ObserverPrintResults()
empty constructor:
Abstract base class for different kinds of events.