Belle II Software  release-05-02-19
ProcessingSignalListener.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/utilities/ProcessingSignalListener.h>
11 
12 #include <tracking/trackFindingCDC/utilities/Backtrace.h>
13 
14 #include <framework/logging/Logger.h>
15 
16 #include <typeinfo>
17 
18 using namespace Belle2;
19 using namespace TrackFindingCDC;
20 
22 
24 {
25  if (m_initialized) {
26  B2DEBUG(20, "Processing signal listener " << m_initializedAs << " was not terminated after initialization");
27  }
28 }
29 
31 {
32  if (m_initialized) {
33  B2DEBUG(20, typeid(*this).name() << " has been initialized before");
34  printBacktrace(LogConfig::c_Debug, 10);
35  }
36  m_initializedAs = typeid(*this).name();
37  m_initialized = true;
38 }
39 
41 {
42  if (not m_initialized) {
43  B2DEBUG(20, typeid(*this).name() << " was not initialized");
44  }
45 }
46 
48 {
49  if (not m_initialized) {
50  B2DEBUG(20, typeid(*this).name() << " was not initialized");
51  }
52 }
53 
55 {
56  if (not m_initialized) {
57  B2DEBUG(20, typeid(*this).name() << " was not initialized");
58  }
59 }
60 
62 {
63  if (m_terminated) {
64  B2DEBUG(20, typeid(*this).name() << " has been terminated before");
65  printBacktrace(LogConfig::c_Debug, 10);
66  }
67  m_terminated = true;
68 
69  if (not m_initialized) {
70  B2DEBUG(20, typeid(*this).name() << " was not initialized before termination");
71  printBacktrace(LogConfig::c_Debug, 10);
72  }
73  m_initialized = false;
74 }
Belle2::TrackFindingCDC::ProcessingSignalListener::beginEvent
virtual void beginEvent()
Receive signal for the start of a new event.
Definition: ProcessingSignalListener.cc:47
Belle2::TrackFindingCDC::ProcessingSignalListener::endRun
virtual void endRun()
Receive signal for the end of the run.
Definition: ProcessingSignalListener.cc:54
Belle2::TrackFindingCDC::ProcessingSignalListener::initialize
virtual void initialize()
Receive signal before the start of the event processing.
Definition: ProcessingSignalListener.cc:30
Belle2::TrackFindingCDC::ProcessingSignalListener::m_initialized
bool m_initialized
Flag to keep track whether initialization happend before.
Definition: ProcessingSignalListener.h:62
Belle2::TrackFindingCDC::ProcessingSignalListener::beginRun
virtual void beginRun()
Receive signal for the beginning of a new run.
Definition: ProcessingSignalListener.cc:40
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::ProcessingSignalListener::ProcessingSignalListener
ProcessingSignalListener()
Allow default construction.
Belle2::TrackFindingCDC::ProcessingSignalListener::m_terminated
bool m_terminated
Flag to keep track whether termination happend before.
Definition: ProcessingSignalListener.h:65
Belle2::TrackFindingCDC::ProcessingSignalListener::~ProcessingSignalListener
virtual ~ProcessingSignalListener()
Make destructor of interface virtual.
Definition: ProcessingSignalListener.cc:23
Belle2::LogConfig::c_Debug
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:36
Belle2::TrackFindingCDC::ProcessingSignalListener::m_initializedAs
std::string m_initializedAs
Name of the type during initialisation.
Definition: ProcessingSignalListener.h:68
Belle2::TrackFindingCDC::ProcessingSignalListener::terminate
virtual void terminate()
Receive Signal for termination of the event processing.
Definition: ProcessingSignalListener.cc:61