|
|
Geant4 User's Guide For Application Developers User Actions |
G4UserRunAction
This class has three virtual methods which are invoked by G4RunManager for each run:
class G4UserRunAction
{
public:
G4UserRunAction();
virtual ~G4UserRunAction();
public:
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
};
|
|
Source listing 6.2.1 G4UserRunAction |
G4UserEventAction
This class has two virtual methods which are invoked by G4EventManager for each event:
class G4UserEventAction
{
public:
G4UserEventAction() {;}
virtual ~G4UserEventAction() {;}
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
protected:
G4EventManager* fpEventManager;
};
|
|
Source listing 6.2.2 G4UserEventAction |
G4UserStackingAction
This class has three virtual methods, ClassifyNewTrack, NewStage and PrepareNewEvent which the user may override in order to control the various track stacking mechanisms. ExampleN04 could be a good example to understand the usage of this class.
#include "G4ClassificationOfNewTrack.hh"
class G4UserStackingAction
{
public:
G4UserStackingAction();
virtual ~G4UserStackingAction();
protected:
G4StackManager * stackManager;
public:
//---------------------------------------------------------------
// virtual methods to be implemented by user
//---------------------------------------------------------------
//
virtual G4ClassificationOfNewTrack
ClassifyNewTrack(const G4Track*);
//
//---------------------------------------------------------------
//
virtual void NewStage();
//
//---------------------------------------------------------------
//
virtual void PrepareNewEvent();
//
//---------------------------------------------------------------
};
|
|
Source listing 6.2.3 G4UserStackingAction |
G4UserTrackingAction
//---------------------------------------------------------------
//
// G4UserTrackingAction.hh
//
// Description:
// This class represents actions taken place by the user at each
// end of stepping.
//
//---------------------------------------------------------------
///////////////////////////
class G4UserTrackingAction
///////////////////////////
{
//--------
public:
//--------
// Constructor & Destructor
G4UserTrackingAction(){};
virtual ~G4UserTrackingAction(){}
// Member functions
virtual void PreUserTrackingAction(const G4Track*){}
virtual void PostUserTrackingAction(const G4Track*){}
//-----------
protected:
//-----------
// Member data
G4TrackingManager* fpTrackingManager;
};
|
|
Source listing 6.2.4 G4UserTrackingAction |
G4UserSteppingAction
//---------------------------------------------------------------
//
// G4UserSteppingAction.hh
//
// Description:
// This class represents actions taken place by the user at each
// end of stepping.
//
//---------------------------------------------------------------
///////////////////////////
class G4UserSteppingAction
///////////////////////////
{
//--------
public:
//--------
// Constructor and destructor
G4UserSteppingAction(){}
virtual ~G4UserSteppingAction(){}
// Member functions
virtual void UserSteppingAction(const G4Step*){}
//-----------
protected:
//-----------
// Member data
G4SteppingManager* fpSteppingManager;
};
|
|
Source listing 6.2.5 G4UserSteppingAction |