OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
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 
21 #include "AbsBeamline/Component.h"
24 
25 #include <string>
26 #include <vector>
27 
28 class LossDataSink;
29 
30 class Degrader: public Component {
31 
32 public:
33 
35  enum Plane {
37  OFF,
39  X,
41  Y,
43  XY
44  };
45 
47  explicit Degrader(const std::string &name);
48 
49  Degrader();
50  Degrader(const Degrader &rhs);
51  virtual ~Degrader();
52 
54  virtual void accept(BeamlineVisitor &) const;
55 
56  virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B);
57 
58  virtual bool applyToReferenceParticle(const Vector_t &R,
59  const Vector_t &P,
60  const double &t,
61  Vector_t &E,
62  Vector_t &B);
63 
64  virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField);
65 
66  virtual void initialise(PartBunchBase<double, 3> *bunch);
67 
68  virtual void finalise();
69 
70  virtual bool bends() const;
71 
72  virtual void goOnline(const double &kineticEnergy);
73 
74  virtual void goOffline();
75 
76  virtual ElementBase::ElementType getType() const;
77 
78  virtual void getDimensions(double &zBegin, double &zEnd) const;
79 
80  std::string getDegraderShape(); // AAA
81 
82  virtual bool isInMaterial(double z);
83 
84 private:
85 
86  // Not implemented.
87  void operator=(const Degrader &);
88 
89  std::vector<double> PosX_m;
90  std::vector<double> PosY_m;
91  std::vector<double> PosZ_m;
92  std::vector<double> MomentumX_m;
93  std::vector<double> MomentumY_m;
94  std::vector<double> MomentumZ_m;
95  std::vector<double> time_m;
96  std::vector<int> id_m;
97 
98  std::unique_ptr<LossDataSink> lossDs_m;
99 };
100 
101 #endif // CLASSIC_Degrader_HH
const std::string name
Interface for a single beam element.
Definition: Component.h:50
virtual bool bends() const
Definition: Degrader.cpp:153
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B)
Definition: Degrader.cpp:101
virtual ElementBase::ElementType getType() const
Get element type std::string.
Definition: Degrader.cpp:162
std::vector< double > MomentumZ_m
Definition: Degrader.h:94
std::string getDegraderShape()
Definition: Degrader.cpp:166
virtual void finalise()
Definition: Degrader.cpp:126
virtual void goOnline(const double &kineticEnergy)
Definition: Degrader.cpp:130
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
Definition: Degrader.cpp:73
void operator=(const Degrader &)
std::vector< double > time_m
Definition: Degrader.h:95
virtual bool isInMaterial(double z)
Definition: Degrader.cpp:65
virtual void getDimensions(double &zBegin, double &zEnd) const
Definition: Degrader.cpp:157
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField)
Definition: Degrader.cpp:116
std::vector< double > MomentumY_m
Definition: Degrader.h:93
Degrader()
Definition: Degrader.cpp:33
std::vector< double > PosY_m
Definition: Degrader.h:90
std::vector< double > PosX_m
Definition: Degrader.h:89
virtual ~Degrader()
Definition: Degrader.cpp:54
Plane
Plane selection.
Definition: Degrader.h:35
@ Y
Monitor acts on y-plane.
Definition: Degrader.h:41
@ OFF
Monitor is off (inactive).
Definition: Degrader.h:37
@ X
Monitor acts on x-plane.
Definition: Degrader.h:39
@ XY
Monitor acts on both planes.
Definition: Degrader.h:43
std::unique_ptr< LossDataSink > lossDs_m
Definition: Degrader.h:98
virtual void goOffline()
Definition: Degrader.cpp:146
std::vector< double > PosZ_m
Definition: Degrader.h:91
virtual void accept(BeamlineVisitor &) const
Apply visitor to Degrader.
Definition: Degrader.cpp:60
std::vector< int > id_m
Definition: Degrader.h:96
std::vector< double > MomentumX_m
Definition: Degrader.h:92