]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4PhysicsConstructorEM.cxx
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / TGeant4 / TG4PhysicsConstructorEM.cxx
1 // $Id$
2 // Category: physics
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class TG4PhysicsConstructorEM
7 // -----------------------------
8 // See the class description in the header file.
9 // According to ExN04EMPhysics.cc,v 1.1.2.1 2001/06/28 19:07:37 gunter Exp 
10 // GEANT4 tag Name: geant4-03-02
11
12 #include "TG4PhysicsConstructorEM.h"
13 #include "TG4ProcessControlMap.h"
14 #include "TG4ProcessMCMap.h"
15
16 #include <G4ParticleDefinition.hh>
17 #include <G4ProcessManager.hh>
18 #include <G4Gamma.hh>
19 #include <G4Electron.hh>
20 #include <G4Positron.hh>
21 #include <G4NeutrinoE.hh>
22 #include <G4AntiNeutrinoE.hh>
23
24 //_____________________________________________________________________________
25 TG4PhysicsConstructorEM::TG4PhysicsConstructorEM(const G4String& name)
26   : TG4VPhysicsConstructor(name) {
27 //
28 }
29
30 //_____________________________________________________________________________
31 TG4PhysicsConstructorEM::TG4PhysicsConstructorEM(G4int verboseLevel,
32                                                  const G4String& name)
33   : TG4VPhysicsConstructor(name, verboseLevel) {
34 //
35 }
36
37 //_____________________________________________________________________________
38 TG4PhysicsConstructorEM::~TG4PhysicsConstructorEM() {
39 //
40 }
41
42 // private methods
43
44 //_____________________________________________________________________________
45 void TG4PhysicsConstructorEM::ConstructProcessForGamma()
46 {
47 // Constructs electromagnetic processes for gamma.
48 // ---
49   
50   // add processes
51   G4ProcessManager* pManager = G4Gamma::Gamma()->GetProcessManager();
52   pManager->AddDiscreteProcess(&fPhotoEffect);
53   pManager->AddDiscreteProcess(&fComptonEffect);
54   pManager->AddDiscreteProcess(&fPairProduction);
55
56   // map to G3 controls
57   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
58   controlMap->Add(&fPhotoEffect, kPHOT); 
59   controlMap->Add(&fComptonEffect, kCOMP); 
60   controlMap->Add(&fPairProduction, kPAIR); 
61
62   // map to AliMCProcess codes
63   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
64   mcMap->Add(&fPhotoEffect, kPPhotoelectric); 
65   mcMap->Add(&fComptonEffect, kPCompton); 
66   mcMap->Add(&fPairProduction, kPPair); 
67 }  
68
69
70 //_____________________________________________________________________________
71 void TG4PhysicsConstructorEM::ConstructProcessForElectron()
72 {
73 // Constructs electromagnetic processes for e-.
74 // ---
75
76   // add process
77   G4ProcessManager* pManager = G4Electron::Electron()->GetProcessManager();
78   pManager->AddDiscreteProcess(&fElectronBremsStrahlung); 
79   pManager->AddProcess(&fElectronIonisation, ordInActive, 2, 2);
80   pManager->AddProcess(&fElectronMultipleScattering);
81
82   // set ordering
83   pManager->SetProcessOrdering(&fElectronMultipleScattering, idxAlongStep,  1);
84   pManager->SetProcessOrdering(&fElectronMultipleScattering, idxPostStep,  1);
85
86   // map to G3 controls
87   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
88   controlMap->Add(&fElectronBremsStrahlung, kBREM); 
89   controlMap->Add(&fElectronIonisation, kLOSS); 
90   controlMap->Add(&fElectronMultipleScattering, kMULS); 
91
92   // map to AliMCProcess codes
93   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
94   mcMap->Add(&fElectronBremsStrahlung, kPBrem); 
95   mcMap->Add(&fElectronMultipleScattering, kPMultipleScattering); 
96   mcMap->Add(&fElectronIonisation, kPEnergyLoss); 
97 }
98
99 //_____________________________________________________________________________
100 void TG4PhysicsConstructorEM::ConstructProcessForPositron()
101 {
102 // Constructs electromagnetic processes for e+.
103 // ---
104   
105   // add processes
106   G4ProcessManager * pManager = G4Positron::Positron()->GetProcessManager();
107   pManager->AddDiscreteProcess(&fPositronBremsStrahlung);
108   pManager->AddDiscreteProcess(&fAnnihilation);
109   pManager->AddRestProcess(&fAnnihilation);
110   pManager->AddProcess(&fPositronIonisation, ordInActive,2, 2);
111   pManager->AddProcess(&fPositronMultipleScattering);
112
113   // set ordering
114   pManager->SetProcessOrdering(&fPositronMultipleScattering, idxAlongStep,  1);
115   pManager->SetProcessOrdering(&fPositronMultipleScattering, idxPostStep,  1);
116
117   // map to G3 controls
118   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
119   controlMap->Add(&fPositronBremsStrahlung, kBREM); 
120   controlMap->Add(&fAnnihilation, kANNI); 
121   controlMap->Add(&fPositronIonisation, kLOSS); 
122   controlMap->Add(&fPositronMultipleScattering, kMULS); 
123
124   // map to AliMCProcess codes
125   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
126   mcMap->Add(&fPositronBremsStrahlung, kPBrem); 
127   mcMap->Add(&fAnnihilation, kPAnnihilation); 
128   mcMap->Add(&fPositronIonisation, kPEnergyLoss); 
129   mcMap->Add(&fPositronMultipleScattering, kPMultipleScattering); 
130 }
131
132 // protected methods
133
134 //_____________________________________________________________________________
135 void TG4PhysicsConstructorEM::ConstructParticle()
136 {
137 // Instantiates particles.
138 // ---
139
140   // gamma
141   G4Gamma::GammaDefinition();
142  
143   // electron
144   G4Electron::ElectronDefinition();
145   G4Positron::PositronDefinition();
146   G4NeutrinoE::NeutrinoEDefinition();
147   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
148 }
149
150 //_____________________________________________________________________________
151 void TG4PhysicsConstructorEM::ConstructProcess()
152 {
153 // Constructs electromagnetic processes for e+.
154 // ---
155
156   ConstructProcessForGamma();
157   ConstructProcessForElectron();
158   ConstructProcessForPositron();
159
160   if (VerboseLevel() > 0) {
161     G4cout << "### Electromagnetic physics constructed." << G4endl;
162   }  
163 }