Geant4  10.02.p03
G4RDeBremsstrahlungSpectrum Class Reference

#include <G4RDeBremsstrahlungSpectrum.hh>

Inheritance diagram for G4RDeBremsstrahlungSpectrum:
Collaboration diagram for G4RDeBremsstrahlungSpectrum:

Public Member Functions

 G4RDeBremsstrahlungSpectrum (const G4DataVector &bins, const G4String &name)
 
 ~G4RDeBremsstrahlungSpectrum ()
 
G4double Probability (G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const
 
G4double AverageEnergy (G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const
 
G4double SampleEnergy (G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const
 
G4double MaxEnergyOfSecondaries (G4double kineticEnergy, G4int Z=0, const G4ParticleDefinition *pd=0) const
 
G4double Excitation (G4int Z, G4double kineticEnergy) const
 
void PrintData () const
 
- Public Member Functions inherited from G4RDVEnergySpectrum
 G4RDVEnergySpectrum ()
 
virtual ~G4RDVEnergySpectrum ()
 

Private Member Functions

G4double IntSpectrum (G4double xMin, G4double xMax, const G4DataVector &p) const
 
G4double AverageValue (G4double xMin, G4double xMax, const G4DataVector &p) const
 
G4double Function (G4double x, const G4DataVector &p) const
 
 G4RDeBremsstrahlungSpectrum (const G4RDeBremsstrahlungSpectrum &)
 
G4RDeBremsstrahlungSpectrumoperator= (const G4RDeBremsstrahlungSpectrum &right)
 

Private Attributes

G4RDBremsstrahlungParameterstheBRparam
 
G4double lowestE
 
size_t length
 
G4int verbose
 
const G4DataVector xp
 

Detailed Description

Definition at line 66 of file G4RDeBremsstrahlungSpectrum.hh.

Constructor & Destructor Documentation

◆ G4RDeBremsstrahlungSpectrum() [1/2]

G4RDeBremsstrahlungSpectrum::G4RDeBremsstrahlungSpectrum ( const G4DataVector bins,
const G4String name 
)

◆ ~G4RDeBremsstrahlungSpectrum()

G4RDeBremsstrahlungSpectrum::~G4RDeBremsstrahlungSpectrum ( )

Definition at line 68 of file G4RDeBremsstrahlungSpectrum.cc.

69 {
70  delete theBRparam;
71 }
G4RDBremsstrahlungParameters * theBRparam

◆ G4RDeBremsstrahlungSpectrum() [2/2]

G4RDeBremsstrahlungSpectrum::G4RDeBremsstrahlungSpectrum ( const G4RDeBremsstrahlungSpectrum )
private

Member Function Documentation

◆ AverageEnergy()

G4double G4RDeBremsstrahlungSpectrum::AverageEnergy ( G4int  Z,
G4double  tMin,
G4double  tMax,
G4double  kineticEnergy,
G4int  shell = 0,
const G4ParticleDefinition pd = 0 
) const
virtual

Implements G4RDVEnergySpectrum.

Definition at line 121 of file G4RDeBremsstrahlungSpectrum.cc.

127 {
128  G4double tm = std::min(tmax, e);
129  G4double t0 = std::max(tmin, lowestE);
130  if(t0 >= tm) return 0.0;
131 
132  t0 /= e;
133  tm /= e;
134 
135  G4double z0 = lowestE/e;
136 
137  G4DataVector p;
138 
139  // Access parameters
140  for (size_t i=0; i<=length; i++) {
141  p.push_back(theBRparam->Parameter(i, Z, e));
142  }
143 
144  G4double x = AverageValue(t0, tm, p);
145  G4double y = IntSpectrum(z0, 1.0, p);
146 
147  // Add integrant over lowest energies
148  G4double zmin = tmin/e;
149  if(zmin < t0) {
150  G4double c = std::sqrt(theBRparam->ParameterC(Z));
151  x += p[0]*(t0 - zmin - c*(std::atan(t0/c) - std::atan(zmin/c)));
152  }
153  x *= e;
154 
155  if(1 < verbose) {
156  G4cout << "tcut(MeV)= " << tmin/MeV
157  << "; tMax(MeV)= " << tmax/MeV
158  << "; e(MeV)= " << e/MeV
159  << "; t0= " << t0
160  << "; tm= " << tm
161  << "; y= " << y
162  << "; x= " << x
163  << G4endl;
164  }
165  p.clear();
166 
167  if(y > 0.0) x /= y;
168  else x = 0.0;
169  // if(x < 0.0) x = 0.0;
170 
171  return x;
172 }
G4double ParameterC(G4int index) const
G4double AverageValue(G4double xMin, G4double xMax, const G4DataVector &p) const
static const double MeV
Definition: G4SIunits.hh:211
Double_t y
G4GLOB_DLL std::ostream G4cout
Float_t Z
G4double IntSpectrum(G4double xMin, G4double xMax, const G4DataVector &p) const
G4double Parameter(G4int parameterIndex, G4int Z, G4double energy) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4RDBremsstrahlungParameters * theBRparam
Here is the call graph for this function:

◆ AverageValue()

G4double G4RDeBremsstrahlungSpectrum::AverageValue ( G4double  xMin,
G4double  xMax,
const G4DataVector p 
) const
private

Definition at line 248 of file G4RDeBremsstrahlungSpectrum.cc.

251 {
252  G4double x1 = std::min(xMin, xp[0]);
253  G4double x2 = std::min(xMax, xp[0]);
254  G4double z1 = x1;
255  G4double z2 = x2;
256  G4double sum = 0.0;
257 
258  if(x1 < x2) {
259  G4double k = (p[1] - p[0])/(xp[1] - xp[0]);
260  sum += (z2 - z1)*(1. - k*xp[0]);
261  z1 *= x1;
262  z2 *= x2;
263  sum += 0.5*k*(z2 - z1);
264  }
265 
266  for (size_t i=0; i<length-1; i++) {
267  x1 = std::max(xMin, xp[i]);
268  x2 = std::min(xMax, xp[i+1]);
269  if(x1 < x2) {
270  z1 = p[i];
271  z2 = p[i+1];
272  sum += 0.5*(z2 - z1)*(x2 + x1) + z1*x2 - z2*x1;
273  }
274  }
275  if(sum < 0.0) sum = 0.0;
276  return sum;
277 }
Double_t x2[nxs]
Double_t x1[nxs]
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ Excitation()

G4double G4RDeBremsstrahlungSpectrum::Excitation ( G4int  Z,
G4double  kineticEnergy 
) const
virtual

Implements G4RDVEnergySpectrum.

Definition at line 303 of file G4RDeBremsstrahlungSpectrum.cc.

304 {
305  return 0.0;
306 }

◆ Function()

G4double G4RDeBremsstrahlungSpectrum::Function ( G4double  x,
const G4DataVector p 
) const
private

Definition at line 279 of file G4RDeBremsstrahlungSpectrum.cc.

281 {
282  G4double f = 0.0;
283 
284  if(x <= xp[0]) {
285  f = p[0] + (p[1] - p[0])*(x - xp[0])/(xp[1] - xp[0]);
286 
287  } else {
288 
289  for (size_t i=0; i<length-1; i++) {
290 
291  if(x <= xp[i+1]) {
292  f = p[i] + (p[i+1] - p[i])*(x - xp[i])/(xp[i+1] - xp[i]);
293  break;
294  }
295  }
296  }
297  return f;
298 }
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ IntSpectrum()

G4double G4RDeBremsstrahlungSpectrum::IntSpectrum ( G4double  xMin,
G4double  xMax,
const G4DataVector p 
) const
private

Definition at line 222 of file G4RDeBremsstrahlungSpectrum.cc.

225 {
226  G4double x1 = std::min(xMin, xp[0]);
227  G4double x2 = std::min(xMax, xp[0]);
228  G4double sum = 0.0;
229 
230  if(x1 < x2) {
231  G4double k = (p[1] - p[0])/(xp[1] - xp[0]);
232  sum += (1. - k*xp[0])*std::log(x2/x1) + k*(x2 - x1);
233  }
234 
235  for (size_t i=0; i<length-1; i++) {
236  x1 = std::max(xMin, xp[i]);
237  x2 = std::min(xMax, xp[i+1]);
238  if(x1 < x2) {
239  G4double z1 = p[i];
240  G4double z2 = p[i+1];
241  sum += z2 - z1 + std::log(x2/x1)*(z1*x2 - z2*x1)/(x2 - x1);
242  }
243  }
244  if(sum < 0.0) sum = 0.0;
245  return sum;
246 }
Double_t x2[nxs]
Double_t x1[nxs]
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ MaxEnergyOfSecondaries()

G4double G4RDeBremsstrahlungSpectrum::MaxEnergyOfSecondaries ( G4double  kineticEnergy,
G4int  Z = 0,
const G4ParticleDefinition pd = 0 
) const
virtual

Implements G4RDVEnergySpectrum.

Definition at line 308 of file G4RDeBremsstrahlungSpectrum.cc.

311 {
312  return kineticEnergy;
313 }

◆ operator=()

G4RDeBremsstrahlungSpectrum& G4RDeBremsstrahlungSpectrum::operator= ( const G4RDeBremsstrahlungSpectrum right)
private

◆ PrintData()

void G4RDeBremsstrahlungSpectrum::PrintData ( void  ) const
virtual

Implements G4RDVEnergySpectrum.

Definition at line 300 of file G4RDeBremsstrahlungSpectrum.cc.

Here is the call graph for this function:

◆ Probability()

G4double G4RDeBremsstrahlungSpectrum::Probability ( G4int  Z,
G4double  tMin,
G4double  tMax,
G4double  kineticEnergy,
G4int  shell = 0,
const G4ParticleDefinition pd = 0 
) const
virtual

Implements G4RDVEnergySpectrum.

Definition at line 74 of file G4RDeBremsstrahlungSpectrum.cc.

80 {
81  G4double tm = std::min(tmax, e);
82  G4double t0 = std::max(tmin, lowestE);
83  if(t0 >= tm) return 0.0;
84 
85  t0 /= e;
86  tm /= e;
87 
88  G4double z0 = lowestE/e;
89  G4DataVector p;
90 
91  // Access parameters
92  for (size_t i=0; i<=length; i++) {
93  p.push_back(theBRparam->Parameter(i, Z, e));
94  }
95 
96  G4double x = IntSpectrum(t0, tm, p);
97  G4double y = IntSpectrum(z0, 1.0, p);
98 
99 
100  if(1 < verbose) {
101  G4cout << "tcut(MeV)= " << tmin/MeV
102  << "; tMax(MeV)= " << tmax/MeV
103  << "; t0= " << t0
104  << "; tm= " << tm
105  << "; xp[0]= " << xp[0]
106  << "; z= " << z0
107  << "; val= " << x
108  << "; nor= " << y
109  << G4endl;
110  }
111  p.clear();
112 
113  if(y > 0.0) x /= y;
114  else x = 0.0;
115  // if(x < 0.0) x = 0.0;
116 
117  return x;
118 }
static const double MeV
Definition: G4SIunits.hh:211
Double_t y
G4GLOB_DLL std::ostream G4cout
Float_t Z
G4double IntSpectrum(G4double xMin, G4double xMax, const G4DataVector &p) const
G4double Parameter(G4int parameterIndex, G4int Z, G4double energy) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4RDBremsstrahlungParameters * theBRparam
Here is the call graph for this function:

◆ SampleEnergy()

G4double G4RDeBremsstrahlungSpectrum::SampleEnergy ( G4int  Z,
G4double  tMin,
G4double  tMax,
G4double  kineticEnergy,
G4int  shell = 0,
const G4ParticleDefinition pd = 0 
) const
virtual

Implements G4RDVEnergySpectrum.

Definition at line 175 of file G4RDeBremsstrahlungSpectrum.cc.

181 {
182  G4double tm = std::min(tmax, e);
183  G4double t0 = std::max(tmin, lowestE);
184  if(t0 >= tm) return 0.0;
185 
186  t0 /= e;
187  tm /= e;
188 
189  G4DataVector p;
190 
191  for (size_t i=0; i<=length; i++) {
192  p.push_back(theBRparam->Parameter(i, Z, e));
193  }
194  G4double amaj = std::max(p[length], 1. - (p[1] - p[0])*xp[0]/(xp[1] - xp[0]) );
195 
196  G4double amax = std::log(tm);
197  G4double amin = std::log(t0);
198  G4double tgam, q, fun;
199 
200  do {
201  G4double x = amin + G4UniformRand()*(amax - amin);
202  tgam = std::exp(x);
203  fun = Function(tgam, p);
204 
205  if(fun > amaj) {
206  G4cout << "WARNING in G4RDeBremsstrahlungSpectrum::SampleEnergy:"
207  << " Majoranta " << amaj
208  << " < " << fun
209  << G4endl;
210  }
211 
212  q = amaj * G4UniformRand();
213  } while (q > fun);
214 
215  tgam *= e;
216 
217  p.clear();
218 
219  return tgam;
220 }
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
Float_t Z
G4double Parameter(G4int parameterIndex, G4int Z, G4double energy) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4RDBremsstrahlungParameters * theBRparam
G4double Function(G4double x, const G4DataVector &p) const
Here is the call graph for this function:

Member Data Documentation

◆ length

size_t G4RDeBremsstrahlungSpectrum::length
private

Definition at line 120 of file G4RDeBremsstrahlungSpectrum.hh.

◆ lowestE

G4double G4RDeBremsstrahlungSpectrum::lowestE
private

Definition at line 119 of file G4RDeBremsstrahlungSpectrum.hh.

◆ theBRparam

G4RDBremsstrahlungParameters* G4RDeBremsstrahlungSpectrum::theBRparam
private

Definition at line 118 of file G4RDeBremsstrahlungSpectrum.hh.

◆ verbose

G4int G4RDeBremsstrahlungSpectrum::verbose
private

Definition at line 121 of file G4RDeBremsstrahlungSpectrum.hh.

◆ xp

const G4DataVector G4RDeBremsstrahlungSpectrum::xp
private

Definition at line 123 of file G4RDeBremsstrahlungSpectrum.hh.


The documentation for this class was generated from the following files: