geant4-B1-example  1.0
 All Classes Files Functions Variables Pages
B1ActionInitialization.cc
Go to the documentation of this file.
1 /// @file B1ActionInitialization.cc
2 /// @brief Implementation of the B1ActionInitialization class
3 
6 #include "B1RunAction.hh"
7 #include "B1EventAction.hh"
8 #include "B1SteppingAction.hh"
9 
10 
11 /// just implement the contructor from the G4VUserActionInitialization class.
13  : G4VUserActionInitialization()
14 {}
15 
16 /// do nothing
18 {}
19 
20 
21 /// only for the multithread.
22 /// + create a B1RunAction object "runAction", and put it in SetUserAction()
24 {
25  B1RunAction* runAction = new B1RunAction;
26  SetUserAction(runAction);
27 }
28 
29 
30 
31 /*!
32 For the sequential mode.
33 1. create a B1PrimaryGeneratorAction object, put it in SetUserAction()
34 2. create a B1RunAction object, put it in SetUserAction()
35 3. create a B1EventAction object, put it in SetUserAction()
36 4. create a B1SteppingAction object, put it in SetUserAction()
37 */
39 {
40 
41  SetUserAction(new B1PrimaryGeneratorAction);
42  // note: B1PrimaryGeneratorAction class is derived from G4VUserPrimaryGeneratorAction class ( a must )
43  // setup: particle gun, with 6 MeV and momentum direction to +z
44  // setup: GeneratePrimaries() method, to get 80% of area, associate particle position.
45 
46 
47  B1RunAction* runAction = new B1RunAction;
48  SetUserAction(runAction);
49  // note: the B1RunAction class derived from G4UserRunAction class
50  // virtual void BeginOfRunAction(const G4Run*); ( reset parameter )
51  // virtual void EndOfRunAction(const G4Run*); ( print summary )
52  // void AddEdep (G4double edep);
53 
54 
55 
56  B1EventAction* eventAction = new B1EventAction(runAction);
57  SetUserAction(eventAction);
58  // note: the B1EventAction class derived from G4UserEventAction class
59  // virtual void BeginOfEventAction(const G4Event* event); (to set fEdep = 0.)
60  // virtual void EndOfEventAction(const G4Event* event); {to accumulate statistics}
61  // void AddEdep(G4double edep) { fEdep += edep; }
62 
63 
64 
65  SetUserAction(new B1SteppingAction(eventAction));
66 }
67 
Run action class ( run is the biggest unit)
Definition: B1RunAction.hh:25
B1ActionInitialization()
just implement the contructor from the G4VUserActionInitialization class.
Stepping action class.
Definition of the B1ActionInitialization class.
Definition of the B1PrimaryGeneratorAction class.
virtual void Build() const
Definition of the B1SteppingAction class.
Definition of the B1EventAction class.
virtual void BuildForMaster() const
user event class
virtual ~B1ActionInitialization()
do nothing