Belle II Software light-2406-ragdoll
RbTuple.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 <vector>
12#include <string>
13
14class TFile;
15
16namespace Belle2 {
21 class Module;
22
24 /*
25 Modules with histogram definitions are supposed to be derived from
26 HistoModule class and histograms are defined in HistoModule::defineHisto() function.
27 It is supposed to be hooked by register_module(*this) function.
28 */
30 public:
31
32 // Constructor and destructor are private for singleton access
35
37 RbTupleManager(int nprocess, const char* filename, const char* workdir = ".");
38
40 static RbTupleManager& Instance();
41
43 void init(int nprocess, const char* filename, const char* workdir = ".");
44
46 // void define ( void (*func)( void ) );
48
49
51 int begin(int pid);
52
54 int terminate();
55
56 // Functions to collect histograms from event processing on the fly
57 // int collect ();
58
60 int dump();
61
63 int hadd(bool deleteflag = true);
64
66 const std::vector<Module*>& getHistDefiningModules() const
67 {
68 return m_histdefs;
69 }
70
71 private:
74 std::vector<Module*> m_histdefs;
75 int m_nproc{0};
76 std::string m_filename;
77 std::string m_workdir;
78 TFile* m_root{nullptr};
79 };
80
82} // Belle2 namespace
Base class for Modules.
Definition: Module.h:72
Class to manage histograms defined in registered modules.
Definition: RbTuple.h:29
TFile * m_root
Histogram output file.
Definition: RbTuple.h:78
static RbTupleManager & Instance()
Access to singleton.
Definition: RbTuple.cc:40
int hadd(bool deleteflag=true)
Functions to add up all histogram files.
Definition: RbTuple.cc:138
std::string m_workdir
Name of working directory.
Definition: RbTuple.h:77
int terminate()
Function called by HistoManager module at the end.
Definition: RbTuple.cc:118
std::string m_filename
Name of histogram output file.
Definition: RbTuple.h:76
int dump()
Function to dump histograms/tuples to the file.
Definition: RbTuple.cc:129
void init(int nprocess, const char *filename, const char *workdir=".")
Global initialization.
Definition: RbTuple.cc:49
const std::vector< Module * > & getHistDefiningModules() const
Return the list of modules that have defined histograms.
Definition: RbTuple.h:66
int begin(int pid)
Function called by HistoManager module for the first event.
Definition: RbTuple.cc:89
int m_nproc
Number of parallel processes.
Definition: RbTuple.h:75
void register_module(Module *)
Functions called by analysis modules in mother process.
Definition: RbTuple.cc:83
std::vector< Module * > m_histdefs
registered HistoModules.
Definition: RbTuple.h:74
static RbTupleManager * s_instance
singleton instance.
Definition: RbTuple.h:72
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24