SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
UserActionPlugin.hh
Go to the documentation of this file.
1 
7 #ifndef SLIC_USERACTIONPLUGIN_HH_
8 #define SLIC_USERACTIONPLUGIN_HH_
9 
10 // Geant4
11 #include "G4Run.hh"
12 #include "G4Event.hh"
13 #include "G4Track.hh"
14 #include "G4Step.hh"
15 #include "G4ClassificationOfNewTrack.hh"
16 
17 namespace slic {
18 
45 
46  public:
47 
51  virtual ~UserActionPlugin() {
52  }
53 
59  virtual std::string getName() = 0;
60 
66  verbose_ = verbose;
67  if (verbose_ < 1) {
68  verbose = 1;
69  } else if (verbose_ > 4) {
70  verbose = 4;
71  }
72  }
73 
79  return verbose_;
80  }
81 
86  virtual bool hasRunAction() {
87  return false;
88  }
89 
94  virtual bool hasSteppingAction() {
95  return false;
96  }
97 
102  virtual bool hasTrackingAction() {
103  return false;
104  }
105 
110  virtual bool hasEventAction() {
111  return false;
112  }
113 
118  virtual bool hasStackingAction() {
119  return false;
120  }
121 
126  virtual bool hasPrimaryGeneratorAction() {
127  return false;
128  }
129 
133  virtual void beginRun(const G4Run*) {
134  }
135 
139  virtual void endRun(const G4Run*) {
140  }
141 
145  virtual void stepping(const G4Step*) {
146  }
147 
151  virtual void preTracking(const G4Track*) {
152  }
153 
157  virtual void postTracking(const G4Track*) {
158  }
159 
163  virtual void beginEvent(const G4Event*) {
164  }
165 
169  virtual void endEvent(const G4Event*) {
170  }
171 
175  virtual void generatePrimary(G4Event*) {
176  }
177 
183  virtual G4ClassificationOfNewTrack stackingClassifyNewTrack(const G4Track*, const G4ClassificationOfNewTrack& currentTrackClass) {
184  return currentTrackClass;
185  }
186 
190  virtual void stackingNewStage() {
191  }
192 
196  virtual void stackingPrepareNewEvent() {
197  }
198 
199  protected:
200 
202  int verbose_ { 1 };
203 };
204 
205 }
206 
207 #define DECLARE_PLUGIN(NS, NAME) \
208 extern "C" NS::NAME* create ## NAME() { \
209  return new NS::NAME; \
210 } \
211 extern "C" void destroy ## NAME(NS::NAME* object) { \
212  delete object; \
213 }
214 
215 #endif
User simulation plugin.
virtual bool hasRunAction()
virtual G4ClassificationOfNewTrack stackingClassifyNewTrack(const G4Track *, const G4ClassificationOfNewTrack &currentTrackClass)
virtual void endEvent(const G4Event *)
virtual void beginRun(const G4Run *)
virtual bool hasSteppingAction()
virtual bool hasEventAction()
virtual void endRun(const G4Run *)
virtual bool hasTrackingAction()
virtual void stackingPrepareNewEvent()
virtual void preTracking(const G4Track *)
virtual void beginEvent(const G4Event *)
void setVerboseLevel(int verbose)
virtual void stepping(const G4Step *)
virtual std::string getName()=0
virtual bool hasStackingAction()
virtual void generatePrimary(G4Event *)
virtual void postTracking(const G4Track *)
virtual bool hasPrimaryGeneratorAction()
virtual void stackingNewStage()
@ verbose
Definition: LogStream.hh:33