Information for Geant4
- Geant4 Version: Geant4.11.2.0-beta
- Operating System: MacOS Sonoma 14.0
- Compiler/Version: AppleClang 15.0.0
- CMake Version: 3.26.5
Problem
If the /process/had/rdm/analogueMC false
was used, the error came as following:
- [1] 95582 segmentation fault ./Am gps.mac > 1.log
- G4SeltzerBergerModel Warning: Majoranta exceeded! 2.11759 > 1.9996 by 1.05901 Niter= 0 Egamma(MeV)= 0.31837 Ee(MeV)= 0.318912 Z= 95 e-
Code
DetectorConstruction.cc
G4VPhysicalVolume* DetectorConstruction::Construct() {
// Define Materials
auto nist_manager = G4NistManager::Instance();
G4Material *world_mat = nist_manager->FindOrBuildMaterial("G4_AIR");
G4Isotope *Am_243_iso = new G4Isotope("Am243", 95, 243, 243.06138*g/mole);
G4Element *elAm = new G4Element("AmericiumElement", "Am", 1);
elAm->AddIsotope(Am_243_iso, 100.*perCent);
G4double density_Am243 = 13.67 * g/cm3;
G4Material* Am_243 = new G4Material("Am_243", density_Am243, 1);
Am_243->AddElement(elAm, 100.*perCent);
// Define World
G4double world_length = 10 * cm;
auto world_solid = new G4Box("World_Solid", world_length/2, world_length/2, world_length/2);
auto world_logic = new G4LogicalVolume(world_solid, world_mat, "World_logic");
G4VPhysicalVolume* world_phys = new G4PVPlacement(nullptr, G4ThreeVector(), world_logic, "World_Phys", nullptr, false, 0, true);
// Define Am-243
G4double source_length = 200 * um;
auto source_solid = new G4Box("Source_Solid", source_length/2, source_length/2, source_length/2);
auto source_logic = new G4LogicalVolume(source_solid, Am_243, "Source_Logic");
new G4PVPlacement(nullptr, G4ThreeVector(), source_logic, "Source_Phys", world_logic, false, 0, true);
return world_phys;
}
PhysicsList.cc
PhysicsList::PhysicsList() : G4VModularPhysicsList() {
// 1. Verbose
SetVerboseLevel(1);
G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*picosecond);
G4NuclideTable::GetInstance()->SetLevelTolerance(1.0*eV);
RegisterPhysics(new G4EmLivermorePhysics());
G4EmParameters* param = G4EmParameters::Instance();
param->SetAugerCascade(true);
param->SetDeexcitationIgnoreCut(true);
param->SetStepFunction(1., 1*CLHEP::mm); // for e- and e+
param->SetStepFunctionMuHad(1., 1*CLHEP::mm);
/*
* RegisterPhysics(new G4EmStandardPhysics());
* G4EmParameters* param = G4EmParameters::Instance();
* param->SetAugerCascade(true);
* param->SetStepFunction(1., 1*CLHEP::mm);
* param->SetStepFunctionMuHad(1., 1*CLHEP::mm);
*/
RegisterPhysics(new G4DecayPhysics());
RegisterPhysics(new BiasedRDPhysics());
RegisterPhysics(new G4HadronPhysicsQGSP_BIC());
RegisterPhysics(new G4HadronElasticPhysics());
RegisterPhysics( new G4IonElasticPhysics());
RegisterPhysics( new G4IonPhysics());
G4EmExtraPhysics* gnuc = new G4EmExtraPhysics();
gnuc->ElectroNuclear(false);
gnuc->MuonNuclear(false);
RegisterPhysics(gnuc);
cut_value = 1 * um;
SetDefaultCutValue(cut_value);
}
mac file
/run/initialize
/process/had/rdm/noVolumes
/process/had/rdm/selectVolume Source_Logic
#/process/had/rdm/nucleusLimits 243 243 95 95
/gps/particle ion
/gps/ion 95 243
/gps/energy 0
/process/had/rdm/analogueMC false
/gps/pos/type Volume
/gps/pos/shape Para
/gps/pos/halfx 100 um
/gps/pos/halfy 100 um
/gps/pos/halfz 100 um
/gps/pos/centre 0 0 0 um
/gps/ang/type iso
/run/beamOn 10000
Debug
The lldb was used with lldb ./Am
, and in the lldb r gps.mac
.Then the code with bt
was used to trace the error, and the result was following:
How to solve it? And if the “Analogue mode” was used, there is no error!
Thanks for your help!
Best!
Kun ZHU