4#include "G4UserEventAction.hh"
7#include <gemc/gbase/gbase.h>
52 std::string help =
"Print a progress log line every N events, with the average event rate.\n \n";
54 help +=
"The value is a string of the form N or N-NTH, where N is the log module:\n";
56 help +=
"N : every worker thread prints 'Starting event n. <k> in thread <tid>.\n";
58 help +=
"Average rate: <r> events / second' every time it has processed a multiple\n";
60 help +=
"of N events. <k> is that thread's own 1-based event count (not the global\n";
62 help +=
"Geant4 event id), and <r> is that thread's average rate.\n";
64 help +=
"N-NTH : as above, but only the worker thread with id NTH prints. NTH must be\n";
66 help +=
"in the range [0, nthreads-1].\n \n";
68 help +=
"Examples: -log_every=100 (all threads, every 100 events)\n";
70 help +=
"-log_every=100-2 (only thread 2, every 100 events)\n";
73 "log module: print event progress and average rate every N events per thread"),
77 "save the original Geant4 track ID in each true-information hit");
79 "save initial information for hit-producing tracks and all their ancestors");
82 "Disable digitization for a comma- or whitespace-separated list of detector names.\n"
83 "Use \"all\" to disable digitization for every detector. Default: none.\n \n"
84 "Example: -no_digitized=\"ftof, ecal\"");
87 "Disable true-information output for a comma- or whitespace-separated list of detector names.\n"
88 "Use \"all\" to disable true-information output for every detector. Default: none.\n \n"
89 "Example: -no_true_info=\"ftof, ecal\"");
132 std::shared_ptr<GTrackProvenance> provenance =
nullptr);
173 void publish_event_data(
const std::shared_ptr<GEventDataCollection>& event_data)
const;
187 void log_event_start(
int thread_id);
192 long long log_events_seen = 0;
197 std::chrono::steady_clock::time_point log_start_time;
212 int log_every_thread = -1;
225 std::shared_ptr<GTrackProvenance> track_provenance;
227 bool save_original_track =
false;
228 bool save_all_ancestors =
false;
GBase(const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
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 * NO_DIGITIZED_OPTION
constexpr const char * NO_TRUE_INFO_OPTION
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.