Geant4  10.00.p01
G4EmSaturation.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4EmSaturation.cc 66241 2012-12-13 18:34:42Z gunter $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4EmSaturation
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 18.02.2008
38 //
39 // Modifications:
40 //
41 // -------------------------------------------------------------
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
46 #include "G4EmSaturation.hh"
47 #include "G4PhysicalConstants.hh"
48 #include "G4SystemOfUnits.hh"
49 #include "G4LossTableManager.hh"
50 #include "G4NistManager.hh"
51 #include "G4Material.hh"
52 #include "G4MaterialCutsCouple.hh"
53 #include "G4Electron.hh"
54 #include "G4Proton.hh"
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57 
59 {
60  verbose = 1;
61  manager = 0;
62 
63  curMaterial = 0;
64  curBirks = 0.0;
65  curRatio = 1.0;
66  curChargeSq = 1.0;
67  nMaterials = 0;
68 
69  electron = 0;
70  proton = 0;
72 
73  Initialise();
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77 
79 {}
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
82 
84  const G4ParticleDefinition* p,
85  const G4MaterialCutsCouple* couple,
86  G4double length,
87  G4double edep,
88  G4double niel)
89 {
90  if(edep <= 0.0) { return 0.0; }
91 
92  G4double evis = edep;
93  G4double bfactor = FindBirksCoefficient(couple->GetMaterial());
94 
95  if(bfactor > 0.0) {
96 
97  G4int pdgCode = p->GetPDGEncoding();
98  // atomic relaxations for gamma incident
99  if(22 == pdgCode) {
100  evis /= (1.0 + bfactor*edep/manager->GetRange(electron,edep,couple));
101 
102  // energy loss
103  } else {
104 
105  // protections
106  G4double nloss = niel;
107  if(nloss < 0.0) nloss = 0.0;
108  G4double eloss = edep - nloss;
109 
110  // neutrons
111  if(2112 == pdgCode || eloss < 0.0 || length <= 0.0) {
112  nloss = edep;
113  eloss = 0.0;
114  }
115 
116  // continues energy loss
117  if(eloss > 0.0) { eloss /= (1.0 + bfactor*eloss/length); }
118 
119  // non-ionizing energy loss
120  if(nloss > 0.0) {
121  if(!proton) { proton = G4Proton::Proton(); }
122  G4double escaled = nloss*curRatio;
123  G4double range = manager->GetRange(proton,escaled,couple)/curChargeSq;
124  nloss /= (1.0 + bfactor*nloss/range);
125  }
126 
127  evis = eloss + nloss;
128  }
129  }
130 
131  return evis;
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
135 
137 {
138  G4String name = mat->GetName();
139  // is this material in the vector?
140 
141  for(G4int j=0; j<nG4Birks; ++j) {
142  if(name == g4MatNames[j]) {
143  if(verbose > 0)
144  G4cout << "### G4EmSaturation::FindG4BirksCoefficient for "
145  << name << " is " << g4MatData[j]*MeV/mm << " mm/MeV "
146  << G4endl;
147  return g4MatData[j];
148  }
149  }
150  return FindBirksCoefficient(mat);
151 }
152 
153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
154 
156 {
157  // electron should exist in any case
158  if(!manager) {
161  }
162 
163  if(mat == curMaterial) { return curBirks; }
164 
165  curMaterial = mat;
166  curBirks = 0.0;
167  curRatio = 1.0;
168  curChargeSq = 1.0;
169 
170  // seach in the run-time list
171  for(G4int i=0; i<nMaterials; ++i) {
172  if(mat == matPointers[i]) {
174  curRatio = massFactors[i];
175  curChargeSq = effCharges[i];
176  return curBirks;
177  }
178  }
179 
180  G4String name = mat->GetName();
182 
183  // material has no Birks coeffitient defined
184  // seach in the Geant4 list
185  if(curBirks == 0.0) {
186  for(G4int j=0; j<nG4Birks; ++j) {
187  if(name == g4MatNames[j]) {
189  curBirks = g4MatData[j];
190  break;
191  }
192  }
193  }
194 
195  if(curBirks == 0.0 && verbose > 0) {
196  G4cout << "### G4EmSaturation::FindBirksCoefficient fails "
197  " for material " << name << G4endl;
198  }
199 
200  // compute mean mass ratio
201  curRatio = 0.0;
202  curChargeSq = 0.0;
203  G4double norm = 0.0;
204  const G4ElementVector* theElementVector = mat->GetElementVector();
205  const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
206  size_t nelm = mat->GetNumberOfElements();
207  for (size_t i=0; i<nelm; ++i) {
208  const G4Element* elm = (*theElementVector)[i];
209  G4double Z = elm->GetZ();
210  G4double w = Z*Z*theAtomNumDensityVector[i];
212  curChargeSq = Z*Z*w;
213  norm += w;
214  }
215  curRatio *= proton_mass_c2/norm;
216  curChargeSq /= norm;
217 
218  // store results
219  matPointers.push_back(mat);
220  matNames.push_back(name);
221  massFactors.push_back(curRatio);
222  effCharges.push_back(curChargeSq);
223  nMaterials++;
224  if(curBirks > 0.0 && verbose > 0) {
225  G4cout << "### G4EmSaturation::FindBirksCoefficient Birks coefficient for "
226  << name << " " << curBirks*MeV/mm << " mm/MeV" << G4endl;
227  }
228  return curBirks;
229 }
230 
231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
232 
234 {
235  if(nMaterials > 0) {
236  G4cout << "### Birks coeffitients used in run time" << G4endl;
237  for(G4int i=0; i<nMaterials; ++i) {
238  G4double br = matPointers[i]->GetIonisation()->GetBirksConstant();
239  G4cout << " " << matNames[i] << " "
240  << br*MeV/mm << " mm/MeV" << " "
241  << br*matPointers[i]->GetDensity()*MeV*cm2/g
242  << " g/cm^2/MeV"
243  << G4endl;
244  }
245  }
246 }
247 
248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
249 
251 {
252  if(nG4Birks > 0) {
253  G4cout << "### Birks coeffitients for Geant4 materials" << G4endl;
254  for(G4int i=0; i<nG4Birks; ++i) {
255  G4cout << " " << g4MatNames[i] << " "
256  << g4MatData[i]*MeV/mm << " mm/MeV" << G4endl;
257  }
258  }
259 }
260 
261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
262 
264 {
265  // M.Hirschberg et al., IEEE Trans. Nuc. Sci. 39 (1992) 511
266  // SCSN-38 kB = 0.00842 g/cm^2/MeV; rho = 1.06 g/cm^3
267  g4MatNames.push_back("G4_POLYSTYRENE");
268  g4MatData.push_back(0.07943*mm/MeV);
269 
270  // C.Fabjan (private communication)
271  // kB = 0.006 g/cm^2/MeV; rho = 7.13 g/cm^3
272  g4MatNames.push_back("G4_BGO");
273  g4MatData.push_back(0.008415*mm/MeV);
274 
275  // A.Ribon analysis of publications
276  // Scallettar et al., Phys. Rev. A25 (1982) 2419.
277  // NIM A 523 (2004) 275.
278  // kB = 0.022 g/cm^2/MeV; rho = 1.396 g/cm^3;
279  // ATLAS Efield = 10 kV/cm provide the strongest effect
280  g4MatNames.push_back("G4_lAr");
281  g4MatData.push_back(0.1576*mm/MeV);
282 
283  //G4_BARIUM_FLUORIDE
284  //G4_CESIUM_IODIDE
285  //G4_GEL_PHOTO_EMULSION
286  //G4_PHOTO_EMULSION
287  //G4_PLASTIC_SC_VINYLTOLUENE
288  //G4_SODIUM_IODIDE
289  //G4_STILBENE
290  //G4_lAr
291  //G4_PbWO4
292  //G4_Lucite
293 
294  nG4Birks = g4MatData.size();
295 }
296 
297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
std::vector< const G4Material * > matPointers
const G4ParticleDefinition * electron
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:224
static const double MeV
Definition: G4SIunits.hh:193
static G4LossTableManager * Instance()
static const double cm2
Definition: G4SIunits.hh:107
std::vector< G4double > g4MatData
const G4ParticleDefinition * proton
std::vector< G4Element * > G4ElementVector
G4double FindBirksCoefficient(const G4Material *)
G4NistManager * nist
G4String name
Definition: TRTMaterials.hh:40
const G4String & GetName() const
Definition: G4Material.hh:176
G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0)
void SetBirksConstant(G4double value)
virtual ~G4EmSaturation()
const G4Material * curMaterial
G4double GetZ() const
Definition: G4Element.hh:131
std::vector< G4double > effCharges
std::vector< G4String > g4MatNames
void DumpBirksCoefficients()
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4double GetBirksConstant() const
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:204
std::vector< G4String > matNames
G4GLOB_DLL std::ostream G4cout
G4double FindG4BirksCoefficient(const G4Material *)
static G4Proton * Proton()
Definition: G4Proton.cc:93
std::vector< G4double > massFactors
void DumpG4BirksCoefficients()
static const double g
Definition: G4SIunits.hh:162
G4LossTableManager * manager
G4double GetAtomicMassAmu(const G4String &symb) const
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
G4double curChargeSq
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
double G4double
Definition: G4Types.hh:76
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
static const double mm
Definition: G4SIunits.hh:102
const G4Material * GetMaterial() const