Loading...
Searching...
No Matches
RunAction.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/// \file scavenger/src/RunAction.cc
27/// \brief Implementation of the scavenger::RunAction class
28
29#include "RunAction.hh"
30#include "Run.hh"
31#include "G4Run.hh"
32#include "G4RunManager.hh"
33#include "G4SystemOfUnits.hh"
34#include "ScoreSpecies.hh"
35
36namespace scavenger
37{
38
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
40
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
45
47 Run *run = new Run();
48 return run;
49}
50
51//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
52
54 G4cout << "### Run " << run->GetRunID() << " starts." << G4endl;
55
56 // informs the runManager to save random number seed
57 G4RunManager::GetRunManager()->SetRandomNumberStore(false);
58}
59
60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
61
63 G4int nofEvents = run->GetNumberOfEvent();
64 if (nofEvents == 0) {
65 return;
66 }
67 const Run *scavengerRun = dynamic_cast<const Run *>(run);
68 G4double sumDose = scavengerRun->GetSumDose();
69 if (IsMaster()) {
70 G4cout
71 << G4endl
72 << "--------------------End of Global Run-----------------------"
73 << G4endl
74 << " The run has " << nofEvents << " events "
75 << G4endl;
76 auto masterScorer = dynamic_cast<ScoreSpecies *>(scavengerRun->GetPrimitiveScorer());
77 G4cout << "Number of events recorded by the species scorer = "
78 << masterScorer->GetNumberOfRecordedEvents()
79 << G4endl;
80 masterScorer->OutputAndClear();
81 } else {
82 G4cout
83 << G4endl
84 << "--------------------End of Local Run------------------------"
85 << G4endl
86 << " The run has " << nofEvents << " events"
87 << G4endl;
88 }
89 G4cout
90 << " Total energy deposited in the world volume : " << sumDose / eV << " eV"
91 << G4endl
92 << " ------------------------------------------------------------"
93 << G4endl
94 << G4endl;
95}
96
97//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
98
99}
Definition of the scavenger::ScoreSpecies class.
void EndOfRunAction(const G4Run *) override
Definition RunAction.cc:62
void BeginOfRunAction(const G4Run *) override
Definition RunAction.cc:53
G4Run * GenerateRun() override
Definition RunAction.cc:46
Collects information event per event from the hits collections.
auto GetPrimitiveScorer() const
Definition Run.hh:54
auto GetSumDose() const
Definition Run.hh:52
Primitive scorer class for scoring the radiolytic species produced after irradiation in a water volum...
G4int GetNumberOfRecordedEvents() const
Get number of recorded events.

Applications | User Support | Publications | Collaboration