00001
00002
00003
00004
00005
00006 #include "RunAction.hh"
00007 #include "DetectorConstruction.hh"
00008
00009 #include "G4Run.hh"
00010 #include "G4RunManager.hh"
00011 #include "G4UnitsTable.hh"
00012 #include "G4EmCalculator.hh"
00013
00014 #include "Randomize.hh"
00015 #include <iomanip>
00016
00017
00018
00019 RunAction::RunAction(DetectorConstruction* det)
00020 :m_detector(det)
00021 { }
00022
00023
00024
00025 RunAction::~RunAction()
00026 { }
00027
00028
00029
00030 void RunAction::BeginOfRunAction(const G4Run* run)
00031 {
00032 G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
00033
00034
00035
00036 m_edepTotal = 0.;
00037 }
00038
00039
00040
00041 void RunAction::EndOfRunAction(const G4Run*)
00042 {
00043
00044 std::ios::fmtflags mode = G4cout.flags();
00045 G4cout.setf(std::ios::fixed,std::ios::floatfield);
00046 G4int prec = G4cout.precision(3);
00047
00048
00049
00050 G4cout
00051 << "\n ---> Total Energy deposited = " << G4BestUnit(m_edepTotal,"Energy")
00052 << G4endl;
00053
00054
00055
00056 G4double mass = m_detector->GetAstronaut()->GetLogicalVolume()->GetMass();
00057 G4cout << " ---> Mass = " << G4BestUnit(mass,"Mass") << G4endl;
00058
00059
00060
00061 G4double dose = m_edepTotal/mass;
00062 G4cout.setf(mode,std::ios::floatfield);
00063 G4cout.precision(5);
00064 G4cout << " ---> Dose = " << G4BestUnit(dose,"Dose")
00065 << " (" << dose/(MeV/kg) << " MeV/kg)" << G4endl;
00066
00067
00068
00069 G4cout.setf(mode,std::ios::floatfield);
00070 G4cout.precision(prec);
00071 }
00072
00073