Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // This example is provided by the Geant4-DNA 27 // Any report or published results obtained us 28 // shall cite the following Geant4-DNA collabo 29 // Med. Phys. 37 (2010) 4692-4708 30 // The Geant4-DNA web site is available at htt 31 // 32 // If you use this example, please cite the fo 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() : G4VModularPhysics 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 G4Strin 97 { 98 if (verboseLevel>1) { 99 G4cout << "PhysicsList::AddPhysicsList: <" 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_o 115 116 } else if (name == "emstandard_opt2") { 117 118 fEmName = name; 119 delete fEmPhysicsList; 120 fEmPhysicsList = new G4EmStandardPhysics_o 121 122 } else if (name == "emstandard_opt3") { 123 124 fEmName = name; 125 delete fEmPhysicsList; 126 fEmPhysicsList = new G4EmStandardPhysics_o 127 128 } else if (name == "emstandard_opt4") { 129 130 fEmName = name; 131 delete fEmPhysicsList; 132 fEmPhysicsList = new G4EmStandardPhysics_o 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(fMesse 153 154 auto particleIterator=GetParticleIterator(); 155 particleIterator->reset(); 156 while ((*particleIterator)()){ 157 G4ParticleDefinition* particle = particleI 158 G4ProcessManager* pmanager = particle->Get 159 160 if (stepMaxProcess->IsApplicable(*particle 161 { 162 pmanager ->AddDiscreteProcess(stepMaxP 163 } 164 } 165 } 166