Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BaierKatkov.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// Author: Alexei Sytov
27// Co-author: Gianfranco Paterno (modifications & testing)
28// On the base of the CRYSTALRAD realization of the Baier-Katkov integral:
29// A. I. Sytov, V. V. Tikhomirov, and L. Bandiera PRAB 22, 064601 (2019)
30
31#ifndef G4BaierKatkov_h
32#define G4BaierKatkov_h 1
33
34#include "globals.hh"
35#include "G4ios.hh"
36#include <vector>
37#include "G4ThreeVector.hh"
38
40
41/** \file G4BaierKatkov.hh
42* \brief Definition of the G4BaierKatkov class
43* This class is designed for the calculation of radiation probability, radiation point
44* and the parameters of the photon produced as well as spectrum accumulation using
45* the Baier-Katkov integral:
46* V. N. Baier, V. M. Katkov, and V. M. Strakhovenko,
47* Electromagnetic Processes at High Energies in Oriented Single Crystals
48* (World Scientific, Singapore, 1998).
49*/
50
52{
53public:
54 // default constructor
56
57 // destructor
58 ~G4BaierKatkov() = default;
59
60 /**
61 You may call DoRadiation at each step of your trajectory
62 CAUTION: please ensure that your steps are physically small enough for calculation
63 of the radiation type you are interested in
64 CAUTION: do ResetRadIntegral() before the start of a new trajectory
65
66 1) change some model defaults if necessary
67 (SetSinglePhotonRadiationProbabilityLimit,
68 SetNSmallTrajectorySteps, SetSpectrumEnergyRange)
69 2) call DoRadiation at each step of your trajectory
70 3) if DoRadiation returns TRUE, this means that a photon is produced (not added
71 as a secondary yet) and its parameters are calculated.
72 4) You may generate a new photon using GeneratePhoton either with
73 the parameters calculated in DoRadiation or your own parameters.
74 CAUTION: By now GeneratePhoton works only for a FastSim model
75 5) Use GetPhotonEnergyInSpectrum() and GetTotalSpectrum() to return calculated
76 total spectrum (all the photons altogether)
77 Caution: is not normalized on the event number
78 6) Get the charged particle parameters in the radiation point:
79 GetParticleNewTotalEnergy(),
80 GetParticleNewAngleX(), GetParticleNewAngleY(),
81 GetNewGlobalTime(),
82 GetParticleNewCoordinateXYZ()
83 */
84
85 ///get functions
86
87 /// get maximal radiation probability to preserve single photon radiation
89 {return fSinglePhotonRadiationProbabilityLimit;}
90
91 ///CAUTION! : use the get functions below ONLY AFTER the call of DoRadiation
92 /// and ONLY IF IT RETURNS true
93
94 ///total probability of radiation: needs calculation of DoRadiation first
95 G4double GetTotalRadiationProbability(){return fTotalRadiationProbability;}
96 ///get new parameters of the particle
97 ///(the parameters at the point of radiation emission)
98 ///needs calculation of DoRadiation first
99 G4double GetParticleNewTotalEnergy(){return fNewParticleEnergy;}
100 G4double GetParticleNewAngleX(){return fNewParticleAngleX;}
101 G4double GetParticleNewAngleY(){return fNewParticleAngleY;}
102 G4double GetNewGlobalTime(){return fNewGlobalTime;}
103 const G4ThreeVector& GetParticleNewCoordinateXYZ(){return fNewParticleCoordinateXYZ;}
104
105 ///get photon energies (x-value in spectrum)
106 const std::vector<G4double>& GetPhotonEnergyInSpectrum()
107 {return fPhotonEnergyInSpectrum;}
108
109 ///get fTotalSpectrum after finishing the trajectory part with DoRadiation
110 const std::vector<G4double>& GetTotalSpectrum(){return fTotalSpectrum;}
111
112 ///set functions
113
114 ///set maximal radiation probability to preserve single photon radiation
116 {fSinglePhotonRadiationProbabilityLimit = wmax;}
117
118 ///number of steps in a trajectory small piece before
119 ///the next call of the radiation integral
120 void SetNSmallTrajectorySteps(G4int nSmallTrajectorySteps)
121 {fNSmallTrajectorySteps = nSmallTrajectorySteps;}
122
123 ///reinitialize intermediate integrals fFa, fSs, fSc, fSsx, fSsy, fScx, fScy;
124 ///reset radiation integral internal variables to defaults;
125 ///reset the trajectory and radiation probability along the trajectory
126 void ResetRadIntegral();
127
128 ///setting the number of photons in sampling of Baier-Katkov Integral
129 ///(MC integration by photon energy and angles <=> photon momentum)
130 void SetSamplingPhotonsNumber(G4int nPhotons){fNMCPhotons = nPhotons;}
131
132 ///setting the number of radiation angles 1/gamma, defining the width of
133 ///the angular distribution of photon sampling in the Baier-Katkov Integral
134 void SetRadiationAngleFactor(G4double radiationAngleFactor)
135 {fRadiationAngleFactor = radiationAngleFactor;}
136
137 ///CAUTION, the bins width is logarithmic
138 ///Do not worry if the maximal energy > particle energy.
139 ///This elements of spectrum with non-physical energies
140 ///will not be processed (they will be 0).
142 G4double emax,
143 G4int numberOfBins);
144 /// SetSpectrumEnergyRange also calls ResetRadIntegral()
145
147 fMaxPhotonEnergy,
148 fNBinsSpectrum);}
150 emax,
151 fNBinsSpectrum);}
152 void SetNBinsSpectrum(G4int nbin){SetSpectrumEnergyRange(fMinPhotonEnergy,
153 fMaxPhotonEnergy,
154 nbin);}
155
156 /// Increase the statistic of virtual photons in a certain energy region
157 /// CAUTION! : don't do it before SetSpectrumEnergyRange or SetMinPhotonEnergy
159 G4int timesPhotonStatistics);
160
161 /// Virtual collimator masks the selection of photon angles in fTotalSpectrum
162 /// Virtual collimator doesn't influence on Geant4 simulations.
163 void SetRoundVirtualCollimator(G4double virtualCollimatorAngularRadius,
164 G4double virtualCollimatorAngularCenterX = 0.,
165 G4double virtualCollimatorAngularCenterY = 0.)
166 {fVirtualCollimatorAngularHalfWidthX2 = virtualCollimatorAngularRadius*
167 virtualCollimatorAngularRadius;
168 fVirtualCollimatorAngularHalfWidthY2 = fVirtualCollimatorAngularHalfWidthX2;
169
170 fVirtualCollimatorAngularCenterX = virtualCollimatorAngularCenterX;
171 fVirtualCollimatorAngularCenterY = virtualCollimatorAngularCenterY;
172 fVirtualCollimatorTypeID = 1;}
173
174 void SetEllipticVirtualCollimator(G4double virtualCollimatorAngularRadiusX,
175 G4double virtualCollimatorAngularRadiusY,
176 G4double virtualCollimatorAngularCenterX = 0.,
177 G4double virtualCollimatorAngularCenterY = 0.)
178 {fVirtualCollimatorAngularHalfWidthX2 = virtualCollimatorAngularRadiusX*
179 virtualCollimatorAngularRadiusX;
180 fVirtualCollimatorAngularHalfWidthY2 = virtualCollimatorAngularRadiusY*
181 virtualCollimatorAngularRadiusY;
182 fVirtualCollimatorAngularCenterX = virtualCollimatorAngularCenterX;
183 fVirtualCollimatorAngularCenterY = virtualCollimatorAngularCenterY;
184 fVirtualCollimatorTypeID = 1;}
185
186 void SetRectangularVirtualCollimator(G4double virtualCollimatorAngularHalfWidthX,
187 G4double virtualCollimatorAngularHalfWidthY,
188 G4double virtualCollimatorAngularCenterX = 0.,
189 G4double virtualCollimatorAngularCenterY = 0.)
190 {fVirtualCollimatorAngularHalfWidthX = virtualCollimatorAngularHalfWidthX;
191 fVirtualCollimatorAngularHalfWidthY = virtualCollimatorAngularHalfWidthY;
192 fVirtualCollimatorAngularCenterX = virtualCollimatorAngularCenterX;
193 fVirtualCollimatorAngularCenterY = virtualCollimatorAngularCenterY;
194 fVirtualCollimatorTypeID = 2;}
195
196 /// add the new elements of the trajectory, calculate radiation in a crystal
197 /// see complete description in G4BaierKatkov::DoRadiation
198 /// calls RadIntegral and all the necessary functions
199 /// sets the parameters of a photon produced (if any)
200 /// using SetPhotonProductionParameters()
201 /// returns true in the case of photon generation, false if not
202 G4bool DoRadiation(G4double etotal, G4double mass,
203 G4double angleX, G4double angleY,
204 G4double angleScatteringX, G4double angleScatteringY,
205 G4double step, G4double globalTime,
206 G4ThreeVector coordinateXYZ,
207 G4bool flagEndTrajectory=false);
208
209 /// generates secondary photon belonging to fastStep with variables
210 /// photon energy, momentum direction, coordinates and global time
211 /// CALCULATED IN DoRadiation => USE IT ONLY AFTER DoRadiation returns true
212 void GeneratePhoton(G4FastStep &fastStep);
213
214private:
215
216 ///set functions
217
218 ///function setting the photon sampling parameters in the Baier-Katkov integral;
219 ///only the maximal energy is set, while fMinPhotonEnergy is used as a minimal energy;
220 ///the angles set the angular distribution (the tails are infinite)
221 void SetPhotonSamplingParameters(G4double ekin,
222 G4double minPhotonAngleX, G4double maxPhotonAngleX,
223 G4double minPhotonAngleY, G4double maxPhotonAngleY);
224
225 ///main functions:
226
227 ///generation of the photons in sampling of Baier-Katkov Integral
228 ///(MC integration by photon energy and angles <=> by photon momentum)
229 void GeneratePhotonSampling();
230
231 ///Baier-Katkov method: calculation of integral, spectrum, full probability;
232 ///returns the total radiation probability;
233 ///calculates the radiation spectrum on this trajectory piece
234 G4double RadIntegral(G4double etotal, G4double mass,
235 std::vector<G4double> &vectorParticleAnglesX,
236 std::vector<G4double> &vectorParticleAnglesY,
237 std::vector<G4double> &vectorScatteringAnglesX,
238 std::vector<G4double> &vectorScatteringAnglesY,
239 std::vector<G4double> &vectorSteps,
240 G4int imin);
241
242 ///set photon production parameters (returns false if no photon produced)
243 ///accumulates fTotalSpectrum
244 ///CAUTION: it is an accessory function of DoRadiation, do not use it separately
245 G4bool SetPhotonProductionParameters(G4double etotal, G4double mass);
246
247 G4int FindVectorIndex(std::vector<G4double> &myvector, G4double value);
248
249 G4double fTotalRadiationProbability = 0.;
250 G4double fSinglePhotonRadiationProbabilityLimit=0.25;//Maximal radiation
251 //probability to preserve single photon radiation
252
253 //number of steps in a trajectory piece before the next call of the radiation integral
254 G4int fNSmallTrajectorySteps=10000;
255 ///trajectory element No (the first element of the array feeded in RadIntegral)
256 G4int fImin0 = 0;
257 ///Monte Carlo statistics of photon sampling in Baier-Katkov with 1 trajectory
258 G4int fNMCPhotons =150;
259 ///the number of bins in photon spectrum
260 G4int fNBinsSpectrum = 110;
261 G4double fMinPhotonEnergy = 0.1*CLHEP::MeV;//min energy in spectrum output
262 G4double fMaxPhotonEnergy = 1*CLHEP::GeV; //max energy in spectrum output
263 G4double fLogEmaxdEmin = 1.;// = log(fMaxPhotonEnergy/fMinPhotonEnergy),
264 // 1/normalizing coefficient in
265 // 1/E distribution between
266 // fMinPhotonEnergy and fMaxPhotonEnergy
267 // is used only for spectrum output, not for simulations
268 //(we take bremsstrahlung for photon sampling)
269 G4double fLogEdEmin = 1.; // = log(E/fMinPhotonEnergy), the same as fLogEmaxdEmin
270 // but with the particle energy as the maximal limit
271
272 G4double fVirtualCollimatorAngularHalfWidthX = 1.;//angular half width in X
273 G4double fVirtualCollimatorAngularHalfWidthY = 1.;//angular half width in Y
274 G4double fVirtualCollimatorAngularHalfWidthX2=1.;//angular half width X square
275 G4double fVirtualCollimatorAngularHalfWidthY2=1.;//angular half width Y square
276 G4double fVirtualCollimatorAngularCenterX = 0.;// angular center
277 G4double fVirtualCollimatorAngularCenterY = 0.;// angular center
278 std::vector<G4bool> fInsideVirtualCollimator;
279 G4int fVirtualCollimatorTypeID = 0; //0 - infinite, 1 - round or ellipse, 2 - rectangular
280
281 ///data of the phootn energy range with additional statistics
282 std::vector<G4double> fLogAddRangeEmindEmin;//=G4Log(emin/fMinPhotonEnergy)
283 std::vector<G4double> fLogAddRangeEmaxdEmin;//=G4Log(emax/fMinPhotonEnergy)
284 std::vector<G4int> fTimesPhotonStatistics;
285
286 ///number of trajectories
287 //(at each of the Baier-Katkov Integral is calculated for the same photons)
288 G4int fItrajectories = 0;
289
290 G4double fEph0=0; //energy of the photon produced
291 G4ThreeVector PhMomentumDirection; //momentum direction of the photon produced
292
293 ///Radiation integral variables
294 G4double fMeanPhotonAngleX =0.; //average angle of radiated photon direction
295 //in sampling, x-plane
296 G4double fParamPhotonAngleX=1.e-3*CLHEP::rad; //a parameter radiated photon
297 //sampling distribution, x-plane
298 G4double fMeanPhotonAngleY =0.; //average angle of radiated photon direction
299 //in sampling, y-plane
300 G4double fParamPhotonAngleY=1.e-3*CLHEP::rad; //a parameter radiated photon
301 //sampling distribution, y-plane
302 G4double fRadiationAngleFactor = 4.; // number of radiation angles 1/gamma:
303 // more fRadiationAngleFactor =>
304 // higher fParamPhotonAngleX and Y
305
306 ///new particle parameters (the parameters at the point of radiation emission)
307 G4double fNewParticleEnergy=0;
308 G4double fNewParticleAngleX=0;
309 G4double fNewParticleAngleY=0;
310 G4double fNewGlobalTime=0;
311 G4ThreeVector fNewParticleCoordinateXYZ;
312
313 ///sampling of the energy and the angles of a photon emission
314 ///(integration variables, Monte Carlo integration)
315 std::vector<G4double> fPhotonEnergyInIntegral;
316 std::vector<G4double> fPhotonAngleInIntegralX;
317 std::vector<G4double> fPhotonAngleInIntegralY;
318 std::vector<G4double> fPhotonAngleNormCoef;
319 ///spectrum bin index for each photon
320 std::vector<G4double> fIBinsSpectrum;
321 ///the vector of the discrete CDF of the radiation of sampling photons
322 std::vector<G4double> fPhotonProductionCDF;
323
324 ///vectors of the trajectory
325 std::vector<G4double> fParticleAnglesX;
326 std::vector<G4double> fParticleAnglesY;
327 std::vector<G4double> fScatteringAnglesX;
328 std::vector<G4double> fScatteringAnglesY;
329 std::vector<G4double> fSteps;
330 std::vector<G4double> fGlobalTimes;
331 std::vector<G4ThreeVector> fParticleCoordinatesXYZ;
332
333 ///intermediate integrals (different for each photon energy value)!!!
334 std::vector<G4double> fFa;//phase
335 std::vector<G4double> fSs;
336 std::vector<G4double> fSc;
337 std::vector<G4double> fSsx;
338 std::vector<G4double> fSsy;
339 std::vector<G4double> fScx;
340 std::vector<G4double> fScy;
341
342 ///output
343 std::vector<G4double> fPhotonEnergyInSpectrum; //energy values in spectrum
344
345 std::vector<G4int> fNPhotonsPerBin; //number of photons per spectrum bin
346 //(accumulating during total run)
347
348 std::vector<G4double> fSpectrum; //spectrum normalized by the total
349 //radiation probability of one particle at one call of RadIntegral
350
351 std::vector<std::vector<G4double>> fAccumSpectrum; //accumulate Spectrum during
352 //the part of a trajectory
353
354 std::vector<G4double> fAccumTotalSpectrum; //spectrum normalized by the total
355 //radiation probability summed
356 //for all the particles (is not divided
357 //of one particle number fNPhotonsPerBin)
358
359 std::vector<G4double> fTotalSpectrum; //spectrum normalized by
360 //the total radiation probability summed
361 //for all the particles
362 //(is divided by the photon number fNPhotonsPerBin)
363 //multiplied by the number of trajectories
364 //(fItrajectories)
365
366 std::vector<G4double> fImax0; //trajectory element numbers at the end of each
367 //small piece; G4double just for security of some operations
368 ///total radiation probability along this trajectory
369 std::vector<G4double> fTotalRadiationProbabilityAlongTrajectory;
370};
371
372#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
void SetRadiationAngleFactor(G4double radiationAngleFactor)
void ResetRadIntegral()
const std::vector< G4double > & GetPhotonEnergyInSpectrum()
get photon energies (x-value in spectrum)
void GeneratePhoton(G4FastStep &fastStep)
void SetRectangularVirtualCollimator(G4double virtualCollimatorAngularHalfWidthX, G4double virtualCollimatorAngularHalfWidthY, G4double virtualCollimatorAngularCenterX=0., G4double virtualCollimatorAngularCenterY=0.)
void SetSpectrumEnergyRange(G4double emin, G4double emax, G4int numberOfBins)
void AddStatisticsInPhotonEnergyRegion(G4double emin, G4double emax, G4int timesPhotonStatistics)
G4double GetParticleNewAngleX()
G4double GetSinglePhotonRadiationProbabilityLimit()
get functions
G4double GetParticleNewTotalEnergy()
void SetSamplingPhotonsNumber(G4int nPhotons)
void SetEllipticVirtualCollimator(G4double virtualCollimatorAngularRadiusX, G4double virtualCollimatorAngularRadiusY, G4double virtualCollimatorAngularCenterX=0., G4double virtualCollimatorAngularCenterY=0.)
void SetSinglePhotonRadiationProbabilityLimit(G4double wmax)
set functions
void SetMaxPhotonEnergy(G4double emax)
void SetNSmallTrajectorySteps(G4int nSmallTrajectorySteps)
void SetRoundVirtualCollimator(G4double virtualCollimatorAngularRadius, G4double virtualCollimatorAngularCenterX=0., G4double virtualCollimatorAngularCenterY=0.)
~G4BaierKatkov()=default
void SetMinPhotonEnergy(G4double emin)
SetSpectrumEnergyRange also calls ResetRadIntegral().
void SetNBinsSpectrum(G4int nbin)
G4bool DoRadiation(G4double etotal, G4double mass, G4double angleX, G4double angleY, G4double angleScatteringX, G4double angleScatteringY, G4double step, G4double globalTime, G4ThreeVector coordinateXYZ, G4bool flagEndTrajectory=false)
G4double GetTotalRadiationProbability()
total probability of radiation: needs calculation of DoRadiation first
G4double GetParticleNewAngleY()
const std::vector< G4double > & GetTotalSpectrum()
get fTotalSpectrum after finishing the trajectory part with DoRadiation
G4double GetNewGlobalTime()
const G4ThreeVector & GetParticleNewCoordinateXYZ()