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.4 2007/03/02 11:08:41 maire Exp $ >> 28 // GEANT4 tag $Name: geant4-08-03-patch-02 $ 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 98 99 auto particleIterator = GetParticleIterator( << 99 #include "G4hIonisation.hh" 100 particleIterator->reset(); << 100 101 while ((*particleIterator)()) { << 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 G4ParticleDefinition* particle = particleI << 102 >> 103 #include "G4EmProcessOptions.hh" >> 104 >> 105 void PhysicsList::ConstructEM() >> 106 { >> 107 theParticleIterator->reset(); >> 108 while( (*theParticleIterator)() ){ >> 109 G4ParticleDefinition* particle = theParticleIterator->value(); 103 G4ProcessManager* pmanager = particle->Get 110 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 111 G4String particleName = particle->GetParticleName(); >> 112 >> 113 if (particleName == "gamma") { >> 114 >> 115 G4ComptonScattering* compton = new G4ComptonScattering(); >> 116 compton->SetModel(comptonModel = new MyKleinNishinaCompton(detector)); >> 117 comptonModel->SetCSFactor(1000.); >> 118 pmanager->AddDiscreteProcess(compton); >> 119 >> 120 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); >> 121 pmanager->AddDiscreteProcess(new G4GammaConversion); >> 122 >> 123 } else if (particleName == "e-") { >> 124 >> 125 pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); >> 126 >> 127 G4eIonisation* eIoni = new G4eIonisation(); >> 128 eIoni->SetEmModel(new MyMollerBhabhaModel); >> 129 pmanager->AddProcess(eIoni, -1, 2,2); >> 130 >> 131 if (registerBrem) { >> 132 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 133 } >> 134 } else if (particleName == "e+") { >> 135 >> 136 pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); >> 137 >> 138 G4eIonisation* pIoni = new G4eIonisation(); >> 139 pIoni->SetEmModel(new MyMollerBhabhaModel); >> 140 pmanager->AddProcess(pIoni, -1, 2,2); >> 141 >> 142 if (registerBrem) { >> 143 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 144 pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); >> 145 } >> 146 >> 147 } else if (particleName == "proton") { 104 148 105 if (stepMaxProcess->IsApplicable(*particle << 149 pmanager->AddProcess(new G4MultipleScattering,-1, 1,1); 106 pmanager->AddDiscreteProcess(stepMaxProc << 150 pmanager->AddProcess(new G4hIonisation, -1, 2,2); 107 } 151 } 108 } 152 } >> 153 >> 154 // Em options >> 155 // >> 156 G4EmProcessOptions emOptions; >> 157 emOptions.SetStepFunction(0.2, 10*um); >> 158 emOptions.SetBuildCSDARange(true); 109 } 159 } 110 160 111 //....oooOO0OOooo........oooOO0OOooo........oo 161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 112 162 113 void PhysicsList::AddPhysicsList(const G4Strin << 163 #include "StepMax.hh" 114 { << 115 if (verboseLevel > 0) { << 116 G4cout << "PhysicsList::AddPhysicsList: <" << 117 } << 118 164 119 if (name == fEmName) return; << 165 void PhysicsList::AddStepMax() >> 166 { >> 167 // Step limitation seen as a process >> 168 StepMax* stepMaxProcess = new StepMax(); 120 169 121 if (name == "standard_opt0") { << 170 theParticleIterator->reset(); 122 fEmName = name; << 171 while ((*theParticleIterator)()){ 123 delete fEmPhysicsList; << 172 G4ParticleDefinition* particle = theParticleIterator->value(); 124 fEmPhysicsList = new PhysListEmStandard_op << 173 G4ProcessManager* pmanager = particle->GetProcessManager(); 125 } << 174 126 else if (name == "standard_opt3") { << 175 if (stepMaxProcess->IsApplicable(*particle)) 127 fEmName = name; << 176 { 128 delete fEmPhysicsList; << 177 pmanager ->AddDiscreteProcess(stepMaxProcess); 129 fEmPhysicsList = new PhysListEmStandard_op << 178 } 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 } 179 } 155 } 180 } 156 181 157 //....oooOO0OOooo........oooOO0OOooo........oo 182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 158 183 >> 184 #include "G4UnitsTable.hh" >> 185 159 void PhysicsList::SetCuts() 186 void PhysicsList::SetCuts() 160 { 187 { 161 if (verboseLevel > 0) { << 188 if (verboseLevel >0){ 162 G4cout << "PhysicsList::SetCuts:"; 189 G4cout << "PhysicsList::SetCuts:"; 163 G4cout << "CutLength : " << G4BestUnit(def << 190 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 164 } 191 } 165 << 192 166 // set cut values for gamma at first and for 193 // set cut values for gamma at first and for e- second and next for e+, 167 // because some processes for e+/e- need cut << 194 // because some processes for e+/e- need cut values for gamma 168 SetCutValue(defaultCutValue, "gamma"); 195 SetCutValue(defaultCutValue, "gamma"); 169 SetCutValue(defaultCutValue, "e-"); 196 SetCutValue(defaultCutValue, "e-"); 170 SetCutValue(defaultCutValue, "e+"); 197 SetCutValue(defaultCutValue, "e+"); 171 SetCutValue(defaultCutValue, "proton"); << 172 } 198 } 173 199 174 //....oooOO0OOooo........oooOO0OOooo........oo 200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 201 >> 202 void PhysicsList::SetComptonCSfactor(G4double factor) >> 203 { >> 204 if (comptonModel) comptonModel->SetCSFactor(factor); >> 205 } >> 206 >> 207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 208 >> 209 void PhysicsList::RegisterBrem(G4bool flag) >> 210 { >> 211 registerBrem = flag; >> 212 } >> 213 >> 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 215 >> 216 >> 217 >> 218 175 219