gdata
Loading...
Searching...
No Matches
gRunHeader.h
Go to the documentation of this file.
1#pragma once
2
3// gemc
4#include "gbase.h"
5
6// C++
7#include <string>
8
28constexpr const char* GDATARUNHEADER_LOGGER = "run_header";
29
30namespace grun_header {
39inline auto defineOptions() -> GOptions {
41 return goptions;
42}
43} // namespace grun_header
44
61class GRunHeader : public GBase<GRunHeader>
62{
63public:
77 GRunHeader(const std::shared_ptr<GOptions>& gopts, int rid, int tid = -1)
78 : GBase(gopts, GDATARUNHEADER_LOGGER), runID(rid) {
79 log->debug(CONSTRUCTOR, "GRunHeader");
80 if (tid != -1) {
81 log->info(1, "\n",
82 TPOINTITEM, " Run ID: ", rid, "\n",
83 TPOINTITEM, " Number of events collected: ", events_processed,
84 TPOINTITEM, " Thread ID: ", tid);
85 }
86 else {
87 log->info(1, "\n",
88 TPOINTITEM, " Run ID: ", rid, "\n",
89 TPOINTITEM, " Number of events collected: ", events_processed);
90 }
91 }
92
97 [[nodiscard]] auto getRunID() const -> int { return runID; }
98
108 [[nodiscard]] auto get_events_processed() const -> int { return events_processed; }
109
116 void increment_events_processed() { events_processed++; }
117
118private:
119 int events_processed{0};
120 int runID;
121};
std::shared_ptr< GLogger > log
void debug(debug_type type, Args &&... args) const
void info(int level, Args &&... args) const
Minimal run metadata: run ID and integrated-event counter.
Definition gRunHeader.h:62
GRunHeader(const std::shared_ptr< GOptions > &gopts, int rid, int tid=-1)
Construct a run header.
Definition gRunHeader.h:77
void increment_events_processed()
Increment the number of processed events.
Definition gRunHeader.h:116
auto get_events_processed() const -> int
Get the number of events integrated into this run summary so far.
Definition gRunHeader.h:108
auto getRunID() const -> int
Get the run identifier.
Definition gRunHeader.h:97
constexpr const char * GDATARUNHEADER_LOGGER
Definition gRunHeader.h:28
CONSTRUCTOR
#define TPOINTITEM
auto defineOptions() -> GOptions
Defines GOptions for the run-header logger domain.
Definition gRunHeader.h:39