#include "PhysicsList.hh" PhysicsList::PhysicsList() { // EM Physics RegisterPhysics(new G4EmStandardPhysics()); // Radioactive decay physics RegisterPhysics(new G4RadioactiveDecayPhysics()); // Optical Physics G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics(); opticalPhysics->SetVerboseLevel(1); RegisterPhysics(opticalPhysics); // Hadronic Physics RegisterPhysics(new G4HadronPhysicsFTFP_BERT()); RegisterPhysics(new G4HadronElasticPhysicsHP()); RegisterPhysics(new G4NeutronTrackingCut()); // Ensure ions and missing particles are defined before processes G4IonConstructor ionConstructor; ionConstructor.ConstructParticle(); // Define all particles to prevent segmentation faults ConstructParticle(); } PhysicsList::~PhysicsList() { } void PhysicsList::ConstructParticle() { G4Gamma::GammaDefinition(); G4Electron::ElectronDefinition(); G4Positron::PositronDefinition(); G4Proton::ProtonDefinition(); G4Neutron::NeutronDefinition(); G4OpticalPhoton::OpticalPhotonDefinition(); } void PhysicsList::ConstructProcess() { // Add Scintillation Process G4Scintillation *scintillation = new G4Scintillation("Scintillation"); scintillation->SetTrackSecondariesFirst(true); // Track optical photons auto particleIterator = G4ParticleTable::GetParticleTable()->GetIterator(); particleIterator->reset(); while ((*particleIterator)()) { G4ParticleDefinition* particle = particleIterator->value(); G4ProcessManager* pmanager = particle->GetProcessManager(); if (scintillation->IsApplicable(*particle)) { pmanager->AddProcess(scintillation); pmanager->SetProcessOrderingToLast(scintillation, idxAtRest); pmanager->SetProcessOrderingToLast(scintillation, idxPostStep); } } AddTransportation(); // Ensure G4EmStandardPhysics is registered only once static bool isEmPhysicsRegistered = false; if (!isEmPhysicsRegistered) { RegisterPhysics(new G4EmStandardPhysics()); // Enables gamma interactions isEmPhysicsRegistered = true; } }