Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // This example is provided by the Geant4-DNA collaboration 27 // Any report or published results obtained using the Geant4-DNA software 28 // shall cite the following Geant4-DNA collaboration publication: 29 // Med. Phys. 37 (2010) 4692-4708 30 // The Geant4-DNA web site is available at http://geant4-dna.org 31 // 32 // If you use this example, please cite the following publication: 33 // Rad. Prot. Dos. 133 (2009) 2-11 34 35 #include "PhysicsList.hh" 36 #include "PhysicsListMessenger.hh" 37 38 #include "G4SystemOfUnits.hh" 39 #include "StepMax.hh" 40 #include "G4EmStandardPhysics.hh" 41 #include "G4EmStandardPhysics_option1.hh" 42 #include "G4EmStandardPhysics_option2.hh" 43 #include "G4EmStandardPhysics_option3.hh" 44 #include "G4EmStandardPhysics_option4.hh" 45 #include "G4EmLivermorePhysics.hh" 46 #include "G4EmPenelopePhysics.hh" 47 #include "G4DecayPhysics.hh" 48 #include "G4ProcessManager.hh" 49 #include "G4Gamma.hh" 50 #include "G4Electron.hh" 51 #include "G4Positron.hh" 52 53 PhysicsList::PhysicsList() : G4VModularPhysicsList() 54 { 55 fMessenger = new PhysicsListMessenger(this); 56 57 SetVerboseLevel(1); 58 59 // EM physics 60 fEmName = G4String("emlivermore"); 61 62 fEmPhysicsList = new G4EmLivermorePhysics(); 63 64 // Deacy physics and all particles 65 fDecPhysicsList = new G4DecayPhysics(); 66 } 67 68 PhysicsList::~PhysicsList() 69 { 70 delete fMessenger; 71 delete fEmPhysicsList; 72 delete fDecPhysicsList; 73 } 74 75 void PhysicsList::ConstructParticle() 76 { 77 fDecPhysicsList->ConstructParticle(); 78 } 79 80 void PhysicsList::ConstructProcess() 81 { 82 // transportation 83 AddTransportation(); 84 85 // electromagnetic physics list 86 fEmPhysicsList->ConstructProcess(); 87 88 // decay physics list 89 fDecPhysicsList->ConstructProcess(); 90 91 // step limitation (as a full process) 92 AddStepMax(); 93 94 } 95 96 void PhysicsList::AddPhysicsList(const G4String& name) 97 { 98 if (verboseLevel>1) { 99 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 100 } 101 102 if (name == fEmName) return; 103 104 if (name == "emstandard_opt0") { 105 106 fEmName = name; 107 delete fEmPhysicsList; 108 fEmPhysicsList = new G4EmStandardPhysics(1); 109 110 } else if (name == "emstandard_opt1") { 111 112 fEmName = name; 113 delete fEmPhysicsList; 114 fEmPhysicsList = new G4EmStandardPhysics_option1(); 115 116 } else if (name == "emstandard_opt2") { 117 118 fEmName = name; 119 delete fEmPhysicsList; 120 fEmPhysicsList = new G4EmStandardPhysics_option2(); 121 122 } else if (name == "emstandard_opt3") { 123 124 fEmName = name; 125 delete fEmPhysicsList; 126 fEmPhysicsList = new G4EmStandardPhysics_option3(); 127 128 } else if (name == "emstandard_opt4") { 129 130 fEmName = name; 131 delete fEmPhysicsList; 132 fEmPhysicsList = new G4EmStandardPhysics_option4(); 133 134 } else if (name == "emlivermore") { 135 136 fEmName = name; 137 delete fEmPhysicsList; 138 fEmPhysicsList = new G4EmLivermorePhysics(); 139 140 } else if (name == "empenelope") { 141 142 fEmName = name; 143 delete fEmPhysicsList; 144 fEmPhysicsList = new G4EmPenelopePhysics(); 145 146 } 147 } 148 149 void PhysicsList::AddStepMax() 150 { 151 // Step limitation seen as a process 152 StepMax* stepMaxProcess = new StepMax(fMessenger); 153 154 auto particleIterator=GetParticleIterator(); 155 particleIterator->reset(); 156 while ((*particleIterator)()){ 157 G4ParticleDefinition* particle = particleIterator->value(); 158 G4ProcessManager* pmanager = particle->GetProcessManager(); 159 160 if (stepMaxProcess->IsApplicable(*particle)) 161 { 162 pmanager ->AddDiscreteProcess(stepMaxProcess); 163 } 164 } 165 } 166