File indexing completed on 2025-01-31 09:22:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include "eRositaEventAction.hh"
0028
0029 #include "G4Event.hh"
0030 #include "G4TrajectoryContainer.hh"
0031 #include "G4Trajectory.hh"
0032 #include "G4ios.hh"
0033
0034 eRositaEventAction::eRositaEventAction()
0035 {
0036 }
0037
0038 eRositaEventAction::~eRositaEventAction()
0039 {
0040 }
0041
0042
0043
0044 void eRositaEventAction::BeginOfEventAction(const G4Event* event)
0045 {
0046 auto numberOfEvents = event->GetEventID() + 1;
0047
0048 constexpr auto INITIAL_FREQUENCY{100};
0049 constexpr auto FIRST_FREQUENCY_THRESHOLD{1000};
0050 constexpr auto SECOND_FREQUENCY_THRESHOLD{10000};
0051 constexpr auto THIRD_FREQUENCY_THRESHOLD{100000};
0052
0053 auto frequency = INITIAL_FREQUENCY;
0054 if (numberOfEvents > FIRST_FREQUENCY_THRESHOLD) {
0055 frequency = FIRST_FREQUENCY_THRESHOLD;
0056 }
0057 if (numberOfEvents > SECOND_FREQUENCY_THRESHOLD) {
0058 frequency = SECOND_FREQUENCY_THRESHOLD;
0059 }
0060 if (numberOfEvents > THIRD_FREQUENCY_THRESHOLD) {
0061 frequency = THIRD_FREQUENCY_THRESHOLD;
0062 }
0063
0064 auto remainder = numberOfEvents % frequency;
0065 if (remainder == 0) {
0066 G4cout << "---- eRosita number of events: " << numberOfEvents << G4endl;
0067 }
0068 }
0069
0070
0071
0072 void eRositaEventAction::EndOfEventAction(const G4Event* event)
0073 {
0074 auto eventIdentifier = event->GetEventID();
0075
0076
0077
0078 auto *trajectoryContainer = event->GetTrajectoryContainer();
0079 auto numberOfTrajectories = 0;
0080 if (trajectoryContainer != nullptr) {
0081 numberOfTrajectories = trajectoryContainer->entries();
0082 }
0083
0084
0085
0086 constexpr auto THRESHOLD{100};
0087
0088 if (eventIdentifier < THRESHOLD || eventIdentifier % THRESHOLD == 0) {
0089 G4cout << ">>> Event: " << event->GetEventID() << G4endl;
0090 G4cout << " " << numberOfTrajectories << " trajectories stored in this event." << G4endl;
0091 }
0092 }