OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Degrader.h
Go to the documentation of this file.
1//
2// Class Degrader
3// Defines the abstract interface for a beam degrader.
4//
5// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved.
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
18#ifndef CLASSIC_Degrader_HH
19#define CLASSIC_Degrader_HH
20
24
25#include <string>
26#include <vector>
27
28class Degrader: public Component {
29
30public:
31
33 enum Plane {
41 XY
42 };
43
45 explicit Degrader(const std::string& name);
46
47 Degrader();
48 Degrader(const Degrader& rhs);
49 virtual ~Degrader();
50
52 virtual void accept(BeamlineVisitor&) const;
53
54 virtual bool apply(const size_t& i, const double& t, Vector_t& E, Vector_t& B);
55
56 virtual bool applyToReferenceParticle(const Vector_t& R,
57 const Vector_t& P,
58 const double& t,
59 Vector_t& E,
60 Vector_t& B);
61
62 virtual void initialise(PartBunchBase<double, 3>* bunch, double& startField, double& endField);
63
64 virtual void initialise(PartBunchBase<double, 3>* bunch);
65
66 virtual void finalise();
67
68 virtual bool bends() const;
69
70 virtual void goOnline(const double& kineticEnergy);
71
72 virtual void goOffline();
73
74 virtual ElementType getType() const;
75
76 virtual void getDimensions(double& zBegin, double& zEnd) const;
77
78 virtual bool isInMaterial(double z);
79
80private:
81
82 // Not implemented.
83 void operator=(const Degrader&);
84
85 std::vector<double> PosX_m;
86 std::vector<double> PosY_m;
87 std::vector<double> PosZ_m;
88 std::vector<double> MomentumX_m;
89 std::vector<double> MomentumY_m;
90 std::vector<double> MomentumZ_m;
91 std::vector<double> time_m;
92 std::vector<int> id_m;
93};
94
95#endif // CLASSIC_Degrader_HH
ElementType
Definition: ElementBase.h:88
const std::string name
Interface for a single beam element.
Definition: Component.h:50
virtual bool bends() const
Definition: Degrader.cpp:147
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B)
Definition: Degrader.cpp:97
std::vector< double > MomentumZ_m
Definition: Degrader.h:90
virtual void finalise()
Definition: Degrader.cpp:121
virtual void goOnline(const double &kineticEnergy)
Definition: Degrader.cpp:125
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
Definition: Degrader.cpp:68
void operator=(const Degrader &)
virtual ElementType getType() const
Get element type std::string.
Definition: Degrader.cpp:156
std::vector< double > time_m
Definition: Degrader.h:91
virtual bool isInMaterial(double z)
Definition: Degrader.cpp:61
virtual void getDimensions(double &zBegin, double &zEnd) const
Definition: Degrader.cpp:151
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField)
Definition: Degrader.cpp:112
std::vector< double > MomentumY_m
Definition: Degrader.h:89
Degrader()
Definition: Degrader.cpp:32
std::vector< double > PosY_m
Definition: Degrader.h:86
std::vector< double > PosX_m
Definition: Degrader.h:85
virtual ~Degrader()
Definition: Degrader.cpp:52
Plane
Plane selection.
Definition: Degrader.h:33
@ Y
Monitor acts on y-plane.
Definition: Degrader.h:39
@ OFF
Monitor is off (inactive).
Definition: Degrader.h:35
@ X
Monitor acts on x-plane.
Definition: Degrader.h:37
@ XY
Monitor acts on both planes.
Definition: Degrader.h:41
virtual void goOffline()
Definition: Degrader.cpp:141
std::vector< double > PosZ_m
Definition: Degrader.h:87
virtual void accept(BeamlineVisitor &) const
Apply visitor to Degrader.
Definition: Degrader.cpp:57
std::vector< int > id_m
Definition: Degrader.h:92
std::vector< double > MomentumX_m
Definition: Degrader.h:88