3#include <gemc/gbase/gbase.h>
4#include <gemc/ganalysis/gAnalysisAccumulator.h>
5#include <gemc/gdynamicDigitization/gdynamicdigitization.h>
53 const std::shared_ptr<const gdynamicdigitization::dRoutinesMap>& gdynamicDigitizationMap,
54 std::shared_ptr<GAnalysisAccumulator> analysisAccumulator =
nullptr);
69 bool offscreen_screenshots =
false;
72 int currentRunno = -1;
82 std::map<int, double> runWeights;
85 std::map<int, int> runEvents;
88 std::vector<int> listOfRuns;
91 int currentRunIndex{};
94 std::optional<std::chrono::steady_clock::time_point> beamOnTime;
112 void distributeEvents(
int nevents_to_process);
120 void setNextRun() { currentRunIndex++; }
131 std::shared_ptr<const gdynamicdigitization::dRoutinesMap> gDigitizationMap;
134 std::shared_ptr<GAnalysisAccumulator> analysisAccumulator;
160 [[nodiscard]]
int getCurrentRun()
const {
return listOfRuns[currentRunIndex]; }
193 [[nodiscard]]
bool beamOnIssued()
const {
return beamOnTime.has_value(); }
202 [[nodiscard]] std::chrono::steady_clock::time_point
beamOnStartTime()
const {
return beamOnTime.value(); }
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="")