ATLAS Offline Software
Loading...
Searching...
No Matches
G4AtlasEventAction.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <G4Event.hh>
6
7// Local includes
9
10namespace G4UA
11{
12
13 //---------------------------------------------------------------------------
14 // Constructor
15 //---------------------------------------------------------------------------
19
20 //---------------------------------------------------------------------------
21 // Begin-event action
22 //---------------------------------------------------------------------------
23 void G4AtlasEventAction::BeginOfEventAction(const G4Event* event)
24 {
25 // Loop over my pre-actions and apply each one in turn
26 for(auto action : m_eventActions){
27 action->BeginOfEventAction(event);
28 if(event->IsAborted()) {
29 if(event->GetUserInformation()) {
30 // no user information means an empty event, skip message
31 G4cout << "G4AtlasEventAction: Event was aborted in BeginOfEventAction, skipping further actions" << G4endl;
32 }
33 break;
34 }
35 }
36 }
37
38 //---------------------------------------------------------------------------
39 // End-event action
40 //---------------------------------------------------------------------------
41 void G4AtlasEventAction::EndOfEventAction(const G4Event* event)
42 {
43 // Loop over my post-actions and apply each one in turn
44 for(auto action : m_eventActions){
45 action->EndOfEventAction(event);
46 if(event->IsAborted()) {
47 if(event->GetUserInformation()) {
48 // no user information means an empty event, skip message
49 G4cout << "G4AtlasEventAction: Event was aborted in EndOfEventAction, skipping further actions" << G4endl;
50 }
51 break;
52 }
53 }
54 }
55
56 //---------------------------------------------------------------------------
57 // Add one action to the list
58 //---------------------------------------------------------------------------
59 void G4AtlasEventAction::addEventAction(G4UserEventAction* action)
60 {
61 m_eventActions.push_back(action);
62 }
63
64} // namespace G4UA
void BeginOfEventAction(const G4Event *event) override final
Geant4 method for pre-event action.
std::vector< G4UserEventAction * > m_eventActions
List of ATLAS event actions.
void addEventAction(G4UserEventAction *action)
Add one action to the list.
void EndOfEventAction(const G4Event *event) override final
Geant4 method for post-event action.