LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DirectAccess.cc File Reference

Main program of the electromagnetic/TestEm0 example. More...

#include "G4Material.hh"
#include "G4PEEffectFluoModel.hh"
#include "G4KleinNishinaCompton.hh"
#include "G4BetheHeitlerModel.hh"
#include "G4eeToTwoGammaModel.hh"
#include "G4MollerBhabhaModel.hh"
#include "G4SeltzerBergerModel.hh"
#include "G4BetheBlochModel.hh"
#include "G4BraggModel.hh"
#include "G4MuBetheBlochModel.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4MuPairProductionModel.hh"
#include "globals.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4Gamma.hh"
#include "G4Positron.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4MuonPlus.hh"
#include "G4DataVector.hh"
#include "G4NistManager.hh"
#include "G4ParticleTable.hh"

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

Main program of the electromagnetic/TestEm0 example.

Definition in file DirectAccess.cc.

Function Documentation

int main ( )

Definition at line 67 of file DirectAccess.cc.

References Z.

67  {
68 
69  G4UnitDefinition::BuildUnitsTable();
70 
71  G4ParticleDefinition* gamma = G4Gamma::Gamma();
72  G4ParticleDefinition* posit = G4Positron::Positron();
73  G4ParticleDefinition* elec = G4Electron::Electron();
74  G4ParticleDefinition* prot = G4Proton::Proton();
75  G4ParticleDefinition* muon = G4MuonPlus::MuonPlus();
76  G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
77  partTable->SetReadiness();
78 
79  G4DataVector cuts;
80  cuts.push_back(1*keV);
81 
82  // define materials
83  //
84  G4Material* material =
85  G4NistManager::Instance()->FindOrBuildMaterial("G4_Fe");
86 
87  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
88 
89  G4MaterialCutsCouple* couple = new G4MaterialCutsCouple(material);
90  couple->SetIndex(0);
91 
92  // work only for simple materials
93  G4double Z = material->GetZ();
94  G4double A = material->GetA();
95 
96  // initialise gamma processes (models)
97  //
98  G4VEmModel* phot = new G4PEEffectFluoModel();
99  G4VEmModel* comp = new G4KleinNishinaCompton();
100  G4VEmModel* conv = new G4BetheHeitlerModel();
101  phot->Initialise(gamma, cuts);
102  comp->Initialise(gamma, cuts);
103  conv->Initialise(gamma, cuts);
104 
105  // valid pointer to a couple is needed for this model
106  phot->SetCurrentCouple(couple);
107 
108  // compute CrossSection per atom and MeanFreePath
109  //
110  G4double Emin = 1.01*MeV, Emax = 2.01*MeV, dE = 100*keV;
111 
112  G4cout << "\n #### Gamma : CrossSectionPerAtom and MeanFreePath for "
113  << material->GetName() << G4endl;
114  G4cout << "\n Energy \t PhotoElec \t Compton \t Conversion \t";
115  G4cout << "\t PhotoElec \t Compton \t Conversion" << G4endl;
116 
117  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
118  G4cout << "\n " << G4BestUnit (Energy, "Energy")
119  << "\t"
120  << G4BestUnit (phot->ComputeCrossSectionPerAtom(gamma,Energy,Z),"Surface")
121  << "\t"
122  << G4BestUnit (comp->ComputeCrossSectionPerAtom(gamma,Energy,Z),"Surface")
123  << "\t"
124  << G4BestUnit (conv->ComputeCrossSectionPerAtom(gamma,Energy,Z),"Surface")
125  << "\t \t"
126  << G4BestUnit (phot->ComputeMeanFreePath(gamma,Energy,material),"Length")
127  << "\t"
128  << G4BestUnit (comp->ComputeMeanFreePath(gamma,Energy,material),"Length")
129  << "\t"
130  << G4BestUnit (conv->ComputeMeanFreePath(gamma,Energy,material),"Length");
131  }
132 
133  G4cout << G4endl;
134 
135  // initialise positron annihilation (model)
136  //
137  G4VEmModel* anni = new G4eeToTwoGammaModel();
138  anni->Initialise(posit, cuts);
139 
140  // compute CrossSection per atom and MeanFreePath
141  //
142  Emin = 1.01*MeV; Emax = 2.01*MeV; dE = 100*keV;
143 
144  G4cout << "\n #### e+ annihilation : CrossSectionPerAtom and MeanFreePath"
145  << " for " << material->GetName() << G4endl;
146  G4cout << "\n Energy \t e+ annihil \t";
147  G4cout << "\t e+ annihil" << G4endl;
148 
149  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
150  G4cout << "\n " << G4BestUnit (Energy, "Energy")
151  << "\t"
152  << G4BestUnit (anni->ComputeCrossSectionPerAtom(posit,Energy,Z),"Surface")
153  << "\t \t"
154  << G4BestUnit (anni->ComputeMeanFreePath(posit,Energy,material),"Length");
155  }
156 
157  G4cout << G4endl;
158 
159  // initialise electron processes (models)
160  //
161  G4VEmModel* ioni = new G4MollerBhabhaModel();
162  G4VEmModel* brem = new G4SeltzerBergerModel();
163  ioni->Initialise(elec, cuts);
164  brem->Initialise(elec, cuts);
165 
166  // compute CrossSection per atom and MeanFreePath
167  //
168  Emin = 1.01*MeV; Emax = 101.01*MeV; dE = 10*MeV;
169  G4double Ecut = 100*keV;
170 
171  G4cout << "\n ####electron: CrossSection, MeanFreePath and StoppingPower"
172  << " for " << material->GetName()
173  << ";\tEnergy cut = " << G4BestUnit (Ecut, "Energy") << G4endl;
174 
175  G4cout << "\n Energy \t ionization \t bremsstra \t";
176  G4cout << "\t ionization \t bremsstra \t";
177  G4cout << "\t ionization \t bremsstra" << G4endl;
178 
179  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
180  G4cout << "\n " << G4BestUnit (Energy, "Energy")
181  << "\t"
182  << G4BestUnit (ioni->ComputeCrossSectionPerAtom(elec,Energy,Z,A,Ecut),
183  "Surface")
184  << "\t"
185  << G4BestUnit (brem->ComputeCrossSectionPerAtom(elec,Energy,Z,A,Ecut),
186  "Surface")
187  << "\t \t"
188  << G4BestUnit (ioni->ComputeMeanFreePath(elec,Energy,material,Ecut),
189  "Length")
190  << "\t"
191  << G4BestUnit (brem->ComputeMeanFreePath(elec,Energy,material,Ecut),
192  "Length")
193  << "\t \t"
194  << G4BestUnit (ioni->ComputeDEDXPerVolume(material,elec,Energy,Ecut),
195  "Energy/Length")
196  << "\t"
197  << G4BestUnit (brem->ComputeDEDXPerVolume(material,elec,Energy,Ecut),
198  "Energy/Length");
199  }
200 
201  G4cout << G4endl;
202 
203  // initialise proton processes (models)
204  //
205  ioni = new G4BetheBlochModel();
206  ioni->Initialise(prot, cuts);
207 
208  // compute CrossSection per atom and MeanFreePath
209  //
210  Emin = 1.01*MeV; Emax = 102.01*MeV; dE = 10*MeV;
211  Ecut = 100*keV;
212 
213  G4cout << "\n #### proton : CrossSection, MeanFreePath and StoppingPower"
214  << " for " << material->GetName()
215  << ";\tEnergy cut = " << G4BestUnit (Ecut, "Energy") << G4endl;
216 
217  G4cout << "\n Energy \t ionization \t";
218  G4cout << "\t ionization \t";
219  G4cout << "\t ionization" << G4endl;
220 
221  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
222  G4cout << "\n " << G4BestUnit (Energy, "Energy")
223  << "\t"
224  << G4BestUnit (ioni->ComputeCrossSectionPerAtom(prot,Energy,Z,A,Ecut),
225  "Surface")
226  << "\t \t"
227  << G4BestUnit (ioni->ComputeMeanFreePath(prot,Energy,material,Ecut),
228  "Length")
229  << "\t \t"
230  << G4BestUnit (ioni->ComputeDEDXPerVolume(material,prot,Energy,Ecut),
231  "Energy/Length");
232  }
233 
234  G4cout << G4endl;
235 
236  // low energy : Bragg Model
237  ioni = new G4BraggModel(prot);
238  ioni->Initialise(prot, cuts);
239 
240  // compute CrossSection per atom and MeanFreePath
241  //
242  Emin = 1.1*keV; Emax = 2.01*MeV; dE = 300*keV;
243  Ecut = 10*keV;
244 
245  G4cout << "\n #### proton : low energy model (Bragg) "
246  << ";\tEnergy cut = " << G4BestUnit (Ecut, "Energy") << G4endl;
247 
248  G4cout << "\n Energy \t ionization \t";
249  G4cout << "\t ionization \t";
250  G4cout << "\t ionization" << G4endl;
251 
252  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
253  G4cout << "\n " << G4BestUnit (Energy, "Energy")
254  << "\t"
255  << G4BestUnit (ioni->ComputeCrossSectionPerAtom(prot,Energy,Z,A,Ecut),
256  "Surface")
257  << "\t \t"
258  << G4BestUnit (ioni->ComputeMeanFreePath(prot,Energy,material,Ecut),
259  "Length")
260  << "\t \t"
261  << G4BestUnit (ioni->ComputeDEDXPerVolume(material,prot,Energy,Ecut),
262  "Energy/Length");
263  }
264 
265  G4cout << G4endl;
266 
267  // initialise muon processes (models)
268  //
269  ioni = new G4MuBetheBlochModel();
270  brem = new G4MuBremsstrahlungModel();
271  G4VEmModel* pair = new G4MuPairProductionModel();
272  ioni->Initialise(muon, cuts);
273  brem->Initialise(muon, cuts);
274  pair->Initialise(muon, cuts);
275 
276  // compute CrossSection per atom and MeanFreePath
277  //
278  Emin = 1.01*GeV; Emax = 101.01*GeV; dE = 10*GeV;
279  Ecut = 10*MeV;
280 
281  G4cout << "\n ####muon: CrossSection and MeanFreePath for "
282  << material->GetName()
283  << ";\tEnergy cut = " << G4BestUnit (Ecut, "Energy") << G4endl;
284 
285  G4cout << "\n Energy \t ionization \t bremsstra \t pair_prod \t";
286  G4cout << "\t ionization \t bremsstra \t pair_prod" << G4endl;
287 
288  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
289  G4cout << "\n " << G4BestUnit (Energy, "Energy")
290  << "\t"
291  << G4BestUnit (ioni->ComputeCrossSectionPerAtom(muon,Energy,Z,A,Ecut),
292  "Surface")
293  << "\t"
294  << G4BestUnit (brem->ComputeCrossSectionPerAtom(muon,Energy,Z,A,Ecut),
295  "Surface")
296  << "\t"
297  << G4BestUnit (pair->ComputeCrossSectionPerAtom(muon,Energy,Z,A,Ecut),
298  "Surface")
299  << "\t \t"
300  << G4BestUnit (ioni->ComputeMeanFreePath(muon,Energy,material,Ecut),
301  "Length")
302  << "\t"
303  << G4BestUnit (brem->ComputeMeanFreePath(muon,Energy,material,Ecut),
304  "Length")
305  << "\t"
306  << G4BestUnit (pair->ComputeMeanFreePath(muon,Energy,material,Ecut),
307  "Length");
308  }
309 
310  G4cout << G4endl;
311 
312  G4cout << "\n ####muon: StoppingPower for "
313  << material->GetName()
314  << ";\tEnergy cut = " << G4BestUnit (Ecut, "Energy") << G4endl;
315 
316  G4cout << "\n Energy \t ionization \t bremsstra \t pair_prod \t" << G4endl;
317 
318  for (G4double Energy = Emin; Energy <= Emax; Energy += dE) {
319  G4cout << "\n " << G4BestUnit (Energy, "Energy")
320  << "\t"
321  << G4BestUnit (ioni->ComputeDEDXPerVolume(material,muon,Energy,Ecut),
322  "Energy/Length")
323  << "\t"
324  << G4BestUnit (brem->ComputeDEDXPerVolume(material,muon,Energy,Ecut),
325  "Energy/Length")
326  << "\t"
327  << G4BestUnit (pair->ComputeDEDXPerVolume(material,muon,Energy,Ecut),
328  "Energy/Length");
329  }
330 
331  G4cout << G4endl;
332  return EXIT_SUCCESS;
333 }
Float_t Z
Definition: plot.C:37
General LArSoft Utilities.