20#include "BDSException.hh"
22#include "BDSUtilities.hh"
26#include "CLHEP/Units/PhysicalConstants.h"
27#include "CLHEP/Units/SystemOfUnits.h"
34const std::vector<G4double> BDSLaser::wavelengths = {340.0*CLHEP::nanometer,
35 425.0*CLHEP::nanometer,
36 445.0*CLHEP::nanometer,
37 520.0*CLHEP::nanometer,
38 565.0*CLHEP::nanometer,
39 590.0*CLHEP::nanometer,
40 625.0*CLHEP::nanometer,
41 740.0*CLHEP::nanometer};
43const std::vector<G4String> BDSLaser::colours = {
"magenta",
53BDSLaser::BDSLaser(G4double wavelengthIn,
55 G4double pulseDurationIn,
56 G4double pulseEnergyIn,
58 G4double laserArrivalTimeIn,
60 const G4ThreeVector& polarizationIn,
61 G4bool ignoreRayleighRangeIn):
62 wavelength(wavelengthIn),
64 pulseDuration(pulseDurationIn),
65 pulseEnergy(pulseEnergyIn),
67 laserArrivalTime(laserArrivalTimeIn),
69 polarization(polarizationIn),
70 ignoreRayleighRange(ignoreRayleighRangeIn)
73 {
throw BDSException(__METHOD_NAME__,
"Laser waist sigma0 is zero.");}
74 peakPower = pulseEnergy / ((2.0*std::sqrt(2.0*std::log(2.0)))*pulseDuration);
75 rayleighRange = (CLHEP::pi * (2.0*sigma0)*(2.0*sigma0)) / (wavelength * m2);
78BDSLaser::BDSLaser(G4double wavelengthIn): wavelength(wavelengthIn),
86 ignoreRayleighRange(0) {}
91G4double BDSLaser::W(G4double z)
const
93 if (ignoreRayleighRange)
98G4double BDSLaser::Intensity(G4double x, G4double y, G4double z)
const
100 return Intensity(G4ThreeVector(x,y,z));
102G4double BDSLaser::Intensity(
const G4ThreeVector& xyz)
const
104 G4double r2 = xyz.perpPart().mag2();
105 G4double wofz = W(xyz.z());
106 G4double wofz2 = wofz*wofz;
107 return (2.0*
peakPower)/(CLHEP::pi*wofz2) * std::exp(-(1.0*(2.0*r2))/wofz2);
110G4double BDSLaser::Radius()
const
112 return std::sqrt((
W0()*std::log(1.0/(CLHEP::e_squared)))/-2.0);
115G4double BDSLaser::PhotonEnergy(G4double particleGamma,
116 G4double overlapAngle,
117 G4double particleBeta)
const
119 return particleGamma*((CLHEP::h_Planck*CLHEP::c_light)/wavelength)
120 *(1-particleBeta*std::cos(overlapAngle*CLHEP::radian));
123G4double BDSLaser::HyperbolicAngle()
const
125 return (m2*wavelength)/(2.0*CLHEP::pi*
W0());
128G4double BDSLaser::TemporalProfileGaussian(G4double particleGlobalTime, G4double particleZCoord)
const
130 G4double mu = (particleGlobalTime-(T0+laserArrivalTime));
131 G4double sigmaT = pulseDuration/(2.0 * std::sqrt(2.0 * std::log(2.0))) ;
132 return std::exp(-((particleZCoord/CLHEP::c_light - mu)*(particleZCoord/CLHEP::c_light-mu)) / (2.0 * sigmaT * sigmaT));
135G4String BDSLaser::GetLaserColour()
const
137 auto it = std::lower_bound(wavelengths.begin(),wavelengths.end(),wavelength);
138 G4int index = std::distance(wavelengths.begin(),it);
139 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())