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: PhysicsList.cc 82219 2014-06-12 09:38:27Z gcosmo $ 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 "G4EmLivermorePhysics.hh" 66 #include "G4LossTableManager.hh" << 54 #include "G4EmPenelopePhysics.hh" >> 55 #include "G4EmLowEPPhysics.hh" >> 56 #include "G4DecayPhysics.hh" >> 57 67 #include "G4PAIModel.hh" 58 #include "G4PAIModel.hh" 68 #include "G4PAIPhotModel.hh" 59 #include "G4PAIPhotModel.hh" 69 #include "G4ParticleTable.hh" << 60 70 #include "G4ParticleTypes.hh" << 61 #include "G4Gamma.hh" >> 62 #include "G4Electron.hh" 71 #include "G4Positron.hh" 63 #include "G4Positron.hh" 72 #include "G4ProcessManager.hh" << 73 #include "G4ProductionCutsTable.hh" << 74 #include "G4Proton.hh" 64 #include "G4Proton.hh" 75 #include "G4SystemOfUnits.hh" << 65 76 #include "G4UnitsTable.hh" 66 #include "G4UnitsTable.hh" >> 67 #include "G4SystemOfUnits.hh" >> 68 #include "G4LossTableManager.hh" >> 69 #include "G4ProductionCutsTable.hh" >> 70 >> 71 #include "StepMax.hh" >> 72 >> 73 #include "G4ProcessManager.hh" >> 74 #include "G4ParticleTypes.hh" >> 75 #include "G4ParticleTable.hh" 77 76 78 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 78 80 PhysicsList::PhysicsList(DetectorConstruction* << 79 PhysicsList::PhysicsList() : G4VModularPhysicsList(), >> 80 fConfig(0), >> 81 fEmPhysicsList(0), >> 82 fDecayPhysicsList(0), >> 83 fStepMaxProcess(0), >> 84 fMessenger(0) 81 { 85 { 82 // set verbosity for zero to avoid double pr << 86 fConfig = G4LossTableManager::Instance()->EmConfigurator(); 83 // on physics verbosity should be restored t << 87 G4LossTableManager::Instance()->SetVerbose(1); 84 // are set << 85 G4EmParameters::Instance()->SetVerbose(0); << 86 << 87 SetDefaultCutValue(1 * mm); << 88 88 >> 89 SetDefaultCutValue(1*mm); >> 90 89 fMessenger = new PhysicsListMessenger(this); 91 fMessenger = new PhysicsListMessenger(this); 90 92 >> 93 fStepMaxProcess = new StepMax(); >> 94 91 // Decay Physics is always defined 95 // Decay Physics is always defined 92 fDecayPhysicsList = new G4DecayPhysics(); 96 fDecayPhysicsList = new G4DecayPhysics(); 93 97 94 // EM physics 98 // EM physics 95 fEmName = G4String("emstandard_opt0"); << 99 fEmName = G4String("emstandard"); 96 fEmPhysicsList = new G4EmStandardPhysics(0); << 100 fEmPhysicsList = new G4EmStandardPhysics(1); 97 101 98 SetVerboseLevel(1); 102 SetVerboseLevel(1); 99 } 103 } 100 104 101 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 106 103 PhysicsList::~PhysicsList() 107 PhysicsList::~PhysicsList() 104 { 108 { 105 delete fMessenger; 109 delete fMessenger; 106 delete fDecayPhysicsList; 110 delete fDecayPhysicsList; 107 delete fEmPhysicsList; 111 delete fEmPhysicsList; >> 112 for(size_t i=0; i<fHadronPhys.size(); ++i) { delete fHadronPhys[i]; } >> 113 delete fStepMaxProcess; 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(); >> 130 for(size_t i=0; i<fHadronPhys.size(); ++i) { >> 131 fHadronPhys[i]->ConstructProcess(); } 124 AddStepMax(); 132 AddStepMax(); 125 } 133 } 126 134 127 //....oooOO0OOooo........oooOO0OOooo........oo 135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 128 136 129 void PhysicsList::AddPhysicsList(const G4Strin 137 void PhysicsList::AddPhysicsList(const G4String& name) 130 { 138 { 131 if (verboseLevel > 1) { << 139 if (verboseLevel>1) { 132 G4cout << "PhysicsList::AddPhysicsList: <" 140 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 133 } 141 } 134 142 135 if (name == fEmName) { 143 if (name == fEmName) { 136 return; 144 return; 137 } << 145 138 else if (name == "emstandard_opt0") { << 146 } else if (name == "emstandard_opt1") { 139 fEmName = name; << 147 140 delete fEmPhysicsList; << 141 fEmPhysicsList = new G4EmStandardPhysics(0 << 142 } << 143 else if (name == "emstandard_opt1") { << 144 fEmName = name; << 145 delete fEmPhysicsList; << 146 fEmPhysicsList = new G4EmStandardPhysics_o << 147 } << 148 else if (name == "emstandard_opt2") { << 149 fEmName = name; 148 fEmName = name; 150 delete fEmPhysicsList; 149 delete fEmPhysicsList; 151 fEmPhysicsList = new G4EmStandardPhysics_o << 150 fEmPhysicsList = new G4EmStandardPhysics_option1(); 152 } << 151 153 else if (name == "emstandard_opt3") { << 152 } else if (name == "emstandard_opt2") { >> 153 154 fEmName = name; 154 fEmName = name; 155 delete fEmPhysicsList; 155 delete fEmPhysicsList; 156 fEmPhysicsList = new G4EmStandardPhysics_o << 156 fEmPhysicsList = new G4EmStandardPhysics_option2(); 157 } << 157 158 else if (name == "emstandard_opt4") { << 158 } else if (name == "emstandard_opt3") { >> 159 159 fEmName = name; 160 fEmName = name; 160 delete fEmPhysicsList; 161 delete fEmPhysicsList; 161 fEmPhysicsList = new G4EmStandardPhysics_o << 162 fEmPhysicsList = new G4EmStandardPhysics_option3(); 162 } << 163 163 else if (name == "emstandardWVI") { << 164 } else if (name == "emstandard_opt4") { >> 165 164 fEmName = name; 166 fEmName = name; 165 delete fEmPhysicsList; 167 delete fEmPhysicsList; 166 fEmPhysicsList = new G4EmStandardPhysicsWV << 168 fEmPhysicsList = new G4EmStandardPhysics_option4(); 167 } << 169 168 else if (name == "emstandardSS") { << 170 } else if (name == "emlivermore") { >> 171 169 fEmName = name; 172 fEmName = name; 170 delete fEmPhysicsList; 173 delete fEmPhysicsList; 171 fEmPhysicsList = new G4EmStandardPhysicsSS << 174 fEmPhysicsList = new G4EmLivermorePhysics(); 172 } << 175 173 else if (name == "emstandardGS") { << 176 } else if (name == "empenelope") { >> 177 174 fEmName = name; 178 fEmName = name; 175 delete fEmPhysicsList; 179 delete fEmPhysicsList; 176 fEmPhysicsList = new G4EmStandardPhysicsGS << 180 fEmPhysicsList = new G4EmPenelopePhysics(); 177 } << 181 178 else if (name == "pai") { << 182 } else if (name == "emlowenergy") { 179 G4EmParameters::Instance()->AddPAIModel("a << 183 180 } << 181 else if (name == "pai_photon") { << 182 G4EmParameters::Instance()->AddPAIModel("a << 183 } << 184 else if (name == "emlivermore") { << 185 fEmName = name; 184 fEmName = name; 186 delete fEmPhysicsList; 185 delete fEmPhysicsList; 187 fEmPhysicsList = new G4EmLivermorePhysics( << 186 fEmPhysicsList = new G4EmLowEPPhysics(); 188 } << 187 189 else if (name == "empenelope") { << 188 } else if (name == "pai") { >> 189 190 fEmName = name; 190 fEmName = name; 191 delete fEmPhysicsList; << 191 AddPAIModel(name); 192 fEmPhysicsList = new G4EmPenelopePhysics(0 << 192 193 } << 193 } else if (name == "pai_photon") { 194 else if (name == "emlowenergy") { << 194 195 fEmName = name; 195 fEmName = name; 196 delete fEmPhysicsList; << 196 AddPAIModel(name); 197 fEmPhysicsList = new G4EmLowEPPhysics(0); << 197 198 } << 198 } else { 199 else { << 199 200 G4cout << "PhysicsList::AddPhysicsList: <" 200 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 201 << " is not defined" << G4endl; << 201 << " is not defined" >> 202 << G4endl; 202 } 203 } 203 } 204 } 204 205 205 //....oooOO0OOooo........oooOO0OOooo........oo 206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 206 207 207 void PhysicsList::AddStepMax() 208 void PhysicsList::AddStepMax() 208 { 209 { 209 // Step limitation seen as a process 210 // Step limitation seen as a process 210 StepMax* stepMaxProcess = new StepMax(fDetec << 211 211 212 auto particleIterator = GetParticleIterator( << 212 theParticleIterator->reset(); 213 particleIterator->reset(); << 213 while ((*theParticleIterator)()) 214 while ((*particleIterator)()) { << 214 { 215 G4ParticleDefinition* particle = particleI << 215 G4ParticleDefinition* particle = theParticleIterator->value(); 216 G4ProcessManager* pmanager = particle->Get 216 G4ProcessManager* pmanager = particle->GetProcessManager(); 217 217 218 if (stepMaxProcess->IsApplicable(*particle << 218 if (fStepMaxProcess->IsApplicable(*particle)) 219 pmanager->AddDiscreteProcess(stepMaxProc << 219 { >> 220 pmanager ->AddDiscreteProcess(fStepMaxProcess); 220 } 221 } 221 } 222 } 222 } 223 } 223 224 224 //....oooOO0OOooo........oooOO0OOooo........oo 225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 225 226 226 void PhysicsList::SetCuts() 227 void PhysicsList::SetCuts() 227 { 228 { 228 G4ProductionCutsTable::GetProductionCutsTabl << 229 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(100.*eV,1e5); 229 if (verboseLevel > 0) { << 230 if ( verboseLevel > 0 ) { DumpCutValuesTable(); } 230 DumpCutValuesTable(); << 231 } >> 232 >> 233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 234 >> 235 void PhysicsList::AddPAIModel(const G4String& modname) >> 236 { >> 237 theParticleIterator->reset(); >> 238 while ((*theParticleIterator)()) >> 239 { >> 240 G4ParticleDefinition* particle = theParticleIterator->value(); >> 241 G4String partname = particle->GetParticleName(); >> 242 if(partname == "e-" || partname == "e+") { >> 243 NewPAIModel(particle, modname, "eIoni"); >> 244 >> 245 } else if(partname == "mu-" || partname == "mu+") { >> 246 NewPAIModel(particle, modname, "muIoni"); >> 247 >> 248 } else if(partname == "proton" || >> 249 partname == "pi+" || >> 250 partname == "pi-" >> 251 ) { >> 252 NewPAIModel(particle, modname, "hIoni"); >> 253 } 231 } 254 } 232 } 255 } 233 256 234 //....oooOO0OOooo........oooOO0OOooo........oo 257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 258 >> 259 void PhysicsList::NewPAIModel(const G4ParticleDefinition* part, >> 260 const G4String& modname, >> 261 const G4String& procname) >> 262 { >> 263 G4String partname = part->GetParticleName(); >> 264 if(modname == "pai") { >> 265 G4PAIModel* pai = new G4PAIModel(part,"PAIModel"); >> 266 fConfig->SetExtraEmModel(partname,procname,pai,"GasDetector", >> 267 0.0,100.*TeV,pai); >> 268 } else if(modname == "pai_photon") { >> 269 G4PAIPhotModel* pai = new G4PAIPhotModel(part,"PAIPhotModel"); >> 270 fConfig->SetExtraEmModel(partname,procname,pai,"GasDetector", >> 271 0.0,100.*TeV,pai); >> 272 } >> 273 } >> 274 >> 275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 276 235 277