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

Last change on this file since 1348 was 1342, checked in by garnier, 15 years ago

update ti head

File size: 11.4 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.19 2010/10/23 19:14:03 gum Exp $
28// GEANT4 tag $Name: examples-V09-03-09 $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33#include "globals.hh"
34#include "ExN06PhysicsList.hh"
35#include "ExN06PhysicsListMessenger.hh"
36
37#include "G4ParticleDefinition.hh"
38#include "G4ParticleTypes.hh"
39#include "G4ParticleTable.hh"
40
41#include "G4ProcessManager.hh"
42
43#include "G4Cerenkov.hh"
44#include "G4Scintillation.hh"
45#include "G4OpAbsorption.hh"
46#include "G4OpRayleigh.hh"
47#include "G4OpMieHG.hh"
48#include "G4OpBoundaryProcess.hh"
49
50#include "G4LossTableManager.hh"
51#include "G4EmSaturation.hh"
52
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55ExN06PhysicsList::ExN06PhysicsList() : G4VUserPhysicsList()
56{
57 theCerenkovProcess = NULL;
58 theScintillationProcess = NULL;
59 theAbsorptionProcess = NULL;
60 theRayleighScatteringProcess = NULL;
61 theMieHGScatteringProcess = NULL;
62 theBoundaryProcess = NULL;
63
64 pMessenger = new ExN06PhysicsListMessenger(this);
65 SetVerboseLevel(0);
66}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70ExN06PhysicsList::~ExN06PhysicsList() { delete pMessenger;}
71
72//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73
74void ExN06PhysicsList::ConstructParticle()
75{
76 // In this method, static member functions should be called
77 // for all particles which you want to use.
78 // This ensures that objects of these particle types will be
79 // created in the program.
80
81 ConstructBosons();
82 ConstructLeptons();
83 ConstructMesons();
84 ConstructBaryons();
85}
86
87//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88
89void ExN06PhysicsList::ConstructBosons()
90{
91 // pseudo-particles
92 G4Geantino::GeantinoDefinition();
93 G4ChargedGeantino::ChargedGeantinoDefinition();
94
95 // gamma
96 G4Gamma::GammaDefinition();
97
98 // optical photon
99 G4OpticalPhoton::OpticalPhotonDefinition();
100}
101
102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103
104void ExN06PhysicsList::ConstructLeptons()
105{
106 // leptons
107 // e+/-
108 G4Electron::ElectronDefinition();
109 G4Positron::PositronDefinition();
110 // mu+/-
111 G4MuonPlus::MuonPlusDefinition();
112 G4MuonMinus::MuonMinusDefinition();
113 // nu_e
114 G4NeutrinoE::NeutrinoEDefinition();
115 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
116 // nu_mu
117 G4NeutrinoMu::NeutrinoMuDefinition();
118 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
119}
120
121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122
123void ExN06PhysicsList::ConstructMesons()
124{
125 // mesons
126 G4PionPlus::PionPlusDefinition();
127 G4PionMinus::PionMinusDefinition();
128 G4PionZero::PionZeroDefinition();
129}
130
131//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132
133void ExN06PhysicsList::ConstructBaryons()
134{
135 // barions
136 G4Proton::ProtonDefinition();
137 G4AntiProton::AntiProtonDefinition();
138
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 theMieHGScatteringProcess = new G4OpMieHG();
257 theBoundaryProcess = new G4OpBoundaryProcess();
258
259// theCerenkovProcess->DumpPhysicsTable();
260// theScintillationProcess->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(theMieHGScatteringProcess);
299 pmanager->AddDiscreteProcess(theBoundaryProcess);
300 }
301 }
302}
303
304//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
305
306void ExN06PhysicsList::SetVerbose(G4int verbose)
307{
308 theCerenkovProcess->SetVerboseLevel(verbose);
309 theScintillationProcess->SetVerboseLevel(verbose);
310 theAbsorptionProcess->SetVerboseLevel(verbose);
311 theRayleighScatteringProcess->SetVerboseLevel(verbose);
312 theMieHGScatteringProcess->SetVerboseLevel(verbose);
313 theBoundaryProcess->SetVerboseLevel(verbose);
314}
315
316//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
317
318void ExN06PhysicsList::SetNbOfPhotonsCerenkov(G4int MaxNumber)
319{
320 theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumber);
321}
322//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
323
324void ExN06PhysicsList::SetCuts()
325{
326 // " G4VUserPhysicsList::SetCutsWithDefault" method sets
327 // the default cut value for all particle types
328 //
329 SetCutsWithDefault();
330
331 if (verboseLevel>0) DumpCutValuesTable();
332}
333
334//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.