// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // Code based on the hadrontherapy advanced example #include "PhysicsList.hh" #include "PhysicsListMessenger.hh" #include "G4PhysListFactory.hh" #include "G4VPhysicsConstructor.hh" #include "G4RunManager.hh" #include "G4EmStandardPhysics_option3.hh" #include "G4EmStandardPhysics_option4.hh" #include "G4EmLivermorePhysics.hh" #include "G4EmPenelopePhysics.hh" #include "G4DecayPhysics.hh" #include "G4HadronElasticPhysics.hh" #include "G4HadronDElasticPhysics.hh" #include "G4HadronElasticPhysicsHP.hh" #include "G4IonBinaryCascadePhysics.hh" #include "G4Decay.hh" #include "G4StepLimiter.hh" #include "G4LossTableManager.hh" #include "G4UnitsTable.hh" #include "G4SystemOfUnits.hh" #include "G4ProcessManager.hh" #include "G4IonFluctuations.hh" #include "G4IonParametrisedLossModel.hh" #include "G4EmProcessOptions.hh" #include "G4HadronPhysicsQGSP_BIC_HP.hh" #include "G4RadioactiveDecayPhysics.hh" #include "G4ProcessManager.hh" #include "G4EmExtraPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4IonElasticPhysics.hh" #include "G4Region.hh" #include "G4RegionStore.hh" ///////////////////////////////////////////////////////////////////////////// PhysicsList::PhysicsList() : G4VModularPhysicsList() { G4LossTableManager::Instance(); defaultCutValue = 1*mm; cutForGamma = defaultCutValue; cutForElectron = defaultCutValue; cutForPositron = defaultCutValue; helIsRegisted = false; bicIsRegisted = false; biciIsRegisted = false; locIonIonInelasticIsRegistered = false; radioactiveDecayIsRegisted = false; pMessenger = new PhysicsListMessenger(this); SetVerboseLevel(1); // EM physics emPhysicsList = new G4EmStandardPhysics_option3(1); emName = G4String("emstandard_opt3"); // Decay physics and all particles decPhysicsList = new G4DecayPhysics(); } ///////////////////////////////////////////////////////////////////////////// PhysicsList::~PhysicsList() { delete pMessenger; delete emPhysicsList; delete decPhysicsList; for(size_t i=0; iGetPhysics(i); G4VPhysicsConstructor* tmp = const_cast (elem); while (elem !=0) { RegisterPhysics(tmp); elem= phys->GetPhysics(++i) ; tmp = const_cast (elem); } } ///////////////////////////////////////////////////////////////////////////// void PhysicsList::ConstructParticle() { decPhysicsList->ConstructParticle(); } ///////////////////////////////////////////////////////////////////////////// void PhysicsList::ConstructProcess() { // transportation // AddTransportation(); // electromagnetic physics list // emPhysicsList->ConstructProcess(); em_config.AddModels(); // decay physics list // decPhysicsList->ConstructProcess(); // hadronic physics lists for(size_t i=0; iConstructProcess(); } // step limitation (as a full process) // AddStepMax(); } ///////////////////////////////////////////////////////////////////////////// void PhysicsList::AddPhysicsList(const G4String& name) { if (verboseLevel>1) { G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; } if (name == emName) return; ///////////////////////////////////////////////////////////////////////////// // ELECTROMAGNETIC MODELS ///////////////////////////////////////////////////////////////////////////// if (name == "standard_opt3") { emName = name; delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics_option3(); G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl; } else if (name == "LowE_Livermore") { emName = name; delete emPhysicsList; emPhysicsList = new G4EmLivermorePhysics(); G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; } else if (name == "LowE_Penelope") { emName = name; delete emPhysicsList; emPhysicsList = new G4EmPenelopePhysics(); G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; ///////////////////////////////////////////////////////////////////////////// // HADRONIC MODELS ///////////////////////////////////////////////////////////////////////////// } else if (name == "elastic" && !helIsRegisted) { G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl; hadronPhys.push_back( new G4HadronElasticPhysics()); helIsRegisted = true; } else if (name == "DElastic" && !helIsRegisted) { hadronPhys.push_back( new G4HadronDElasticPhysics()); helIsRegisted = true; } else if (name == "HPElastic" && !helIsRegisted) { hadronPhys.push_back( new G4HadronElasticPhysicsHP()); helIsRegisted = true; } else if (name == "binary" && !bicIsRegisted) { hadronPhys.push_back(new G4HadronPhysicsQGSP_BIC_HP()); bicIsRegisted = true; G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: HadronPhysicsQGSP_BIC_HP()" << G4endl; } else if (name == "binary_ion" && !biciIsRegisted) { hadronPhys.push_back(new G4IonBinaryCascadePhysics()); biciIsRegisted = true; G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4IonBinaryCascadePhysics()" << G4endl; } else if (name == "radioactive_decay" && !radioactiveDecayIsRegisted ) { hadronPhys.push_back(new G4RadioactiveDecayPhysics()); radioactiveDecayIsRegisted = true; G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4RadioactiveDecayPhysics()" << G4endl; } else if (name == "QGSP_BIC_EMZ") { G4cout << "BIC being used" << G4endl; emName = name; delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics_option4(); G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC_HP()); hadronPhys.push_back( new G4HadronElasticPhysicsHP()); hadronPhys.push_back( new G4StoppingPhysics()); hadronPhys.push_back( new G4IonBinaryCascadePhysics()); hadronPhys.push_back( new G4DecayPhysics()); } else { G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << " is not defined" << G4endl; } } void PhysicsList::AddStepMax() { // Step limitation seen as a process auto particleIterator=GetParticleIterator(); particleIterator->reset(); while ((*particleIterator)()) { G4ParticleDefinition* particle = particleIterator->value(); G4ProcessManager* pmanager = particle->GetProcessManager(); pmanager -> AddProcess(new G4StepLimiter(), -1,-1,3); } } void PhysicsList::SetCuts() { if (verboseLevel >0){ G4cout << "PhysicsList::SetCuts:"; G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; } G4double lowLimit = 250. * eV; G4double highLimit = 100. * GeV; G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowLimit, highLimit); // set cut values for gamma at first and for e- second and next for e+, // because some processes for e+/e- need cut values for gamma SetCutValue(cutForGamma, "gamma"); SetCutValue(cutForElectron, "e-"); SetCutValue(cutForPositron, "e+"); G4String regionName0 = "phantomLog"; G4Region* region0 = G4RegionStore::GetInstance()->GetRegion(regionName0); G4ProductionCuts* PhantomRegion = new G4ProductionCuts ; G4double phantomElectronCut = 2*mm; PhantomRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("gamma")); PhantomRegion -> SetProductionCut(phantomElectronCut,G4ProductionCuts::GetIndex("e-")); PhantomRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("e+")); PhantomRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("proton")); region0 -> SetProductionCuts(PhantomRegion); G4String regionName = "cutLog"; G4Region* region = G4RegionStore::GetInstance()->GetRegion(regionName); G4ProductionCuts* CutRegion = new G4ProductionCuts ; G4double regionElectronCut = 1*micrometer; CutRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("gamma")); CutRegion -> SetProductionCut(regionElectronCut,G4ProductionCuts::GetIndex("e-")); CutRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("e+")); CutRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("proton")); region -> SetProductionCuts(CutRegion); G4String regionName2 = "detectorLog"; G4Region* region2 = G4RegionStore::GetInstance()->GetRegion(regionName2); G4ProductionCuts* DetectorRegion = new G4ProductionCuts ; G4double detectorElectronCut = 2*mm; DetectorRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("gamma")); DetectorRegion -> SetProductionCut(detectorElectronCut,G4ProductionCuts::GetIndex("e-")); DetectorRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("e+")); DetectorRegion -> SetProductionCut(defaultCutValue,G4ProductionCuts::GetIndex("proton")); region2 -> SetProductionCuts(DetectorRegion); if (verboseLevel>0) DumpCutValuesTable(); } void PhysicsList::SetCutForGamma(G4double cut) { cutForGamma = cut; SetParticleCuts(cutForGamma, G4Gamma::Gamma()); } void PhysicsList::SetCutForElectron(G4double cut) { cutForElectron = cut; SetParticleCuts(cutForElectron, G4Electron::Electron()); } void PhysicsList::SetCutForPositron(G4double cut) { cutForPositron = cut; SetParticleCuts(cutForPositron, G4Positron::Positron()); }