Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VChannelingFastSimCrystalData.hh
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//
27
28#ifndef G4VChannelingFastSimCrystalData_h
29#define G4VChannelingFastSimCrystalData_h 1
30
31#include "G4ios.hh"
32#include "globals.hh"
33#include "G4ThreeVector.hh"
34#include "Randomize.hh"
35#include "G4LogicalVolume.hh"
36#include "G4Material.hh"
37#include "G4VSolid.hh"
38#include <unordered_map>
39
41
42/** \file G4VChannelingFastSimCrystalData.hh
43* \brief Definition of the G4VChannelingFastSimCrystalData class
44* The class contains the data and properties related to the crystal lattice as well as
45* functions to simulate of important physical processes, i.e. coulomb scattering on
46* screened atomic potential, on single electrons and ionization energy losses;
47* functions of electric fields, nuclear and electron densities and minimum energy
48* of ionization (the corresponding interpolation coefficients are in
49* G4ChannelingFastSimInterpolation).
50* The functions related to the crystal geometry (transformation of coordinates and angles
51* from the reference system of the bounding box of the local volume to
52* the crystal lattice co-rotating reference system and vice versa) and
53* initialization function SetMaterialProperties are created as virtual to make
54* material data input and geometry functions flexible for modification.
55*/
56
58public:
59
62
63 ///electric fields produced by crystal lattice
64 G4double Ex(G4double x,G4double y) {return (fElectricFieldX->GetIF(x,y))*(-fZ2/fPV);}
65 G4double Ey(G4double x,G4double y) {return (fElectricFieldY->GetIF(x,y))*(-fZ2/fPV);}
66
67 ///electron density function
69 {
71 if(nel0<0.) {nel0=0.;}//exception, errors of interpolation functions
72 return nel0;
73 }
74 ///minimum energy of ionization function
77 ///nuclear density function (normalized to average nuclear density)
79 {return std::abs(fNucleiDensity[ielement]->GetIF(x,y));}
80 //abs to describe exception, errors of interpolation functions,
81 //don't put it =0, otherwise division on 0 in CoulombAtomicScattering
82
83 ///Calculate the value of the Lindhard angle (!!! the value for a straight crystal)
85 ///Calculate the value of the Lindhard angle (!!! the value for a straight crystal)
86 G4double GetLindhardAngle();//return the Lindhard angle value calculated in
87 //SetParticleProperties
88
89 ///Calculate simulation step (standard value for channeling particles and
90 ///reduced value for overbarrier particles)
92 ///Calculate maximal simulation step (standard value for channeling particles)
94
95 ///get particle velocity/c
96 G4double GetBeta(){return fBeta;}
97
99 G4int GetModel() {return iModel;}//=1 for planes, =2 for axes
100
101 ///get bending angle of the crystal planes/axes
102 ///(default BendingAngle=0 => straight crystal);
104 ///fBendingAngle MAY BE NOT THE SAME AS THE BENDING ANGLE OF THE CRYSTAL VOLUME:
105 ///THE VOLUME OF A BENT CRYSTAL MAY BE G4Box, while the planes/axes inside may be bent
106
108
109 ///get crystal curvature
110 ///for crystalline undulator the curvature is a function, otherwise it's a constant
112
113 ///get crystalline undulator wave function
115 ///get crystalline undulator wave 1st derivative function
117 return fCU ? -fCUAmplitudeK*std::sin(fCUK*z+fCUPhase) : 0;}
118
119 ///find and upload crystal lattice input files, calculate all the basic values
120 ///(to do only once)
121 virtual void SetMaterialProperties(const G4Material* crystal,
122 const G4String &lattice) = 0;
123
124 ///set geometry parameters from current logical volume
125 void SetGeometryParameters(const G4LogicalVolume *crystallogic);
126
127 ///set bending angle of the crystal planes/axes
128 ///(default fBendingAngle=0 => straight crystal);
129 ///only non-negative values! crystal is bent in the positive direction of x
130 void SetBendingAngle(G4double tetab, const G4LogicalVolume *crystallogic);
131 ///fBendingAngle MAY BE NOT THE SAME AS THE BENDING ANGLE OF THE CRYSTAL VOLUME
132 ///THE VOLUME OF A BENT CRYSTAL MAY BE G4Box, while the planes/axes inside may be bent
133
134 ///set miscut angle (default fMiscutAngle=0), acceptable range +-1 mrad,
135 ///otherwise geometry routines may be unstable
136 void SetMiscutAngle(G4double tetam, const G4LogicalVolume *crystallogic);
137
138 ///set crystalline undulator parameters: amplitude, period and phase
139 /// (default: all 3 value = 0)
140 /// function to use in Detector Construction
142 G4double period,
143 G4double phase,
144 const G4LogicalVolume *crystallogic);
145
146 ///set crystalline undulator parameters (internal function of the model)
147 ///for convenience we put amplitude, period and phase in a G4ThreeVector
148 void SetCUParameters(const G4ThreeVector &amplitudePeriodPhase,
149 const G4LogicalVolume *crystallogic);
150
151 ///recalculate all the important values
152 ///(to do both at the trajectory start and after energy loss)
154 G4double mp,
155 G4double charge,
156 G4bool ifhadron);
157
158 ///calculate the coordinates in the co-rotating reference system
159 ///within a channel (periodic cell)
160 ///(connected with crystal planes/axes either bent or straight)
162
163 ///calculate the coordinates in the Box reference system
164 ///(connected with the bounding box of the volume)
166
167 ///change the channel if necessary, recalculate x o y
169
170 ///return correction of the longitudinal coordinate
171 /// (along current plane/axis vs "central plane/axis")
173
174 ///calculate the horizontal angle in the co-rotating reference system
175 ///within a channel (periodic cell)
176 ///(connected with crystal planes/axes either bent or straight)
178
179 ///calculate the horizontal angle in the Box reference system
180 ///(connected with the bounding box of the volume)
182
183 ///auxialiary function to transform the horizontal angle
185
186 ///multiple and single scattering on screened potential
188 G4double effectiveStep,
189 G4double step,
190 G4int ielement);
191 ///multiple and single scattering on electrons
193 G4double electronDensity,
194 G4double step);
195 ///ionization losses
197
198 void SetVerbosity(G4int ver){fVerbosity = ver;}
199
200protected:
201 ///classes containing interpolation coefficients
202 //horizontal electric field data
204 //vertical electric field data
206 //electron density data
208 //minimal energy of ionization data
210 //nuclear density distributions data
211 std::vector <G4ChannelingFastSimInterpolation*> fNucleiDensity;
212
213 ///values related to the crystal geometry
214 G4ThreeVector fHalfDimBoundingBox;//bounding box half dimensions
215 G4int fBent=0;//flag of bent crystal,
216 //=0 for straight and =1 for bent, by default straight crystal
217
218 G4double fBendingAngle=0.;// angle of bending of the crystal planes/axes
219 //inside the crystal volume
220 //MAY BE NOT THE SAME AS THE BENDING ANGLE OF THE CRYSTAL VOLUME
221 //THE VOLUME OF A BENT CRYSTAL MAY BE G4Box,
222 //while the planes/axes inside may be bent
223 G4double fBendingR = 0.; // bending radius of the crystal planes/axes
224 G4double fBending2R=0.; // =2*fBendingR
225 G4double fBendingRsquare=0.; // =fBendingR**2
226 G4double fCurv=0.; //=1/fBendingR bending curvature of the crystal planes/axes
227
228 G4double fMiscutAngle = 0.;// miscut angle, can be of either sign or 0;
229 //safe values |ThetaMiscut|<0.001
230 G4double fCosMiscutAngle=1.;// = std::cos(fMiscutAngle), to economy operations
231 G4double fSinMiscutAngle=0.;// = std::sin(fMiscutAngle), to economy operations
232
233 G4double fCorrectionZ = 1.;//correction of the longitudinal coordinate
234 //(along current plane/axis vs "central plane/axis"), 1 is default value
235 //(for "central plane/axis" or a straight crystal)
236
237 G4bool fCU = false;//flag of crystalline undulator geometry
238 //(periodically bent crystal)
239 G4double fCUAmplitude=0.; //Amplitude of a crystalline undulator
240 G4double fCUK=0.; //2*pi/period of a crystalline undulator
241 G4double fCUPhase=0.;//Phase of a crystalline undulator
242 G4double fCUAmplitudeK=0.;//fCUAmplitude*fCUK
243 G4double fCUK2=0.; //fCUK^2
244
245 ///values related to the crystal lattice
246 G4int fNelements=1;//number of nuclear elements in a crystal
247 G4int iModel=1;// model type (iModel=1 for interplanar potential,
248 //iModel=2 for the interaxial one)
249
250 G4double fVmax=0; // the height of the potential well
251 G4double fVmax2=0; // =2*fVmax
252 G4double fVMinCrystal=0;// non-zero minimal potential inside the crystal,
253 // necessary for angle recalculation for entrance/exit
254 //through the crystal lateral surface
255
256 G4double fChangeStep=0;// fChannelingStep = fChangeStep/fTetaL
257
258 std::vector <G4double> fI0; //Mean excitation energy
259
260 std::vector <G4double> fRF;//Thomas-Fermi screening radius
261
262 ///angles necessary for multiple and single coulomb scattering
263
264 //minimal scattering angle by coulomb scattering on nuclei
265 //defined by shielding by electrons
266 std::vector <G4double> fTeta10;//(in the Channeling model
267 //teta1=fTeta10/fPz*(1.13+fK40/vz**2)
268 //maximal scattering angle by coulomb scattering on nuclei defined by nucleus radius
269 std::vector <G4double> fTetamax0;//(in the Channeling model tetamax=fTetamax0/fPz)
270 std::vector <G4double> fTetamax2;//=tetamax*tetamax
271 std::vector <G4double> fTetamax12;//=teta1*teta1+tetamax*tetamax
272 std::vector <G4double> fTeta12; //= teta1*teta1
273
274 ///coefficients necessary for multiple and single coulomb scattering
275 std::vector <G4double> fK20; //a useful coefficient, fK2=fK20/fPV/fPV
276 std::vector <G4double> fK2; //a useful coefficient,
277 //fK2=(fZ2*alpha*hdc)**2*4.*pi*fN0*(fZ1/fPV)**2
278 std::vector <G4double> fK40; //a useful coefficient, fK40=3.76D0*(alpha*fZ1)**2
279 G4double fK30=0;//a useful coefficient, fK3=fK30/fPV/fPV
280 G4double fK3=0;//a useful coefficient, fK3=2.*pi*alpha*hdc/electron_mass_c2/(fPV)**2
281
282 std::vector <G4double> fKD; //a useful coefficient for dE/dx
283
284 ///coefficients for multiple scattering suppression
285 std::vector <G4double> fPu11;//a useful coefficient for exponent containing u1
286 std::vector <G4double> fPzu11;//a useful coefficient for exponent containing u1
287 std::vector <G4double> fBB;//a useful coefficient
288 std::vector <G4double> fE1XBbb;//a useful coefficient
289 std::vector <G4double> fBBDEXP;//a useful coefficient
290
291 //Variable to control printout
293
294
295private:
296
297 //exponential integral
298 G4double expint(G4double x);
299
300 ///private variables
301
302 std::unordered_map<G4int, G4double> fMapBendingAngle;//the map fBendingAngle
303 //for different logical volumes
304
305 std::unordered_map<G4int, G4double> fMapMiscutAngle;//the map fMiscutAngle
306 //for different logical volumes
307
308 std::unordered_map<G4int, G4ThreeVector> fMapCUAmplitudePeriodPhase;//the map of
309 //AmplitudePeriodPhase
310 //for different logical volumes
311
312 G4double fChannelingStep=0;// simulation step under the channeling conditions =
313 //channeling oscillation length/fNsteps
314 // channeling oscillation length: Biryukov book Eq. (1.24)
315
316 ///energy depended values
317 G4double fPz=0; // particle momentum absolute value
318 G4double fPV=0; // pv
319 G4double fTetaL=0; //Lindhard angle
320 G4double fBeta=0; //particle (velocity/c)
321 G4double fV2=0; // particle (velocity/c)^2
322 G4double fGamma=0; //Lorentz factor
323 G4double fMe2Gamma=0; // me^2*fGamma
324 G4double fTmax=0; // max ionization losses
325
326 ///particle properties flags
327 G4bool fHadron=false;//=true (for hadrons); =false (for leptons)
328 G4double fZ2=0; //particle charge
329
330};
331
332#endif
333
Definition of the G4ChannelingFastSimInterpolation class The class includes spline interpolation coef...
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4double GetIF(G4double xx, G4double yy)
Get Spline Function.
virtual G4double AngleXShift(G4double z)=0
auxialiary function to transform the horizontal angle
G4double IonizationLosses(G4double dz, G4int ielement)
ionization losses
std::vector< G4double > fK20
coefficients necessary for multiple and single coulomb scattering
G4double GetLindhardAngle()
Calculate the value of the Lindhard angle (!!! the value for a straight crystal)
G4double GetBeta()
get particle velocity/c
std::vector< G4ChannelingFastSimInterpolation * > fNucleiDensity
void SetGeometryParameters(const G4LogicalVolume *crystallogic)
set geometry parameters from current logical volume
void SetCUParameters(const G4ThreeVector &amplitudePeriodPhase, const G4LogicalVolume *crystallogic)
virtual void SetMaterialProperties(const G4Material *crystal, const G4String &lattice)=0
G4ChannelingFastSimInterpolation * fMinIonizationEnergy
G4ChannelingFastSimInterpolation * fElectricFieldY
virtual G4ThreeVector ChannelChange(G4double &x, G4double &y, G4double &z)=0
change the channel if necessary, recalculate x o y
virtual G4ThreeVector CoordinatesFromBoxToLattice(const G4ThreeVector &pos0)=0
virtual G4double AngleXFromBoxToLattice(G4double tx, G4double z)=0
G4double ElectronDensity(G4double x, G4double y)
electron density function
void SetCrystallineUndulatorParameters(G4double amplitude, G4double period, G4double phase, const G4LogicalVolume *crystallogic)
G4ThreeVector fHalfDimBoundingBox
values related to the crystal geometry
G4double GetSimulationStep(G4double tx, G4double ty)
void SetBendingAngle(G4double tetab, const G4LogicalVolume *crystallogic)
virtual G4double AngleXFromLatticeToBox(G4double tx, G4double z)=0
G4double MinIonizationEnergy(G4double x, G4double y)
minimum energy of ionization function
G4ChannelingFastSimInterpolation * fElectricFieldX
classes containing interpolation coefficients
G4double Ex(G4double x, G4double y)
electric fields produced by crystal lattice
G4ChannelingFastSimInterpolation * fElectronDensity
G4int fNelements
values related to the crystal lattice
G4ThreeVector CoulombElectronScattering(G4double eMinIonization, G4double electronDensity, G4double step)
multiple and single scattering on electrons
std::vector< G4double > fTeta10
angles necessary for multiple and single coulomb scattering
void SetParticleProperties(G4double etotal, G4double mp, G4double charge, G4bool ifhadron)
G4double NuclearDensity(G4double x, G4double y, G4int ielement)
nuclear density function (normalized to average nuclear density)
G4double GetCUx(G4double z)
get crystalline undulator wave function
virtual G4ThreeVector CoordinatesFromLatticeToBox(const G4ThreeVector &pos)=0
G4double GetMaxSimulationStep(G4double etotal, G4double mass)
Calculate maximal simulation step (standard value for channeling particles)
std::vector< G4double > fPu11
coefficients for multiple scattering suppression
G4ThreeVector CoulombAtomicScattering(G4double effectiveStep, G4double step, G4int ielement)
multiple and single scattering on screened potential
G4double GetCUtetax(G4double z)
get crystalline undulator wave 1st derivative function
void SetMiscutAngle(G4double tetam, const G4LogicalVolume *crystallogic)