LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RunActionBase.hh
Go to the documentation of this file.
1 // This file is the header for the @RunActionBase@ class.
2 
3 // A base class for Geant user run actions
4 
5 // There is no implementation file, as it is intended only as a base class.
6 
7 // When you create a run action object, you have the option to overload the
8 // following methods:
9 
10 // @BeginOfRun@ - This method, which takes a pointer to a constant @G4Run@
11 // object, is called once at the beginning of each run. Putting code in this
12 // method of an action object is equivalent to putting it in the
13 // @BeginOfRun@ method of the simulation's run action class.
14 
15 // @EndOfRun@ - This method, which takes a pointer to a constant @G4Run@
16 // object, is called once at the end of each run. Putting code in this method
17 // of an action object is equivalent to putting it in the @EndOfRun@ method
18 // of the simulation's run action class.
19 
20 #ifndef artg4tk_actionBase_RunActionBase_hh
21 #define artg4tk_actionBase_RunActionBase_hh
22 
23 #include <string>
24 
26 
29 
30 // Declarations of types we use as input parameters
31 class G4Run;
32 
33 // Everything goes in the Art G4 namespace
34 namespace artg4tk {
35 
36  class RunActionBase : public ActionBase {
37  public:
38  // Constructor. The derived class must call this constructor. It takes a
39  // single string for the name of the action object.
40  RunActionBase(std::string myName) : ActionBase(myName)
41  {
43  actionHolder->registerAction(this);
44  }
45 
46  // Destructor
47  virtual ~RunActionBase();
48 
49  // h3. The interesting methods.
50 
51  // All of these are defined to do nothing by default. Users can override
52  // them if desired, and if they're not overloaded, they do nothing.
53 
54  // Called at the beginning of each run.
55  virtual void
56  beginOfRunAction(const G4Run*)
57  {}
58 
59  // Called at the end of each run.
60  virtual void
61  endOfRunAction(const G4Run*)
62  {}
63  };
64 }
65 
66 #endif /* artg4tk_actionBase_RunActionBase_hh */
RunActionBase(std::string myName)
virtual void endOfRunAction(const G4Run *)
virtual void beginOfRunAction(const G4Run *)
void registerAction(RunActionBase *const action)
Definition: ActionHolder.cc:60
std::string const & myName() const
Definition: ActionBase.hh:25