73 bool revBeam,
bool revTrack)
const {
75 trackMap(map, ref, revBeam, revTrack);
81 bool revBeam,
bool revTrack)
const {
83 if(revTrack) length = - length;
85 double scale = (ref.
getQ() *
c) / (ref.
getP());
86 if(revBeam) scale = - scale;
89 std::vector<double> slices;
101 applyDrift(map, length * (slices[i+1] - slices[i]), ref);
111 bool revBeam,
bool revTrack)
const {
113 if(revTrack) length = - length;
115 double scale = (ref.
getQ() *
c) / (ref.
getP());
116 if(revBeam) scale = - scale;
119 std::vector<double> slices;
131 applyDrift(part, length * (slices[i+1] - slices[i]), ref);
142 bool revBeam,
bool revTrack)
const {
144 if(revTrack) length = - length;
146 double scale = (ref.
getQ() *
c) / (ref.
getP());
147 if(revBeam) scale = - scale;
150 std::vector<double> slices;
153 for(
unsigned int i = 0; i < bunch->
getLocalNum(); i++) {
164 applyDrift(part, length * (slices[s+1] - slices[s]), ref);
170 for(
unsigned int i = 0; i < bunch->
getLocalNum(); i++) {
181 double kin = reference.
getM() / reference.
getP();
182 double ref = kin * kin;
187 map[0] += px * lByPz;
188 map[2] += py * lByPz;
189 map[4] += length * (pt * ref - (px * px + py * py + (3.0 *
ref) * pt * pt) / 2.0);
195 double kin = reference.
getM() / reference.
getP();
196 double ref = kin * kin;
197 double px = part.
px();
198 double py = part.
py();
199 double pt = part.
pt();
200 double lByPz = length / (1.0 + pt);
201 part.
x() += px * lByPz;
202 part.
y() += py * lByPz;
203 part.
t() += length * (pt * ref - (px * px + py * py + (3.0 *
ref) * pt * pt) / 2.0);
209 double scale)
const {
210 int order = field.
order();
221 kx = kxt + field.
normal(order);
222 ky = kyt - field.
skew(order);
225 map[1] -= kx * scale;
226 map[3] += ky * scale;
233 double scale)
const {
234 int order = field.
order();
239 double kx = + field.
normal(order);
240 double ky = - field.
skew(order);
243 double kxt = x * kx - y * ky;
244 double kyt = x * ky + y * kx;
245 kx = kxt + field.
normal(order);
246 ky = kyt - field.
skew(order);
249 part.
px() -= kx * scale;
250 part.
py() += ky * scale;
262 slices.push_back(1.0 / 2.0);
266 slices.push_back(1.0 / 6.0);
267 slices.push_back(5.0 / 6.0);
271 slices.push_back(1.0 / 8.0);
272 slices.push_back(4.0 / 8.0);
273 slices.push_back(7.0 / 8.0);
277 slices.push_back(3.0 / 30.0);
278 slices.push_back(11.0 / 30.0);
279 slices.push_back(19.0 / 30.0);
280 slices.push_back(27.0 / 30.0);
285 double pos = step / 2.0;
287 slices.push_back(pos);
294 slices.push_back(1.0);
double & py()
Get reference to vertical momentum (no dimension).
double normal(int) const
Get component.
virtual BMultipoleField & getField() override=0
Get multipole field.
void getSlices(std::vector< double > &v) const
Return slice positions.
virtual MPSplitIntegrator * clone() const
Make clone.
virtual BGeometryBase & getGeometry()=0
Get geometry.
double & x()
Get reference to horizontal position in m.
virtual BGeometryBase & getGeometry()
Get geometry.
Interface for general multipole.
Abstract base class for accelerator geometry classes.
virtual ~MPSplitIntegrator()
double skew(int) const
Get component.
double getQ() const
The constant charge per particle.
virtual double getElementLength() const
Get design length.
OpalParticle get_part(int ii)
virtual void getMap(FVps< double, 6 > &map, const PartData &data, bool revBeam, bool revTrack) const
Get map from MPSplitIntegrator.
constexpr double c
The velocity of light in m/s.
Pointer< ElementBase > itsElement
Pointer to the replaced element.
size_t getLocalNum() const
void set_part(FVector< double, 6 > z, int ii)
double & pt()
Get reference to relative momentum error (no dimension).
double getP() const
The constant reference momentum per particle.
void applyMultipole(FVps< double, 6 > &map, const BMultipoleField &field, double factor) const
virtual ElementBase::ElementType getType() const
Get element type string.
The magnetic field of a multipole.
double getM() const
The constant mass per particle.
virtual void trackParticle(OpalParticle &part, const PartData &data, bool revBeam, bool revTrack) const
Track particle through MPSplitIntegrator.
void applyDrift(FVps< double, 6 > &map, double, const PartData &) const
virtual void trackBunch(PartBunchBase< double, 3 > *bunch, const PartData &data, bool revBeam, bool revTrack) const
Track particle bunch through MPSplitIntegrator.
double & y()
Get reference to vertical displacement in m.
Integrator replacing each multipole by a set of thin lenses.
virtual void trackMap(FVps< double, 6 > &map, const PartData &data, bool revBeam, bool revTrack) const
Track map through MPSplitIntegrator.
double & t()
Get reference to longitudinal displacement c*t in m.
double & px()
Get reference to horizontal momentum (no dimension).
int order() const
Return order.