#include <RunAction.hh>
Public Member Functions | |
RunAction (DetectorConstruction *) | |
~RunAction () | |
void | BeginOfRunAction (const G4Run *) |
void | EndOfRunAction (const G4Run *) |
void | SumEvents (G4double e) |
Private Attributes | |
DetectorConstruction * | m_detector |
G4double | m_sumEdep |
G4double | m_sumEdep2 |
G4int | m_nbEntry |
std::vector< G4double > | m_depthDose |
G4double | m_astronautHeight |
G4double | m_sliceWidth |
G4int | m_nbSlices |
Definition at line 19 of file RunAction.hh.
RunAction::RunAction | ( | DetectorConstruction * | det | ) |
RunAction::~RunAction | ( | ) |
void RunAction::BeginOfRunAction | ( | const G4Run * | run | ) |
Definition at line 28 of file RunAction.cc.
00029 { 00030 G4cout << "### Run " << run->GetRunID() << " start." << G4endl; 00031 00032 //initialize total energy deposit 00033 // 00034 m_sumEdep = m_sumEdep2 = 0.; 00035 m_nbEntry = 0; 00036 00037 //construct vector of m_depthDose distribution 00038 // 00039 m_nbSlices = 100; 00040 m_astronautHeight = m_detector->GetAstronautHeight(); 00041 m_sliceWidth = m_astronautHeight/m_nbSlices; 00042 m_depthDose.resize(m_nbSlices, 0.); 00043 }
void RunAction::EndOfRunAction | ( | const G4Run * | ) |
Definition at line 47 of file RunAction.cc.
00048 { 00049 G4double meanEd = 0., meanEd2 = 0., rmsEd = 0., error_rel_sum = 0.; 00050 if (m_nbEntry) { 00051 meanEd = m_sumEdep/m_nbEntry; meanEd2 = m_sumEdep2/m_nbEntry; 00052 G4double variance = meanEd2 - meanEd*meanEd; 00053 if (variance > 0.) rmsEd = std::sqrt(variance); 00054 error_rel_sum = rmsEd/(meanEd*std::sqrt(double(m_nbEntry))); 00055 } 00056 00057 // choose printing format 00058 std::ios::fmtflags mode = G4cout.flags(); 00059 G4cout.setf(std::ios::fixed,std::ios::floatfield); 00060 G4int prec = G4cout.precision(3); 00061 00062 //print total energy deposit 00063 // 00064 G4cout 00065 << "\n ---> Nb of non-empty events = " << m_nbEntry 00066 << "\n ---> Mean Edep per event = " << G4BestUnit(meanEd,"Energy") 00067 << "\n ---> Total Energy deposited = " << G4BestUnit(m_sumEdep,"Energy") 00068 << " +- " << G4BestUnit(m_sumEdep*error_rel_sum,"Energy") 00069 << " (-> " << 100*error_rel_sum << " %)" 00070 << G4endl; 00071 00072 //get mass of astronaut 00073 // 00074 G4double mass = m_detector->GetAstronaut()->GetLogicalVolume()->GetMass(); 00075 00076 //compute dose 00077 // 00078 G4double dose = m_sumEdep/mass; 00079 G4cout.setf(mode,std::ios::floatfield); 00080 G4cout.precision(5); 00081 G4cout << " ---> Dose = " << G4BestUnit(dose,"Dose") 00082 << " +- " << G4BestUnit(dose*error_rel_sum,"Dose") << "\n" 00083 << G4endl; 00084 00085 // restaure default formats 00086 G4cout.setf(mode,std::ios::floatfield); 00087 G4cout.precision(prec); 00088 }
void RunAction::SumEvents | ( | G4double | e | ) | [inline] |
Definition at line 29 of file RunAction.hh.
Referenced by EventAction::EndOfEventAction().
00029 { m_sumEdep += e; m_sumEdep2 += e*e; m_nbEntry++; };
DetectorConstruction* RunAction::m_detector [private] |
G4double RunAction::m_sumEdep [private] |
Definition at line 34 of file RunAction.hh.
Referenced by BeginOfRunAction(), EndOfRunAction(), and SumEvents().
G4double RunAction::m_sumEdep2 [private] |
Definition at line 34 of file RunAction.hh.
Referenced by BeginOfRunAction(), EndOfRunAction(), and SumEvents().
G4int RunAction::m_nbEntry [private] |
Definition at line 35 of file RunAction.hh.
Referenced by BeginOfRunAction(), EndOfRunAction(), and SumEvents().
std::vector<G4double> RunAction::m_depthDose [private] |
G4double RunAction::m_astronautHeight [private] |
G4double RunAction::m_sliceWidth [private] |
G4int RunAction::m_nbSlices [private] |