]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4PhysicsConstructorEM.cxx
Several pointers were set to zero in the default constructors to avoid memory managem...
[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   : G4VPhysicsConstructor(name)
27 {
28 //
29   SetVerboseLevel(1);
30 }
31
32 //_____________________________________________________________________________
33 TG4PhysicsConstructorEM::~TG4PhysicsConstructorEM() {
34 //
35 }
36
37 // private methods
38
39 //_____________________________________________________________________________
40 void TG4PhysicsConstructorEM::ConstructProcessForGamma()
41 {
42 // Constructs electromagnetic processes for gamma.
43 // ---
44   
45   // add processes
46   G4ProcessManager* pManager = G4Gamma::Gamma()->GetProcessManager();
47   pManager->AddDiscreteProcess(&fPhotoEffect);
48   pManager->AddDiscreteProcess(&fComptonEffect);
49   pManager->AddDiscreteProcess(&fPairProduction);
50
51   // map to G3 controls
52   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
53   controlMap->Add(&fPhotoEffect, kPHOT); 
54   controlMap->Add(&fComptonEffect, kCOMP); 
55   controlMap->Add(&fPairProduction, kPAIR); 
56
57   // map to AliMCProcess codes
58   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
59   mcMap->Add(&fPhotoEffect, kPPhotoelectric); 
60   mcMap->Add(&fComptonEffect, kPCompton); 
61   mcMap->Add(&fPairProduction, kPPair); 
62 }  
63
64
65 //_____________________________________________________________________________
66 void TG4PhysicsConstructorEM::ConstructProcessForElectron()
67 {
68 // Constructs electromagnetic processes for e-.
69 // ---
70
71   // add process
72   G4ProcessManager* pManager = G4Electron::Electron()->GetProcessManager();
73   pManager->AddDiscreteProcess(&fElectronBremsStrahlung); 
74   pManager->AddProcess(&fElectronIonisation, ordInActive, 2, 2);
75   pManager->AddProcess(&fElectronMultipleScattering);
76
77   // set ordering
78   pManager->SetProcessOrdering(&fElectronMultipleScattering, idxAlongStep,  1);
79   pManager->SetProcessOrdering(&fElectronMultipleScattering, idxPostStep,  1);
80
81   // map to G3 controls
82   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
83   controlMap->Add(&fElectronBremsStrahlung, kBREM); 
84   controlMap->Add(&fElectronIonisation, kLOSS); 
85   controlMap->Add(&fElectronMultipleScattering, kMULS); 
86
87   // map to AliMCProcess codes
88   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
89   mcMap->Add(&fElectronBremsStrahlung, kPBrem); 
90   mcMap->Add(&fElectronMultipleScattering, kPMultipleScattering); 
91   mcMap->Add(&fElectronIonisation, kPEnergyLoss); 
92 }
93
94 //_____________________________________________________________________________
95 void TG4PhysicsConstructorEM::ConstructProcessForPositron()
96 {
97 // Constructs electromagnetic processes for e+.
98 // ---
99   
100   // add processes
101   G4ProcessManager * pManager = G4Positron::Positron()->GetProcessManager();
102   pManager->AddDiscreteProcess(&fPositronBremsStrahlung);
103   pManager->AddDiscreteProcess(&fAnnihilation);
104   pManager->AddRestProcess(&fAnnihilation);
105   pManager->AddProcess(&fPositronIonisation, ordInActive,2, 2);
106   pManager->AddProcess(&fPositronMultipleScattering);
107
108   // set ordering
109   pManager->SetProcessOrdering(&fPositronMultipleScattering, idxAlongStep,  1);
110   pManager->SetProcessOrdering(&fPositronMultipleScattering, idxPostStep,  1);
111
112   // map to G3 controls
113   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
114   controlMap->Add(&fPositronBremsStrahlung, kBREM); 
115   controlMap->Add(&fAnnihilation, kANNI); 
116   controlMap->Add(&fPositronIonisation, kLOSS); 
117   controlMap->Add(&fPositronMultipleScattering, kMULS); 
118
119   // map to AliMCProcess codes
120   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
121   mcMap->Add(&fPositronBremsStrahlung, kPBrem); 
122   mcMap->Add(&fAnnihilation, kPAnnihilation); 
123   mcMap->Add(&fPositronIonisation, kPEnergyLoss); 
124   mcMap->Add(&fPositronMultipleScattering, kPMultipleScattering); 
125 }
126
127 // protected methods
128
129 //_____________________________________________________________________________
130 void TG4PhysicsConstructorEM::ConstructParticle()
131 {
132 // Instantiates particles.
133 // ---
134
135   // gamma
136   G4Gamma::GammaDefinition();
137  
138   // electron
139   G4Electron::ElectronDefinition();
140   G4Positron::PositronDefinition();
141   G4NeutrinoE::NeutrinoEDefinition();
142   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
143 }
144
145 //_____________________________________________________________________________
146 void TG4PhysicsConstructorEM::ConstructProcess()
147 {
148 // Constructs electromagnetic processes for e+.
149 // ---
150
151   ConstructProcessForGamma();
152   ConstructProcessForElectron();
153   ConstructProcessForPositron();
154
155   if (verboseLevel>0)
156     G4cout << "### Electromagnetic physics constructed." << G4endl;
157 }