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 /// \file electromagnetic/TestEm8/src/PhysicsL 26 /// \file electromagnetic/TestEm8/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id$ 29 // 30 // 30 //-------------------------------------------- 31 //--------------------------------------------------------------------------- 31 // 32 // 32 // ClassName: PhysicsList 33 // ClassName: PhysicsList 33 // 34 // 34 // Description: EM physics with a possibility 35 // Description: EM physics with a possibility to add PAI model 35 // 36 // 36 // Author: V.Ivanchenko 01.09.2010 37 // Author: V.Ivanchenko 01.09.2010 37 // 38 // 38 //-------------------------------------------- 39 //---------------------------------------------------------------------------- 39 // 40 // 40 41 41 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 44 44 #include "PhysicsList.hh" 45 #include "PhysicsList.hh" 45 << 46 #include "DetectorConstruction.hh" << 47 #include "PhysicsListMessenger.hh" 46 #include "PhysicsListMessenger.hh" 48 #include "StepMax.hh" << 49 47 50 #include "G4DecayPhysics.hh" << 51 #include "G4Electron.hh" << 52 #include "G4EmConfigurator.hh" << 53 #include "G4EmLivermorePhysics.hh" << 54 #include "G4EmLowEPPhysics.hh" << 55 #include "G4EmParameters.hh" << 56 #include "G4EmPenelopePhysics.hh" << 57 #include "G4EmStandardPhysics.hh" 48 #include "G4EmStandardPhysics.hh" 58 #include "G4EmStandardPhysicsGS.hh" << 59 #include "G4EmStandardPhysicsSS.hh" << 60 #include "G4EmStandardPhysicsWVI.hh" << 61 #include "G4EmStandardPhysics_option1.hh" 49 #include "G4EmStandardPhysics_option1.hh" 62 #include "G4EmStandardPhysics_option2.hh" 50 #include "G4EmStandardPhysics_option2.hh" 63 #include "G4EmStandardPhysics_option3.hh" 51 #include "G4EmStandardPhysics_option3.hh" 64 #include "G4EmStandardPhysics_option4.hh" 52 #include "G4EmStandardPhysics_option4.hh" 65 #include "G4Gamma.hh" << 53 #include "G4EmStandardPhysicsGS.hh" 66 #include "G4LossTableManager.hh" << 54 #include "G4EmStandardPhysicsSS.hh" >> 55 #include "G4EmStandardPhysicsWVI.hh" >> 56 #include "G4EmLivermorePhysics.hh" >> 57 #include "G4EmPenelopePhysics.hh" >> 58 #include "G4EmLowEPPhysics.hh" >> 59 #include "G4DecayPhysics.hh" >> 60 67 #include "G4PAIModel.hh" 61 #include "G4PAIModel.hh" 68 #include "G4PAIPhotModel.hh" 62 #include "G4PAIPhotModel.hh" 69 #include "G4ParticleTable.hh" << 63 70 #include "G4ParticleTypes.hh" << 64 #include "G4Gamma.hh" >> 65 #include "G4Electron.hh" 71 #include "G4Positron.hh" 66 #include "G4Positron.hh" 72 #include "G4ProcessManager.hh" << 73 #include "G4ProductionCutsTable.hh" << 74 #include "G4Proton.hh" 67 #include "G4Proton.hh" 75 #include "G4SystemOfUnits.hh" << 68 76 #include "G4UnitsTable.hh" 69 #include "G4UnitsTable.hh" >> 70 #include "G4SystemOfUnits.hh" >> 71 #include "G4LossTableManager.hh" >> 72 #include "G4ProductionCutsTable.hh" >> 73 #include "G4EmConfigurator.hh" >> 74 #include "G4EmParameters.hh" >> 75 >> 76 #include "StepMax.hh" >> 77 >> 78 #include "G4ProcessManager.hh" >> 79 #include "G4ParticleTypes.hh" >> 80 #include "G4ParticleTable.hh" >> 81 #include "DetectorConstruction.hh" 77 82 78 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 84 80 PhysicsList::PhysicsList(DetectorConstruction* << 85 PhysicsList::PhysicsList(DetectorConstruction* ptr) >> 86 : G4VModularPhysicsList(), fDetectorConstruction(ptr) 81 { 87 { 82 // set verbosity for zero to avoid double pr << 88 // set verbosity for zero to avoid double printout 83 // on physics verbosity should be restored t 89 // on physics verbosity should be restored to 1 when cuts 84 // are set 90 // are set 85 G4EmParameters::Instance()->SetVerbose(0); 91 G4EmParameters::Instance()->SetVerbose(0); 86 92 87 SetDefaultCutValue(1 * mm); << 93 SetDefaultCutValue(1*mm); 88 << 94 89 fMessenger = new PhysicsListMessenger(this); 95 fMessenger = new PhysicsListMessenger(this); 90 96 91 // Decay Physics is always defined 97 // Decay Physics is always defined 92 fDecayPhysicsList = new G4DecayPhysics(); 98 fDecayPhysicsList = new G4DecayPhysics(); 93 99 94 // EM physics 100 // EM physics 95 fEmName = G4String("emstandard_opt0"); 101 fEmName = G4String("emstandard_opt0"); 96 fEmPhysicsList = new G4EmStandardPhysics(0); 102 fEmPhysicsList = new G4EmStandardPhysics(0); 97 103 98 SetVerboseLevel(1); 104 SetVerboseLevel(1); 99 } 105 } 100 106 101 //....oooOO0OOooo........oooOO0OOooo........oo 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 108 103 PhysicsList::~PhysicsList() 109 PhysicsList::~PhysicsList() 104 { 110 { 105 delete fMessenger; 111 delete fMessenger; 106 delete fDecayPhysicsList; 112 delete fDecayPhysicsList; 107 delete fEmPhysicsList; 113 delete fEmPhysicsList; 108 } 114 } 109 115 110 //....oooOO0OOooo........oooOO0OOooo........oo 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 117 112 void PhysicsList::ConstructParticle() 118 void PhysicsList::ConstructParticle() 113 { 119 { 114 fDecayPhysicsList->ConstructParticle(); 120 fDecayPhysicsList->ConstructParticle(); 115 } 121 } 116 122 117 //....oooOO0OOooo........oooOO0OOooo........oo 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 118 124 119 void PhysicsList::ConstructProcess() 125 void PhysicsList::ConstructProcess() 120 { 126 { 121 AddTransportation(); 127 AddTransportation(); 122 fEmPhysicsList->ConstructProcess(); 128 fEmPhysicsList->ConstructProcess(); 123 fDecayPhysicsList->ConstructProcess(); 129 fDecayPhysicsList->ConstructProcess(); 124 AddStepMax(); 130 AddStepMax(); 125 } 131 } 126 132 127 //....oooOO0OOooo........oooOO0OOooo........oo 133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 128 134 129 void PhysicsList::AddPhysicsList(const G4Strin 135 void PhysicsList::AddPhysicsList(const G4String& name) 130 { 136 { 131 if (verboseLevel > 1) { << 137 if (verboseLevel>1) { 132 G4cout << "PhysicsList::AddPhysicsList: <" 138 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 133 } 139 } 134 140 135 if (name == fEmName) { 141 if (name == fEmName) { 136 return; 142 return; 137 } << 143 138 else if (name == "emstandard_opt0") { << 144 } else if (name == "emstandard_opt0") { >> 145 139 fEmName = name; 146 fEmName = name; 140 delete fEmPhysicsList; 147 delete fEmPhysicsList; 141 fEmPhysicsList = new G4EmStandardPhysics(0 148 fEmPhysicsList = new G4EmStandardPhysics(0); 142 } << 149 143 else if (name == "emstandard_opt1") { << 150 } else if (name == "emstandard_opt1") { >> 151 144 fEmName = name; 152 fEmName = name; 145 delete fEmPhysicsList; 153 delete fEmPhysicsList; 146 fEmPhysicsList = new G4EmStandardPhysics_o 154 fEmPhysicsList = new G4EmStandardPhysics_option1(0); 147 } << 155 148 else if (name == "emstandard_opt2") { << 156 } else if (name == "emstandard_opt2") { >> 157 149 fEmName = name; 158 fEmName = name; 150 delete fEmPhysicsList; 159 delete fEmPhysicsList; 151 fEmPhysicsList = new G4EmStandardPhysics_o 160 fEmPhysicsList = new G4EmStandardPhysics_option2(0); 152 } << 161 153 else if (name == "emstandard_opt3") { << 162 } else if (name == "emstandard_opt3") { >> 163 154 fEmName = name; 164 fEmName = name; 155 delete fEmPhysicsList; 165 delete fEmPhysicsList; 156 fEmPhysicsList = new G4EmStandardPhysics_o 166 fEmPhysicsList = new G4EmStandardPhysics_option3(0); 157 } << 167 158 else if (name == "emstandard_opt4") { << 168 } else if (name == "emstandard_opt4") { >> 169 159 fEmName = name; 170 fEmName = name; 160 delete fEmPhysicsList; 171 delete fEmPhysicsList; 161 fEmPhysicsList = new G4EmStandardPhysics_o 172 fEmPhysicsList = new G4EmStandardPhysics_option4(0); 162 } << 173 163 else if (name == "emstandardWVI") { << 174 } else if (name == "emstandardWVI") { >> 175 164 fEmName = name; 176 fEmName = name; 165 delete fEmPhysicsList; 177 delete fEmPhysicsList; 166 fEmPhysicsList = new G4EmStandardPhysicsWV 178 fEmPhysicsList = new G4EmStandardPhysicsWVI(0); 167 } << 179 168 else if (name == "emstandardSS") { << 180 } else if (name == "emstandardSS") { >> 181 169 fEmName = name; 182 fEmName = name; 170 delete fEmPhysicsList; 183 delete fEmPhysicsList; 171 fEmPhysicsList = new G4EmStandardPhysicsSS 184 fEmPhysicsList = new G4EmStandardPhysicsSS(0); 172 } << 185 173 else if (name == "emstandardGS") { << 186 } else if (name == "emstandardGS") { >> 187 174 fEmName = name; 188 fEmName = name; 175 delete fEmPhysicsList; 189 delete fEmPhysicsList; 176 fEmPhysicsList = new G4EmStandardPhysicsGS 190 fEmPhysicsList = new G4EmStandardPhysicsGS(0); 177 } << 191 178 else if (name == "pai") { << 192 } else if (name == "pai") { 179 G4EmParameters::Instance()->AddPAIModel("a << 193 G4EmParameters::Instance()->AddPAIModel("all","world","pai"); 180 } << 194 181 else if (name == "pai_photon") { << 195 } else if (name == "pai_photon") { 182 G4EmParameters::Instance()->AddPAIModel("a << 196 G4EmParameters::Instance()->AddPAIModel("all","world","pai_photon"); 183 } << 197 184 else if (name == "emlivermore") { << 198 } else if (name == "emlivermore") { >> 199 185 fEmName = name; 200 fEmName = name; 186 delete fEmPhysicsList; 201 delete fEmPhysicsList; 187 fEmPhysicsList = new G4EmLivermorePhysics( 202 fEmPhysicsList = new G4EmLivermorePhysics(0); 188 } << 203 189 else if (name == "empenelope") { << 204 } else if (name == "empenelope") { >> 205 190 fEmName = name; 206 fEmName = name; 191 delete fEmPhysicsList; 207 delete fEmPhysicsList; 192 fEmPhysicsList = new G4EmPenelopePhysics(0 208 fEmPhysicsList = new G4EmPenelopePhysics(0); 193 } << 209 194 else if (name == "emlowenergy") { << 210 } else if (name == "emlowenergy") { >> 211 195 fEmName = name; 212 fEmName = name; 196 delete fEmPhysicsList; 213 delete fEmPhysicsList; 197 fEmPhysicsList = new G4EmLowEPPhysics(0); 214 fEmPhysicsList = new G4EmLowEPPhysics(0); 198 } << 215 199 else { << 216 } else { >> 217 200 G4cout << "PhysicsList::AddPhysicsList: <" 218 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 201 << " is not defined" << G4endl; << 219 << " is not defined" >> 220 << G4endl; 202 } 221 } 203 } 222 } 204 223 205 //....oooOO0OOooo........oooOO0OOooo........oo 224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 206 225 207 void PhysicsList::AddStepMax() 226 void PhysicsList::AddStepMax() 208 { 227 { 209 // Step limitation seen as a process 228 // Step limitation seen as a process 210 StepMax* stepMaxProcess = new StepMax(fDetec 229 StepMax* stepMaxProcess = new StepMax(fDetectorConstruction); 211 230 212 auto particleIterator = GetParticleIterator( << 231 auto particleIterator=GetParticleIterator(); 213 particleIterator->reset(); 232 particleIterator->reset(); 214 while ((*particleIterator)()) { << 233 while ((*particleIterator)()) >> 234 { 215 G4ParticleDefinition* particle = particleI 235 G4ParticleDefinition* particle = particleIterator->value(); 216 G4ProcessManager* pmanager = particle->Get 236 G4ProcessManager* pmanager = particle->GetProcessManager(); 217 237 218 if (stepMaxProcess->IsApplicable(*particle << 238 if (stepMaxProcess->IsApplicable(*particle)) >> 239 { 219 pmanager->AddDiscreteProcess(stepMaxProc 240 pmanager->AddDiscreteProcess(stepMaxProcess); 220 } 241 } 221 } 242 } 222 } 243 } 223 244 224 //....oooOO0OOooo........oooOO0OOooo........oo 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 225 246 226 void PhysicsList::SetCuts() 247 void PhysicsList::SetCuts() 227 { 248 { 228 G4ProductionCutsTable::GetProductionCutsTabl << 249 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(25.*eV,1e5); 229 if (verboseLevel > 0) { << 250 if ( verboseLevel > 0 ) { DumpCutValuesTable(); } 230 DumpCutValuesTable(); << 231 } << 232 } 251 } 233 252 234 //....oooOO0OOooo........oooOO0OOooo........oo 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 254 235 255