OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Laser.cpp
Go to the documentation of this file.
1#include "AbsBeamline/Laser.h"
2
5
7
8Laser::Laser(const std::string& name)
9 : Component(name),
10 startField_m(0.0),
11 wavelength_m(0.0),
12 pulseEnergy_m(0.0),
13 pulseLength_m(0.0),
14 waistX_m(0.0),
15 waistY_m(0.0),
16 direction_m(0.0),
17 stokes_m(0.0) {}
18
19Laser::Laser(const Laser& right)
20 : Component(right),
21 startField_m(right.startField_m),
22 wavelength_m(right.wavelength_m),
23 pulseEnergy_m(right.pulseEnergy_m),
24 pulseLength_m(right.pulseLength_m),
25 waistX_m(right.waistX_m),
26 waistY_m(right.waistY_m),
27 direction_m(right.direction_m),
28 stokes_m(right.stokes_m) {}
29
31
32void Laser::accept(BeamlineVisitor& visitor) const { visitor.visitLaser(*this); }
33
34void Laser::initialise(PartBunch_t* bunch, double& startField, double& endField) {
35 endField = startField + getElementLength();
36 RefPartBunch_m = bunch;
37 startField_m = startField;
38}
39
41
42bool Laser::bends() const { return false; }
43
44void Laser::getFieldExtend(double& zBegin, double& zEnd) const {
45 zBegin = startField_m;
47}
48
50
51void Laser::setWavelength(double wavelength) { wavelength_m = wavelength; }
52
53double Laser::getWavelength() const { return wavelength_m; }
54
55void Laser::setPulseEnergy(double pulseEnergy) { pulseEnergy_m = pulseEnergy; }
56
57double Laser::getPulseEnergy() const { return pulseEnergy_m; }
58
59void Laser::setPulseLength(double pulseLength) { pulseLength_m = pulseLength; }
60
61double Laser::getPulseLength() const { return pulseLength_m; }
62
63void Laser::setWaistX(double waistX) { waistX_m = waistX; }
64
65double Laser::getWaistX() const { return waistX_m; }
66
67void Laser::setWaistY(double waistY) { waistY_m = waistY; }
68
69double Laser::getWaistY() const { return waistY_m; }
70
71void Laser::setDirection(const Vector_t<double, 3>& direction) { direction_m = direction; }
72
74
75void Laser::setStokes(const Vector_t<double, 3>& stokes) { stokes_m = stokes; }
76
80
82 double electronTotalEnergyGeV, const Vector_t<double, 3>& beamDirection) const {
84 electronTotalEnergyGeV, getPhotonEnergyGeV(), beamDirection, direction_m);
85}
86
88 double electronTotalEnergyGeV, const Vector_t<double, 3>& beamDirection) const {
90 electronTotalEnergyGeV, getPhotonEnergyGeV(), beamDirection, direction_m);
91}
92
ippl::Vector< T, Dim > Vector_t
ElementType
Definition ElementBase.h:94
virtual void visitLaser(const Laser &)=0
Apply the algorithm to a laser element.
PartBunch_t * RefPartBunch_m
Definition Component.h:225
virtual double getElementLength() const
Get design length.
Passive OPALX laser element.
Definition Laser.h:25
void setWavelength(double wavelength)
Set the laser wavelength in m.
Definition Laser.cpp:51
void setDirection(const Vector_t< double, 3 > &direction)
Set the laboratory-frame laser propagation direction.
Definition Laser.cpp:71
double getWaistY() const
Get the vertical waist in m.
Definition Laser.cpp:69
double getWaistX() const
Get the horizontal waist in m.
Definition Laser.cpp:65
Vector_t< double, 3 > stokes_m
Definition Laser.h:154
double getPulseLength() const
Get the pulse duration in s.
Definition Laser.cpp:61
void getFieldExtend(double &zBegin, double &zEnd) const override
Get the longitudinal element extent in the current lattice traversal.
Definition Laser.cpp:44
void accept(BeamlineVisitor &) const override
Accept a beamline visitor through the laser-specific interface.
Definition Laser.cpp:32
Laser()
Construct an unnamed laser element.
Definition Laser.cpp:6
double pulseLength_m
Definition Laser.h:150
double startField_m
Definition Laser.h:147
void setWaistX(double waistX)
Set the horizontal waist in m.
Definition Laser.cpp:63
void setPulseEnergy(double pulseEnergy)
Set the total pulse energy in J.
Definition Laser.cpp:55
Vector_t< double, 3 > direction_m
Definition Laser.h:153
ElementType getType() const override
Return the OPALX element type identifier.
Definition Laser.cpp:49
void setPulseLength(double pulseLength)
Set the pulse duration in s.
Definition Laser.cpp:59
void initialise(PartBunch_t *bunch, double &startField, double &endField) override
Initialize the element for a tracking pass.
Definition Laser.cpp:34
bool bends() const override
Return false because the element has straight reference geometry.
Definition Laser.cpp:42
double getLinearComptonForwardPhotonEnergyGeV(double electronTotalEnergyGeV, const Vector_t< double, 3 > &beamDirection) const
Compute the forward scattered photon energy for linear Compton scattering.
Definition Laser.cpp:87
double waistY_m
Definition Laser.h:152
double getWavelength() const
Get the laser wavelength in m.
Definition Laser.cpp:53
double wavelength_m
Definition Laser.h:148
~Laser() override
Destroy the laser element.
Definition Laser.cpp:30
double getPhotonEnergyGeV() const
Convert the stored laser wavelength to a single-photon energy.
Definition Laser.cpp:77
double getPulseEnergy() const
Get the total pulse energy in J.
Definition Laser.cpp:57
double pulseEnergy_m
Definition Laser.h:149
void setWaistY(double waistY)
Set the vertical waist in m.
Definition Laser.cpp:67
const Vector_t< double, 3 > & getDirection() const
Get the laboratory-frame laser propagation direction.
Definition Laser.cpp:73
double getLinearComptonInvariantX(double electronTotalEnergyGeV, const Vector_t< double, 3 > &beamDirection) const
Compute the linear Compton invariant x for a given beam direction.
Definition Laser.cpp:81
void setStokes(const Vector_t< double, 3 > &stokes)
Set the normalized Stokes polarization vector.
Definition Laser.cpp:75
double waistX_m
Definition Laser.h:151
void finalise() override
Finalize the element after a tracking pass.
Definition Laser.cpp:40
const Vector_t< double, 3 > & getStokes() const
Get the normalized Stokes polarization vector.
Definition Laser.cpp:93
double labForwardPhotonEnergyGeV(double electronTotalEnergyGeV, double laserPhotonEnergyGeV, const Vector_t< double, 3 > &beamDirection, const Vector_t< double, 3 > &laserDirection)
Forward scattered photon energy in the laboratory frame.
double invariantX(double incomingPhotonEnergyERFGeV)
Compute CAIN's linear-Compton invariant .
double photonEnergyFromWavelengthGeV(double wavelength_m)
Convert a laser wavelength to a single-photon energy.