LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
EventActionBase.hh
Go to the documentation of this file.
1 // This file is the header for the @EventActionBase@ class.
2 
3 // A base class for Geant user event actions
4 
5 // When you create an event action object, you have the option to overload the
6 // following methods:
7 
8 // @BeginOfEventAction@ - This method, which takes a pointer to a constant
9 // @G4Event@ object, is called once at the beginning of each event. Note that
10 // this occurs after the primaries have been constructed and passed to the
11 // event manager, but before anything is simulated. Putting code in this
12 // method of an action object is equivalent to putting it in the
13 // @BeginOfEventAction@ method of the simulation's event action class.
14 
15 // @EndOfEventAction@ - This method, which takes a pointer to a constant
16 // @G4Event@ object, is called once at the end of each event. This is the
17 // last time the event object is accessible (right before the state changes
18 // from EventProc (in which the event is accessible) to GeomClosed). Putting
19 // code in this method of an action object is equivalent to putting it in the
20 // @EndOfEventAction@ method of the simulation's event action class.
21 
22 #ifndef artg4tk_actionBase_EventActionBase_hh
23 #define artg4tk_actionBase_EventActionBase_hh
24 
25 #include <string>
26 
29 
31 
32 // Declarations of types we use as input parameters
33 class G4Event;
34 
35 // Everything goes in the Art G4 namespace
36 namespace artg4tk {
37 
38  class EventActionBase : public ActionBase {
39  public:
40  // Constructor. The derived class must call this constructor. It takes a
41  // single string for the name of the action object.
42  explicit EventActionBase(std::string name);
43 
44  // Destructor
45  virtual ~EventActionBase();
46 
47  // Tell Art what this detector will put into the event. You do not need to
48  // call this yourself.
49  void
51  {
52  doCallArtProduces(collector);
53  }
54 
55  // h3. The interesting methods.
56  // All of these are defined to do nothing by default. Users can override
57  // them if desired, and if they're not overloaded, they do nothing.
58 
59  // Called at the beginning of each event (after creation of primaries)
60  virtual void
61  beginOfEventAction(const G4Event*)
62  {}
63 
64  // Called at the end of each event
65  virtual void
66  endOfEventAction(const G4Event*)
67  {}
68 
69  private:
70  // Tell Art what you will put into the event.
71  virtual void
73  {}
74  };
75 }
76 
77 #endif /* artg4tk_actionBase_EventActionBase_hh */
void callArtProduces(art::ProducesCollector &collector)
virtual void beginOfEventAction(const G4Event *)
EventActionBase(std::string name)
virtual void doCallArtProduces(art::ProducesCollector &)
virtual void endOfEventAction(const G4Event *)