OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Tracker.h
Go to the documentation of this file.
1 #ifndef CLASSIC_Tracker_HH
2 #define CLASSIC_Tracker_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Tracker.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1.2.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Tracker
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Algorithms
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2004/11/12 18:57:53 $
19 // $Author: adelmann $
20 //
21 // ------------------------------------------------------------------------
22 
25 #include "Algorithms/PartData.h"
26 #include "FixedAlgebra/FTps.h"
27 
28 #include "Utilities/ClassicField.h"
29 
30 class BMultipoleField;
31 class Euclid3D;
32 class OpalParticle;
33 
34 
35 // Class Tracker
36 // ------------------------------------------------------------------------
38 // An abstract base class for all visitors capable of tracking particles
39 // through a beam element.
40 // [P]
41 // Phase space coordinates (in this order):
42 // [DL]
43 // [DT]x:[DD]
44 // horizontal displacement (metres).
45 // [DT]p_x/p_r:[DD]
46 // horizontal canonical momentum (no dimension).
47 // [DT]y:[DD]
48 // vertical displacement (metres).
49 // [DT]p_y/p_r:[DD]
50 // vertical canonical momentum (no dimension).
51 // [DT]delta_p/p_r:[DD]
52 // relative momentum error (no dimension).
53 // [DT]v*delta_t:[DD]
54 // time difference delta_t w.r.t. the reference frame which moves with
55 // uniform velocity
56 // [P]
57 // v_r = c*beta_r = p_r/m
58 // [P]
59 // along the design orbit, multiplied by the instantaneous velocity v of
60 // the particle (metres).
61 // [/DL]
62 // Where
63 // [DL]
64 // [DT]p_r:[DD]
65 // is the constant reference momentum defining the reference frame velocity.
66 // [DT]m:[DD]
67 // is the rest mass of the particles.
68 // [/DL]
69 // Other units used:
70 // [DL]
71 // [DT]reference momentum:[DD]
72 // electron-volts.
73 // [DT]accelerating voltage:[DD]
74 // volts.
75 // [DT]separator voltage:[DD]
76 // volts.
77 // [DT]frequencies:[DD]
78 // hertz.
79 // [DT]phase lags:[DD]
80 // multiples of (2*pi).
81 // [/DL]
82 
83 
84 class Tracker: public AbstractTracker {
85 
86 public:
87 
89  // The beam line to be tracked is [b]bl[/b].
90  // The particle reference data are taken from [b]data[/b].
91  // The particle bunch is initially empty.
92  // If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
93  // If [b]revTrack[/b] is true, we track against the beam.
94  Tracker(const Beamline &, const PartData &,
95  bool backBeam, bool backTrack);
96 
98  // The beam line to be tracked is [b]bl[/b].
99  // The particle reference data are taken from [b]data[/b].
100  // The particle bunch is taken from [b]bunch[/b].
101  // If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
102  // If [b]revTrack[/b] is true, we track against the beam.
103  Tracker(const Beamline &, PartBunchBase<double, 3> *bunch,
104  const PartData &, bool backBeam, bool backTrack);
105 
106  virtual ~Tracker();
107 
109  const PartBunchBase<double, 3> *getBunch() const;
110 
112  void addToBunch(const OpalParticle &);
113 
115  //~ void setBunch(const PartBunch &);
116 
118  // This override calls the component to track the bunch.
119  virtual void visitComponent(const Component &);
120 
122  virtual void visitPatch(const Patch &pat);
123 
125  virtual void visitAlignWrapper(const AlignWrapper &);
126 
128  virtual void visitTrackIntegrator(const TrackIntegrator &);
129 
131  virtual void visitMapIntegrator(const MapIntegrator &);
132 
134  virtual void setNumBunch(int) {};
135 
137  virtual int getNumBunch() { return 0; }
138 
140  //virtual void setMpacflg(bool /* mpacflg */) {};
141 
142  // standing wave structures
144 
146 
147 protected:
148 
150  void applyDrift(double length);
151 
152  // Apply thin multipole kick. .
153  void applyThinMultipole(const BMultipoleField &field, double factor);
154 
155  // Special kick routine for thin SBend.
156  void applyThinSBend(const BMultipoleField &field, double scale, double h);
157 
159  void applyTransform(const Euclid3D &, double refLength = 0.0);
160 
163 
166 
169 
172 
175  // typedef PartBunch::iterator iterator;
176 
177 private:
178 
179  // Not implemented.
180  Tracker();
181  Tracker(const Tracker &);
182  void operator=(const Tracker &);
183 };
184 
185 #endif // CLASSIC_Tracker_HH
FieldList cavities_m
set multipacting flag
Definition: Tracker.h:143
virtual void setNumBunch(int)
set total number of tracked bunches
Definition: Tracker.h:134
Track particles or bunches.
void addToBunch(const OpalParticle &)
Add particle to bunch.
Definition: Tracker.cpp:79
const Beamline & itsBeamline_m
Definition: Tracker.h:145
std::list< ClassicField > FieldList
Definition: ClassicField.h:47
Define the position of a misaligned element.
Definition: AlignWrapper.h:39
FTps< double, 2 > buildSBendVectorPotential2D(const BMultipoleField &, double h)
Construct vector potential for a SBend.
Definition: Tracker.cpp:293
Particle reference data.
Definition: PartData.h:38
void applyDrift(double length)
Apply a drift length.
Definition: Tracker.cpp:133
virtual void visitPatch(const Patch &pat)
Apply the algorithm to a patch.
Definition: Tracker.cpp:94
virtual ~Tracker()
Definition: Tracker.cpp:70
void operator=(const Tracker &)
FTps< double, 6 > buildMultipoleVectorPotential(const BMultipoleField &)
Construct vector potential for a Multipole.
Definition: Tracker.cpp:266
FTps< double, 2 > buildMultipoleVectorPotential2D(const BMultipoleField &)
Construct vector potential for a Multipole.
Definition: Tracker.cpp:239
virtual void visitAlignWrapper(const AlignWrapper &)
Apply the algorithm to an align wrapper.
Definition: Tracker.cpp:101
Displacement and rotation in space.
Definition: Euclid3D.h:68
virtual void visitMapIntegrator(const MapIntegrator &)
Apply the algorithm to an integrator capable of mapping.
Definition: Tracker.cpp:128
An abstract sequence of beam line components.
Definition: Beamline.h:37
Integrate particle.
virtual void visitComponent(const Component &)
Store the bunch.
Definition: Tracker.cpp:89
virtual void visitTrackIntegrator(const TrackIntegrator &)
Apply the algorithm to an integrator capable of tracking.
Definition: Tracker.cpp:123
The magnetic field of a multipole.
const PartBunchBase< double, 3 > * getBunch() const
Return the current bunch.
Definition: Tracker.cpp:74
FTps< double, 6 > buildSBendVectorPotential(const BMultipoleField &, double h)
Construct vector potential for a SBend.
Definition: Tracker.cpp:345
Truncated power series in N variables of type T.
Interface for a geometric patch.
Definition: Patch.h:34
virtual int getNumBunch()
get total number of tracked bunches
Definition: Tracker.h:137
Interface for a single beam element.
Definition: Component.h:51
void applyThinSBend(const BMultipoleField &field, double scale, double h)
Definition: Tracker.cpp:183
OpalParticle position.
Definition: OpalParticle.h:38
PartBunchBase< double, 3 > * itsBunch_m
The bunch of particles to be tracked.
Definition: Tracker.h:174
void applyThinMultipole(const BMultipoleField &field, double factor)
Definition: Tracker.cpp:154
Integrate a map.
Definition: MapIntegrator.h:41
void applyTransform(const Euclid3D &, double refLength=0.0)
Apply a geometric transformation.
Definition: Tracker.cpp:202
Track particles or bunches.
Definition: Tracker.h:84