Initial version
[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 TG4PhysicsConstructorEM::TG4PhysicsConstructorEM(const G4String& name)
25   : G4VPhysicsConstructor(name)
26 {
27 //
28   SetVerboseLevel(1);
29 }
30
31 TG4PhysicsConstructorEM::~TG4PhysicsConstructorEM() {
32 //
33 }
34
35 // protected methods
36
37 void TG4PhysicsConstructorEM::ConstructParticle()
38 {
39 // The particles are constructed in the 
40 // TG4ModularPhysicsList.
41 // ---
42 }
43
44 void TG4PhysicsConstructorEM::ConstructProcess()
45 {
46 // Constructs electromagnetic processes.
47 // ---
48
49   theParticleIterator->reset();
50   while( (*theParticleIterator)() ){
51     G4ParticleDefinition* particle = theParticleIterator->value();
52     G4ProcessManager* pmanager = particle->GetProcessManager();
53     G4String particleName = particle->GetParticleName();
54      
55     if (particleName == "gamma") {
56     // gamma
57       // Construct processes for gamma
58       pmanager->AddDiscreteProcess(new G4GammaConversion());
59       pmanager->AddDiscreteProcess(new G4ComptonScattering());      
60       pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
61
62     } else if (particleName == "e-") {
63     //electron
64       // Construct processes for electron
65       G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
66       G4VProcess* theeminusIonisation = new G4eIonisation();
67       G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
68       // add processes
69       pmanager->AddProcess(theeminusMultipleScattering);
70       pmanager->AddProcess(theeminusIonisation);
71       pmanager->AddProcess(theeminusBremsstrahlung);      
72       // set ordering for AlongStepDoIt
73       pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,  1);
74       pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,  2);
75       // set ordering for PostStepDoIt
76       pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
77       pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
78       pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
79
80     } else if (particleName == "e+") {
81     //positron
82       // Construct processes for positron
83       G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
84       G4VProcess* theeplusIonisation = new G4eIonisation();
85       G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
86       G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
87       // add processes
88       pmanager->AddProcess(theeplusMultipleScattering);
89       pmanager->AddProcess(theeplusIonisation);
90       pmanager->AddProcess(theeplusBremsstrahlung);
91       pmanager->AddProcess(theeplusAnnihilation);
92       // set ordering for AtRestDoIt
93       pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
94       // set ordering for AlongStepDoIt
95       pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,  1);
96       pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,  2);
97       // set ordering for PostStepDoIt
98       pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
99       pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
100       pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
101       pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
102   
103     } else if( particleName == "mu+" || 
104                particleName == "mu-"    ) {
105     //muon  
106      // Construct processes for muon+
107      G4VProcess* aMultipleScattering = new G4MultipleScattering();
108      G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
109      G4VProcess* aPairProduction = new G4MuPairProduction();
110      G4VProcess* anIonisation = new G4MuIonisation();
111       // add processes
112      pmanager->AddProcess(anIonisation);
113      pmanager->AddProcess(aMultipleScattering);
114      pmanager->AddProcess(aBremsstrahlung);
115      pmanager->AddProcess(aPairProduction);
116      // set ordering for AlongStepDoIt
117      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
118      pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
119      // set ordering for PostStepDoIt
120      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
121      pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
122      pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
123      pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
124      
125     } else if( particleName == "GenericIon" ) {
126      G4VProcess* aionIonization = new G4hIonisation;
127      G4VProcess* aMultipleScattering = new G4MultipleScattering();
128      pmanager->AddProcess(aionIonization);
129      pmanager->AddProcess(aMultipleScattering);
130      // set ordering for AlongStepDoIt
131      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
132      pmanager->SetProcessOrdering(aionIonization, idxAlongStep,  2);
133      // set ordering for PostStepDoIt
134      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
135      pmanager->SetProcessOrdering(aionIonization, idxPostStep, 2);
136
137    } else if ((!particle->IsShortLived()) &&
138               (particle->GetPDGCharge() != 0.0) && 
139               (particle->GetParticleName() != "chargedgeantino")) {
140      // all others charged particles except geantino
141      G4VProcess* aMultipleScattering = new G4MultipleScattering();
142      G4VProcess* anIonisation = new G4hIonisation();
143      // add processes
144      pmanager->AddProcess(anIonisation);
145      pmanager->AddProcess(aMultipleScattering);
146      // set ordering for AlongStepDoIt
147      pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,  1);
148      pmanager->SetProcessOrdering(anIonisation, idxAlongStep,  2);
149      // set ordering for PostStepDoIt
150      pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
151      pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
152     }
153   }
154
155   if (verboseLevel>0)
156     G4cout << "### Electromagnetic physics constructed." << G4endl;
157 }