Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B3RunAction.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$
27 //
30 
31 #include "B3RunAction.hh"
33 
34 #include "G4Run.hh"
35 #include "G4RunManager.hh"
36 #include "G4UnitsTable.hh"
37 #include "G4SystemOfUnits.hh"
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 
42  : G4UserRunAction(),
43  fGoodEvents(0),
44  fSumDose(0.)
45 {
46  //add new units for dose
47  //
48  const G4double milligray = 1.e-3*gray;
49  const G4double microgray = 1.e-6*gray;
50  const G4double nanogray = 1.e-9*gray;
51  const G4double picogray = 1.e-12*gray;
52 
53  new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
54  new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
55  new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
56  new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
57 }
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62 {}
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
67 {
68  G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
69 
70  fGoodEvents = 0;
71  fSumDose = 0.;
72 
73  //inform the runManager to save random number seed
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  G4int NbOfEvents = run->GetNumberOfEvent();
82  if (NbOfEvents == 0) return;
83 
84  //run conditions
85  //
86  const B3PrimaryGeneratorAction* kinematic
87  = static_cast<const B3PrimaryGeneratorAction*>(
89  G4ParticleDefinition* particle
90  = kinematic->GetParticleGun()->GetParticleDefinition();
91  G4String partName = particle->GetParticleName();
92 
93  //print
94  //
95  G4cout
96  << "\n--------------------End of Run------------------------------\n"
97  << " The run was " << NbOfEvents << " "<< partName
98  << "; Nb of 'good' e+ annihilations: " << fGoodEvents
99  << "\n Total dose in patient : " << G4BestUnit(fSumDose,"Dose")
100  << "\n------------------------------------------------------------\n"
101  << G4endl;
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......