source: trunk/examples/novice/N06/src/ExN06PhysicsList.cc@ 1305

Last change on this file since 1305 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 11.3 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: ExN06PhysicsList.cc,v 1.17 2009/11/10 05:16:23 gum Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "G4ios.hh"
34#include <iomanip>
35
36#include "globals.hh"
37#include "ExN06PhysicsList.hh"
38#include "ExN06PhysicsListMessenger.hh"
39
40#include "G4ParticleDefinition.hh"
41#include "G4ParticleTypes.hh"
42#include "G4ParticleTable.hh"
43
44#include "G4Material.hh"
45#include "G4MaterialTable.hh"
46
47#include "G4ProcessManager.hh"
48#include "G4ProcessVector.hh"
49
50#include "G4Cerenkov.hh"
51#include "G4Scintillation.hh"
52#include "G4OpAbsorption.hh"
53#include "G4OpRayleigh.hh"
54#include "G4OpBoundaryProcess.hh"
55
56#include "G4LossTableManager.hh"
57#include "G4EmSaturation.hh"
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
61ExN06PhysicsList::ExN06PhysicsList() : G4VUserPhysicsList()
62{
63 theCerenkovProcess = 0;
64 theScintillationProcess = 0;
65 theAbsorptionProcess = 0;
66 theRayleighScatteringProcess = 0;
67 theBoundaryProcess = 0;
68
69 pMessenger = new ExN06PhysicsListMessenger(this);
70 SetVerboseLevel(0);
71}
72
73//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74
75ExN06PhysicsList::~ExN06PhysicsList() { delete pMessenger;}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78
79void ExN06PhysicsList::ConstructParticle()
80{
81 // In this method, static member functions should be called
82 // for all particles which you want to use.
83 // This ensures that objects of these particle types will be
84 // created in the program.
85
86 ConstructBosons();
87 ConstructLeptons();
88 ConstructMesons();
89 ConstructBaryons();
90}
91
92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93
94void ExN06PhysicsList::ConstructBosons()
95{
96 // pseudo-particles
97 G4Geantino::GeantinoDefinition();
98 G4ChargedGeantino::ChargedGeantinoDefinition();
99
100 // gamma
101 G4Gamma::GammaDefinition();
102
103 // optical photon
104 G4OpticalPhoton::OpticalPhotonDefinition();
105}
106
107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108
109void ExN06PhysicsList::ConstructLeptons()
110{
111 // leptons
112 G4Electron::ElectronDefinition();
113 G4Positron::PositronDefinition();
114 G4NeutrinoE::NeutrinoEDefinition();
115 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
116 G4MuonPlus::MuonPlusDefinition();
117 G4MuonMinus::MuonMinusDefinition();
118 G4NeutrinoMu::NeutrinoMuDefinition();
119 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123
124void ExN06PhysicsList::ConstructMesons()
125{
126 // mesons
127 G4PionPlus::PionPlusDefinition();
128 G4PionMinus::PionMinusDefinition();
129 G4PionZero::PionZeroDefinition();
130}
131
132//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133
134void ExN06PhysicsList::ConstructBaryons()
135{
136// barions
137 G4Proton::ProtonDefinition();
138 G4AntiProton::AntiProtonDefinition();
139 G4Neutron::NeutronDefinition();
140 G4AntiNeutron::AntiNeutronDefinition();
141}
142
143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144
145void ExN06PhysicsList::ConstructProcess()
146{
147 AddTransportation();
148 ConstructGeneral();
149 ConstructEM();
150 ConstructOp();
151}
152
153//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
154
155#include "G4Decay.hh"
156
157//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158
159void ExN06PhysicsList::ConstructGeneral()
160{
161 // Add Decay Process
162 G4Decay* theDecayProcess = new G4Decay();
163 theParticleIterator->reset();
164 while( (*theParticleIterator)() ){
165 G4ParticleDefinition* particle = theParticleIterator->value();
166 G4ProcessManager* pmanager = particle->GetProcessManager();
167 if (theDecayProcess->IsApplicable(*particle)) {
168 pmanager ->AddProcess(theDecayProcess);
169 // set ordering for PostStepDoIt and AtRestDoIt
170 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
171 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
172 }
173 }
174}
175
176//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177
178#include "G4ComptonScattering.hh"
179#include "G4GammaConversion.hh"
180#include "G4PhotoElectricEffect.hh"
181
182#include "G4eMultipleScattering.hh"
183#include "G4MuMultipleScattering.hh"
184#include "G4hMultipleScattering.hh"
185
186#include "G4eIonisation.hh"
187#include "G4eBremsstrahlung.hh"
188#include "G4eplusAnnihilation.hh"
189
190#include "G4MuIonisation.hh"
191#include "G4MuBremsstrahlung.hh"
192#include "G4MuPairProduction.hh"
193
194#include "G4hIonisation.hh"
195
196//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
197
198void ExN06PhysicsList::ConstructEM()
199{
200 theParticleIterator->reset();
201 while( (*theParticleIterator)() ){
202 G4ParticleDefinition* particle = theParticleIterator->value();
203 G4ProcessManager* pmanager = particle->GetProcessManager();
204 G4String particleName = particle->GetParticleName();
205
206 if (particleName == "gamma") {
207 // gamma
208 // Construct processes for gamma
209// pmanager->AddDiscreteProcess(new G4GammaConversion());
210// pmanager->AddDiscreteProcess(new G4ComptonScattering());
211// pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
212
213 } else if (particleName == "e-") {
214 //electron
215 // Construct processes for electron
216 pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
217 pmanager->AddProcess(new G4eIonisation(), -1, 2, 2);
218 pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3, 3);
219
220 } else if (particleName == "e+") {
221 //positron
222 // Construct processes for positron
223 pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
224 pmanager->AddProcess(new G4eIonisation(), -1, 2, 2);
225 pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3, 3);
226 pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1, 4);
227
228 } else if( particleName == "mu+" ||
229 particleName == "mu-" ) {
230 //muon
231 // Construct processes for muon
232 pmanager->AddProcess(new G4MuMultipleScattering(),-1, 1, 1);
233 pmanager->AddProcess(new G4MuIonisation(), -1, 2, 2);
234 pmanager->AddProcess(new G4MuBremsstrahlung(), -1, 3, 3);
235 pmanager->AddProcess(new G4MuPairProduction(), -1, 4, 4);
236
237 } else {
238 if ((particle->GetPDGCharge() != 0.0) &&
239 (particle->GetParticleName() != "chargedgeantino")) {
240 // all others charged particles except geantino
241 pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
242 pmanager->AddProcess(new G4hIonisation(), -1,2,2);
243 }
244 }
245 }
246}
247
248//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
249
250void ExN06PhysicsList::ConstructOp()
251{
252 theCerenkovProcess = new G4Cerenkov("Cerenkov");
253 theScintillationProcess = new G4Scintillation("Scintillation");
254 theAbsorptionProcess = new G4OpAbsorption();
255 theRayleighScatteringProcess = new G4OpRayleigh();
256 theBoundaryProcess = new G4OpBoundaryProcess();
257
258// theCerenkovProcess->DumpPhysicsTable();
259// theScintillationProcess->DumpPhysicsTable();
260// theAbsorptionProcess->DumpPhysicsTable();
261// theRayleighScatteringProcess->DumpPhysicsTable();
262
263 SetVerbose(1);
264
265 theCerenkovProcess->SetMaxNumPhotonsPerStep(20);
266 theCerenkovProcess->SetMaxBetaChangePerStep(10.0);
267 theCerenkovProcess->SetTrackSecondariesFirst(true);
268
269 theScintillationProcess->SetScintillationYieldFactor(1.);
270 theScintillationProcess->SetTrackSecondariesFirst(true);
271
272 // Use Birks Correction in the Scintillation process
273
274 G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
275 theScintillationProcess->AddSaturation(emSaturation);
276
277 G4OpticalSurfaceModel themodel = unified;
278 theBoundaryProcess->SetModel(themodel);
279
280 theParticleIterator->reset();
281 while( (*theParticleIterator)() ){
282 G4ParticleDefinition* particle = theParticleIterator->value();
283 G4ProcessManager* pmanager = particle->GetProcessManager();
284 G4String particleName = particle->GetParticleName();
285 if (theCerenkovProcess->IsApplicable(*particle)) {
286 pmanager->AddProcess(theCerenkovProcess);
287 pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
288 }
289 if (theScintillationProcess->IsApplicable(*particle)) {
290 pmanager->AddProcess(theScintillationProcess);
291 pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
292 pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
293 }
294 if (particleName == "opticalphoton") {
295 G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
296 pmanager->AddDiscreteProcess(theAbsorptionProcess);
297 pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
298 pmanager->AddDiscreteProcess(theBoundaryProcess);
299 }
300 }
301}
302
303//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304
305void ExN06PhysicsList::SetVerbose(G4int verbose)
306{
307 theCerenkovProcess->SetVerboseLevel(verbose);
308 theScintillationProcess->SetVerboseLevel(verbose);
309 theAbsorptionProcess->SetVerboseLevel(verbose);
310 theRayleighScatteringProcess->SetVerboseLevel(verbose);
311 theBoundaryProcess->SetVerboseLevel(verbose);
312}
313
314//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
315
316void ExN06PhysicsList::SetNbOfPhotonsCerenkov(G4int MaxNumber)
317{
318 theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumber);
319}
320//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
321
322void ExN06PhysicsList::SetCuts()
323{
324 // " G4VUserPhysicsList::SetCutsWithDefault" method sets
325 // the default cut value for all particle types
326 //
327 SetCutsWithDefault();
328
329 if (verboseLevel>0) DumpCutValuesTable();
330}
331
332//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.