ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BremsstrahlungCrossSectionHandler.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4BremsstrahlungCrossSectionHandler.cc
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 //
27 // -------------------------------------------------------------------
28 //
29 // GEANT4 Class file
30 //
31 //
32 // File name: G4BremsstrahlungCrossSectionHandler
33 //
34 // Author: V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
35 //
36 // Creation date: 25 September 2001
37 //
38 // Modifications:
39 //
40 // 10.10.2001 MGP Revision to improve code quality and consistency with design
41 // 21.01.2003 VI cut per region
42 // 03.03.2009 LP Added public method to make a easier migration of
43 // G4LowEnergyBremsstrahlung to G4LivermoreBremsstrahlungModel
44 //
45 // 15 Jul 2009 Nicolas A. Karakatsanis
46 //
47 // - BuildCrossSectionForMaterials method was revised in order to calculate the
48 // logarithmic values of the loaded data.
49 // It retrieves the data values from the G4EMLOW data files but, then, calculates the
50 // respective log values and loads them to seperate data structures.
51 // The EM data sets, initialized this way, contain both non-log and log values.
52 // These initialized data sets can enhance the computing performance of data interpolation
53 // operations
54 //
55 //
56 //
57 //
58 // -------------------------------------------------------------------
59 
62 #include "G4DataVector.hh"
63 #include "G4CompositeEMDataSet.hh"
64 #include "G4VDataSetAlgorithm.hh"
66 #include "G4VEMDataSet.hh"
67 #include "G4EMDataSet.hh"
68 #include "G4Material.hh"
69 #include "G4ProductionCutsTable.hh"
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72 
75  : theBR(spec)
76 {
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
81 
83 {
84  delete interp;
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
88 
89 std::vector<G4VEMDataSet*>*
91  const G4DataVector* energyCuts)
92 {
93  std::vector<G4VEMDataSet*>* set = new std::vector<G4VEMDataSet*>;
94 
95  G4DataVector* energies;
96  G4DataVector* cs;
97 
98  G4DataVector* log_energies;
99  G4DataVector* log_cs;
100 
101  G4int nOfBins = energyVector.size();
102 
103  const G4ProductionCutsTable* theCoupleTable=
105  size_t numOfCouples = theCoupleTable->GetTableSize();
106 
107  for (size_t mLocal=0; mLocal<numOfCouples; mLocal++) {
108 
109  const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(mLocal);
110  const G4Material* material= couple->GetMaterial();
111  const G4ElementVector* elementVector = material->GetElementVector();
112  const G4double* nAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
113  G4int nElements = material->GetNumberOfElements();
114 
115  G4double tcut = (*energyCuts)[mLocal];
116 
117  G4VDataSetAlgorithm* algo = interp->Clone();
118  G4VEMDataSet* setForMat = new G4CompositeEMDataSet(algo,1.,1.);
119 
120  for (G4int i=0; i<nElements; i++) {
121 
122  G4int Z = (G4int) ((*elementVector)[i]->GetZ());
123 
124  energies = new G4DataVector;
125  cs = new G4DataVector;
126 
127  log_energies = new G4DataVector;
128  log_cs = new G4DataVector;
129 
130  G4double density = nAtomsPerVolume[i];
131 
132  for (G4int bin=0; bin<nOfBins; bin++) {
133 
134  G4double e = energyVector[bin];
135  energies->push_back(e);
136  if (e==0.) e=1e-300;
137  log_energies->push_back(std::log10(e));
138  G4double value = 0.0;
139 
140  if(e > tcut) {
141  G4double elemCs = FindValue(Z, e);
142 
143  value = theBR->Probability(Z, tcut, e, e);
144 
145  value *= elemCs*density;
146  }
147  cs->push_back(value);
148 
149  if (value==0.) value=1e-300;
150  log_cs->push_back(std::log10(value));
151  }
152  G4VDataSetAlgorithm* algol = interp->Clone();
153 
154  //G4VEMDataSet* elSet = new G4EMDataSet(i,energies,cs,algol,1.,1.);
155 
156  G4VEMDataSet* elSet = new G4EMDataSet(i,energies,cs,log_energies,log_cs,algol,1.,1.);
157 
158  setForMat->AddComponent(elSet);
159  }
160  set->push_back(setForMat);
161  }
162 
163  return set;
164 }
165 
166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
167 
169  G4double cutEnergy,
170  G4int Z)
171 {
172  G4double value = 0.;
173  if(energy > cutEnergy)
174  {
175  G4double elemCs = FindValue(Z, energy);
176  value = theBR->Probability(Z,cutEnergy, energy, energy);
177  value *= elemCs;
178  }
179  return value;
180 }