19#include "BDSException.hh"
21#include "BDSUtilities.hh"
25#include "CLHEP/Units/PhysicalConstants.h"
26#include "CLHEP/Units/SystemOfUnits.h"
33const std::vector<G4double> BDSLaser::wavelengths = {340.0*CLHEP::nanometer,
34 425.0*CLHEP::nanometer,
35 445.0*CLHEP::nanometer,
36 520.0*CLHEP::nanometer,
37 565.0*CLHEP::nanometer,
38 590.0*CLHEP::nanometer,
39 625.0*CLHEP::nanometer,
40 740.0*CLHEP::nanometer};
42const std::vector<G4String> BDSLaser::colours = {
"magenta",
52BDSLaser::BDSLaser(G4double wavelengthIn,
54 G4double pulseDurationIn,
55 G4double pulseEnergyIn,
57 G4double laserArrivalTimeIn,
59 const G4ThreeVector& polarizationIn,
60 G4bool ignoreRayleighRangeIn):
61 wavelength(wavelengthIn),
63 pulseDuration(pulseDurationIn),
64 pulseEnergy(pulseEnergyIn),
66 laserArrivalTime(laserArrivalTimeIn),
68 polarization(polarizationIn),
69 ignoreRayleighRange(ignoreRayleighRangeIn)
72 {
throw BDSException(__METHOD_NAME__,
"Laser waist sigma0 is zero.");}
73 peakPower = pulseEnergy / ((2.0*std::sqrt(2.0*std::log(2.0)))*pulseDuration);
74 rayleighRange = (CLHEP::pi * (2.0*sigma0)*(2.0*sigma0)) / (wavelength * m2);
77BDSLaser::BDSLaser(G4double wavelengthIn): wavelength(wavelengthIn),
85 ignoreRayleighRange(0) {}
90G4double BDSLaser::W(G4double z)
const
92 if (ignoreRayleighRange)
97G4double BDSLaser::Intensity(G4double x, G4double y, G4double z)
const
99 return Intensity(G4ThreeVector(x,y,z));
101G4double BDSLaser::Intensity(
const G4ThreeVector& xyz)
const
103 G4double r2 = xyz.perpPart().mag2();
104 G4double wofz = W(xyz.z());
105 G4double wofz2 = wofz*wofz;
106 return (2.0*
peakPower)/(CLHEP::pi*wofz2) * std::exp(-(1.0*(2.0*r2))/wofz2);
109G4double BDSLaser::Radius()
const
111 return std::sqrt((
W0()*std::log(1.0/(CLHEP::e_squared)))/-2.0);
114G4double BDSLaser::PhotonEnergy(G4double particleGamma,
115 G4double overlapAngle,
116 G4double particleBeta)
const
118 return particleGamma*((CLHEP::h_Planck*CLHEP::c_light)/wavelength)
119 *(1-particleBeta*std::cos(overlapAngle*CLHEP::radian));
122G4double BDSLaser::HyperbolicAngle()
const
124 return (m2*wavelength)/(2.0*CLHEP::pi*
W0());
127G4double BDSLaser::TemporalProfileGaussian(G4double particleGlobalTime, G4double particleZCoord)
const
129 G4double mu = (particleGlobalTime-(T0+laserArrivalTime));
130 G4double sigmaT = pulseDuration/(2.0 * std::sqrt(2.0 * std::log(2.0))) ;
131 return std::exp(-((particleZCoord/CLHEP::c_light - mu)*(particleZCoord/CLHEP::c_light-mu)) / (2.0 * sigmaT * sigmaT));
134G4String BDSLaser::GetLaserColour()
const
136 auto it = std::lower_bound(wavelengths.begin(),wavelengths.end(),wavelength);
137 G4int index = std::distance(wavelengths.begin(),it);
138 return colours[index];
General exception with possible name of object and message.
G4double rayleighRange
Calculated parameters.
G4double peakPower
Calculated parameters.
G4double W0() const
Accessor.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())