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 medical/fanoCavity/src/PhysicsList.c << 27 /// \brief Implementation of the PhysicsList c << 28 // 26 // >> 27 // $Id: PhysicsList.cc,v 1.6 2007/06/27 13:47:25 maire Exp $ >> 28 // GEANT4 tag $Name: geant4-09-00-patch-01 $ 29 // 29 // >> 30 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "PhysicsList.hh" 34 #include "PhysicsList.hh" 34 << 35 #include "PhysListEmStandard_GS.hh" << 36 #include "PhysListEmStandard_SS.hh" << 37 #include "PhysListEmStandard_WVI.hh" << 38 #include "PhysListEmStandard_option0.hh" << 39 #include "PhysListEmStandard_option3.hh" << 40 #include "PhysListEmStandard_option4.hh" << 41 #include "PhysicsListMessenger.hh" 35 #include "PhysicsListMessenger.hh" 42 #include "StepMax.hh" << 36 #include "DetectorConstruction.hh" 43 37 44 #include "G4EmBuilder.hh" << 45 #include "G4LossTableManager.hh" << 46 #include "G4ParticleDefinition.hh" 38 #include "G4ParticleDefinition.hh" >> 39 #include "G4ParticleTypes.hh" >> 40 #include "G4ParticleTable.hh" >> 41 47 #include "G4ProcessManager.hh" 42 #include "G4ProcessManager.hh" 48 #include "G4SystemOfUnits.hh" << 43 #include "G4LossTableManager.hh" 49 #include "G4UnitsTable.hh" << 50 44 51 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 52 46 53 PhysicsList::PhysicsList(DetectorConstruction* << 47 PhysicsList::PhysicsList(DetectorConstruction* det) >> 48 : G4VUserPhysicsList(), detector(det) 54 { 49 { 55 G4LossTableManager::Instance(); << 50 defaultCutValue = 10.*km; 56 fMessenger = new PhysicsListMessenger(this); << 51 registerBrem = false; 57 << 52 pMessenger = new PhysicsListMessenger(this); 58 // EM physics << 59 fEmName = G4String("standard_opt3"); << 60 fEmPhysicsList = new PhysListEmStandard_opti << 61 << 62 defaultCutValue = 10 * km; << 63 << 64 SetVerboseLevel(1); 53 SetVerboseLevel(1); >> 54 >> 55 G4LossTableManager::Instance(); 65 } 56 } 66 57 67 //....oooOO0OOooo........oooOO0OOooo........oo 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 68 59 69 PhysicsList::~PhysicsList() 60 PhysicsList::~PhysicsList() 70 { << 61 { delete pMessenger; } 71 delete fEmPhysicsList; << 72 delete fMessenger; << 73 } << 74 62 75 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 64 77 void PhysicsList::ConstructParticle() 65 void PhysicsList::ConstructParticle() 78 { 66 { 79 G4EmBuilder::ConstructMinimalEmSet(); << 67 G4Geantino::GeantinoDefinition(); >> 68 G4Gamma::GammaDefinition(); >> 69 >> 70 G4Electron::ElectronDefinition(); >> 71 G4Positron::PositronDefinition(); >> 72 >> 73 G4Proton::ProtonDefinition(); 80 } 74 } 81 75 82 //....oooOO0OOooo........oooOO0OOooo........oo 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 83 77 84 void PhysicsList::ConstructProcess() 78 void PhysicsList::ConstructProcess() 85 { 79 { 86 AddTransportation(); 80 AddTransportation(); 87 fEmPhysicsList->ConstructProcess(); << 81 ConstructEM(); 88 << 89 AddStepMax(); 82 AddStepMax(); 90 } 83 } 91 84 92 //....oooOO0OOooo........oooOO0OOooo........oo 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 86 94 void PhysicsList::AddStepMax() << 87 #include "G4ComptonScattering.hh" 95 { << 88 #include "MyKleinNishinaCompton.hh" 96 // Step limitation seen as a process << 89 #include "G4GammaConversion.hh" 97 StepMax* stepMaxProcess = new StepMax(); << 90 #include "G4PhotoElectricEffect.hh" >> 91 >> 92 #include "G4MultipleScattering.hh" >> 93 >> 94 #include "G4eIonisation.hh" >> 95 #include "MyMollerBhabhaModel.hh" >> 96 #include "G4eBremsstrahlung.hh" >> 97 #include "G4eplusAnnihilation.hh" >> 98 >> 99 #include "G4hIonisation.hh" 98 100 99 auto particleIterator = GetParticleIterator( << 101 #include "G4EmProcessOptions.hh" 100 particleIterator->reset(); << 102 #include "G4MscStepLimitType.hh" 101 while ((*particleIterator)()) { << 103 102 G4ParticleDefinition* particle = particleI << 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 105 >> 106 >> 107 void PhysicsList::ConstructEM() >> 108 { >> 109 theParticleIterator->reset(); >> 110 while( (*theParticleIterator)() ){ >> 111 G4ParticleDefinition* particle = theParticleIterator->value(); 103 G4ProcessManager* pmanager = particle->Get 112 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 113 G4String particleName = particle->GetParticleName(); >> 114 >> 115 if (particleName == "gamma") { >> 116 >> 117 G4ComptonScattering* compton = new G4ComptonScattering(); >> 118 compton->SetModel(comptonModel = new MyKleinNishinaCompton(detector)); >> 119 comptonModel->SetCSFactor(1000.); >> 120 pmanager->AddDiscreteProcess(compton); >> 121 >> 122 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); >> 123 pmanager->AddDiscreteProcess(new G4GammaConversion); >> 124 >> 125 } else if (particleName == "e-") { >> 126 >> 127 pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); >> 128 >> 129 G4eIonisation* eIoni = new G4eIonisation(); >> 130 eIoni->SetEmModel(new MyMollerBhabhaModel); >> 131 pmanager->AddProcess(eIoni, -1, 2,2); >> 132 >> 133 if (registerBrem) { >> 134 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 135 } >> 136 } else if (particleName == "e+") { >> 137 >> 138 pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); >> 139 >> 140 G4eIonisation* pIoni = new G4eIonisation(); >> 141 pIoni->SetEmModel(new MyMollerBhabhaModel); >> 142 pmanager->AddProcess(pIoni, -1, 2,2); >> 143 >> 144 if (registerBrem) { >> 145 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 146 pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); >> 147 } >> 148 >> 149 } else if (particleName == "proton") { 104 150 105 if (stepMaxProcess->IsApplicable(*particle << 151 pmanager->AddProcess(new G4MultipleScattering,-1, 1,1); 106 pmanager->AddDiscreteProcess(stepMaxProc << 152 pmanager->AddProcess(new G4hIonisation, -1, 2,2); 107 } 153 } 108 } 154 } >> 155 >> 156 // Em options >> 157 // >> 158 G4EmProcessOptions emOptions; >> 159 >> 160 //multiple scattering >> 161 // >> 162 emOptions.SetMscStepLimitation(fUseDistanceToBoundary); >> 163 emOptions.SetSkin(2.); >> 164 >> 165 //energy loss >> 166 // >> 167 emOptions.SetLinearLossLimit(1.e-6); >> 168 emOptions.SetStepFunction(0.2, 10*um); >> 169 >> 170 //build CSDA range >> 171 // >> 172 emOptions.SetBuildCSDARange(true); 109 } 173 } 110 174 111 //....oooOO0OOooo........oooOO0OOooo........oo 175 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 112 176 113 void PhysicsList::AddPhysicsList(const G4Strin << 177 #include "StepMax.hh" 114 { << 115 if (verboseLevel > 0) { << 116 G4cout << "PhysicsList::AddPhysicsList: <" << 117 } << 118 178 119 if (name == fEmName) return; << 179 void PhysicsList::AddStepMax() >> 180 { >> 181 // Step limitation seen as a process >> 182 StepMax* stepMaxProcess = new StepMax(); 120 183 121 if (name == "standard_opt0") { << 184 theParticleIterator->reset(); 122 fEmName = name; << 185 while ((*theParticleIterator)()){ 123 delete fEmPhysicsList; << 186 G4ParticleDefinition* particle = theParticleIterator->value(); 124 fEmPhysicsList = new PhysListEmStandard_op << 187 G4ProcessManager* pmanager = particle->GetProcessManager(); 125 } << 188 126 else if (name == "standard_opt3") { << 189 if (stepMaxProcess->IsApplicable(*particle)) 127 fEmName = name; << 190 { 128 delete fEmPhysicsList; << 191 pmanager ->AddDiscreteProcess(stepMaxProcess); 129 fEmPhysicsList = new PhysListEmStandard_op << 192 } 130 } << 131 else if (name == "standard_opt4") { << 132 fEmName = name; << 133 delete fEmPhysicsList; << 134 fEmPhysicsList = new PhysListEmStandard_op << 135 } << 136 else if (name == "standard_GS") { << 137 fEmName = name; << 138 delete fEmPhysicsList; << 139 fEmPhysicsList = new PhysListEmStandard_GS << 140 } << 141 else if (name == "standard_WVI") { << 142 fEmName = name; << 143 delete fEmPhysicsList; << 144 fEmPhysicsList = new PhysListEmStandard_WV << 145 } << 146 else if (name == "standard_SS") { << 147 fEmName = name; << 148 delete fEmPhysicsList; << 149 fEmPhysicsList = new PhysListEmStandard_SS << 150 } << 151 else { << 152 G4cout << "PhysicsList::AddPhysicsList: <" << 153 << " is not defined" << G4endl; << 154 } 193 } 155 } 194 } 156 195 157 //....oooOO0OOooo........oooOO0OOooo........oo 196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 158 197 >> 198 #include "G4UnitsTable.hh" >> 199 159 void PhysicsList::SetCuts() 200 void PhysicsList::SetCuts() 160 { 201 { 161 if (verboseLevel > 0) { << 202 if (verboseLevel >0){ 162 G4cout << "PhysicsList::SetCuts:"; 203 G4cout << "PhysicsList::SetCuts:"; 163 G4cout << "CutLength : " << G4BestUnit(def << 204 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 164 } 205 } 165 << 206 166 // set cut values for gamma at first and for 207 // set cut values for gamma at first and for e- second and next for e+, 167 // because some processes for e+/e- need cut << 208 // because some processes for e+/e- need cut values for gamma 168 SetCutValue(defaultCutValue, "gamma"); 209 SetCutValue(defaultCutValue, "gamma"); 169 SetCutValue(defaultCutValue, "e-"); 210 SetCutValue(defaultCutValue, "e-"); 170 SetCutValue(defaultCutValue, "e+"); 211 SetCutValue(defaultCutValue, "e+"); 171 SetCutValue(defaultCutValue, "proton"); << 172 } 212 } 173 213 174 //....oooOO0OOooo........oooOO0OOooo........oo 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 215 >> 216 void PhysicsList::SetComptonCSfactor(G4double factor) >> 217 { >> 218 if (comptonModel) comptonModel->SetCSFactor(factor); >> 219 } >> 220 >> 221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 222 >> 223 void PhysicsList::RegisterBrem(G4bool flag) >> 224 { >> 225 registerBrem = flag; >> 226 } >> 227 >> 228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 229 >> 230 >> 231 >> 232 175 233