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