geant4-B1-example  1.0
 All Classes Files Functions Variables Pages
B1EventAction.cc
Go to the documentation of this file.
1 /// \file B1EventAction.cc
2 /// \brief Implementation of the B1EventAction class
3 
4 #include "B1EventAction.hh"
5 #include "B1RunAction.hh"
6 
7 #include "G4Event.hh"
8 #include "G4RunManager.hh"
9 
10 
11 /// B1EventAction::fEdep represents the energy deposit from a given event. <br>
12 /// here, we initialize B1EventAction::fEdep = 0
14 : G4UserEventAction(),
15  fRunAction(runAction),
16  fEdep(0.)
17 {}
18 
19 
20 /// do nothing.
22 
23 
24 /// reset B1EventAction::fEdep to 0
25 void B1EventAction::BeginOfEventAction(const G4Event*) { fEdep = 0.; }
26 
27 
28 /*!
29  at the end of a given event, we use fRunAction object to update
30  the B1RunAction::fEdep by call B1RunAction::AddEdep()
31 */
32 void B1EventAction::EndOfEventAction(const G4Event*)
33 {
34  // accumulate statistics in run action
35  // note:
36  // B1RunAction* fRunAction;
37  // void B1RunAction::AddEdep(G4double edep)
38  // { fEdep += edep; fEdep2 += edep*edep; }
39  // the fEdep should be named as fEdep_accumulated
40  // the fEdep in Event class, just the energy from a single event.
41  fRunAction->AddEdep(fEdep);
42 
43 
44 }
45 
Run action class ( run is the biggest unit)
Definition: B1RunAction.hh:25
virtual void BeginOfEventAction(const G4Event *event)
reset B1EventAction::fEdep to 0
void AddEdep(G4double edep)
for a user event action object to update fEdep and fEdep2. fEdep represents the energy deposit of a...
Definition: B1RunAction.cc:188
B1EventAction(B1RunAction *runAction)
Definition of the B1EventAction class.
virtual void EndOfEventAction(const G4Event *event)
virtual ~B1EventAction()
do nothing.