source: trunk/examples/novice/N05/src/ExN05PhysicsList.cc@ 1323

Last change on this file since 1323 was 1313, checked in by garnier, 15 years ago

geant4.9.4 beta rc0

File size: 10.9 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//
27// $Id: ExN05PhysicsList.cc,v 1.15 2010/03/19 08:59:39 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-cand-00 $
29//
30//
31
32#include "ExN05PhysicsList.hh"
33
34#include "globals.hh"
35#include "G4ParticleDefinition.hh"
36#include "G4ProcessManager.hh"
37#include "G4ProcessVector.hh"
38#include "G4ParticleTypes.hh"
39#include "G4ParticleTable.hh"
40#include "G4Material.hh"
41#include "G4MaterialTable.hh"
42#include "G4ios.hh"
43#include <iomanip>
44
45#include "G4FastSimulationManagerProcess.hh"
46
47
48ExN05PhysicsList::ExN05PhysicsList(): G4VUserPhysicsList()
49{
50 SetVerboseLevel(1);
51}
52
53ExN05PhysicsList::~ExN05PhysicsList()
54{
55}
56
57void ExN05PhysicsList::ConstructParticle()
58{
59 // In this method, static member functions should be called
60 // for all particles which you want to use.
61 // This ensures that objects of these particle types will be
62 // created in the program.
63
64 ConstructBosons();
65 ConstructLeptons();
66 ConstructMesons();
67 ConstructBaryons();
68 ConstructIons();
69}
70
71void ExN05PhysicsList::ConstructBosons()
72{
73 // pseudo-particles
74 G4Geantino::GeantinoDefinition();
75 G4ChargedGeantino::ChargedGeantinoDefinition();
76
77 // gamma
78 G4Gamma::GammaDefinition();
79
80 // optical photon
81 G4OpticalPhoton::OpticalPhotonDefinition();
82}
83
84#include "G4LeptonConstructor.hh"
85void ExN05PhysicsList::ConstructLeptons()
86{
87 // Construct all leptons
88 G4LeptonConstructor pConstructor;
89 pConstructor.ConstructParticle();
90}
91
92#include "G4MesonConstructor.hh"
93void ExN05PhysicsList::ConstructMesons()
94{
95 // Construct all mesons
96 G4MesonConstructor pConstructor;
97 pConstructor.ConstructParticle();
98}
99
100#include "G4BaryonConstructor.hh"
101void ExN05PhysicsList::ConstructBaryons()
102{
103 // Construct all barions
104 G4BaryonConstructor pConstructor;
105 pConstructor.ConstructParticle();
106}
107
108#include "G4IonConstructor.hh"
109void ExN05PhysicsList::ConstructIons()
110{
111 // Construct light ions
112 G4IonConstructor pConstructor;
113 pConstructor.ConstructParticle();
114}
115
116void ExN05PhysicsList::ConstructProcess()
117{
118 AddTransportation();
119 AddParameterisation();
120
121 ConstructEM();
122 ConstructGeneral();
123}
124
125void ExN05PhysicsList::AddTransportation()
126{
127 G4VUserPhysicsList::AddTransportation();
128}
129
130#include "G4ComptonScattering.hh"
131#include "G4GammaConversion.hh"
132#include "G4PhotoElectricEffect.hh"
133
134#include "G4eMultipleScattering.hh"
135#include "G4MuMultipleScattering.hh"
136#include "G4hMultipleScattering.hh"
137
138#include "G4eIonisation.hh"
139#include "G4eBremsstrahlung.hh"
140#include "G4eplusAnnihilation.hh"
141
142#include "G4MuIonisation.hh"
143#include "G4MuBremsstrahlung.hh"
144#include "G4MuPairProduction.hh"
145
146#include "G4hIonisation.hh"
147void ExN05PhysicsList::ConstructEM()
148{
149 theParticleIterator->reset();
150 while( (*theParticleIterator)() ){
151 G4ParticleDefinition* particle = theParticleIterator->value();
152 G4ProcessManager* pmanager = particle->GetProcessManager();
153 G4String particleName = particle->GetParticleName();
154
155 if (particleName == "gamma") {
156 // gamma
157 // Construct processes for gamma
158 pmanager->AddDiscreteProcess(new G4GammaConversion());
159 pmanager->AddDiscreteProcess(new G4ComptonScattering());
160 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
161
162 } else if (particleName == "e-") {
163 //electron
164 // Construct processes for electron
165 G4VProcess* theeminusMultipleScattering = new G4eMultipleScattering();
166 G4VProcess* theeminusIonisation = new G4eIonisation();
167 G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
168 // add processes
169 pmanager->AddProcess(theeminusMultipleScattering);
170 pmanager->AddProcess(theeminusIonisation);
171 pmanager->AddProcess(theeminusBremsstrahlung);
172 // set ordering for AlongStepDoIt
173 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep, 1);
174 pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep, 2);
175 // set ordering for PostStepDoIt
176 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
177 pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
178 pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
179
180 } else if (particleName == "e+") {
181 //positron
182 // Construct processes for positron
183 G4VProcess* theeplusMultipleScattering = new G4eMultipleScattering();
184 G4VProcess* theeplusIonisation = new G4eIonisation();
185 G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
186 G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
187 // add processes
188 pmanager->AddProcess(theeplusMultipleScattering);
189 pmanager->AddProcess(theeplusIonisation);
190 pmanager->AddProcess(theeplusBremsstrahlung);
191 pmanager->AddProcess(theeplusAnnihilation);
192 // set ordering for AtRestDoIt
193 pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
194 // set ordering for AlongStepDoIt
195 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1);
196 pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2);
197 // set ordering for PostStepDoIt
198 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
199 pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
200 pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
201 pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
202
203 } else if( particleName == "mu+" ||
204 particleName == "mu-" ) {
205 //muon
206 // Construct processes for muon+
207 G4VProcess* aMultipleScattering = new G4MuMultipleScattering();
208 G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
209 G4VProcess* aPairProduction = new G4MuPairProduction();
210 G4VProcess* anIonisation = new G4MuIonisation();
211 // add processes
212 pmanager->AddProcess(anIonisation);
213 pmanager->AddProcess(aMultipleScattering);
214 pmanager->AddProcess(aBremsstrahlung);
215 pmanager->AddProcess(aPairProduction);
216 // set ordering for AlongStepDoIt
217 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
218 pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
219 // set ordering for PostStepDoIt
220 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
221 pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
222 pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
223 pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
224
225 } else if ((!particle->IsShortLived()) &&
226 (particle->GetPDGCharge() != 0.0) &&
227 (particle->GetParticleName() != "chargedgeantino")) {
228 // all others charged particles except geantino
229 G4VProcess* aMultipleScattering = new G4hMultipleScattering();
230 G4VProcess* anIonisation = new G4hIonisation();
231 // add processes
232 pmanager->AddProcess(anIonisation);
233 pmanager->AddProcess(aMultipleScattering);
234 // set ordering for AlongStepDoIt
235 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
236 pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
237 // set ordering for PostStepDoIt
238 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
239 pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
240 }
241 }
242}
243
244
245#include "G4Decay.hh"
246void ExN05PhysicsList::ConstructGeneral()
247{
248 // Add Decay Process
249 G4Decay* theDecayProcess = new G4Decay();
250 theParticleIterator->reset();
251 while( (*theParticleIterator)() ){
252 G4ParticleDefinition* particle = theParticleIterator->value();
253 G4ProcessManager* pmanager = particle->GetProcessManager();
254 if (theDecayProcess->IsApplicable(*particle)) {
255 pmanager ->AddProcess(theDecayProcess);
256 // set ordering for PostStepDoIt and AtRestDoIt
257 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
258 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
259 }
260 }
261}
262
263void ExN05PhysicsList::AddParameterisation()
264{
265 // -- Fast simulation manager process for "mass geometry":
266 G4FastSimulationManagerProcess* fastSimProcess_massGeom = new G4FastSimulationManagerProcess("G4FSMP_massGeom");
267 // -- Fast simulation manager process for "parallel geometry":
268 G4FastSimulationManagerProcess* fastSimProcess_parallelGeom = new G4FastSimulationManagerProcess("G4FSMP_parallelGeom", "pionGhostWorld");
269 theParticleIterator->reset();
270 while( (*theParticleIterator)() )
271 {
272 G4ParticleDefinition* particle = theParticleIterator->value();
273 G4ProcessManager* pmanager = particle->GetProcessManager();
274 // -- For the mass geometry, G4FSMP is a PostStep process, ordering does not matter:
275 if (particle->GetParticleName() == "e+" ||
276 particle->GetParticleName() == "e-" ||
277 particle->GetParticleName() == "gamma") pmanager->AddDiscreteProcess(fastSimProcess_massGeom);
278 // -- For the parallel geometry, G4FSMP is an Along+PostStep process, and ordering matters:
279 if (particle->GetParticleName() == "pi+" ||
280 particle->GetParticleName() == "pi-")
281 {
282 pmanager->AddProcess(fastSimProcess_parallelGeom);
283 pmanager->SetProcessOrdering(fastSimProcess_parallelGeom, idxAlongStep, 1);
284 pmanager->SetProcessOrdering(fastSimProcess_parallelGeom, idxPostStep);
285 }
286 }
287}
288
289void ExN05PhysicsList::SetCuts()
290{
291 if (verboseLevel >1){
292 G4cout << "ExN05PhysicsList::SetCuts:";
293 }
294 // " G4VUserPhysicsList::SetCutsWithDefault" method sets
295 // the default cut value for all particle types
296 SetCutsWithDefault();
297}
298
299
Note: See TracBrowser for help on using the repository browser.