updated for geant4.2.0 (processNameList type in PrintAllProcesses())
[u/mrichter/AliRoot.git] / TGeant4 / TG4PhysicsList.cxx
CommitLineData
2817d3e2 1// $Id$
2// Category: physics
3//
4// According to:
5// ExN04PhysicsList.cc,v 1.7 1999/12/15 14:49:26 gunter
6// GEANT4 tag Name: geant4-01-01
7
8#include "TG4PhysicsList.h"
9#include "TG4PhysicsListMessenger.h"
10#include "TG4PhysicsManager.h"
11#include "TG4CutVector.h"
12#include "TG4FlagVector.h"
13#include "TG4SpecialCuts.h"
14#include "TG4SpecialFlags.h"
15
16#include <G4ParticleDefinition.hh>
17#include <G4ParticleWithCuts.hh>
18#include <G4ProcessManager.hh>
19#include <G4ProcessVector.hh>
20#include <G4ParticleTypes.hh>
21#include <G4ParticleTable.hh>
22#include <G4BosonConstructor.hh>
23#include <G4LeptonConstructor.hh>
24#include <G4MesonConstructor.hh>
25#include <G4BaryonConstructor.hh>
26#include <G4IonConstructor.hh>
27#include <G4ShortLivedConstructor.hh>
28#include <G4Material.hh>
29#include <G4MaterialTable.hh>
30#include <G4ProcessTable.hh>
31//#include <G4ios.hh>
32
33#include <g4std/iomanip>
34
35
36TG4PhysicsList::TG4PhysicsList()
37 : G4VUserPhysicsList(),
38 fSetOptical(false),
39 fSetHadron(false),
40 fSetSpecialCuts(false),
41 fSetSpecialFlags(false)
42{
43 // default cut value (1.0mm)
44 defaultCutValue = 1.0*mm;
45
46 // messenger
47 fMessenger = new TG4PhysicsListMessenger(this);
48
49 SetVerboseLevel(1);
50}
51
52TG4PhysicsList::TG4PhysicsList(const TG4PhysicsList& right)
53 : G4VUserPhysicsList(right)
54{
55 // messenger
56 fMessenger = new TG4PhysicsListMessenger(this);
57
58 fSetOptical = right.fSetOptical;
59 fSetHadron = right.fSetHadron;
60 fSetSpecialCuts = right.fSetSpecialCuts;
61 fSetSpecialFlags = right.fSetSpecialFlags;
62}
63
64TG4PhysicsList::~TG4PhysicsList() {
65//
66}
67
68// operators
69
70TG4PhysicsList& TG4PhysicsList::operator=(const TG4PhysicsList& right)
71{
72 // check assignement to self
73 if (this == &right) return *this;
74
75 // base class assignement
76 G4VUserPhysicsList::operator=(right);
77
78 fSetOptical = right.fSetOptical;
79 fSetHadron = right.fSetHadron;
80 fSetSpecialCuts = right.fSetSpecialCuts;
81 fSetSpecialFlags = right.fSetSpecialFlags;
82
83 return *this;
84}
85
86// public methods
87
88void TG4PhysicsList::ConstructParticle()
89{
90// In this method, static member functions should be called
91// for all particles which you want to use.
92// This ensures that objects of these particle types will be
93// created in the program.
94// ---
95
96 // lock physics manager
97 TG4PhysicsManager* physicsManager = TG4PhysicsManager::Instance();
98 physicsManager->Lock();
99 physicsManager->SetPhysicsList(this);
100
101 // create all particles
102 ConstructAllBosons();
103 ConstructAllLeptons();
104 ConstructAllMesons();
105 ConstructAllBaryons();
106 ConstructAllIons();
107 ConstructAllShortLiveds();
108}
109
110void TG4PhysicsList::ConstructProcess()
111{
112// Constructs all processes.
113// ---
114
115 AddTransportation();
116
117 ConstructEM();
118 if (fSetHadron) ConstructHad();
119 if (fSetOptical) ConstructOp();
120 if (fSetSpecialCuts) ConstructSpecialCuts();
121 if (fSetSpecialFlags) ConstructSpecialFlags();
122 ConstructGeneral();
123 if (verboseLevel>1) PrintAllProcesses();
124 // InActivateEM();
125}
126
127void TG4PhysicsList::SetProcessActivation()
128{
129// (In)Activates built processes according
130// to the setup in TG4PhysicsManager::fFlagVector.
131// ---
132
133 G4cout << "TG4PhysicsList::SetProcessActivation() start" << endl;
134
135 TG4PhysicsManager* physicsManager = TG4PhysicsManager::Instance();
136 TG4FlagVector* flagVector = physicsManager->GetFlagVector();
137
138 // uncomment following lines to print
139 // the flagVector values
140 //for (G4int i=0; i<kNoG3Flags; i++)
141 //{ cout << i << " flag: " << (*flagVector)[i] << endl; }
142
143 if (flagVector) {
144 theParticleIterator->reset();
145 while ((*theParticleIterator)())
146 {
147 G4ParticleDefinition* particle = theParticleIterator->value();
148 G4ProcessManager* processManager = particle->GetProcessManager();
149 G4ProcessVector* processVector = processManager->GetProcessList();
150
151 // set processes flags
152 for (G4int i=0; i<processManager->GetProcessListLength(); i++) {
153 G4int flag = flagVector->GetFlag((*processVector)[i]);
154 if ((flag == kInActivate) &&
155 (processManager->GetProcessActivation(i))) {
156 if (verboseLevel>1) {
157 G4cout << "Set process inactivation for "
158 << (*processVector)[i]->GetProcessName() << endl;
159 }
160 processManager->SetProcessActivation(i,false);
161 }
162 else if (((flag == kActivate) || (flag == kActivate2)) &&
163 (!processManager->GetProcessActivation(i))) {
164 if (verboseLevel>1) {
165 G4cout << "Set process activation for "
166 << (*processVector)[i]->GetProcessName() << endl;
167 }
168 processManager->SetProcessActivation(i,true);
169 }
170 }
171 }
172 }
173 else {
174 G4String text = "TG4PhysicsList::SetProcessActivation: \n";
175 text = text + " Vector of processes flags is not set.";
176 TG4Globals::Warning(text);
177 }
178 G4cout << "TG4PhysicsList::SetProcessActivation() end" << endl;
179}
180
181void TG4PhysicsList::PrintAllProcesses() const
182{
183// Prints all processes.
184// ---
185
186 G4cout << "TG4PhysicsList processes: " << endl;
187 G4cout << "========================= " << endl;
188
189 G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
055b749a 190 G4ProcessTable::G4ProcNameVector* processNameList
191 = processTable->GetNameList();
2817d3e2 192
055b749a 193 for (G4int i=0; i <processNameList->size(); i++){
2817d3e2 194 G4cout << " " << (*processNameList)[i] << endl;
195 }
196}
197
198// protected methods
199
200#include <G4ComptonScattering.hh>
201#include <G4GammaConversion.hh>
202#include <G4PhotoElectricEffect.hh>
203
204#include <G4MultipleScattering.hh>
205
206#include <G4eIonisation.hh>
207#include <G4eBremsstrahlung.hh>
208#include <G4eplusAnnihilation.hh>
209
210#include <G4MuIonisation.hh>
211#include <G4MuBremsstrahlung.hh>
212#include <G4MuPairProduction.hh>
213
214#include <G4hIonisation.hh>
215#include <G4ionIonisation.hh>
216
217void TG4PhysicsList::ConstructEM()
218{
219// Constructs electromagnetic processes.
220// ---
221
222 theParticleIterator->reset();
223 while( (*theParticleIterator)() ){
224 G4ParticleDefinition* particle = theParticleIterator->value();
225 G4ProcessManager* pmanager = particle->GetProcessManager();
226 G4String particleName = particle->GetParticleName();
227
228 if (particleName == "gamma") {
229 // gamma
230 // Construct processes for gamma
231 pmanager->AddDiscreteProcess(new G4GammaConversion());
232 pmanager->AddDiscreteProcess(new G4ComptonScattering());
233 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
234
235 } else if (particleName == "e-") {
236 //electron
237 // Construct processes for electron
238 G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
239 G4VProcess* theeminusIonisation = new G4eIonisation();
240 G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
241 // add processes
242 pmanager->AddProcess(theeminusMultipleScattering);
243 pmanager->AddProcess(theeminusIonisation);
244 pmanager->AddProcess(theeminusBremsstrahlung);
245 // set ordering for AlongStepDoIt
246 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep, 1);
247 pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep, 2);
248 // set ordering for PostStepDoIt
249 pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
250 pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
251 pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
252
253 } else if (particleName == "e+") {
254 //positron
255 // Construct processes for positron
256 G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
257 G4VProcess* theeplusIonisation = new G4eIonisation();
258 G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
259 G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
260 // add processes
261 pmanager->AddProcess(theeplusMultipleScattering);
262 pmanager->AddProcess(theeplusIonisation);
263 pmanager->AddProcess(theeplusBremsstrahlung);
264 pmanager->AddProcess(theeplusAnnihilation);
265 // set ordering for AtRestDoIt
266 pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
267 // set ordering for AlongStepDoIt
268 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1);
269 pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2);
270 // set ordering for PostStepDoIt
271 pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
272 pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
273 pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
274 pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
275
276 } else if( particleName == "mu+" ||
277 particleName == "mu-" ) {
278 //muon
279 // Construct processes for muon+
280 G4VProcess* aMultipleScattering = new G4MultipleScattering();
281 G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
282 G4VProcess* aPairProduction = new G4MuPairProduction();
283 G4VProcess* anIonisation = new G4MuIonisation();
284 // add processes
285 pmanager->AddProcess(anIonisation);
286 pmanager->AddProcess(aMultipleScattering);
287 pmanager->AddProcess(aBremsstrahlung);
288 pmanager->AddProcess(aPairProduction);
289 // set ordering for AlongStepDoIt
290 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
291 pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
292 // set ordering for PostStepDoIt
293 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
294 pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
295 pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
296 pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
297
298 } else if( particleName == "GenericIon" ) {
299 G4VProcess* aionIonization = new G4ionIonisation;
300 G4VProcess* aMultipleScattering = new G4MultipleScattering();
301 pmanager->AddProcess(aionIonization);
302 pmanager->AddProcess(aMultipleScattering);
303 // set ordering for AlongStepDoIt
304 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
305 pmanager->SetProcessOrdering(aionIonization, idxAlongStep, 2);
306 // set ordering for PostStepDoIt
307 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
308 pmanager->SetProcessOrdering(aionIonization, idxPostStep, 2);
309
310 } else if ((!particle->IsShortLived()) &&
311 (particle->GetPDGCharge() != 0.0) &&
312 (particle->GetParticleName() != "chargedgeantino")) {
313 // all others charged particles except geantino
314 G4VProcess* aMultipleScattering = new G4MultipleScattering();
315 G4VProcess* anIonisation = new G4hIonisation();
316 // add processes
317 pmanager->AddProcess(anIonisation);
318 pmanager->AddProcess(aMultipleScattering);
319 // set ordering for AlongStepDoIt
320 pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
321 pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
322 // set ordering for PostStepDoIt
323 pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
324 pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
325 }
326 }
327}
328
329
330// Hadron Processes
331
332#include <G4HadronElasticProcess.hh>
333
334#include <G4PionPlusInelasticProcess.hh>
335#include <G4PionMinusInelasticProcess.hh>
336#include <G4KaonPlusInelasticProcess.hh>
337#include <G4KaonZeroSInelasticProcess.hh>
338#include <G4KaonZeroLInelasticProcess.hh>
339#include <G4KaonMinusInelasticProcess.hh>
340#include <G4ProtonInelasticProcess.hh>
341#include <G4AntiProtonInelasticProcess.hh>
342#include <G4NeutronInelasticProcess.hh>
343#include <G4AntiNeutronInelasticProcess.hh>
344#include <G4LambdaInelasticProcess.hh>
345#include <G4AntiLambdaInelasticProcess.hh>
346#include <G4SigmaPlusInelasticProcess.hh>
347#include <G4SigmaMinusInelasticProcess.hh>
348#include <G4AntiSigmaPlusInelasticProcess.hh>
349#include <G4AntiSigmaMinusInelasticProcess.hh>
350#include <G4XiZeroInelasticProcess.hh>
351#include <G4XiMinusInelasticProcess.hh>
352#include <G4AntiXiZeroInelasticProcess.hh>
353#include <G4AntiXiMinusInelasticProcess.hh>
354#include <G4DeuteronInelasticProcess.hh>
355#include <G4TritonInelasticProcess.hh>
356#include <G4AlphaInelasticProcess.hh>
357#include <G4OmegaMinusInelasticProcess.hh>
358#include <G4AntiOmegaMinusInelasticProcess.hh>
359
360// Low-energy Models
361
362#include <G4LElastic.hh>
363
364#include <G4LEPionPlusInelastic.hh>
365#include <G4LEPionMinusInelastic.hh>
366#include <G4LEKaonPlusInelastic.hh>
367#include <G4LEKaonZeroSInelastic.hh>
368#include <G4LEKaonZeroLInelastic.hh>
369#include <G4LEKaonMinusInelastic.hh>
370#include <G4LEProtonInelastic.hh>
371#include <G4LEAntiProtonInelastic.hh>
372#include <G4LENeutronInelastic.hh>
373#include <G4LEAntiNeutronInelastic.hh>
374#include <G4LELambdaInelastic.hh>
375#include <G4LEAntiLambdaInelastic.hh>
376#include <G4LESigmaPlusInelastic.hh>
377#include <G4LESigmaMinusInelastic.hh>
378#include <G4LEAntiSigmaPlusInelastic.hh>
379#include <G4LEAntiSigmaMinusInelastic.hh>
380#include <G4LEXiZeroInelastic.hh>
381#include <G4LEXiMinusInelastic.hh>
382#include <G4LEAntiXiZeroInelastic.hh>
383#include <G4LEAntiXiMinusInelastic.hh>
384#include <G4LEDeuteronInelastic.hh>
385#include <G4LETritonInelastic.hh>
386#include <G4LEAlphaInelastic.hh>
387#include <G4LEOmegaMinusInelastic.hh>
388#include <G4LEAntiOmegaMinusInelastic.hh>
389
390// High-energy Models
391
392#include <G4HEPionPlusInelastic.hh>
393#include <G4HEPionMinusInelastic.hh>
394#include <G4HEKaonPlusInelastic.hh>
395#include <G4HEKaonZeroInelastic.hh>
396#include <G4HEKaonZeroInelastic.hh>
397#include <G4HEKaonMinusInelastic.hh>
398#include <G4HEProtonInelastic.hh>
399#include <G4HEAntiProtonInelastic.hh>
400#include <G4HENeutronInelastic.hh>
401#include <G4HEAntiNeutronInelastic.hh>
402#include <G4HELambdaInelastic.hh>
403#include <G4HEAntiLambdaInelastic.hh>
404#include <G4HESigmaPlusInelastic.hh>
405#include <G4HESigmaMinusInelastic.hh>
406#include <G4HEAntiSigmaPlusInelastic.hh>
407#include <G4HEAntiSigmaMinusInelastic.hh>
408#include <G4HEXiZeroInelastic.hh>
409#include <G4HEXiMinusInelastic.hh>
410#include <G4HEAntiXiZeroInelastic.hh>
411#include <G4HEAntiXiMinusInelastic.hh>
412#include <G4HEOmegaMinusInelastic.hh>
413#include <G4HEAntiOmegaMinusInelastic.hh>
414
415// Stopping processes
416
417#ifdef TRIUMF_STOP_PIMINUS
418#include <G4PionMinusAbsorptionAtRest.hh>
419#else
420#include <G4PiMinusAbsorptionAtRest.hh>
421#endif
422#ifdef TRIUMF_STOP_KMINUS
423#include <G4KaonMinusAbsorption.hh>
424#else
425#include <G4KaonMinusAbsorptionAtRest.hh>
426#endif
427
428void TG4PhysicsList::ConstructHad()
429{
430//
431// ConstructHad()
432//
433// Makes discrete physics processes for the hadrons, at present limited
434// to those particles with GHEISHA interactions (INTRC > 0).
435// The processes are: Elastic scattering and Inelastic scattering.
436//
437// F.W.Jones 09-JUL-1998
438// ---
439
440 G4cout << "### TG4PhysicsList::ConstructHad()" << endl;
441
442 G4HadronElasticProcess* theElasticProcess =
443 new G4HadronElasticProcess;
444 G4LElastic* theElasticModel = new G4LElastic;
445 theElasticProcess->RegisterMe(theElasticModel);
446
447 theParticleIterator->reset();
448 while ((*theParticleIterator)()) {
449 G4ParticleDefinition* particle = theParticleIterator->value();
450 G4ProcessManager* pmanager = particle->GetProcessManager();
451 G4String particleName = particle->GetParticleName();
452
453 if (particleName == "pi+") {
454 pmanager->AddDiscreteProcess(theElasticProcess);
455 G4PionPlusInelasticProcess* theInelasticProcess =
456 new G4PionPlusInelasticProcess("inelastic");
457 G4LEPionPlusInelastic* theLEInelasticModel =
458 new G4LEPionPlusInelastic;
459 theInelasticProcess->RegisterMe(theLEInelasticModel);
460 G4HEPionPlusInelastic* theHEInelasticModel =
461 new G4HEPionPlusInelastic;
462 theInelasticProcess->RegisterMe(theHEInelasticModel);
463 pmanager->AddDiscreteProcess(theInelasticProcess);
464 }
465 else if (particleName == "pi-") {
466 pmanager->AddDiscreteProcess(theElasticProcess);
467 G4PionMinusInelasticProcess* theInelasticProcess =
468 new G4PionMinusInelasticProcess("inelastic");
469 G4LEPionMinusInelastic* theLEInelasticModel =
470 new G4LEPionMinusInelastic;
471 theInelasticProcess->RegisterMe(theLEInelasticModel);
472 G4HEPionMinusInelastic* theHEInelasticModel =
473 new G4HEPionMinusInelastic;
474 theInelasticProcess->RegisterMe(theHEInelasticModel);
475 pmanager->AddDiscreteProcess(theInelasticProcess);
476#ifdef TRIUMF_STOP_PIMINUS
477 pmanager->AddRestProcess(new G4PionMinusAbsorptionAtRest, ordDefault);
478#else
479 G4String prcNam;
480 pmanager->AddRestProcess(
481 new G4PiMinusAbsorptionAtRest(
482 prcNam="PiMinusAbsorptionAtRest"), ordDefault);
483#endif
484 }
485 else if (particleName == "kaon+") {
486 pmanager->AddDiscreteProcess(theElasticProcess);
487 G4KaonPlusInelasticProcess* theInelasticProcess =
488 new G4KaonPlusInelasticProcess("inelastic");
489 G4LEKaonPlusInelastic* theLEInelasticModel =
490 new G4LEKaonPlusInelastic;
491 theInelasticProcess->RegisterMe(theLEInelasticModel);
492 G4HEKaonPlusInelastic* theHEInelasticModel =
493 new G4HEKaonPlusInelastic;
494 theInelasticProcess->RegisterMe(theHEInelasticModel);
495 pmanager->AddDiscreteProcess(theInelasticProcess);
496 }
497 else if (particleName == "kaon0S") {
498 pmanager->AddDiscreteProcess(theElasticProcess);
499 G4KaonZeroSInelasticProcess* theInelasticProcess =
500 new G4KaonZeroSInelasticProcess("inelastic");
501 G4LEKaonZeroSInelastic* theLEInelasticModel =
502 new G4LEKaonZeroSInelastic;
503 theInelasticProcess->RegisterMe(theLEInelasticModel);
504 G4HEKaonZeroInelastic* theHEInelasticModel =
505 new G4HEKaonZeroInelastic;
506 theInelasticProcess->RegisterMe(theHEInelasticModel);
507 pmanager->AddDiscreteProcess(theInelasticProcess);
508 }
509 else if (particleName == "kaon0L") {
510 pmanager->AddDiscreteProcess(theElasticProcess);
511 G4KaonZeroLInelasticProcess* theInelasticProcess =
512 new G4KaonZeroLInelasticProcess("inelastic");
513 G4LEKaonZeroLInelastic* theLEInelasticModel =
514 new G4LEKaonZeroLInelastic;
515 theInelasticProcess->RegisterMe(theLEInelasticModel);
516 G4HEKaonZeroInelastic* theHEInelasticModel =
517 new G4HEKaonZeroInelastic;
518 theInelasticProcess->RegisterMe(theHEInelasticModel);
519 pmanager->AddDiscreteProcess(theInelasticProcess);
520 }
521 else if (particleName == "kaon-") {
522 pmanager->AddDiscreteProcess(theElasticProcess);
523 G4KaonMinusInelasticProcess* theInelasticProcess =
524 new G4KaonMinusInelasticProcess("inelastic");
525 G4LEKaonMinusInelastic* theLEInelasticModel =
526 new G4LEKaonMinusInelastic;
527 theInelasticProcess->RegisterMe(theLEInelasticModel);
528 G4HEKaonMinusInelastic* theHEInelasticModel =
529 new G4HEKaonMinusInelastic;
530 theInelasticProcess->RegisterMe(theHEInelasticModel);
531 pmanager->AddDiscreteProcess(theInelasticProcess);
532#ifdef TRIUMF_STOP_KMINUS
533 pmanager->AddRestProcess(new G4KaonMinusAbsorption, ordDefault);
534#else
535 pmanager->AddRestProcess(new G4KaonMinusAbsorptionAtRest, ordDefault);
536#endif
537 }
538 else if (particleName == "proton") {
539 pmanager->AddDiscreteProcess(theElasticProcess);
540 G4ProtonInelasticProcess* theInelasticProcess =
541 new G4ProtonInelasticProcess("inelastic");
542 G4LEProtonInelastic* theLEInelasticModel = new G4LEProtonInelastic;
543 theInelasticProcess->RegisterMe(theLEInelasticModel);
544 G4HEProtonInelastic* theHEInelasticModel = new G4HEProtonInelastic;
545 theInelasticProcess->RegisterMe(theHEInelasticModel);
546 pmanager->AddDiscreteProcess(theInelasticProcess);
547 }
548 else if (particleName == "anti_proton") {
549 pmanager->AddDiscreteProcess(theElasticProcess);
550 G4AntiProtonInelasticProcess* theInelasticProcess =
551 new G4AntiProtonInelasticProcess("inelastic");
552 G4LEAntiProtonInelastic* theLEInelasticModel =
553 new G4LEAntiProtonInelastic;
554 theInelasticProcess->RegisterMe(theLEInelasticModel);
555 G4HEAntiProtonInelastic* theHEInelasticModel =
556 new G4HEAntiProtonInelastic;
557 theInelasticProcess->RegisterMe(theHEInelasticModel);
558 pmanager->AddDiscreteProcess(theInelasticProcess);
559 }
560 else if (particleName == "neutron") {
561 pmanager->AddDiscreteProcess(theElasticProcess);
562 G4NeutronInelasticProcess* theInelasticProcess =
563 new G4NeutronInelasticProcess("inelastic");
564 G4LENeutronInelastic* theLEInelasticModel =
565 new G4LENeutronInelastic;
566 theInelasticProcess->RegisterMe(theLEInelasticModel);
567 G4HENeutronInelastic* theHEInelasticModel =
568 new G4HENeutronInelastic;
569 theInelasticProcess->RegisterMe(theHEInelasticModel);
570 pmanager->AddDiscreteProcess(theInelasticProcess);
571 }
572 else if (particleName == "anti_neutron") {
573 pmanager->AddDiscreteProcess(theElasticProcess);
574 G4AntiNeutronInelasticProcess* theInelasticProcess =
575 new G4AntiNeutronInelasticProcess("inelastic");
576 G4LEAntiNeutronInelastic* theLEInelasticModel =
577 new G4LEAntiNeutronInelastic;
578 theInelasticProcess->RegisterMe(theLEInelasticModel);
579 G4HEAntiNeutronInelastic* theHEInelasticModel =
580 new G4HEAntiNeutronInelastic;
581 theInelasticProcess->RegisterMe(theHEInelasticModel);
582 pmanager->AddDiscreteProcess(theInelasticProcess);
583 }
584 else if (particleName == "lambda") {
585 pmanager->AddDiscreteProcess(theElasticProcess);
586 G4LambdaInelasticProcess* theInelasticProcess =
587 new G4LambdaInelasticProcess("inelastic");
588 G4LELambdaInelastic* theLEInelasticModel = new G4LELambdaInelastic;
589 theInelasticProcess->RegisterMe(theLEInelasticModel);
590 G4HELambdaInelastic* theHEInelasticModel = new G4HELambdaInelastic;
591 theInelasticProcess->RegisterMe(theHEInelasticModel);
592 pmanager->AddDiscreteProcess(theInelasticProcess);
593 }
594 else if (particleName == "anti_lambda") {
595 pmanager->AddDiscreteProcess(theElasticProcess);
596 G4AntiLambdaInelasticProcess* theInelasticProcess =
597 new G4AntiLambdaInelasticProcess("inelastic");
598 G4LEAntiLambdaInelastic* theLEInelasticModel =
599 new G4LEAntiLambdaInelastic;
600 theInelasticProcess->RegisterMe(theLEInelasticModel);
601 G4HEAntiLambdaInelastic* theHEInelasticModel =
602 new G4HEAntiLambdaInelastic;
603 theInelasticProcess->RegisterMe(theHEInelasticModel);
604 pmanager->AddDiscreteProcess(theInelasticProcess);
605 }
606 else if (particleName == "sigma+") {
607 pmanager->AddDiscreteProcess(theElasticProcess);
608 G4SigmaPlusInelasticProcess* theInelasticProcess =
609 new G4SigmaPlusInelasticProcess("inelastic");
610 G4LESigmaPlusInelastic* theLEInelasticModel =
611 new G4LESigmaPlusInelastic;
612 theInelasticProcess->RegisterMe(theLEInelasticModel);
613 G4HESigmaPlusInelastic* theHEInelasticModel =
614 new G4HESigmaPlusInelastic;
615 theInelasticProcess->RegisterMe(theHEInelasticModel);
616 pmanager->AddDiscreteProcess(theInelasticProcess);
617 }
618 else if (particleName == "sigma-") {
619 pmanager->AddDiscreteProcess(theElasticProcess);
620 G4SigmaMinusInelasticProcess* theInelasticProcess =
621 new G4SigmaMinusInelasticProcess("inelastic");
622 G4LESigmaMinusInelastic* theLEInelasticModel =
623 new G4LESigmaMinusInelastic;
624 theInelasticProcess->RegisterMe(theLEInelasticModel);
625 G4HESigmaMinusInelastic* theHEInelasticModel =
626 new G4HESigmaMinusInelastic;
627 theInelasticProcess->RegisterMe(theHEInelasticModel);
628 pmanager->AddDiscreteProcess(theInelasticProcess);
629 }
630 else if (particleName == "anti_sigma+") {
631 pmanager->AddDiscreteProcess(theElasticProcess);
632 G4AntiSigmaPlusInelasticProcess* theInelasticProcess =
633 new G4AntiSigmaPlusInelasticProcess("inelastic");
634 G4LEAntiSigmaPlusInelastic* theLEInelasticModel =
635 new G4LEAntiSigmaPlusInelastic;
636 theInelasticProcess->RegisterMe(theLEInelasticModel);
637 G4HEAntiSigmaPlusInelastic* theHEInelasticModel =
638 new G4HEAntiSigmaPlusInelastic;
639 theInelasticProcess->RegisterMe(theHEInelasticModel);
640 pmanager->AddDiscreteProcess(theInelasticProcess);
641 }
642 else if (particleName == "anti_sigma-") {
643 pmanager->AddDiscreteProcess(theElasticProcess);
644 G4AntiSigmaMinusInelasticProcess* theInelasticProcess =
645 new G4AntiSigmaMinusInelasticProcess("inelastic");
646 G4LEAntiSigmaMinusInelastic* theLEInelasticModel =
647 new G4LEAntiSigmaMinusInelastic;
648 theInelasticProcess->RegisterMe(theLEInelasticModel);
649 G4HEAntiSigmaMinusInelastic* theHEInelasticModel =
650 new G4HEAntiSigmaMinusInelastic;
651 theInelasticProcess->RegisterMe(theHEInelasticModel);
652 pmanager->AddDiscreteProcess(theInelasticProcess);
653 }
654 else if (particleName == "xi0") {
655 pmanager->AddDiscreteProcess(theElasticProcess);
656 G4XiZeroInelasticProcess* theInelasticProcess =
657 new G4XiZeroInelasticProcess("inelastic");
658 G4LEXiZeroInelastic* theLEInelasticModel =
659 new G4LEXiZeroInelastic;
660 theInelasticProcess->RegisterMe(theLEInelasticModel);
661 G4HEXiZeroInelastic* theHEInelasticModel =
662 new G4HEXiZeroInelastic;
663 theInelasticProcess->RegisterMe(theHEInelasticModel);
664 pmanager->AddDiscreteProcess(theInelasticProcess);
665 }
666 else if (particleName == "xi-") {
667 pmanager->AddDiscreteProcess(theElasticProcess);
668 G4XiMinusInelasticProcess* theInelasticProcess =
669 new G4XiMinusInelasticProcess("inelastic");
670 G4LEXiMinusInelastic* theLEInelasticModel =
671 new G4LEXiMinusInelastic;
672 theInelasticProcess->RegisterMe(theLEInelasticModel);
673 G4HEXiMinusInelastic* theHEInelasticModel =
674 new G4HEXiMinusInelastic;
675 theInelasticProcess->RegisterMe(theHEInelasticModel);
676 pmanager->AddDiscreteProcess(theInelasticProcess);
677 }
678 else if (particleName == "anti_xi0") {
679 pmanager->AddDiscreteProcess(theElasticProcess);
680 G4AntiXiZeroInelasticProcess* theInelasticProcess =
681 new G4AntiXiZeroInelasticProcess("inelastic");
682 G4LEAntiXiZeroInelastic* theLEInelasticModel =
683 new G4LEAntiXiZeroInelastic;
684 theInelasticProcess->RegisterMe(theLEInelasticModel);
685 G4HEAntiXiZeroInelastic* theHEInelasticModel =
686 new G4HEAntiXiZeroInelastic;
687 theInelasticProcess->RegisterMe(theHEInelasticModel);
688 pmanager->AddDiscreteProcess(theInelasticProcess);
689 }
690 else if (particleName == "anti_xi-") {
691 pmanager->AddDiscreteProcess(theElasticProcess);
692 G4AntiXiMinusInelasticProcess* theInelasticProcess =
693 new G4AntiXiMinusInelasticProcess("inelastic");
694 G4LEAntiXiMinusInelastic* theLEInelasticModel =
695 new G4LEAntiXiMinusInelastic;
696 theInelasticProcess->RegisterMe(theLEInelasticModel);
697 G4HEAntiXiMinusInelastic* theHEInelasticModel =
698 new G4HEAntiXiMinusInelastic;
699 theInelasticProcess->RegisterMe(theHEInelasticModel);
700 pmanager->AddDiscreteProcess(theInelasticProcess);
701 }
702 else if (particleName == "deuteron") {
703 pmanager->AddDiscreteProcess(theElasticProcess);
704 G4DeuteronInelasticProcess* theInelasticProcess =
705 new G4DeuteronInelasticProcess("inelastic");
706 G4LEDeuteronInelastic* theLEInelasticModel =
707 new G4LEDeuteronInelastic;
708 theInelasticProcess->RegisterMe(theLEInelasticModel);
709 pmanager->AddDiscreteProcess(theInelasticProcess);
710 }
711 else if (particleName == "triton") {
712 pmanager->AddDiscreteProcess(theElasticProcess);
713 G4TritonInelasticProcess* theInelasticProcess =
714 new G4TritonInelasticProcess("inelastic");
715 G4LETritonInelastic* theLEInelasticModel =
716 new G4LETritonInelastic;
717 theInelasticProcess->RegisterMe(theLEInelasticModel);
718 pmanager->AddDiscreteProcess(theInelasticProcess);
719 }
720 else if (particleName == "alpha") {
721 pmanager->AddDiscreteProcess(theElasticProcess);
722 G4AlphaInelasticProcess* theInelasticProcess =
723 new G4AlphaInelasticProcess("inelastic");
724 G4LEAlphaInelastic* theLEInelasticModel =
725 new G4LEAlphaInelastic;
726 theInelasticProcess->RegisterMe(theLEInelasticModel);
727 pmanager->AddDiscreteProcess(theInelasticProcess);
728 }
729 else if (particleName == "omega-") {
730 pmanager->AddDiscreteProcess(theElasticProcess);
731 G4OmegaMinusInelasticProcess* theInelasticProcess =
732 new G4OmegaMinusInelasticProcess("inelastic");
733 G4LEOmegaMinusInelastic* theLEInelasticModel =
734 new G4LEOmegaMinusInelastic;
735 theInelasticProcess->RegisterMe(theLEInelasticModel);
736 G4HEOmegaMinusInelastic* theHEInelasticModel =
737 new G4HEOmegaMinusInelastic;
738 theInelasticProcess->RegisterMe(theHEInelasticModel);
739 pmanager->AddDiscreteProcess(theInelasticProcess);
740 }
741 else if (particleName == "anti_omega-") {
742 pmanager->AddDiscreteProcess(theElasticProcess);
743 G4AntiOmegaMinusInelasticProcess* theInelasticProcess =
744 new G4AntiOmegaMinusInelasticProcess("inelastic");
745 G4LEAntiOmegaMinusInelastic* theLEInelasticModel =
746 new G4LEAntiOmegaMinusInelastic;
747 theInelasticProcess->RegisterMe(theLEInelasticModel);
748 G4HEAntiOmegaMinusInelastic* theHEInelasticModel =
749 new G4HEAntiOmegaMinusInelastic;
750 theInelasticProcess->RegisterMe(theHEInelasticModel);
751 pmanager->AddDiscreteProcess(theInelasticProcess);
752 }
753 }
754
755 G4cout << "### TG4PhysicsList::ConstructHad() finished." << endl;
756
757}
758
759
760#include <G4Cerenkov.hh>
761#include <G4OpAbsorption.hh>
762#include <G4OpRayleigh.hh>
763#include <G4OpBoundaryProcess.hh>
764
765void TG4PhysicsList::ConstructOp()
766{
767// Constructs optical processes.
768// According to ExN06PhysicsList.cc.
769// (geant4 1.1)
770// ---
771
772 G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov");
773 G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
774 G4OpRayleigh* theRayleighScatteringProcess = new G4OpRayleigh();
775 G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
776
777 theCerenkovProcess->DumpPhysicsTable();
778 //theAbsorptionProcess->DumpPhysicsTable();
779 //theRayleighScatteringProcess->DumpPhysicsTable();
780
781 // add verbose
782 //theCerenkovProcess->SetVerboseLevel(1);
783 //theAbsorptionProcess->SetVerboseLevel(1);
784 //theRayleighScatteringProcess->SetVerboseLevel(1);
785 //theBoundaryProcess->SetVerboseLevel(1);
786
787 G4int maxNumPhotons = 300;
788
789 theCerenkovProcess->SetTrackSecondariesFirst(true);
790 theCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumPhotons);
791
792 //G4OpticalSurfaceModel themodel = unified;
793 // model from GEANT3
794 G4OpticalSurfaceModel themodel = glisur;
795 theBoundaryProcess->SetModel(themodel);
796
797 theParticleIterator->reset();
798 while( (*theParticleIterator)() ){
799 G4ParticleDefinition* particle = theParticleIterator->value();
800 G4ProcessManager* processManager = particle->GetProcessManager();
801 G4String particleName = particle->GetParticleName();
802 if (theCerenkovProcess->IsApplicable(*particle)) {
803 processManager->AddContinuousProcess(theCerenkovProcess);
804 }
805 if (particleName == "opticalphoton") {
806 G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
807 processManager->AddDiscreteProcess(theAbsorptionProcess);
808 processManager->AddDiscreteProcess(theRayleighScatteringProcess);
809 processManager->AddDiscreteProcess(theBoundaryProcess);
810 }
811 }
812}
813
814#include <G4Decay.hh>
815
816void TG4PhysicsList::ConstructGeneral()
817{
818// Constructs general processes.
819// ---
820
821 // Add Decay Process
822 G4Decay* theDecayProcess = new G4Decay();
823 theParticleIterator->reset();
824 while( (*theParticleIterator)() ){
825 G4ParticleDefinition* particle = theParticleIterator->value();
826 G4ProcessManager* pmanager = particle->GetProcessManager();
827 if (theDecayProcess->IsApplicable(*particle)) {
828 pmanager ->AddProcess(theDecayProcess);
829 // set ordering for PostStepDoIt and AtRestDoIt
830 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
831 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
832 }
833 }
834}
835
836void TG4PhysicsList::ConstructSpecialCuts()
837{
838// Adds TG4SpecialCuts "process" that activates
839// the kinetic energy cuts defined in
840// the vector of cuts (PhysicsManager::fCutVector) or in TG4Limits.
841// ---
842
843 TG4PhysicsManager* physicsManager
844 = TG4PhysicsManager::Instance();
845
846 if (physicsManager->IsSpecialCuts())
847 {
848 TG4CutVector* cutVector
849 = physicsManager->GetCutVector();
850 TG4boolVector* isCutVector
851 = physicsManager->GetIsCutVector();
852
853 theParticleIterator->reset();
854 while ((*theParticleIterator)())
855 {
856 G4ParticleDefinition* particle = theParticleIterator->value();
857 TG3ParticleWSP particleWSP
858 = physicsManager->GetG3ParticleWSP(particle);
859 G4String name;
860 physicsManager->GetG3ParticleWSPName(particleWSP, name);
861
862 // uncomment this to see all particles "WSP"
863 //G4cout << "Iterating particle: "
864 // << particle->GetParticleName() << " " << particleWSP << " "
865 // << name << endl;
866
867 // special process is created in case
868 // cutVector (vector of kinetic energy cuts) is set
869 // or the special cut is set by TG4Limits
870 if ((particleWSP !=kNofParticlesWSP) &&
871 ((*isCutVector)[particleWSP])) {
872 // check if process already exists
873 G4String processName = "specialCutFor" + name;
874 G4VProcess* process = FindProcess(processName);
875 if (!process) {
876 process = new TG4SpecialCuts(particleWSP, cutVector, processName);
877 }
878 //particle->GetProcessManager()->AddProcess(process, 0, -1, 1);
879 particle->GetProcessManager()->AddDiscreteProcess(process);
880 }
881 }
882
883 if (verboseLevel>0) {
884 G4cout << "TG4PhysicsList::ConstructSpecialCuts: " << endl;
885 if (cutVector)
886 G4cout << " Global kinetic energy cuts are set." << endl;
887 G4cout << " Special cuts process is defined for: " << endl
888 << " ";
889 for (G4int i=0; i<kAny; i++) {
890 G4String name;
891 physicsManager->GetG3ParticleWSPName(i, name);
892 if ((*isCutVector)[i]) G4cout << name << " ";
893 }
894 G4cout << endl;
895 }
896 }
897}
898
899void TG4PhysicsList::ConstructSpecialFlags()
900{
901// Adds TG4SpecialFlags "process" that activates
902// the control process flags defined in TG4Limits.
903// ---
904
905 TG4PhysicsManager* physicsManager
906 = TG4PhysicsManager::Instance();
907
908 if (physicsManager->IsSpecialFlags())
909 {
910 G4cout << "IsSpecialFlags started" << endl;
911 TG4boolVector* isFlagVector
912 = physicsManager->GetIsFlagVector();
913
914 theParticleIterator->reset();
915 while ((*theParticleIterator)())
916 {
917 G4ParticleDefinition* particle = theParticleIterator->value();
918 TG3ParticleWSP particleWSP
919 = physicsManager->GetG3ParticleWSP(particle);
920 //G4String name;
921 //GetG3ParticleWSPName(particleWSP, name);
922
923 // special process is set in case
924 // the special flag is set by TG4Limits
925 if ((particleWSP !=kNofParticlesWSP) &&
926 ((*isFlagVector)[particleWSP])) {
927 // check if process already exists
928 G4String processName = "specialFlag";
929 G4VProcess* process = FindProcess(processName);
930 if (!process) {
931 process = new TG4SpecialFlags(processName);
932 }
933 //particle->GetProcessManager()->AddProcess(process, 0, -1, 1);
934 particle->GetProcessManager()->AddDiscreteProcess(process);
935 }
936 }
937
938 if (verboseLevel>0) {
939 G4cout << "TG4PhysicsList::ConstructSpecialFlagss: " << endl;
940 G4cout << " Special flags process is defined for: " << endl
941 << " ";
942 for (G4int i=0; i<kNofParticlesWSP; i++) {
943 G4String name;
944 physicsManager->GetG3ParticleWSPName(i, name);
945 if ((*isFlagVector)[i]) G4cout << name << " ";
946 }
947 G4cout << endl;
948 }
949 }
950}
951
952void TG4PhysicsList::SetCuts()
953{
954// "G4VUserPhysicsList::SetCutsWithDefault" method sets
955// the default cut value for all particle types
956// ---
957
958 SetCutsWithDefault();
959}
960
961void TG4PhysicsList::ConstructAllBosons()
962{
963// Construct all bosons
964// ---
965
966 G4BosonConstructor pConstructor;
967 pConstructor.ConstructParticle();
968}
969
970void TG4PhysicsList::ConstructAllLeptons()
971{
972// Construct all leptons
973// ---
974
975 G4LeptonConstructor pConstructor;
976 pConstructor.ConstructParticle();
977}
978
979void TG4PhysicsList::ConstructAllMesons()
980{
981// Construct all mesons
982// ---
983
984 G4MesonConstructor pConstructor;
985 pConstructor.ConstructParticle();
986}
987
988void TG4PhysicsList::ConstructAllBaryons()
989{
990// Construct all barions
991// ---
992
993 G4BaryonConstructor pConstructor;
994 pConstructor.ConstructParticle();
995}
996
997void TG4PhysicsList::ConstructAllIons()
998{
999// Construct light ions
1000// ---
1001
1002 G4IonConstructor pConstructor;
1003 pConstructor.ConstructParticle();
1004}
1005
1006void TG4PhysicsList::ConstructAllShortLiveds()
1007{
1008// Construct resonaces and quarks
1009// ---
1010
1011 G4ShortLivedConstructor pConstructor;
1012 pConstructor.ConstructParticle();
1013}
1014
1015// private methods
1016
1017G4VProcess* TG4PhysicsList::FindProcess(G4String processName) const
1018{
1019// Finds G4VProcess with specified name.
1020// ---
1021
1022 G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
1023
1024 G4ProcessVector* processVector
1025 = processTable->FindProcesses(processName);
1026 G4VProcess* firstFoundProcess = 0;
1027 if (processVector->entries()>0) firstFoundProcess= (*processVector)[0];
1028
1029 processVector->clear();
1030 delete processVector;
1031
1032 return firstFoundProcess;
1033}
1034
1035void TG4PhysicsList::InActivateProcess(G4String processName,
1036 G4ParticleDefinition* particle)
1037{
1038// Activates the process specified by name for the specified
1039// particle.
1040// Only for tests - to be removed.
1041// ---
1042
1043 G4ProcessManager* processManager = particle->GetProcessManager();
1044 G4ProcessVector* processVector = processManager->GetProcessList();
1045 for (G4int i=0; i<processVector->entries(); i++) {
1046 if ((*processVector)[i]->GetProcessName() == processName) {
1047 processManager->SetProcessActivation((*processVector)[i], false);
1048 return;
1049 }
1050 }
1051
1052 G4String text = "TG4PhysicsList::InActivateProcess: ";
1053 text = text + processName + " is not set for ";
1054 text = text + particle->GetParticleName();
1055 TG4Globals::Exception(text);
1056}
1057
1058void TG4PhysicsList::InActivateEM()
1059{
1060// Inactivates specified electromagnetic processes.
1061// Only for tests - to be removed.
1062// !! This method must be called after all Construct methods.
1063// Uncomment the selected line(s) to inactivate desired processes.
1064// ---
1065
1066 theParticleIterator->reset();
1067 while ((*theParticleIterator)())
1068 {
1069 G4ParticleDefinition* particle = theParticleIterator->value();
1070 G4String name = particle->GetParticleName();
1071
1072 if (name == "gamma") {
1073 // gamma
1074 //InActivateProcess("phot", particle);
1075 //InActivateProcess("compt", particle);
1076 //InActivateProcess("conv", particle);
1077 }
1078 else if (name == "e-") {
1079 //electron
1080 InActivateProcess("msc", particle);
1081 G4cout << "msc inactivated." << endl;
1082 //InActivateProcess("eIoni", particle);
1083 //G4cout << "eIoni inactivated." << endl;
1084 InActivateProcess("eBrem", particle);
1085 G4cout << "eBrem inactivated." << endl;
1086 }
1087 else if (name == "e+") {
1088 //positron
1089 //InActivateProcess("msc", particle);
1090 //InActivateProcess("eIoni", particle);
1091 //InActivateProcess("eBrem", particle);
1092 //InActivateProcess("annihil", particle);
1093 }
1094 else if (name == "mu+" || name == "mu-") {
1095 //muon
1096 //InActivateProcess("msc", particle);
1097 //InActivateProcess("MuIoni", particle);
1098 //InActivateProcess("MuBrem", particle);
1099 //InActivateProcess("MuPairProd", particle);
1100 }
1101 else if ((!particle->IsShortLived()) &&
1102 (particle->GetPDGCharge() != 0.0) &&
1103 (particle->GetParticleName() != "chargedgeantino"))
1104 {
1105 // all others charged particles except geantino
1106 //InActivateProcess("msc", particle);
1107 //InActivateProcess("hIoni", particle);
1108 }
1109 }
1110}
1111