Geant4  10.02.p02
B4bEventAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: B4bEventAction.cc 75604 2013-11-04 13:17:26Z gcosmo $
27 //
30 
31 #include "B4bEventAction.hh"
32 #include "B4bRunData.hh"
33 
34 #include "G4RunManager.hh"
35 #include "G4Event.hh"
36 #include "G4UnitsTable.hh"
37 
38 #include "Randomize.hh"
39 #include <iomanip>
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
45 {}
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55  G4double absoEdep, G4double absoTrackLength,
56  G4double gapEdep, G4double gapTrackLength) const
57 {
58  // print event statistics
59  G4cout
60  << " Absorber: total energy: "
61  << std::setw(7) << G4BestUnit(absoEdep, "Energy")
62  << " total track length: "
63  << std::setw(7) << G4BestUnit(absoTrackLength, "Length")
64  << G4endl
65  << " Gap: total energy: "
66  << std::setw(7) << G4BestUnit(gapEdep, "Energy")
67  << " total track length: "
68  << std::setw(7) << G4BestUnit(gapTrackLength, "Length")
69  << G4endl;
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  B4bRunData* runData
77  = static_cast<B4bRunData*>(
79  runData->Reset();
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  B4bRunData* runData
87  = static_cast<B4bRunData*>(
89  runData->FillPerEvent();
90 
91  //print per event (modulo n)
92  //
93  G4int eventID = event->GetEventID();
95  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
96  G4cout << "---> End of event: " << eventID << G4endl;
97 
99  runData->GetEdep(kAbs),
100  runData->GetTrackLength(kAbs),
101  runData->GetEdep(kGap),
102  runData->GetTrackLength(kGap));
103  }
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double GetEdep(G4int id) const
Definition: B4bRunData.hh:91
Definition of the B4bEventAction class.
G4int GetPrintProgress()
virtual ~B4bEventAction()
Definition of the B4bRunData class.
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
void FillPerEvent()
Definition: B4bRunData.cc:57
G4GLOB_DLL std::ostream G4cout
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const
virtual void EndOfEventAction(const G4Event *event)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
void Reset()
Definition: B4bRunData.cc:79
Run data class.
Definition: B4bRunData.hh:58
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual void BeginOfEventAction(const G4Event *event)
G4Run * GetNonConstCurrentRun() const
G4double GetTrackLength(G4int id) const
Definition: B4bRunData.hh:95