ATLAS Offline Software
Loading...
Searching...
No Matches
G4AtlasRunAction.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Local includes
6#include "G4AtlasRunAction.h"
7
8namespace G4UA
9{
10
11 //---------------------------------------------------------------------------
12 // Constructor
13 //---------------------------------------------------------------------------
14 G4AtlasRunAction::G4AtlasRunAction(): fTimer(std::make_unique<G4Timer>())
15 {
16 }
17
18 //---------------------------------------------------------------------------
19 // Begin-run action
20 //---------------------------------------------------------------------------
22 {
23 // Loop over my pre-actions and apply each one in turn
24 for(auto action : m_runActions){
25 action->BeginOfRunAction(run);
26 }
27 fTimer->Start();
28
29 }
30
31 //---------------------------------------------------------------------------
32 // End-run action
33 //---------------------------------------------------------------------------
35 {
36 fTimer->Stop();
37 G4cout << " ======================================================" << G4endl;
38 G4cout << " Time: " << *fTimer << G4endl;
39 G4cout << " ======================================================" << G4endl;
40 // Loop over my post-actions and apply each one in turn
41 for(auto action : m_runActions){
42 action->EndOfRunAction(run);
43 }
44 }
45
46 //---------------------------------------------------------------------------
47 // Add one action to the list
48 //---------------------------------------------------------------------------
49 void G4AtlasRunAction::addRunAction(G4UserRunAction* action)
50 {
51 m_runActions.push_back(action);
52 }
53
54} // namespace G4UA
std::vector< G4UserRunAction * > m_runActions
List of ATLAS run actions.
void addRunAction(G4UserRunAction *action)
Add one action to the list.
void BeginOfRunAction(const G4Run *run) override final
Geant4 method for pre-run action.
std::unique_ptr< G4Timer > fTimer
void EndOfRunAction(const G4Run *run) override final
Geant4 method for post-run action.
STL namespace.
int run(int argc, char *argv[])