4#include "G4UserEventAction.hh"
7#include <gemc/gbase/gbase.h>
50 std::string help =
"Print a progress log line every N events, with the average event rate.\n \n";
52 help +=
"The value is a string of the form N or N-NTH, where N is the log module:\n";
54 help +=
"N : every worker thread prints 'Starting event n. <k> in thread <tid>.\n";
56 help +=
"Average rate: <r> events / second' every time it has processed a multiple\n";
58 help +=
"of N events. <k> is that thread's own 1-based event count (not the global\n";
60 help +=
"Geant4 event id), and <r> is that thread's average rate.\n";
62 help +=
"N-NTH : as above, but only the worker thread with id NTH prints. NTH must be\n";
64 help +=
"in the range [0, nthreads-1].\n \n";
66 help +=
"Examples: -log_every=100 (all threads, every 100 events)\n";
68 help +=
"-log_every=100-2 (only thread 2, every 100 events)\n";
71 "log module: print event progress and average rate every N events per thread"),
75 "save the original Geant4 track ID in each true-information hit");
77 "save initial information for hit-producing tracks and all their ancestors");
120 std::shared_ptr<GTrackProvenance> provenance =
nullptr);
161 void publish_event_data(
const std::shared_ptr<GEventDataCollection>& event_data)
const;
175 void log_event_start(
int thread_id);
180 long long log_events_seen = 0;
185 std::chrono::steady_clock::time_point log_start_time;
200 int log_every_thread = -1;
213 std::shared_ptr<GTrackProvenance> track_provenance;
215 bool save_original_track =
false;
216 bool save_all_ancestors =
false;
Handles event begin/end callbacks, hit digitization, and event-level publication.
GEventAction & operator=(const GEventAction &)=delete
GEventAction(GEventAction &&)=delete
void EndOfEventAction(const G4Event *event) override
Called by Geant4 at the end of an event.
GEventAction & operator=(GEventAction &&)=delete
~GEventAction() override=default
GEventAction(const std::shared_ptr< GOptions > &gopt, GRunAction *run_a, std::shared_ptr< GTrackProvenance > provenance=nullptr)
Constructs the event action.
GEventAction(const GEventAction &)=delete
void BeginOfEventAction(const G4Event *event) override
Called by Geant4 at the beginning of an event.
Handles run begin/end callbacks and creates the thread-local GRun object.
Worker-local, event-scoped track ancestry registry.
constexpr const char * EVENTACTION_LOGGER
constexpr const char * LOG_EVERY_OPTION
Name of the option controlling periodic per-event log messages.
constexpr const char * SAVE_ORIGINAL_TRACK_SWITCH
constexpr const char * SAVE_ALL_ANCESTORS_SWITCH
Declares GRunAction, the run-lifecycle action for the GEMC actions module.
#define UNINITIALIZEDSTRINGQUANTITY
Namespace containing helpers related to event-action configuration.
GOptions defineOptions()
Returns the options associated with the event-action logger scope.