source: trunk/source/geometry/magneticfield/test/NTST/src/NTSTPhysicsList.cc@ 1306

Last change on this file since 1306 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 16.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// $Id: NTSTPhysicsList.cc,v 1.5 2006/06/29 18:26:22 gunter Exp $
27// GEANT4 tag $Name: HEAD $
28//
29//
30
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33
34#include "NTSTPhysicsList.hh"
35#include "NTSTPhysicsListMessenger.hh"
36
37#include "G4ParticleDefinition.hh"
38#include "G4ParticleWithCuts.hh"
39#include "G4ProcessManager.hh"
40#include "G4ProcessVector.hh"
41#include "G4ParticleTypes.hh"
42#include "G4ParticleTable.hh"
43#include "G4Material.hh"
44#include "G4ios.hh"
45#include "NTSTLooperDeath.hh"
46#include <iomanip>
47
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49
50NTSTPhysicsList::NTSTPhysicsList()
51 : G4VUserPhysicsList(),
52 useBgsTran(false), // use G4Transportation by default
53 MinimumEnergyCut(1*MeV), // ParticleWithCuts min E cut
54 MaximumEnergyCut(100*TeV), // ParticleWithCuts max E cut
55 Cut(2.*mm), // Range cut
56 LooperCut(0*MeV), // Kill loopers below this energy
57 theLooperDeath(0), // pointer to looperdeath process
58 thePhotoElectricEffect(NULL),theComptonScattering(NULL),
59 theGammaConversion(NULL),
60 theeminusMultipleScattering(NULL),theeminusIonisation(NULL),
61 theeminusBremsstrahlung(NULL),
62 theeplusMultipleScattering(NULL),theeplusIonisation(NULL),
63 theeplusBremsstrahlung(NULL),
64 theeplusAnnihilation(NULL)
65{
66 SetVerboseLevel(2);
67 physicsListMessenger = new NTSTPhysicsListMessenger(this);
68}
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
71
72NTSTPhysicsList::~NTSTPhysicsList()
73{
74 delete theLooperDeath;
75}
76
77//....Ooooo0ooooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
78
79void NTSTPhysicsList::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 ConstructBarions();
90}
91
92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93
94void NTSTPhysicsList::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//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
107
108void NTSTPhysicsList::ConstructLeptons()
109{
110 // leptons
111 G4Electron::ElectronDefinition();
112 G4Positron::PositronDefinition();
113 G4MuonPlus::MuonPlusDefinition();
114 G4MuonMinus::MuonMinusDefinition();
115
116 G4NeutrinoE::NeutrinoEDefinition();
117 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
118 G4NeutrinoMu::NeutrinoMuDefinition();
119 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
123
124void NTSTPhysicsList::ConstructMesons()
125{
126 // mesons
127 G4PionPlus ::PionPlusDefinition();
128 G4PionMinus ::PionMinusDefinition();
129 G4PionZero ::PionZeroDefinition();
130 G4Eta ::EtaDefinition();
131 G4EtaPrime ::EtaPrimeDefinition();
132 G4KaonPlus ::KaonPlusDefinition();
133 G4KaonMinus ::KaonMinusDefinition();
134 G4KaonZero ::KaonZeroDefinition();
135 G4AntiKaonZero ::AntiKaonZeroDefinition();
136 G4KaonZeroLong ::KaonZeroLongDefinition();
137 G4KaonZeroShort::KaonZeroShortDefinition();
138}
139
140//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141
142void NTSTPhysicsList::ConstructBarions()
143{
144 // barions
145 G4Proton ::ProtonDefinition();
146 G4AntiProton ::AntiProtonDefinition();
147 G4Neutron ::NeutronDefinition();
148 G4AntiNeutron ::AntiNeutronDefinition();
149}
150
151
152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
153
154void NTSTPhysicsList::ConstructProcess()
155{
156 if (useBgsTran) {
157 G4cout << " +^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^+ " <<
158 G4endl;
159 G4cout << " +--- BgsTransportation is not available in this version ---+ " <<
160 G4endl;
161 }
162
163 AddTransportation();
164
165 G4cout << " +^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^+ " <<
166 G4endl;
167 G4cout << " +v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v+ " <<
168 G4endl;
169 G4cout << " +--- ---+ " <<
170 G4endl;
171 G4cout << " +--- G4Transportation ---+ " <<
172 G4endl;
173 G4cout << " +--- USED !! ---+ " <<
174 G4endl;
175 G4cout << " +--- ---+ " <<
176 G4endl;
177 G4cout << " +^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^+ " <<
178 G4endl;
179 G4cout << " +v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v+ " <<
180 G4endl;
181
182 ConstructEM();
183 ConstructLeptHad();
184 ConstructHad();
185 ConstructGeneral();
186}
187
188
189void NTSTPhysicsList::AddBgsTransportation()
190{
191 G4Exception("BgsTransportation is not enabled in this version -- due to migration to Touchable Handles");
192#if 0
193 // BgsTransportation *theTransportationProcess= new BgsTransportation();
194
195 // loop over all particles in G4ParticleTable
196 theParticleIterator->reset();
197 while( (*theParticleIterator)() ){
198 G4ParticleDefinition* particle = theParticleIterator->value();
199 G4ProcessManager* pmanager = particle->GetProcessManager();
200 if (!particle->IsShortLived()) {
201 // Add transportation process for all particles other than "shortlived"
202 if ( pmanager == 0) {
203 // Error !! no process manager
204 G4Exception("G4VUserPhysicsList::AddTransportation : no process manager!");
205 } else {
206 // add transportation with ordering = ( -1, "first", "first" )
207 pmanager ->AddProcess(theTransportationProcess);
208 pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep);
209 pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep);
210 }
211 } else {
212 // shortlived particle case
213 }
214 }
215#endif
216}
217
218//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
219
220#include "G4ComptonScattering.hh"
221#include "G4GammaConversion.hh"
222#include "G4PhotoElectricEffect.hh"
223
224#include "G4MultipleScattering.hh"
225
226#include "G4eIonisation.hh"
227#include "G4eBremsstrahlung.hh"
228#include "G4eplusAnnihilation.hh"
229
230#include "G4MuIonisation.hh"
231#include "G4MuBremsstrahlung.hh"
232#include "G4MuPairProduction.hh"
233
234#include "G4hIonisation.hh"
235
236//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
237
238void NTSTPhysicsList::ConstructEM()
239{
240 theParticleIterator->reset();
241 while( (*theParticleIterator)() ){
242 G4ParticleDefinition* particle = theParticleIterator->value();
243 G4ProcessManager* pmanager = particle->GetProcessManager();
244 G4String particleName = particle->GetParticleName();
245
246 if (particleName == "gamma") {
247 // gamma
248 // Construct processes for gamma
249 thePhotoElectricEffect = new G4PhotoElectricEffect();
250 theComptonScattering = new G4ComptonScattering();
251 theGammaConversion = new G4GammaConversion();
252
253 pmanager->AddDiscreteProcess(thePhotoElectricEffect);
254 pmanager->AddDiscreteProcess(theComptonScattering);
255 pmanager->AddDiscreteProcess(theGammaConversion);
256
257 } else if (particleName == "e-") {
258 //electron
259 // Construct processes for electron
260 theeminusMultipleScattering = new G4MultipleScattering();
261 theeminusIonisation = new G4eIonisation();
262 theeminusBremsstrahlung = new G4eBremsstrahlung();
263
264 pmanager->AddProcess(theeminusMultipleScattering,-1,1,1);
265 pmanager->AddProcess(theeminusIonisation,-1,2,2);
266 pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3);
267
268 } else if (particleName == "e+") {
269 //positron
270 // Construct processes for positron
271 theeplusMultipleScattering = new G4MultipleScattering();
272 theeplusIonisation = new G4eIonisation();
273 theeplusBremsstrahlung = new G4eBremsstrahlung();
274 theeplusAnnihilation = new G4eplusAnnihilation();
275
276 pmanager->AddProcess(theeplusMultipleScattering,-1,1,1);
277 pmanager->AddProcess(theeplusIonisation,-1,2,2);
278 pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
279 pmanager->AddProcess(theeplusAnnihilation,0,-1,4);
280
281 } else if( particleName == "mu+" ||
282 particleName == "mu-" ) {
283 //muon
284 // Construct processes for muon+
285 pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
286 pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
287 pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
288 pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
289
290 } else if ((!particle->IsShortLived()) &&
291 (particle->GetPDGCharge() != 0.0) &&
292 (particle->GetParticleName() != "chargedgeantino")) {
293 // all others charged particles except geantino
294 pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
295 pmanager->AddProcess(new G4hIonisation(),-1,2,2);
296 }
297 }
298}
299
300
301#include "G4Decay.hh"
302
303void NTSTPhysicsList::ConstructGeneral()
304{
305 // Add Decay Process
306 G4Decay* theDecayProcess = new G4Decay();
307 theParticleIterator->reset();
308 while( (*theParticleIterator)() ){
309 G4ParticleDefinition* particle = theParticleIterator->value();
310 G4ProcessManager* pmanager = particle->GetProcessManager();
311 if (theDecayProcess->IsApplicable(*particle)) {
312 pmanager ->AddProcess(theDecayProcess);
313 // set ordering for PostStepDoIt and AtRestDoIt
314 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
315 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
316 }
317 }
318 if (LooperCut>0) {
319 //
320 // Set special process to kill loopers
321 //
322 if (theLooperDeath == 0) theLooperDeath = new NTSTLooperDeath;
323 theLooperDeath->SetMinMomentum(LooperCut);
324 theParticleIterator->reset();
325 while( (*theParticleIterator)() ){
326 G4ParticleDefinition* particle = theParticleIterator->value();
327 if (theLooperDeath->IsApplicable(*particle)) {
328 G4ProcessManager* pmanager = particle->GetProcessManager();
329 pmanager->AddProcess(theLooperDeath, -1, -1, 5);
330 }
331 }
332 G4cout << "### Kill loopers below " << LooperCut << G4endl;
333 }
334}
335
336//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
337
338void NTSTPhysicsList::SetCuts()
339{
340 SetDefaultCutValue(Cut);
341 SetCutsWithDefault();
342}
343
344//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
345
346void NTSTPhysicsList::SetStatusEmProcess()
347{
348 // Process definitions
349
350 const
351 G4String process1("phot"),process2("Comp"),process3("conv"),
352 process4("muls"),process5("ioni"),process6("brem"),
353 process7("anni");
354 static
355 G4String lstate1("on"),lstate2("on"),lstate3("on"),
356 lstate4("on"),lstate5("on"),lstate6("on"),lstate7("on");
357
358 G4String process,newstate;
359 G4bool active(true);
360
361 G4ProcessManager* pGammaManager = G4Gamma::GammaDefinition() -> GetProcessManager();
362 G4ProcessManager* pElectManager = G4Electron::ElectronDefinition() -> GetProcessManager();
363 G4ProcessManager* pPositManager = G4Positron::PositronDefinition() -> GetProcessManager();
364 //
365 //
366 // Loop over processes
367 //
368 do {
369 // diplay the status of the processes
370 G4cout << " ****** Processes status ****** " << G4endl;
371 G4cout << " " << process1 << " " << process2 << " " << process3
372 << " " << process4 << " " << process5 << " " << process6
373 << " " << process7 << G4endl;
374 G4cout << " " << lstate1 << " " << lstate2 << " " << lstate3
375 << " " << lstate4 << " " << lstate5 << " " << lstate6
376 << " " << lstate7 << G4endl;
377
378 // update the status of the processes
379 G4cout << " enter -> a process name, on/off or: ok on : " << G4endl;
380 G4cin >> process >> newstate ;
381 if (newstate=="on") active = true;
382 else active = false;
383
384 if (process == "phot")
385 { pGammaManager -> SetProcessActivation (thePhotoElectricEffect, active);
386 lstate1 = newstate;
387 }
388 else if (process == "Comp")
389 { pGammaManager -> SetProcessActivation (theComptonScattering, active);
390 lstate2 = newstate;
391 }
392 else if (process == "conv")
393 { pGammaManager -> SetProcessActivation (theGammaConversion, active);
394 lstate3 = newstate;
395 }
396 else if (process == "muls")
397 { pElectManager -> SetProcessActivation (theeminusMultipleScattering, active);
398 pPositManager -> SetProcessActivation (theeplusMultipleScattering, active);
399 lstate4 = newstate;
400 }
401 else if (process == "ioni")
402 { pElectManager -> SetProcessActivation (theeminusIonisation, active);
403 pPositManager -> SetProcessActivation (theeplusIonisation, active);
404 lstate5 = newstate;
405 }
406 else if (process == "brem")
407 { pElectManager -> SetProcessActivation (theeminusBremsstrahlung, active);
408 pPositManager -> SetProcessActivation (theeplusBremsstrahlung, active);
409 lstate6 = newstate;
410 }
411 else if (process == "anni")
412 { pPositManager -> SetProcessActivation (theeplusAnnihilation, active);
413 lstate7 = newstate;
414 }
415 } while (process!="ok") ;
416
417 G4cout << " ---> Done" << G4endl;
418}
419
420//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
421
422void
423NTSTPhysicsList::ConstructLeptHad()
424{;}
425
426//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
427
428void
429NTSTPhysicsList::ConstructHad()
430{;}
431
432//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
433
434void
435NTSTPhysicsList::SetMinimumEnergyCut(const G4double e) {
436 MinimumEnergyCut = e;
437 // -- G4cerr << " SetMinimumEnergyCut is not currently implemented." << G4endl;
438 // -- G4Exception("SetMinimumEnergyCut missing");
439 // G4ParticleWithCuts::SetEnergyRange(MinimumEnergyCut, MaximumEnergyCut);
440 G4cerr << " SetMinimumEnergyCut is newly re-implemented." << G4endl;
441 G4ProductionCutsTable::GetProductionCutsTable()
442 ->SetEnergyRange(MinimumEnergyCut, MaximumEnergyCut);
443}
444
445//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
446
447void
448NTSTPhysicsList::SetMaximumEnergyCut(const G4double e) {
449 MaximumEnergyCut = e;
450 // -- G4cerr << " SetMaximumEnergyCut is not currently implemented." << G4endl;
451 // -- G4Exception("SetMaximumEnergyCut missing");
452 // G4ParticleWithCuts::SetEnergyRange(MinimumEnergyCut, MaximumEnergyCut);
453
454 G4cerr << " SetMaximumEnergyCut is newly re-implemented." << G4endl;
455 G4ProductionCutsTable::GetProductionCutsTable()
456 ->SetEnergyRange(MinimumEnergyCut, MaximumEnergyCut);
457
458}
459
460//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
461
462
463void
464NTSTPhysicsList::SetLooperCut(const G4double e) {
465 LooperCut = e;
466}
Note: See TracBrowser for help on using the repository browser.