OPAL (Object Oriented Parallel Accelerator Library)  2024.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 - 2023, 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 
21 #include "AbsBeamline/Component.h"
24 
25 #include <string>
26 #include <vector>
27 
28 class Degrader: public Component {
29 
30 public:
32  enum Plane {
34  OFF,
36  X,
38  Y,
41  };
42 
44  explicit Degrader(const std::string& name);
45 
46  Degrader();
47  Degrader(const Degrader& rhs);
48  virtual ~Degrader();
49 
51  virtual void accept(BeamlineVisitor&) const override;
52 
53  virtual bool apply(const size_t& i, const double& t, Vector_t& E, Vector_t& B) override;
54 
55  virtual bool applyToReferenceParticle(const Vector_t& R,
56  const Vector_t& P,
57  const double& t,
58  Vector_t& E,
59  Vector_t& B) override;
60 
61  virtual void initialise(PartBunchBase<double, 3>* bunch, double& startField, double& endField) override;
62 
63  virtual void initialise(PartBunchBase<double, 3>* bunch);
64 
65  virtual void finalise() override;
66 
67  virtual bool bends() const override;
68 
69  virtual void goOnline(const double& kineticEnergy) override;
70 
71  virtual void goOffline() override;
72 
73  virtual ElementType getType() const override;
74 
75  virtual void getDimensions(double& zBegin, double& zEnd) const override;
76 
77  virtual bool isInside(const Vector_t& R) const override;
78 
79  void setDimensions(double xsize, double ysize);
80 
81 private:
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  double width_m;
95  double height_m;
96 };
97 
98 #endif // CLASSIC_Degrader_HH
virtual void getDimensions(double &zBegin, double &zEnd) const override
Definition: Degrader.cpp:166
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Degrader.
Definition: Degrader.cpp:61
virtual bool isInside(const Vector_t &R) const override
Definition: Degrader.cpp:71
Degrader()
Definition: Degrader.cpp:32
virtual ~Degrader()
Definition: Degrader.cpp:56
virtual void finalise() override
Definition: Degrader.cpp:136
Monitor acts on both planes.
Definition: Degrader.h:40
Definition: TSVMeta.h:24
virtual ElementType getType() const override
Get element type std::string.
Definition: Degrader.cpp:171
Plane
Plane selection.
Definition: Degrader.h:32
std::vector< double > PosX_m
Definition: Degrader.h:85
Monitor is off (inactive).
Definition: Degrader.h:34
virtual bool bends() const override
Definition: Degrader.cpp:162
std::vector< double > PosZ_m
Definition: Degrader.h:87
ElementType
Definition: ElementBase.h:88
std::vector< double > MomentumY_m
Definition: Degrader.h:89
double width_m
Definition: Degrader.h:94
void operator=(const Degrader &)
std::vector< double > time_m
Definition: Degrader.h:91
virtual void goOffline() override
Definition: Degrader.cpp:156
virtual void goOnline(const double &kineticEnergy) override
Definition: Degrader.cpp:140
const std::string name
double height_m
Definition: Degrader.h:95
Monitor acts on x-plane.
Definition: Degrader.h:36
std::vector< int > id_m
Definition: Degrader.h:92
std::vector< double > MomentumX_m
Definition: Degrader.h:88
Interface for a single beam element.
Definition: Component.h:50
std::vector< double > MomentumZ_m
Definition: Degrader.h:90
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Definition: Degrader.cpp:127
void setDimensions(double xsize, double ysize)
Definition: Degrader.cpp:65
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
Definition: Degrader.cpp:112
std::vector< double > PosY_m
Definition: Degrader.h:86
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
Definition: Degrader.cpp:83
Monitor acts on y-plane.
Definition: Degrader.h:38