source: trunk/source/processes/electromagnetic/utils/src/G4EmSaturation.cc @ 968

Last change on this file since 968 was 968, checked in by garnier, 15 years ago

fichier ajoutes

  • Property svn:executable set to *
File size: 8.7 KB
Line 
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,v 1.9 2008/11/12 15:37:33 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-02-ref-02 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class file
32//
33//
34// File name:     G4EmSaturation
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 18.02.2008
39//
40// Modifications:
41//
42// -------------------------------------------------------------
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47#include "G4EmSaturation.hh"
48#include "G4Gamma.hh"
49#include "G4Electron.hh"
50#include "G4Neutron.hh"
51#include "G4Proton.hh"
52#include "G4LossTableManager.hh"
53#include "G4NistManager.hh"
54#include "G4Material.hh"
55#include "G4MaterialCutsCouple.hh"
56
57//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58
59G4EmSaturation::G4EmSaturation()
60{
61  verbose = 1;
62  manager = 0;
63  curMaterial = 0;
64  curBirks = 0.0;
65  curRatio = 1.0;
66  curChargeSq = 1.0;
67  nMaterials = 0;
68  Initialise();
69}
70
71//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72
73G4EmSaturation::~G4EmSaturation()
74{}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77
78G4double G4EmSaturation::VisibleEnergyDeposition(
79                                      const G4ParticleDefinition* p, 
80                                      const G4MaterialCutsCouple* couple, 
81                                      G4double length,
82                                      G4double edep,
83                                      G4double niel)
84{
85  if(edep <= 0.0) return 0.0;
86
87  G4double evis = edep;
88  G4double bfactor = FindBirksCoefficient(couple->GetMaterial());
89
90  if(bfactor > 0.0) { 
91
92    // atomic relaxations
93    if(p == gamma) {
94      evis /= (1.0 + bfactor*edep/manager->GetRange(electron,edep,couple));
95
96      // energy loss
97    } else {
98
99      // protections
100      G4double nloss = niel;
101      if(nloss < 0.0) nloss = 0.0;
102      G4double eloss = edep - nloss;
103      if(p == neutron || eloss < 0.0 || length <= 0.0) {
104        nloss = edep;
105        eloss = 0.0;
106      }
107
108      // continues energy loss
109      if(eloss > 0.0) eloss /= (1.0 + bfactor*eloss/length);
110 
111      // non-ionizing energy loss
112      if(nloss > 0.0) {
113        G4double escaled = nloss*curRatio;
114        G4double s = manager->GetRange(proton,escaled,couple)/curChargeSq; 
115        nloss /= (1.0 + bfactor*nloss/s);
116      }
117
118      evis = eloss + nloss;
119    }
120  }
121 
122  return evis;
123}
124
125//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
126
127G4double G4EmSaturation::FindG4BirksCoefficient(const G4Material* mat)
128{
129  G4String name = mat->GetName();
130  // is this material in the vector?
131 
132  for(G4int j=0; j<nG4Birks; j++) {
133    if(name == g4MatNames[j]) {
134      if(verbose > 0) 
135        G4cout << "### G4EmSaturation::FindG4BirksCoefficient for "
136               << name << " is " << g4MatData[j]*MeV/mm << " mm/MeV "
137               << G4endl;
138      return g4MatData[j];
139    }
140  }
141  return FindBirksCoefficient(mat);
142}
143
144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
145
146G4double G4EmSaturation::FindBirksCoefficient(const G4Material* mat)
147{
148  if(mat == curMaterial) return curBirks;
149
150  curMaterial = mat;
151  curBirks = 0.0;
152  curRatio = 1.0;
153  curChargeSq = 1.0;
154
155  // seach in the run-time list
156  for(G4int i=0; i<nMaterials; i++) {
157    if(mat == matPointers[i]) {
158      curBirks = mat->GetIonisation()->GetBirksConstant();
159      curRatio = massFactors[i];
160      curChargeSq = effCharges[i];
161      return curBirks;
162    }
163  }
164
165  if(!manager) {
166    manager = G4LossTableManager::Instance();
167    nist    = G4NistManager::Instance();
168    gamma   = G4Gamma::Gamma();
169    electron= G4Electron::Electron();
170    proton  = G4Proton::Proton();
171    neutron = G4Neutron::Neutron();
172  }
173
174  G4String name = mat->GetName();
175  curBirks = mat->GetIonisation()->GetBirksConstant();
176
177  // material has no Birks coeffitient defined
178  // seach in the Geant4 list
179  if(curBirks == 0.0) {
180    for(G4int j=0; j<nG4Birks; j++) {
181      if(name == g4MatNames[j]) {
182        mat->GetIonisation()->SetBirksConstant(g4MatData[j]);
183        curBirks = g4MatData[j];
184        break;
185      }
186    }
187  }
188
189  if(curBirks == 0.0 && verbose > 0) {
190      G4cout << "### G4EmSaturation::FindBirksCoefficient fails "
191        " for material " << name << G4endl;
192  }
193
194  // compute mean mass ratio
195  curRatio = 0.0;
196  curChargeSq = 0.0;
197  G4double norm = 0.0;
198  const G4ElementVector* theElementVector = mat->GetElementVector();
199  const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
200  size_t nelm = mat->GetNumberOfElements();
201  for (size_t i=0; i<nelm; i++) {
202    const G4Element* elm = (*theElementVector)[i];
203    G4double Z = elm->GetZ();
204    G4double w = Z*Z*theAtomNumDensityVector[i];
205    curRatio += w/nist->GetAtomicMassAmu(G4int(Z));
206    curChargeSq = Z*Z*w;
207    norm += w;
208  }
209  curRatio *= proton_mass_c2/norm;
210  curChargeSq /= norm;
211
212  // store results
213  matPointers.push_back(mat);
214  matNames.push_back(name);
215  massFactors.push_back(curRatio);
216  effCharges.push_back(curChargeSq);
217  nMaterials++;
218  if(curBirks > 0.0 && verbose > 0) {
219    G4cout << "### G4EmSaturation::FindBirksCoefficient Birks coefficient for "
220           << name << "  " << curBirks*MeV/mm << " mm/MeV" << G4endl;
221  }
222  return curBirks;
223}
224
225//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
226
227void G4EmSaturation::DumpBirksCoefficients()
228{
229  if(nMaterials > 0) {
230    G4cout << "### Birks coeffitients used in run time" << G4endl;
231    for(G4int i=0; i<nMaterials; i++) {
232      G4double br = matPointers[i]->GetIonisation()->GetBirksConstant();
233      G4cout << "   " << matNames[i] << "     " 
234             << br*MeV/mm << " mm/MeV" << "     "
235             << br*matPointers[i]->GetDensity()*MeV*cm2/g
236             << " g/cm^2/MeV" 
237             << G4endl;
238    }
239  }
240}
241
242//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
243
244void G4EmSaturation::DumpG4BirksCoefficients()
245{
246  if(nG4Birks > 0) {
247    G4cout << "### Birks coeffitients for Geant4 materials" << G4endl;
248    for(G4int i=0; i<nG4Birks; i++) {
249      G4cout << "   " << g4MatNames[i] << "   " 
250             << g4MatData[i]*MeV/mm << " mm/MeV" << G4endl;
251    }
252  }
253}
254
255//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
256
257void G4EmSaturation::Initialise()
258{
259  // M.Hirschberg et al., IEEE Trans. Nuc. Sci. 39 (1992) 511
260  // SCSN-38 kB = 0.00842 g/cm^2/MeV; rho = 1.06 g/cm^3
261  g4MatNames.push_back("G4_POLYSTYRENE");
262  g4MatData.push_back(0.07943*mm/MeV);
263
264  // C.Fabjan (private communication)
265  // kB = 0.006 g/cm^2/MeV; rho = 7.13 g/cm^3
266  g4MatNames.push_back("G4_BGO");
267  g4MatData.push_back(0.008415*mm/MeV);
268
269  // A.Ribon analysis of publications
270  // Scallettar et al., Phys. Rev. A25 (1982) 2419.
271  // NIM A 523 (2004) 275.
272  // kB = 0.022 g/cm^2/MeV; rho = 1.396 g/cm^3;
273  // ATLAS Efield = 10 kV/cm provide the strongest effect
274  g4MatNames.push_back("G4_lAr");
275  g4MatData.push_back(0.1576*mm/MeV);
276
277  //G4_BARIUM_FLUORIDE
278  //G4_CESIUM_IODIDE
279  //G4_GEL_PHOTO_EMULSION
280  //G4_PHOTO_EMULSION
281  //G4_PLASTIC_SC_VINYLTOLUENE
282  //G4_SODIUM_IODIDE
283  //G4_STILBENE
284  //G4_lAr
285  //G4_PbWO4
286  //G4_Lucite
287
288  nG4Birks = g4MatData.size();
289}
290
291//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.