source: trunk/examples/extended/electromagnetic/TestEm6/src/PhysicsList.cc

Last change on this file was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 11.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id: PhysicsList.cc,v 1.15 2010/03/31 09:26:09 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "PhysicsList.hh"
33#include "PhysicsListMessenger.hh"
34
35#include "G4ParticleDefinition.hh"
36#include "G4ProcessManager.hh"
37#include "G4ParticleTypes.hh"
38#include "G4ParticleTable.hh"
39
40#include "G4Proton.hh"
41#include "G4AntiProton.hh"
42#include "G4Neutron.hh"
43#include "G4AntiNeutron.hh"
44
45#include "G4GammaConversionToMuons.hh"
46
47#include "G4eMultipleScattering.hh"
48#include "G4MuMultipleScattering.hh"
49#include "G4hMultipleScattering.hh"
50
51#include "G4eIonisation.hh"
52#include "G4eBremsstrahlung.hh"
53#include "G4eplusAnnihilation.hh"
54#include "G4AnnihiToMuPair.hh"
55
56#include "G4MuIonisation.hh"
57#include "G4MuBremsstrahlung.hh"
58#include "G4MuPairProduction.hh"
59
60#include "G4hIonisation.hh"
61#include "G4hhIonisation.hh"
62#include "G4ionIonisation.hh"
63#include "G4eeToHadrons.hh"
64
65#include "G4Decay.hh"
66#include "G4EmProcessOptions.hh"
67
68#include "G4StepLimiter.hh"
69
70#include "G4ProcessTable.hh"
71
72#include "G4ComptonScattering.hh"
73#include "G4GammaConversion.hh"
74#include "G4PhotoElectricEffect.hh"
75
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78
79PhysicsList::PhysicsList()
80: G4VUserPhysicsList()
81{
82 defaultCutValue = 1.*km;
83 pMes = new PhysicsListMessenger(this);
84 SetVerboseLevel(1);
85}
86
87//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88
89PhysicsList::~PhysicsList()
90{
91 delete pMes;
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
96void PhysicsList::ConstructParticle()
97{
98 // In this method, static member functions should be called
99 // for all particles which you want to use.
100 // This ensures that objects of these particle types will be
101 // created in the program.
102
103 ConstructBosons();
104 ConstructLeptons();
105 ConstructHadrons();
106}
107
108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109
110void PhysicsList::ConstructBosons()
111{
112 // pseudo-particles
113 G4Geantino::GeantinoDefinition();
114 G4ChargedGeantino::ChargedGeantinoDefinition();
115
116 // gamma
117 G4Gamma::GammaDefinition();
118}
119
120//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121
122void PhysicsList::ConstructLeptons()
123{
124 // leptons
125 G4Electron::ElectronDefinition();
126 G4Positron::PositronDefinition();
127 G4MuonPlus::MuonPlusDefinition();
128 G4MuonMinus::MuonMinusDefinition();
129
130 G4NeutrinoE::NeutrinoEDefinition();
131 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
132 G4NeutrinoMu::NeutrinoMuDefinition();
133 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
134}
135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136
137void PhysicsList::ConstructHadrons()
138{
139 // mesons
140 G4PionPlus::PionPlusDefinition();
141 G4PionMinus::PionMinusDefinition();
142 G4PionZero::PionZeroDefinition();
143 G4Eta::EtaDefinition();
144 G4EtaPrime::EtaPrimeDefinition();
145 G4KaonPlus::KaonPlusDefinition();
146 G4KaonMinus::KaonMinusDefinition();
147 G4KaonZero::KaonZeroDefinition();
148 G4AntiKaonZero::AntiKaonZeroDefinition();
149 G4KaonZeroLong::KaonZeroLongDefinition();
150 G4KaonZeroShort::KaonZeroShortDefinition();
151
152 // baryons
153 G4Proton::ProtonDefinition();
154 G4AntiProton::AntiProtonDefinition();
155 G4Neutron::NeutronDefinition();
156 G4AntiNeutron::AntiNeutronDefinition();
157}
158
159//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160
161void PhysicsList::ConstructProcess()
162{
163 AddTransportation();
164 ConstructEM();
165 ConstructGeneral();
166}
167
168//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169
170void PhysicsList::ConstructEM()
171{
172 theParticleIterator->reset();
173 while( (*theParticleIterator)() ){
174 G4ParticleDefinition* particle = theParticleIterator->value();
175 G4ProcessManager* pmanager = particle->GetProcessManager();
176 G4String particleName = particle->GetParticleName();
177
178 if (particleName == "gamma") {
179 // gamma allow only gamma -> mu+mu-
180 pmanager->AddDiscreteProcess(new G4GammaConversionToMuons);
181 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
182 pmanager->AddDiscreteProcess(new G4ComptonScattering);
183 pmanager->AddDiscreteProcess(new G4GammaConversion);
184
185 } else if (particleName == "e-") {
186 //electron
187 pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1);
188 pmanager->AddProcess(new G4eIonisation, -1, 2,2);
189 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
190 pmanager->AddProcess(new G4StepLimiter, -1,-1,4);
191
192 } else if (particleName == "e+") {
193 //positron
194 // to make the process of e+e- annihilation more visible,
195 // do not enable the other standard processes:
196 //pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1);
197 //pmanager->AddProcess(new G4eIonisation, -1, 2,2);
198 //pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
199 //pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
200
201 pmanager->AddDiscreteProcess(new G4AnnihiToMuPair);
202 pmanager->AddDiscreteProcess(new G4eeToHadrons);
203 pmanager->AddDiscreteProcess(new G4StepLimiter);
204
205 } else if( particleName == "mu+" ||
206 particleName == "mu-" ) {
207 //muon
208 pmanager->AddProcess(new G4MuMultipleScattering,-1, 1,1);
209 pmanager->AddProcess(new G4MuIonisation, -1, 2,2);
210 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3,3);
211 pmanager->AddProcess(new G4MuPairProduction, -1, 4,4);
212 pmanager->AddProcess(new G4StepLimiter, -1,-1,5);
213
214 } else if( particleName == "anti_proton") {
215 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
216 pmanager->AddProcess(new G4hhIonisation, -1, 2,2);
217 pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
218
219 } else if( particleName == "GenericIon") {
220 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
221 pmanager->AddProcess(new G4ionIonisation, -1, 2,2);
222 pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
223
224 } else if( particle->GetPDGCharge() != 0.0 && !particle->IsShortLived()
225 && particleName != "chargedgeantino") {
226 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
227 pmanager->AddProcess(new G4hIonisation, -1, 2,2);
228 pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
229 }
230 }
231
232 G4EmProcessOptions opt;
233 opt.SetVerbose(1);
234 opt.SetMinEnergy(100*eV);
235 opt.SetMaxEnergy(1000*TeV);
236 opt.SetDEDXBinning(13*7);
237 opt.SetLambdaBinning(13*7);
238}
239
240//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
241
242void PhysicsList::ConstructGeneral()
243{
244 // Add Decay Process
245 G4Decay* theDecayProcess = new G4Decay();
246 theParticleIterator->reset();
247 while ((*theParticleIterator)()){
248 G4ParticleDefinition* particle = theParticleIterator->value();
249 G4ProcessManager* pmanager = particle->GetProcessManager();
250 if (theDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
251 pmanager ->AddProcess(theDecayProcess);
252 // set ordering for PostStepDoIt and AtRestDoIt
253 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
254 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
255 }
256 }
257}
258
259//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
260
261void PhysicsList::SetCuts()
262{
263 if (verboseLevel >0){
264 G4cout << "PhysicsList::SetCuts:";
265 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
266 }
267
268 // set cut values for gamma at first and for e- second and next for e+,
269 // because some processes for e+/e- need cut values for gamma
270 SetCutValue(defaultCutValue, "gamma");
271 SetCutValue(defaultCutValue, "e-");
272 SetCutValue(defaultCutValue, "e+");
273
274 if (verboseLevel>0) DumpCutValuesTable();
275}
276
277//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
278
279void PhysicsList::SetGammaToMuPairFac(G4double fac)
280{
281 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
282 G4GammaConversionToMuons* theGammaToMuPairProcess = (G4GammaConversionToMuons*) theProcessTable->FindProcess("GammaToMuPair","gamma");
283 if(theGammaToMuPairProcess) theGammaToMuPairProcess->SetCrossSecFactor(fac);
284 else G4cout << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" << G4endl;
285}
286
287//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
288
289void PhysicsList::SetAnnihiToMuPairFac(G4double fac)
290{
291 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
292 G4AnnihiToMuPair* theAnnihiToMuPairProcess = (G4AnnihiToMuPair*) theProcessTable->FindProcess("AnnihiToMuPair","e+");
293 if(theAnnihiToMuPairProcess) theAnnihiToMuPairProcess->SetCrossSecFactor(fac);
294 else G4cout << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac was ignored" << G4endl;
295}
296
297//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
298
299void PhysicsList::SetAnnihiToHadronFac(G4double fac)
300{
301 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
302 G4eeToHadrons* eehadProcess = (G4eeToHadrons*) theProcessTable->FindProcess("ee2hadr","e+");
303 if(eehadProcess) eehadProcess->SetCrossSecFactor(fac);
304 else G4cout << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" << G4endl;
305}
306
307//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.