Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -28,17 +28,18 @@
/// \brief Implementation of the B1::RunAction class
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
// #include "Run.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4AccumulableManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
namespace VtkVis
{
@@ -49,15 +50,15 @@ RunAction::RunAction()
{
// add new units for dose
//
const G4double milligray = 1.e-3*gray;
const G4double microgray = 1.e-6*gray;
const G4double nanogray = 1.e-9*gray;
const G4double picogray = 1.e-12*gray;
const G4double milligray = 1.e-3 * gray;
const G4double microgray = 1.e-6 * gray;
const G4double nanogray = 1.e-9 * gray;
const G4double picogray = 1.e-12 * gray;
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
new G4UnitDefinition("milligray", "milliGy", "Dose", milligray);
new G4UnitDefinition("microgray", "microGy", "Dose", microgray);
new G4UnitDefinition("nanogray", "nanoGy", "Dose", nanogray);
new G4UnitDefinition("picogray", "picoGy", "Dose", picogray);
// Register accumulable to the accumulable manager
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
@@ -75,7 +76,6 @@ void RunAction::BeginOfRunAction(const G4Run*)
// reset accumulables to their initial values
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->Reset();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -91,17 +91,20 @@ void RunAction::EndOfRunAction(const G4Run* run)
// Compute dose = total energy deposit in a run and its variance
//
G4double edep = fEdep.GetValue();
G4double edep = fEdep.GetValue();
G4double edep2 = fEdep2.GetValue();
G4double rms = edep2 - edep*edep/nofEvents;
if (rms > 0.) rms = std::sqrt(rms); else rms = 0.;
G4double rms = edep2 - edep * edep / nofEvents;
if (rms > 0.)
rms = std::sqrt(rms);
else
rms = 0.;
const auto detConstruction = static_cast<const DetectorConstruction*>(
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4double mass = detConstruction->GetScoringVolume()->GetMass();
G4double dose = edep/mass;
G4double rmsDose = rms/mass;
G4double dose = edep / mass;
G4double rmsDose = rms / mass;
// Run conditions
// note: There is no primary generator action object for "master"
@@ -109,48 +112,37 @@ void RunAction::EndOfRunAction(const G4Run* run)
const auto generatorAction = static_cast<const PrimaryGeneratorAction*>(
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
G4String runCondition;
if (generatorAction)
{
if (generatorAction) {
const G4ParticleGun* particleGun = generatorAction->GetParticleGun();
runCondition += particleGun->GetParticleDefinition()->GetParticleName();
runCondition += " of ";
G4double particleEnergy = particleGun->GetParticleEnergy();
runCondition += G4BestUnit(particleEnergy,"Energy");
runCondition += G4BestUnit(particleEnergy, "Energy");
}
// Print
//
if (IsMaster()) {
G4cout
<< G4endl
<< "--------------------End of Global Run-----------------------";
G4cout << G4endl << "--------------------End of Global Run-----------------------";
}
else {
G4cout
<< G4endl
<< "--------------------End of Local Run------------------------";
G4cout << G4endl << "--------------------End of Local Run------------------------";
}
G4cout
<< G4endl
<< " The run consists of " << nofEvents << " "<< runCondition
<< G4endl
<< " Cumulated dose per run, in scoring volume : "
<< G4BestUnit(dose,"Dose") << " rms = " << G4BestUnit(rmsDose,"Dose")
<< G4endl
<< "------------------------------------------------------------"
<< G4endl
<< G4endl;
G4cout << G4endl << " The run consists of " << nofEvents << " " << runCondition << G4endl
<< " Cumulated dose per run, in scoring volume : " << G4BestUnit(dose, "Dose")
<< " rms = " << G4BestUnit(rmsDose, "Dose") << G4endl
<< "------------------------------------------------------------" << G4endl << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::AddEdep(G4double edep)
{
fEdep += edep;
fEdep2 += edep*edep;
fEdep += edep;
fEdep2 += edep * edep;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace VtkVis