]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4PhysicsConstructorEM.cxx
added comment lines separating methods
[u/mrichter/AliRoot.git] / TGeant4 / TG4PhysicsConstructorEM.cxx
1 // $Id$
2 // Category: physics
3 //
4 // According to corresponding part of:
5 // ExN04PhysicsList.cc,v 1.7 1999/12/15 14:49:26 gunter
6 // GEANT4 tag Name: geant4-01-01
7
8 #include "TG4PhysicsConstructorEM.h"
9
10 #include <G4ParticleDefinition.hh>
11 #include <G4ProcessManager.hh>
12 #include <G4ComptonScattering.hh>
13 #include <G4GammaConversion.hh>
14 #include <G4PhotoElectricEffect.hh>
15 #include <G4MultipleScattering.hh>
16 #include <G4eIonisation.hh>
17 #include <G4eBremsstrahlung.hh>
18 #include <G4eplusAnnihilation.hh>
19 #include <G4MuIonisation.hh>
20 #include <G4MuBremsstrahlung.hh>
21 #include <G4MuPairProduction.hh>
22 #include <G4hIonisation.hh>
23
24 //_____________________________________________________________________________
25 TG4PhysicsConstructorEM::TG4PhysicsConstructorEM(const G4String& name)
26   : G4VPhysicsConstructor(name)
27 {
28 //
29   SetVerboseLevel(1);
30 }
31
32 //_____________________________________________________________________________
33 TG4PhysicsConstructorEM::~TG4PhysicsConstructorEM() {
34 //
35 }
36
37 // protected methods
38
39 //_____________________________________________________________________________
40 void TG4PhysicsConstructorEM::ConstructParticle()
41 {
42 // The particles are constructed in the 
43 // TG4ModularPhysicsList.
44 // ---
45 }
46
47 //_____________________________________________________________________________
48 void TG4PhysicsConstructorEM::ConstructProcess()
49 {
50 // Constructs electromagnetic processes.
51 // ---
52
53   theParticleIterator->reset();
54   while( (*theParticleIterator)() ){
55     G4ParticleDefinition* particle = theParticleIterator->value();
56     G4ProcessManager* pmanager = particle->GetProcessManager();
57     G4String particleName = particle->GetParticleName();
58      
59     if (particleName == "gamma") {
60     // gamma
61       // Construct processes for gamma
62       pmanager->AddDiscreteProcess(new G4GammaConversion());
63       pmanager->AddDiscreteProcess(new G4ComptonScattering());      
64       pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
65
66     } else if (particleName == "e-") {
67     //electron
68       // Construct processes for electron
69       G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
70       G4VProcess* theeminusIonisation = new G4eIonisation();
71       G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
72       // add processes
73       pmanager->AddProcess(theeminusMultipleScattering);
74       pmanager->AddProcess(theeminusIonisation);
75       pmanager->AddProcess(theeminusBremsstrahlung);      
76       // set ordering for AlongStepDoIt
77       pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,  1);
78       pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,  2);
79       // set ordering for PostStepDoIt
80       pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
81       pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
82       pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
83
84     } else if (particleName == "e+") {
85     //positron
86       // Construct processes for positron
87       G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
88       G4VProcess* theeplusIonisation = new G4eIonisation();
89       G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
90       G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
91       // add processes
92       pmanager->AddProcess(theeplusMultipleScattering);
93       pmanager->AddProcess(theeplusIonisation);
94       pmanager->AddProcess(theeplusBremsstrahlung);
95       pmanager->AddProcess(theeplusAnnihilation);
96       // set ordering for AtRestDoIt
97       pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
98       // set ordering for AlongStepDoIt
99       pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,  1);
100       pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,  2);
101       // set ordering for PostStepDoIt
102       pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
103       pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
104       pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
105       pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
106   
107     } else if( particleName == "mu+" || 
108                particleName == "mu-"    ) {
109     //muon  
110      // Construct processes for muon+
111      G4VProcess* aMultipleScattering = new G4MultipleScattering();
112      G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
113      G4VProcess* aPairProduction = new G4MuPairProduction();
114      G4VProcess* anIonisation = new G4MuIonisation();
115       // add processes
116      pmanager->AddProcess(anIonisation);
117      pmanager->AddProcess(aMultipleScattering);
118      pmanager->AddProcess(aBremsstrahlung);
119      pmanager->AddProcess(aPairProduction);
120      // set ordering for AlongStepDoIt
121      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
122      pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
123      // set ordering for PostStepDoIt
124      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
125      pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
126      pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
127      pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
128      
129     } else if( particleName == "GenericIon" ) {
130      G4VProcess* aionIonization = new G4hIonisation;
131      G4VProcess* aMultipleScattering = new G4MultipleScattering();
132      pmanager->AddProcess(aionIonization);
133      pmanager->AddProcess(aMultipleScattering);
134      // set ordering for AlongStepDoIt
135      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
136      pmanager->SetProcessOrdering(aionIonization, idxAlongStep,  2);
137      // set ordering for PostStepDoIt
138      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
139      pmanager->SetProcessOrdering(aionIonization, idxPostStep, 2);
140
141    } else if ((!particle->IsShortLived()) &&
142               (particle->GetPDGCharge() != 0.0) && 
143               (particle->GetParticleName() != "chargedgeantino")) {
144      // all others charged particles except geantino
145      G4VProcess* aMultipleScattering = new G4MultipleScattering();
146      G4VProcess* anIonisation = new G4hIonisation();
147      // add processes
148      pmanager->AddProcess(anIonisation);
149      pmanager->AddProcess(aMultipleScattering);
150      // set ordering for AlongStepDoIt
151      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
152      pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
153      // set ordering for PostStepDoIt
154      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
155      pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
156     }
157   }
158
159   if (verboseLevel>0)
160     G4cout << "### Electromagnetic physics constructed." << G4endl;
161 }