OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
IdealMapper.h
Go to the documentation of this file.
1 #ifndef MAD_IdealMapper_HH
2 #define MAD_IdealMapper_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: IdealMapper.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: IdealMapper
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:33 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
22 
23 class BMultipoleField;
24 class Euclid3D;
25 
26 template <class T, int M, int N> class FMatrix;
27 
28 // Class IdealMapper
29 // ------------------------------------------------------------------------
31 // Ignores the following:
32 // [ul]
33 // [li]Any misalignments,
34 // [li]Any field errors,
35 // [li]Any momentum errors.
36 // [/ul]
37 // Phase space coordinates numbering:
38 // [tab 3 b]
39 // [row]number [&]name [&]unit [/row]
40 // [row]0 [&]x [&]metres [/row]
41 // [row]1 [&]p_x/p_r [&]1 [/row]
42 // [row]2 [&]y [&]metres [/row]
43 // [row]3 [&]p_y/p_r [&]1 [/row]
44 // [row]4 [&]v*delta_t [&]metres [/row]
45 // [row]5 [&]delta_p/p_r [&]1 [/row]
46 // [/tab][p]
47 // Where $p_r$ is the constant reference momentum defining the reference
48 // frame velocity, $m$ is the rest mass of the particles, and $v$ is the
49 // instantaneous velocity of the particle.
50 // [p]
51 // Other units used:
52 // [tab 2 b]
53 // [row]quantity [&]unit [/row]
54 // [row]reference momentum [&]electron-volts [/row]
55 // [row]velocity [&]metres/second [/row]
56 // [row]accelerating voltage [&]volts [/row]
57 // [row]separator voltage [&]volts [/row]
58 // [row]frequencies [&]hertz [/row]
59 // [row]phase lags [&]$2*pi$ [/row]
60 // [/tab][p]
61 // Approximations used:
62 // [ul]
63 // [li] All elements are represented by maps for finite-length elements.
64 // [li] Geometric transformations ignore rotations about transverse axes and
65 // translations along the design orbit and truncate after first order.
66 // [li] Beam-beam elements are ignored.
67 // [/ul]
68 
69 class IdealMapper: public LinearMapper {
70 
71 public:
72 
74  // The beam line to be tracked is [b]bl[/b].
75  // The particle reference data are taken from [b]data[/b].
76  // If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
77  // If [b]revTrack[/b] is true, we track against the beam.
78  IdealMapper(const Beamline &beamline, const PartData &,
79  bool revBeam, bool revTrack);
80 
81  virtual ~IdealMapper();
82 
84  virtual void getMatrix(FMatrix<double, 6, 6> &) const;
85 
87  virtual void setMatrix(const FMatrix<double, 6, 6> &);
88 
90  // Override to ignore corrector kick.
91  virtual void visitCorrector(const Corrector &);
92 
94  // Override to ignore patch.
95  virtual void visitPatch(const Patch &pat);
96 
98  // Override to ignore separator kick.
99  virtual void visitSeparator(const Separator &);
100 
102  // Override to ignore misalignment.
103  virtual void visitAlignWrapper(const AlignWrapper &);
104 
106  virtual void visitCorrectorWrapper(const CorrectorWrapper &);
107 
109  virtual void visitMultipoleWrapper(const MultipoleWrapper &);
110 
112  virtual void visitRBendWrapper(const RBendWrapper &);
113 
115  virtual void visitSBendWrapper(const SBendWrapper &);
116 
117 protected:
118 
119  // Apply thin multipole kick (integrated over length) to ideal map.
120  virtual void applyMultipoleBody
121  (double length, double refLength, const BMultipoleField &field, double scale);
122 
123  // Apply thin multipole kick (integrated over length) to all particles.
124  virtual void applySBendBody
125  (double length, double refLength, double h,
126  const BMultipoleField &field, double scale);
127 
129  // Apply a thin multipole kick (integrated over length) to current map.
130  virtual void applyThinMultipole
131  (const BMultipoleField &field, double factor);
132 
134  // Special kick routine for thin SBend.
135  virtual void applyThinSBend
136  (const BMultipoleField &field, double scale, double h);
137 
139  // Propagate current map through a geometric transformation.
140  virtual void applyTransform(const Euclid3D &, double refLength);
141 
142 private:
143 
144  // Not implemented.
145  IdealMapper();
146  IdealMapper(const IdealMapper &);
147  void operator=(const IdealMapper &);
148 
150  void applyLinearMap(double length, double kx, double ks, double ky);
151 
153  static void makeFocus(double k, double L, double &c, double &s);
154 };
155 
156 #endif // MAD_IdealMapper_HH
virtual void visitPatch(const Patch &pat)
Apply the algorithm to a patch.
Definition: IdealMapper.cpp:73
virtual void visitCorrectorWrapper(const CorrectorWrapper &)
Apply the algorithm to an corrector wrapper..
Definition: IdealMapper.cpp:90
virtual void visitSeparator(const Separator &)
Apply the algorithm to a Separator.
Definition: IdealMapper.cpp:78
virtual void visitCorrector(const Corrector &)
Apply the algorithm to a Corrector.
Definition: IdealMapper.cpp:67
A templated representation for matrices.
Definition: IdealMapper.h:26
virtual void setMatrix(const FMatrix< double, 6, 6 > &)
Reset the linear part of the accumulated map for restart.
Definition: IdealMapper.cpp:62
virtual void applyThinSBend(const BMultipoleField &field, double scale, double h)
Thin SBend kick.
Interface for electrostatic separator.
Definition: Separator.h:33
Build a map using the linear map around the design orbit for each element.
Definition: IdealMapper.h:69
Define the position of a misaligned element.
Definition: AlignWrapper.h:39
virtual void visitMultipoleWrapper(const MultipoleWrapper &)
Apply the algorithm to an multipole wrapper..
Definition: IdealMapper.cpp:96
Particle reference data.
Definition: PartData.h:38
Interface for general corrector.
Definition: Corrector.h:35
Representation of a perturbed multipole.
Build a map using a linear map for each element.
Definition: LinearMapper.h:68
void applyLinearMap(double length, double kx, double ks, double ky)
Apply linear map, defined by the linear coefficients.
virtual ~IdealMapper()
Definition: IdealMapper.cpp:53
virtual void applyTransform(const Euclid3D &, double refLength)
Apply transform.
void operator=(const IdealMapper &)
constexpr double c
The velocity of light in m/s.
Definition: Physics.h:52
Displacement and rotation in space.
Definition: Euclid3D.h:68
virtual void visitRBendWrapper(const RBendWrapper &)
Apply the algorithm to an RBend wrapper..
virtual void applyThinMultipole(const BMultipoleField &field, double factor)
Thin multipole kick.
virtual void getMatrix(FMatrix< double, 6, 6 > &) const
Return the linear part of the accumulated map.
Definition: IdealMapper.cpp:57
Representation of a perturbed sector bend.
Definition: SBendWrapper.h:37
An abstract sequence of beam line components.
Definition: Beamline.h:37
Representation for a perturbed closed orbit corrector.
virtual void applyMultipoleBody(double length, double refLength, const BMultipoleField &field, double scale)
The magnetic field of a multipole.
virtual void visitAlignWrapper(const AlignWrapper &)
Apply the algorithm to an offset beamline object wrapper.
Definition: IdealMapper.cpp:84
virtual void applySBendBody(double length, double refLength, double h, const BMultipoleField &field, double scale)
virtual void visitSBendWrapper(const SBendWrapper &)
Apply the algorithm to an SBend wrapper..
Interface for a geometric patch.
Definition: Patch.h:34
Representation of a perturbed rectangular bend.
Definition: RBendWrapper.h:37
static void makeFocus(double k, double L, double &c, double &s)
Helper function for finding first-order coefficients.