ATLAS Offline Software
Loading...
Searching...
No Matches
TestActionTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef G4USERACTIONS_TESTACTIONTOOL_H
6#define G4USERACTIONS_TESTACTIONTOOL_H
7
8// Framework includes
10
11// Geant4 includes
12#include "G4UserRunAction.hh"
13#include "G4UserEventAction.hh"
14#include "G4UserSteppingAction.hh"
15
16// G4Atlas includes
19
20
21namespace G4UA
22{
23
27 class TestAction : public G4UserRunAction,
28 public G4UserEventAction,
29 public G4UserSteppingAction
30 {
31
32 public:
33
35 struct Report
36 {
37 int numEvent = 0;
38 int numStep = 0;
39 void merge(const Report& other) {
40 numEvent += other.numEvent;
41 numStep += other.numStep;
42 }
43 };
44
46 TestAction();
47
49 virtual void BeginOfRunAction(const G4Run*) override final;
50
52 virtual void EndOfRunAction(const G4Run*) override final;
53
55 virtual void BeginOfEventAction(const G4Event*) override final;
56
58 virtual void EndOfEventAction(const G4Event*) override final;
59
61 virtual void UserSteppingAction(const G4Step* step) override final;
62
64 inline const Report& getReport() const
65 { return m_report; }
66
67 private:
68
71
72 }; // class TestAction
73
74
78 class TestActionTool : public UserActionToolBase<TestAction>
79 {
80
81 public:
82
84 TestActionTool(const std::string& type, const std::string& name,
85 const IInterface* parent);
86
88 virtual StatusCode initialize() override final;
89
91 virtual StatusCode finalize() override final;
92
93 protected:
94
96 virtual std::unique_ptr<TestAction>
97 makeAndFillAction(G4AtlasUserActions& actions) override final;
98
99 }; // class TestActionTool
100
101} // namespace G4UA
102
103#endif // G4USERACTIONS_TESTACTIONTOOL_H
virtual StatusCode initialize() override final
Initialize the tool.
TestActionTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
virtual StatusCode finalize() override final
Finalize the tool.
virtual std::unique_ptr< TestAction > makeAndFillAction(G4AtlasUserActions &actions) override final
Fill user action.
const Report & getReport() const
Get the results report.
virtual void BeginOfRunAction(const G4Run *) override final
Executes before the run.
virtual void EndOfEventAction(const G4Event *) override final
Executes at end of G4 event.
TestAction()
Constructor.
virtual void UserSteppingAction(const G4Step *step) override final
Stepping action method.
virtual void EndOfRunAction(const G4Run *) override final
Exeuctes after the run.
virtual void BeginOfEventAction(const G4Event *) override final
Executes at beginning of G4 event.
Report m_report
Results report.
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Struct for passing around user actions.
Results to be accumulated across threads at end of job.
void merge(const Report &other)