Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 16:15:15 +00:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -61,6 +61,9 @@
#include "G4IonParametrisedLossModel.hh"
#include "G4NuclearStopping.hh"
#include "G4LossTableManager.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -72,11 +75,11 @@ ElectromagneticPhysics::ElectromagneticPhysics(const G4String& name)
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(0);
param->SetStepFunction(0.2, 1*mm); //default= 0.1, 100*um
param->SetStepFunctionMuHad(0.2, 1*mm);
param->SetStepFunctionLightIons(0.2, 100*um);
param->SetStepFunctionIons(0.2, 50*um);
param->SetStepFunction(0.2, 100*um);
param->SetStepFunctionMuHad(0.1, 10*um);
param->SetStepFunctionLightIons(0.1, 10*um);
param->SetStepFunctionIons(0.1, 1*um);
param->SetDeexcitationIgnoreCut(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -157,6 +160,11 @@ void ElectromagneticPhysics::ConstructProcess()
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
// Deexcitation
//
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file HadronElasticPhysicsHP.hh
/// \file HadronElasticPhysicsHP.cc
/// \brief Definition of the HadronElasticPhysicsHP class
//
//
@@ -34,8 +34,7 @@
#include "HadronElasticPhysicsHP.hh"
#include "NeutronHPMessenger.hh"
#include "G4GenericMessenger.hh"
#include "G4HadronicProcess.hh"
#include "G4ParticleHPElastic.hh"
#include "G4ParticleHPElasticData.hh"
@@ -48,16 +47,17 @@
HadronElasticPhysicsHP::HadronElasticPhysicsHP(G4int ver)
: G4HadronElasticPhysics(ver),
fThermal(false), fNeutronMessenger(0)
fMessenger(nullptr), fThermal(false)
{
fNeutronMessenger = new NeutronHPMessenger(this);
// define commands for this class
DefineCommands();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HadronElasticPhysicsHP::~HadronElasticPhysicsHP()
{
delete fNeutronMessenger;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -76,8 +76,27 @@ void HadronElasticPhysicsHP::ConstructProcess()
model1->SetMinEnergy(4*eV);
G4ParticleHPThermalScattering* model2 = new G4ParticleHPThermalScattering();
process->RegisterMe(model2);
process->AddDataSet(new G4ParticleHPThermalScatteringData());
process->AddDataSet(new G4ParticleHPThermalScatteringData());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HadronElasticPhysicsHP::DefineCommands()
{
// Define /testhadr/phys command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/testhadr/phys/",
"physics list commands");
// thermal scattering command
auto& thermalCmd
= fMessenger->DeclareProperty("thermalScattering", fThermal);
thermalCmd.SetGuidance("set thermal scattering model");
thermalCmd.SetParameterName("thermal", false);
thermalCmd.SetDefaultValue("false");
thermalCmd.SetStates(G4State_PreInit);
}
//..oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -45,7 +45,6 @@ HistoManager::HistoManager()
HistoManager::~HistoManager()
{
delete G4AnalysisManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -53,9 +52,8 @@ HistoManager::~HistoManager()
void HistoManager::Book()
{
// Create or get analysis manager
// The choice of analysis technology is done via selection of a namespace
// in HistoManager.hh
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetDefaultFileType("root");
analysisManager->SetFileName(fFileName);
analysisManager->SetVerboseLevel(1);
analysisManager->SetActivation(true); //enable inactivation of histograms
@@ -50,6 +50,8 @@
#include "G4EmStandardPhysics_option3.hh"
#include "G4DecayPhysics.hh"
#include "RadioactiveDecayPhysics.hh"
#include "G4RadioactiveDecayPhysics.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -91,7 +93,8 @@ PhysicsList::PhysicsList()
RegisterPhysics(new G4DecayPhysics());
// Radioactive decay
RegisterPhysics(new G4RadioactiveDecayPhysics());
RegisterPhysics(new RadioactiveDecayPhysics());
////RegisterPhysics(new G4RadioactiveDecayPhysics());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,49 +23,84 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file NeutronHPMessenger.cc
/// \brief Implementation of the NeutronHPMessenger class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "NeutronHPMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HadronElasticPhysicsHP.hh"
#include "RadioactiveDecayPhysics.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4Radioactivation.hh"
#include "G4GenericIon.hh"
#include "G4PhysicsListHelper.hh"
#include "G4EmParameters.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4LossTableManager.hh"
#include "G4NuclearLevelData.hh"
#include "G4DeexPrecoParameters.hh"
#include "G4NuclideTable.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NeutronHPMessenger::NeutronHPMessenger(HadronElasticPhysicsHP* phys)
:G4UImessenger(),fNeutronPhysics(phys),
fPhysDir(0), fThermalCmd(0)
{
fPhysDir = new G4UIdirectory("/testhadr/phys/");
fPhysDir->SetGuidance("physics list commands");
fThermalCmd = new G4UIcmdWithABool("/testhadr/phys/thermalScattering",this);
fThermalCmd->SetGuidance("set thermal scattering model");
fThermalCmd->SetParameterName("thermal",false);
fThermalCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NeutronHPMessenger::~NeutronHPMessenger()
RadioactiveDecayPhysics::RadioactiveDecayPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
delete fThermalCmd;
delete fPhysDir;
// mandatory for G4NuclideTable
//
///G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*picosecond);
///G4NuclideTable::GetInstance()->SetLevelTolerance(1.0*eV);
// hadronic physics extra configuration
//
G4DeexPrecoParameters* deex =
G4NuclearLevelData::GetInstance()->GetParameters();
deex->SetStoreICLevelData(true);
deex->SetMaxLifeTime(G4NuclideTable::GetInstance()->GetThresholdOfHalfLife()
/std::log(2.));
deex->SetIsomerProduction(true);
deex->SetCorrelatedGamma(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void NeutronHPMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == fThermalCmd)
{fNeutronPhysics->SetThermalPhysics(fThermalCmd->GetNewBoolValue(newValue));}
RadioactiveDecayPhysics::~RadioactiveDecayPhysics()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RadioactiveDecayPhysics::ConstructParticle()
{
G4GenericIon::GenericIon();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RadioactiveDecayPhysics::ConstructProcess()
{
G4Radioactivation* radioactiveDecay = new G4Radioactivation();
G4bool ARMflag = false;
radioactiveDecay->SetARM(ARMflag); //Atomic Rearangement
// EM physics extra configuration
// this physics constructor should be defined after EM constructor
G4EmParameters::Instance()->SetFluo(ARMflag);
G4EmParameters::Instance()->SetAugerCascade(ARMflag);
G4EmParameters::Instance()->SetDeexcitationIgnoreCut(ARMflag);
G4LossTableManager* man = G4LossTableManager::Instance();
G4VAtomDeexcitation* ad = man->AtomDeexcitation();
// EM physics constructors are not used
if( ad == nullptr ) {
ad = new G4UAtomicDeexcitation();
man->SetAtomDeexcitation(ad);
man->ResetParameters();
}
G4PhysicsListHelper::GetPhysicsListHelper()->
RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -108,6 +108,7 @@ void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
void Run::CountProcesses(const G4VProcess* process)
{
if (process == nullptr) return;
G4String procName = process->GetProcessName();
std::map<G4String,G4int>::iterator it = fProcCounter.find(procName);
if ( it == fProcCounter.end()) {
@@ -265,7 +266,7 @@ void Run::EndOfRun()
//particles count
//
G4cout << "\n List of generated particles:" << G4endl;
G4cout << "\n List of generated particles (with meanLife != 0):" << G4endl;
for ( const auto& particleData : fParticleDataMap1 ) {
G4String name = particleData.first;
@@ -99,11 +99,12 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
G4double tmin = analysis->GetH1Xmin(id)*unit;
G4double tmax = analysis->GetH1Xmax(id)*unit;
G4double binWidth = analysis->GetH1Width(id)*unit;
G4double weight = track->GetWeight();
G4double t1 = std::max(fTimeBirth,tmin);
G4double t2 = std::min(fTimeEnd ,tmax);
for (G4double time = t1; time<t2; time+= binWidth)
analysis->FillH1(id,time);
analysis->FillH1(id,time,weight);
}
// keep only emerging particles
@@ -119,6 +120,7 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
G4String type = particle->GetParticleType();
G4double charge = particle->GetPDGCharge();
G4double time = track->GetGlobalTime();
G4double weight = track->GetWeight();
if (charge > 3.) {ih1 = 10; ih2 = 20;}
else if (particle == G4Gamma::Gamma()) {ih1 = 4; ih2 = 14;}
else if (particle == G4Electron::Electron()) {ih1 = 5; ih2 = 15;}
@@ -131,9 +133,8 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
else if (type == "baryon") {ih1 = 11; ih2 = 21;}
else if (type == "meson") {ih1 = 12; ih2 = 22;}
else if (type == "lepton") {ih1 = 13; ih2 = 23;};
if (ih1 > 0) analysis->FillH1(ih1,ekin);
if (ih2 > 0) analysis->FillH1(ih2,time);
if (ih1 > 0) analysis->FillH1(ih1,ekin,weight);
if (ih2 > 0) analysis->FillH1(ih2,time,weight);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......