Belle II Software light-2607-kasei
pEventProcessor.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/core/Module.h>
12#include <framework/core/EventProcessor.h>
13#include <framework/core/Path.h>
14
15
16namespace Belle2 {
21
22 class ProcHandler;
23 class RingBuffer;
24
29
30 public:
31
34
36 virtual ~pEventProcessor() override;
37
45 // cppcheck-suppress duplInheritedMember ; intentionally hides the base class member
46 void process(const PathPtr& spath, long maxEvent);
47
54 void gotSigINT();
55
60 void killRingBuffers();
61
63 void cleanup();
64
65 private:
67 void analyzePath(const PathPtr& path);
68
70 void preparePaths();
71
73 RingBuffer* connectViaRingBuffer(const char* name, const PathPtr& a, PathPtr& b);
74
76 void dump_modules(const std::string&, const ModulePtrList&);
77
83 static void clearFileList();
84
90 static void prependModulesIfNotPresent(ModulePtrList* modules, const ModulePtrList& prependModules);
91
92 private:
94 std::unique_ptr<ProcHandler> m_procHandler;
95
102
104 RingBuffer* m_rbin = nullptr;
106 RingBuffer* m_rbout = nullptr;;
107
110
111 };
112
114}
EventProcessor()
Constructor.
EModulePropFlags
Each module can be tagged with property flags, which indicate certain features of the module.
Definition Module.h:77
A class to manage processes for parallel processing.
Definition ProcHandler.h:21
Class to manage a Ring Buffer placed in an IPC shared memory.
Definition RingBuffer.h:39
void preparePaths()
Adds internal modules to paths, prepare RingBuffers.
void dump_modules(const std::string &, const ModulePtrList &)
Dump module names in the ModulePtrList.
PathPtr m_outputPath
Output path.
static ModulePtrList getModulesWithFlag(const ModulePtrList &modules, Module::EModulePropFlags flag)
Return only modules which have the given Module flag set.
RingBuffer * m_rbin
input RingBuffer
RingBuffer * m_rbout
output RingBuffer
std::unique_ptr< ProcHandler > m_procHandler
handler to fork and manage processes.
void cleanup()
clean up IPC resources (should only be called in one process).
void process(const PathPtr &spath, long maxEvent)
Processes the full module chain, starting with the first module in the given path.
RingBuffer * connectViaRingBuffer(const char *name, const PathPtr &a, PathPtr &b)
Create RingBuffer with name from given environment variable, add Tx and Rx modules to a and b.
ModulePtr m_histoman
Pointer to HistoManagerModule, or nullptr if not found.
void analyzePath(const PathPtr &path)
Analyze given path.
virtual ~pEventProcessor() override
Destructor.
void gotSigINT()
signal handler for Ctrl+C (async-safe)
static void prependModulesIfNotPresent(ModulePtrList *modules, const ModulePtrList &prependModules)
Prepend given 'prependModules' to 'modules', if they're not already present.
PathPtr m_mainPath
Main (parallel section) path.
static ModulePtrList getModulesWithoutFlag(const ModulePtrList &modules, Module::EModulePropFlags flag)
Return only modules which do not have the given Module flag set.
PathPtr m_inputPath
Input path.
void killRingBuffers()
signal handler (async-safe)
static void clearFileList()
TFiles are stored in a global list and cleaned up by root since this will happen in all forked proces...
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition Path.h:35
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition Module.h:43
std::list< ModulePtr > ModulePtrList
Defines a std::list of shared module pointers.
Definition Module.h:583
Abstract base class for different kinds of events.