LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TrackingActionBase.hh
Go to the documentation of this file.
1 // This file is the header for the @TrackingActionBase@ class.
2 
3 // A base class for Geant user tracking actions
4 
5 // There is no implementation file, as it is intended only as a base class.
6 
7 // When you create an action object, you have the option to overload the
8 // following methods:
9 
10 // @PreUserTrackingAction@ - This method, which takes a pointer to a constant
11 // @G4Track@ object, is called once after a track has been created but before
12 // it is simulated. Putting code in this method of an action object is
13 // equivalent to putting it in the @PreUserTrackingAction@ method of the
14 // simulation's tracking action class.
15 
16 // @PostUserTrackingAction@ - This method, which takes a pointer to a constant
17 // @G4Track@ object, is called once after a track has been stopped. Putting
18 // code in this method of an action object is equivalent to putting it in the
19 // @PostUserTrackingAction@ method of the simulation's tracking action class.
20 
21 #ifndef artg4tk_actionBase_TrackingActionBase_hh
22 #define artg4tk_actionBase_TrackingActionBase_hh
23 
24 #include <string>
25 
27 
28 // Declarations of types we use as input parameters
29 class G4Track;
30 
31 // Everything goes in the Art G4 namespace
32 namespace artg4tk {
33 
34  class TrackingActionBase : public ActionBase {
35  public:
36  // Constructor. The derived class must call this constructor. It takes a
37  // single string for the name of the action object.
38  explicit TrackingActionBase(std::string name);
39 
40  // Destructor
41  virtual ~TrackingActionBase();
42 
43  // h3. The interesting methods.
44  // All of these are defined to do nothing by default. Users can override
45  // them if desired, and if they're not overloaded, they do nothing.
46 
47  // Called before a track is simulated
48  virtual void
49  preUserTrackingAction(const G4Track*)
50  {}
51 
52  // Called when a track is stopped
53  virtual void
54  postUserTrackingAction(const G4Track*)
55  {}
56  };
57 }
58 
59 #endif /* artg4tk_actionBase_TrackingActionBase_hh */
virtual void preUserTrackingAction(const G4Track *)
virtual void postUserTrackingAction(const G4Track *)
TrackingActionBase(std::string name)