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 polarisation/Pol01/src/PhysicsList.c << 26 // 27 /// \brief Implementation of the PhysicsList c << 27 // $Id: PhysicsList.cc,v 1.2 2006/10/02 16:25:55 vnivanch Exp $ 28 // << 28 // GEANT4 tag $Name: geant4-09-02 $ 29 // << 30 // 29 // 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 32 34 #include "PhysicsList.hh" 33 #include "PhysicsList.hh" 35 << 36 #include "PhysListEmPolarized.hh" << 37 #include "PhysicsListMessenger.hh" 34 #include "PhysicsListMessenger.hh" 38 #include "StepMax.hh" << 35 >> 36 #include "PhysListEmStandard.hh" >> 37 #include "PhysListEmPolarized.hh" 39 38 40 #include "G4EmBuilder.hh" << 39 #include "G4LossTableManager.hh" 41 #include "G4EmParameters.hh" << 40 #include "G4UnitsTable.hh" 42 #include "G4EmStandardPhysics.hh" << 43 #include "G4ProcessManager.hh" << 44 41 45 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 43 47 PhysicsList::PhysicsList() << 44 PhysicsList::PhysicsList() 48 : G4VModularPhysicsList(), fEmPhysicsList(0) << 45 : G4VModularPhysicsList() 49 { 46 { 50 fMessenger = new PhysicsListMessenger(this); << 47 G4LossTableManager::Instance(); >> 48 >> 49 currentDefaultCut = 0.1*mm; >> 50 cutForGamma = currentDefaultCut; >> 51 cutForElectron = currentDefaultCut; >> 52 cutForPositron = currentDefaultCut; 51 53 52 G4EmParameters::Instance(); << 54 pMessenger = new PhysicsListMessenger(this); 53 55 54 SetVerboseLevel(1); 56 SetVerboseLevel(1); 55 57 56 fEmPhysicsList = new PhysListEmPolarized(); << 58 emName = "polarized"; >> 59 emPhysicsList = new PhysListEmPolarized(); >> 60 57 } 61 } 58 62 59 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 64 61 PhysicsList::~PhysicsList() 65 PhysicsList::~PhysicsList() 62 { 66 { 63 delete fMessenger; << 67 delete pMessenger; 64 } 68 } 65 69 66 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 67 71 >> 72 // Bosons >> 73 #include "G4Gamma.hh" >> 74 >> 75 // leptons >> 76 #include "G4Electron.hh" >> 77 #include "G4Positron.hh" >> 78 >> 79 >> 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 81 68 void PhysicsList::ConstructParticle() 82 void PhysicsList::ConstructParticle() 69 { 83 { 70 // minimal set of particles for EM physics << 84 // only QED in this example 71 G4EmBuilder::ConstructMinimalEmSet(); << 85 >> 86 // gamma >> 87 G4Gamma::GammaDefinition(); >> 88 >> 89 // leptons >> 90 G4Electron::ElectronDefinition(); >> 91 G4Positron::PositronDefinition(); 72 } 92 } 73 93 74 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 95 >> 96 #include "G4EmProcessOptions.hh" >> 97 76 void PhysicsList::ConstructProcess() 98 void PhysicsList::ConstructProcess() 77 { 99 { 78 // Transportation 100 // Transportation 79 // 101 // 80 AddTransportation(); 102 AddTransportation(); 81 103 82 // Electromagnetic physics list 104 // Electromagnetic physics list 83 // 105 // 84 fEmPhysicsList->ConstructProcess(); << 106 emPhysicsList->ConstructProcess(); 85 << 107 86 // step limitation (as a full process) 108 // step limitation (as a full process) 87 // << 109 // 88 AddStepMax(); << 110 AddStepMax(); 89 } 111 } 90 112 91 //....oooOO0OOooo........oooOO0OOooo........oo 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 114 93 void PhysicsList::AddPhysicsList(const G4Strin 115 void PhysicsList::AddPhysicsList(const G4String& name) 94 { 116 { 95 if (verboseLevel > 0) { << 117 if (verboseLevel>0) { 96 G4cout << "PhysicsList::AddPhysicsList: <" 118 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 97 } 119 } 98 << 120 99 if (name == fEmName) return; << 121 if (name == emName) return; 100 122 101 if (name == "standard") { 123 if (name == "standard") { 102 fEmName = name; << 124 103 delete fEmPhysicsList; << 125 emName = name; 104 fEmPhysicsList = new G4EmStandardPhysics() << 126 delete emPhysicsList; 105 } << 127 emPhysicsList = new PhysListEmStandard(); 106 else if (name == "polarized") { << 128 107 fEmName = name; << 129 } 108 delete fEmPhysicsList; << 130 if (name == "polarized") { 109 fEmPhysicsList = new PhysListEmPolarized() << 131 110 } << 132 emName = name; >> 133 delete emPhysicsList; >> 134 emPhysicsList = new PhysListEmPolarized(); >> 135 >> 136 } 111 else { 137 else { 112 G4cout << "PhysicsList::AddPhysicsList: <" 138 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 113 << " is not defined" << G4endl; << 139 << " is not defined" >> 140 << G4endl; 114 } 141 } 115 } 142 } 116 143 117 //....oooOO0OOooo........oooOO0OOooo........oo 144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 118 145 >> 146 #include "G4ProcessManager.hh" >> 147 #include "StepMax.hh" >> 148 119 void PhysicsList::AddStepMax() 149 void PhysicsList::AddStepMax() 120 { 150 { 121 // Step limitation seen as a process 151 // Step limitation seen as a process 122 StepMax* stepMaxProcess = new StepMax(); 152 StepMax* stepMaxProcess = new StepMax(); 123 153 124 auto particleIterator = GetParticleIterator( << 154 theParticleIterator->reset(); 125 particleIterator->reset(); << 155 while ((*theParticleIterator)()){ 126 while ((*particleIterator)()) { << 156 G4ParticleDefinition* particle = theParticleIterator->value(); 127 G4ParticleDefinition* particle = particleI << 157 G4ProcessManager* pmanager = particle->GetProcessManager(); 128 G4ProcessManager* pmanager = particle->Get << 129 158 130 if (stepMaxProcess->IsApplicable(*particle << 159 if (stepMaxProcess->IsApplicable(*particle) && pmanager) 131 pmanager->AddDiscreteProcess(stepMaxProc << 160 pmanager ->AddDiscreteProcess(stepMaxProcess); 132 } 161 } >> 162 } >> 163 >> 164 >> 165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 166 >> 167 #include "G4Gamma.hh" >> 168 #include "G4Electron.hh" >> 169 #include "G4Positron.hh" >> 170 >> 171 void PhysicsList::SetCuts() >> 172 { >> 173 // set cut values for gamma at first and for e- second and next for e+, >> 174 // because some processes for e+/e- need cut values for gamma >> 175 SetCutValue(cutForGamma, "gamma"); >> 176 SetCutValue(cutForElectron, "e-"); >> 177 SetCutValue(cutForPositron, "e+"); >> 178 } >> 179 >> 180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 181 >> 182 void PhysicsList::SetCutForGamma(G4double cut) >> 183 { >> 184 cutForGamma = cut; >> 185 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 186 } >> 187 >> 188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 189 >> 190 void PhysicsList::SetCutForElectron(G4double cut) >> 191 { >> 192 cutForElectron = cut; >> 193 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 194 } >> 195 >> 196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 197 >> 198 void PhysicsList::SetCutForPositron(G4double cut) >> 199 { >> 200 cutForPositron = cut; >> 201 SetParticleCuts(cutForPositron, G4Positron::Positron()); 133 } 202 } 134 203 135 //....oooOO0OOooo........oooOO0OOooo........oo 204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 136 205