ExampleAction.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ExampleAction.h
3 /// \brief Use Geant4's user "hooks" to kill particles in the rock
4 ///
5 /// \version $Id: ExampleAction.h,v 1.1 2012-08-27 17:55:03 rhatcher Exp $
6 /// \author rhatcher@fnal.gov
7 ////////////////////////////////////////////////////////////////////////
8 
9 /// This class implements the G4Base::UserAction interface in order to
10 /// decide whether to keep or kill particles
11 
12 #ifndef ALTNS_EXAMPLEACTION_H
13 #define ALTNS_EXAMPLEACTION_H
14 
15 #include "nutools/G4Base/UserAction.h"
16 
17 // Forward declarations.
18 class G4Event;
19 class G4Track;
20 class G4Step;
21 
22 namespace altns {
23 
24  // accumulate a list of particles modeled in G4
25  class ExampleAction : public g4b::UserAction {
26 
27  public:
28  // Standard constructors and destructors;
29  ExampleAction();
30  virtual ~ExampleAction();
31 
32  void Config(fhicl::ParameterSet const& pset);
33  void PrintConfig(std::string const& opt);
34 
35  /// UserActions method that we'll override, to obtain access to
36  /// Geant4's particle tracks and trajectories.
37  void BeginOfEventAction(const G4Event*);
38  void EndOfEventAction(const G4Event*);
39  void PreTrackingAction(const G4Track*);
40  void PostTrackingAction(const G4Track*);
41  void SteppingAction(const G4Step*);
42 
43  /// Does this UserAction do stacking?
44  /// Override to return "true" if the following interfaces are implemented
45  bool ProvidesStacking() { return true; }
46  /// G4UserStackingAction interfaces
47  G4ClassificationOfNewTrack StackClassifyNewTrack(const G4Track*);
48  void StackNewStage();
49  void StackPrepareNewEvent();
50 
51  private:
52 
53  double fSomeValue; ///< some user config value
54  int fVerbose; ///< verbosity
55  int fStepMsgMaxPerEvt; ///< shut up about steps
56  int fTrack2ndMsgMaxPerEvt; ///< shut up about 2ndary tracks
57 
58  int fStepMsg; ///< # steps have we printed this evt?
59  int fTrack2ndMsg; ///< # of 2ndary track printed this evt?
60 
61  };
62 
63 } // namespace altns
64 
65 #endif // ALTNS_EXAMPLEACTION_h
void SteppingAction(const G4Step *)
G4UserSteppingAction interface.
void PostTrackingAction(const G4Track *)
G4ClassificationOfNewTrack StackClassifyNewTrack(const G4Track *)
G4UserStackingAction interfaces.
std::string string
Definition: nybbler.cc:12
int fVerbose
verbosity
Definition: ExampleAction.h:54
int fStepMsgMaxPerEvt
shut up about steps
Definition: ExampleAction.h:55
opt
Definition: train.py:196
void Config(fhicl::ParameterSet const &pset)
Override Config() to extract any necessary parameters.
int fTrack2ndMsgMaxPerEvt
shut up about 2ndary tracks
Definition: ExampleAction.h:56
void PrintConfig(std::string const &opt)
Override PrintConfig() to print out current configuration.
void BeginOfEventAction(const G4Event *)
int fTrack2ndMsg
of 2ndary track printed this evt?
Definition: ExampleAction.h:59
double fSomeValue
some user config value
Definition: ExampleAction.h:53
int fStepMsg
steps have we printed this evt?
Definition: ExampleAction.h:58
void PreTrackingAction(const G4Track *)
G4UserTrackingAction interfaces.
void EndOfEventAction(const G4Event *)