Belle II Software light-2406-ragdoll
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 {
22 class ProcHandler;
23 class RingBuffer;
24
29
30 public:
31
34
36 virtual ~pEventProcessor();
37
45 void process(const PathPtr& spath, long maxEvent);
46
53 void gotSigINT();
54
59 void killRingBuffers();
60
62 void cleanup();
63
64 private:
66 void analyzePath(const PathPtr& path);
67
69 void preparePaths();
70
72 RingBuffer* connectViaRingBuffer(const char* name, const PathPtr& a, PathPtr& b);
73
75 void dump_modules(const std::string&, const ModulePtrList&);
76
82 void clearFileList();
83
89 static void prependModulesIfNotPresent(ModulePtrList* modules, const ModulePtrList& prependModules);
90
91 private:
93 std::unique_ptr<ProcHandler> m_procHandler;
94
101
103 RingBuffer* m_rbin = nullptr;
105 RingBuffer* m_rbout = nullptr;;
106
109
110 };
111
113}
provides the core event processing loop.
EModulePropFlags
Each module can be tagged with property flags, which indicate certain features of the module.
Definition: Module.h:77
Class to manage a Ring Buffer placed in an IPC shared memory.
Definition: RingBuffer.h:39
This class provides the core event processing loop for parallel processing.
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.
pEventProcessor()
Constructor.
ModulePtr m_histoman
Pointer to HistoManagerModule, or nullptr if not found.
void analyzePath(const PathPtr &path)
Analyze given path.
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.
virtual ~pEventProcessor()
Destructor.
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)
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:584
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24