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