OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Tracker.h
Go to the documentation of this file.
1 //
2 // Class Tracker
3 // Track particles or bunches.
4 // An abstract base class for all visitors capable of tracking particles
5 // through a beam element.
6 // [P]
7 // Phase space coordinates (in this order):
8 // [DL]
9 // [DT]x:[DD]
10 // horizontal displacement (metres).
11 // [DT]p_x/p_r:[DD]
12 // horizontal canonical momentum (no dimension).
13 // [DT]y:[DD]
14 // vertical displacement (metres).
15 // [DT]p_y/p_r:[DD]
16 // vertical canonical momentum (no dimension).
17 // [DT]delta_p/p_r:[DD]
18 // relative momentum error (no dimension).
19 // [DT]v*delta_t:[DD]
20 // time difference delta_t w.r.t. the reference frame which moves with
21 // uniform velocity
22 // [P]
23 // v_r = c*beta_r = p_r/m
24 // [P]
25 // along the design orbit, multiplied by the instantaneous velocity v of
26 // the particle (metres).
27 // [/DL]
28 // Where
29 // [DL]
30 // [DT]p_r:[DD]
31 // is the constant reference momentum defining the reference frame velocity.
32 // [DT]m:[DD]
33 // is the rest mass of the particles.
34 // [/DL]
35 // Other units used:
36 // [DL]
37 // [DT]reference momentum:[DD]
38 // electron-volts.
39 // [DT]accelerating voltage:[DD]
40 // volts.
41 // [DT]separator voltage:[DD]
42 // volts.
43 // [DT]frequencies:[DD]
44 // hertz.
45 // [DT]phase lags:[DD]
46 // multiples of (2*pi).
47 // [/DL]
48 //
49 // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
50 // All rights reserved
51 //
52 // This file is part of OPAL.
53 //
54 // OPAL is free software: you can redistribute it and/or modify
55 // it under the terms of the GNU General Public License as published by
56 // the Free Software Foundation, either version 3 of the License, or
57 // (at your option) any later version.
58 //
59 // You should have received a copy of the GNU General Public License
60 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
61 //
62 #ifndef CLASSIC_Tracker_HH
63 #define CLASSIC_Tracker_HH
64 
67 #include "Algorithms/PartData.h"
68 #include "FixedAlgebra/FTps.h"
69 
70 #include "Utilities/ClassicField.h"
71 
72 class BMultipoleField;
73 class Euclid3D;
74 class OpalParticle;
75 
76 class Tracker: public AbstractTracker {
77 
78 public:
79 
81  // The beam line to be tracked is [b]bl[/b].
82  // The particle reference data are taken from [b]data[/b].
83  // The particle bunch is initially empty.
84  // If [b]backBeam[/b] is true, the beam runs from s = C to s = 0.
85  // If [b]backTrack[/b] is true, we track against the beam.
86  Tracker(const Beamline &, const PartData &,
87  bool backBeam, bool backTrack);
88 
90  // The beam line to be tracked is [b]bl[/b].
91  // The particle reference data are taken from [b]data[/b].
92  // The particle bunch is taken from [b]bunch[/b].
93  // If [b]backBeam[/b] is true, the beam runs from s = C to s = 0.
94  // If [b]backTrack[/b] is true, we track against the beam.
96  const PartData &, bool backBeam, bool backTrack);
97 
98  virtual ~Tracker();
99 
101  const PartBunchBase<double, 3> *getBunch() const;
102 
104  void addToBunch(const OpalParticle &);
105 
107  //~ void setBunch(const PartBunch &);
108 
110  // This override calls the component to track the bunch.
111  virtual void visitComponent(const Component &);
112 
114  virtual void setNumBunch(short) {};
115 
117  virtual short getNumBunch() { return 0; }
118 
119  // standing wave structures
121 
123 
124 protected:
125 
127  void applyDrift(double length);
128 
129  // Apply thin multipole kick. .
130  void applyThinMultipole(const BMultipoleField &field, double factor);
131 
132  // Special kick routine for thin SBend.
133  void applyThinSBend(const BMultipoleField &field, double scale, double h);
134 
136  void applyTransform(const Euclid3D &, double refLength = 0.0);
137 
140 
143 
146 
149 
152  // typedef PartBunch::iterator iterator;
153 
154 private:
155 
156  // Not implemented.
158  Tracker(const Tracker &);
159  void operator=(const Tracker &);
160 };
161 
162 #endif // CLASSIC_Tracker_HH
std::list< ClassicField > FieldList
Definition: ClassicField.h:42
Interface for a single beam element.
Definition: Component.h:50
Track particles or bunches.
Particle reference data.
Definition: PartData.h:35
void operator=(const Tracker &)
virtual ~Tracker()
Definition: Tracker.cpp:98
virtual void setNumBunch(short)
set total number of tracked bunches
Definition: Tracker.h:114
void applyThinMultipole(const BMultipoleField &field, double factor)
Definition: Tracker.cpp:141
FieldList cavities_m
Definition: Tracker.h:120
void applyTransform(const Euclid3D &, double refLength=0.0)
Apply a geometric transformation.
Definition: Tracker.cpp:189
FTps< double, 2 > buildSBendVectorPotential2D(const BMultipoleField &, double h)
Construct vector potential for a SBend.
Definition: Tracker.cpp:280
FTps< double, 6 > buildSBendVectorPotential(const BMultipoleField &, double h)
Construct vector potential for a SBend.
Definition: Tracker.cpp:332
void applyThinSBend(const BMultipoleField &field, double scale, double h)
Definition: Tracker.cpp:170
FTps< double, 6 > buildMultipoleVectorPotential(const BMultipoleField &)
Construct vector potential for a Multipole.
Definition: Tracker.cpp:253
virtual short getNumBunch()
get total number of tracked bunches
Definition: Tracker.h:117
const Beamline & itsBeamline_m
Definition: Tracker.h:122
virtual void visitComponent(const Component &)
Store the bunch.
Definition: Tracker.cpp:117
void addToBunch(const OpalParticle &)
Add particle to bunch.
Definition: Tracker.cpp:107
void applyDrift(double length)
Apply a drift length.
Definition: Tracker.cpp:122
PartBunchBase< double, 3 > * itsBunch_m
The bunch of particles to be tracked.
Definition: Tracker.h:151
Tracker(const Tracker &)
const PartBunchBase< double, 3 > * getBunch() const
Return the current bunch.
Definition: Tracker.cpp:102
FTps< double, 2 > buildMultipoleVectorPotential2D(const BMultipoleField &)
Construct vector potential for a Multipole.
Definition: Tracker.cpp:226
Displacement and rotation in space.
Definition: Euclid3D.h:68
An abstract sequence of beam line components.
Definition: Beamline.h:34
The magnetic field of a multipole.
Truncated power series in N variables of type T.
Definition: FTps.h:45