OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
Tracker.cpp
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#include "Algorithms/Tracker.h"
64
65// FIXME Remove headers and dynamic_cast in readOneBunchFromFile
66#include "PartBunch/PartBunch.h"
67
68#include <cfloat>
69#include <cmath>
70#include <limits>
71
72// Class Tracker
73// ------------------------------------------------------------------------
74
75Tracker::Tracker(const Beamline& beamline, const PartData& reference, bool backBeam, bool backTrack)
76 : Tracker(beamline, nullptr, reference, backBeam, backTrack) {
77}
78
80 const Beamline& beamline, PartBunch_t* bunch, const PartData& reference, bool backBeam,
81 bool backTrack)
82 : AbstractTracker(beamline, reference, backBeam, backTrack),
83 itsBeamline_m(beamline),
84 itsBunch_m(bunch) {
85}
86
89
91 return itsBunch_m;
92}
93
95}
96
97//~ void Tracker::setBunch(const PartBunch &bunch) {
98//~ itsBunch_m = &bunch;
99//~ }
100
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
Interface for a single beam element.
Definition Component.h:50
virtual void trackBunch(PartBunch_t *bunch, const PartData &, bool revBeam, bool revTrack) const
Track particle bunch.
Definition Component.cpp:56
const PartData itsReference
The reference information.
AbstractTracker(const Beamline &, const PartData &, bool backBeam, bool backTrack)
Constructor.
Particle reference data.
Definition PartData.h:37
virtual ~Tracker()
Definition Tracker.cpp:87
Tracker(const Beamline &, const PartData &, bool backBeam, bool backTrack)
Constructor.
Definition Tracker.cpp:75
const Beamline & itsBeamline_m
Definition Tracker.h:119
virtual void visitComponent(const Component &)
Store the bunch.
Definition Tracker.cpp:101
void addToBunch(const OpalParticle &)
Add particle to bunch.
Definition Tracker.cpp:94
const PartBunch_t * getBunch() const
Return the current bunch.
Definition Tracker.cpp:90
PartBunch_t * itsBunch_m
The bunch of particles to be tracked.
Definition Tracker.h:123
An abstract sequence of beam line components.
Definition Beamline.h:34