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: G4MaterialStoppingICRU73.hh,v 1.4 2009/02/19 11:09:22 antoni Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
28 | |
---|
29 | #ifndef G4MaterialStoppingICRU73_h |
---|
30 | #define G4MaterialStoppingICRU73_h 1 |
---|
31 | |
---|
32 | //--------------------------------------------------------------------------- |
---|
33 | // |
---|
34 | // ClassName: G4MaterialStoppingICRU73 |
---|
35 | // |
---|
36 | // Description: Data on stopping powers for light ions in compounds |
---|
37 | // |
---|
38 | // Author: Ivantchenko 10.07.2008 |
---|
39 | // |
---|
40 | // Modifications: |
---|
41 | // |
---|
42 | //---------------------------------------------------------------------------- |
---|
43 | // |
---|
44 | // Class Description: |
---|
45 | // |
---|
46 | // Data on Stopping Powers from the ICRU73 report |
---|
47 | // |
---|
48 | |
---|
49 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
50 | |
---|
51 | |
---|
52 | #include "globals.hh" |
---|
53 | #include "G4LPhysicsFreeVector.hh" |
---|
54 | #include <vector> |
---|
55 | |
---|
56 | class G4MaterialStoppingICRU73 |
---|
57 | { |
---|
58 | public: |
---|
59 | |
---|
60 | G4MaterialStoppingICRU73(G4bool splineFlag = true); |
---|
61 | |
---|
62 | ~G4MaterialStoppingICRU73(); |
---|
63 | |
---|
64 | G4double GetDEDX(G4int ionZ, G4int idxMaterial, G4double kinEnergy); |
---|
65 | |
---|
66 | inline G4double GetDEDX(G4int ionZ, const G4String& NameMaterial, |
---|
67 | G4double kinEnergy); |
---|
68 | |
---|
69 | inline G4int GetMaterialIndex(const G4String& NameMaterial); |
---|
70 | |
---|
71 | // Function returns an unique index (>=0) for each ion-material couple (the |
---|
72 | // return value is -1 if the couple is not found): |
---|
73 | inline G4int GetIonMaterialCoupleIndex( |
---|
74 | G4int atomicNumber, // Atomic number of ion |
---|
75 | const G4String& materialName); // Material name |
---|
76 | |
---|
77 | inline G4double GetDensity(G4int idxMaterial); |
---|
78 | |
---|
79 | inline G4String GetMaterialName(G4int idxMaterial); |
---|
80 | |
---|
81 | inline G4PhysicsVector* GetPhysicsVector(G4int ionZ, G4int idxMaterial); |
---|
82 | |
---|
83 | inline G4PhysicsVector* GetPhysicsVector(G4int ionZ, |
---|
84 | const G4String& NameMaterial); |
---|
85 | |
---|
86 | inline G4double GetLowerEnergyBoundary(); |
---|
87 | |
---|
88 | inline G4double GetUpperEnergyBoundary(); |
---|
89 | |
---|
90 | private: |
---|
91 | |
---|
92 | void Initialise(); |
---|
93 | |
---|
94 | void AddData(G4double* energy, G4double* stoppower, G4double factor); |
---|
95 | |
---|
96 | // hide assignment operator |
---|
97 | G4MaterialStoppingICRU73 & operator=(const G4MaterialStoppingICRU73 &right); |
---|
98 | G4MaterialStoppingICRU73(const G4MaterialStoppingICRU73&); |
---|
99 | |
---|
100 | G4bool spline; |
---|
101 | G4int Z[16]; |
---|
102 | G4double A[16]; |
---|
103 | G4String MatName[31]; |
---|
104 | G4double Density[31]; |
---|
105 | |
---|
106 | // Lower and upper energy boundaries for dE/dx vectors: |
---|
107 | G4double lowerEnergyBoundary; |
---|
108 | G4double upperEnergyBoundary; |
---|
109 | |
---|
110 | std::vector<G4LPhysicsFreeVector*> dedx; |
---|
111 | }; |
---|
112 | |
---|
113 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
114 | |
---|
115 | inline G4double |
---|
116 | G4MaterialStoppingICRU73::GetDEDX(G4int ionZ, const G4String& NameMaterial, |
---|
117 | G4double kinEnergy) |
---|
118 | { |
---|
119 | return GetDEDX(ionZ, GetMaterialIndex(NameMaterial), kinEnergy); |
---|
120 | } |
---|
121 | |
---|
122 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
123 | |
---|
124 | inline G4int |
---|
125 | G4MaterialStoppingICRU73::GetMaterialIndex(const G4String& NameMaterial) |
---|
126 | { |
---|
127 | G4int idx = -1; |
---|
128 | for (G4int i=0; i<31; i++){ |
---|
129 | if(MatName[i] == NameMaterial) { |
---|
130 | idx = i; |
---|
131 | break; |
---|
132 | } |
---|
133 | } |
---|
134 | return idx; |
---|
135 | } |
---|
136 | |
---|
137 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
138 | |
---|
139 | inline G4int |
---|
140 | G4MaterialStoppingICRU73::GetIonMaterialCoupleIndex( |
---|
141 | G4int atomicNumber, |
---|
142 | const G4String& materialName) |
---|
143 | { |
---|
144 | G4int idx = -1; |
---|
145 | if(atomicNumber >= 3 && atomicNumber <= 18) { |
---|
146 | |
---|
147 | G4int materialIndex = GetMaterialIndex(materialName); |
---|
148 | if(materialIndex >= 0) idx = materialIndex * 16 + atomicNumber - 3; |
---|
149 | } |
---|
150 | |
---|
151 | return idx; |
---|
152 | } |
---|
153 | |
---|
154 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
155 | |
---|
156 | inline G4double |
---|
157 | G4MaterialStoppingICRU73::GetDensity(G4int idxMaterial) |
---|
158 | { |
---|
159 | G4double d = 0.0; |
---|
160 | if( idxMaterial >= 0 && idxMaterial <= 30) d = Density[idxMaterial]; |
---|
161 | return d; |
---|
162 | } |
---|
163 | |
---|
164 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
165 | |
---|
166 | inline |
---|
167 | G4String G4MaterialStoppingICRU73::GetMaterialName(G4int idxMaterial) |
---|
168 | { |
---|
169 | G4String s = ""; |
---|
170 | if( idxMaterial >= 0 && idxMaterial <= 30) s = MatName[idxMaterial]; |
---|
171 | return s; |
---|
172 | } |
---|
173 | |
---|
174 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
175 | |
---|
176 | inline G4PhysicsVector* |
---|
177 | G4MaterialStoppingICRU73::GetPhysicsVector(G4int ionZ, G4int idxMaterial) |
---|
178 | { |
---|
179 | G4PhysicsVector* v = 0; |
---|
180 | if(ionZ >= 3 && ionZ <= 18 && idxMaterial >= 0 && idxMaterial <= 30) { |
---|
181 | v = dedx[idxMaterial*16 + ionZ - 3]; |
---|
182 | } |
---|
183 | return v; |
---|
184 | } |
---|
185 | |
---|
186 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
187 | |
---|
188 | inline G4PhysicsVector* |
---|
189 | G4MaterialStoppingICRU73::GetPhysicsVector(G4int ionZ, |
---|
190 | const G4String& NameMaterial) |
---|
191 | { |
---|
192 | return GetPhysicsVector(ionZ, GetMaterialIndex(NameMaterial)); |
---|
193 | } |
---|
194 | |
---|
195 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
196 | |
---|
197 | inline G4double |
---|
198 | G4MaterialStoppingICRU73::GetLowerEnergyBoundary() { |
---|
199 | |
---|
200 | return lowerEnergyBoundary; |
---|
201 | } |
---|
202 | |
---|
203 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
204 | |
---|
205 | inline G4double |
---|
206 | G4MaterialStoppingICRU73::GetUpperEnergyBoundary() { |
---|
207 | |
---|
208 | return upperEnergyBoundary; |
---|
209 | } |
---|
210 | |
---|
211 | #endif |
---|