3#include <gemc/gbase/gbase.h>
4#include <gemc/ganalysis/gAnalysisAccumulator.h>
5#include <gemc/gdynamicDigitization/gdynamicdigitization.h>
54 const std::shared_ptr<const gdynamicdigitization::dRoutinesMap>& gdynamicDigitizationMap,
55 std::shared_ptr<GAnalysisAccumulator> analysisAccumulator =
nullptr);
70 bool offscreen_screenshots =
false;
73 std::optional<int> currentRunno;
83 std::map<int, double> runWeights;
86 std::map<int, int> runEvents;
89 std::vector<int> listOfRuns;
92 int currentRunIndex{};
95 std::optional<std::chrono::steady_clock::time_point> beamOnTime;
113 void distributeEvents(
int nevents_to_process);
121 void setNextRun() { currentRunIndex++; }
132 std::shared_ptr<const gdynamicdigitization::dRoutinesMap> gDigitizationMap;
135 std::shared_ptr<GAnalysisAccumulator> analysisAccumulator;
161 [[nodiscard]]
int getCurrentRun()
const {
return listOfRuns[currentRunIndex]; }
194 [[nodiscard]]
bool beamOnIssued()
const {
return beamOnTime.has_value(); }
205 throw std::logic_error(
"beamOnStartTime() called before the first /run/beamOn");
void resetRunContext()
Force per-run digitization setup to run again on the next event batch.
bool beamOnIssued() const
Returns whether at least one /run/beamOn has been issued.
int processEvents()
Processes all runs by initializing digitization routines and dispatching events.
std::chrono::steady_clock::time_point beamOnStartTime() const
Returns the wall-clock time of the first /run/beamOn.
int getCurrentRun() const
Returns the current run number from the internally stored run list.
EventDispenser(const std::shared_ptr< GOptions > &gopt, const std::shared_ptr< const gdynamicdigitization::dRoutinesMap > &gdynamicDigitizationMap, std::shared_ptr< GAnalysisAccumulator > analysisAccumulator=nullptr)
Constructs an EventDispenser and prepares the run event distribution.
void setNumberOfEvents(int nevts)
Sets the total number of events to process in single-run mode.
int getTotalNumberOfEvents() const
Computes the total number of events across all runs.
std::map< int, int > getRunEvents()
Returns the computed run-to-event allocation.
GBase(const std::shared_ptr< GOptions > &gopt, std::string logger_name="")