OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
BeamStripping.h
Go to the documentation of this file.
1 #ifndef CLASSIC_BeamStripping_HH
2 #define CLASSIC_BeamStripping_HH
3 
4 // Class category: AbsBeamline
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: BeamStripping
10 // Defines the abstract interface for a beam BeamStripping
11 //
12 // ------------------------------------------------------------------------
13 // Class category: AbsBeamline
14 // ------------------------------------------------------------------------
15 // $Date: 2018/11 $
16 // $Author: PedroCalvo$
17 // ------------------------------------------------------------------------
18 
19 #include "AbsBeamline/Component.h"
20 
21 #include <string>
22 #include <vector>
23 
24 class BeamlineVisitor;
25 class Cyclotron;
26 
27 struct PFieldData {
28  std::string filename;
29  // known from file: field and three theta derivatives
30  std::vector<double> pfld; //Pz
31 
32  // Grid-Size
33  //need to be read from inputfile.
34  int nrad, ntet;
35 
36  // one more grid line is stored in azimuthal direction:
37  int ntetS;
38 
39  // total grid points number.
40  int ntot;
41 };
42 
43 struct PPositions {
44  // these 4 parameters are need to be read from field file.
45  double rmin, delr;
46  double tetmin, dtet;
47 
48  // Radii and step width of initial Grid
49  std::vector<double> rarr;
50 
51  double Pfact; // MULTIPLICATION FACTOR FOR PRESSURE MAP
52 };
53 
54 
55 
56 // Class BeamStripping
57 // ------------------------------------------------------------------------
58 
59 class BeamStripping: public Component {
60 
61 public:
62 
64  explicit BeamStripping(const std::string &name);
65 
66  BeamStripping();
67  BeamStripping(const BeamStripping &rhs);
68  virtual ~BeamStripping();
69 
71  virtual void accept(BeamlineVisitor &) const;
72 
73  virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B);
74 
75  virtual bool apply(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B);
76 
77  virtual bool checkBeamStripping(PartBunchBase<double, 3> *bunch, Cyclotron* cycl, const int turnnumber, const double t, const double tstep);
78 
79  virtual bool checkBeamStripping(Vector_t r, Vector_t rmin, Vector_t rmax);
80 
81  virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField);
82 
83  virtual void initialise(PartBunchBase<double, 3> *bunch, const double &scaleFactor);
84 
85  virtual void finalise();
86 
87  virtual bool bends() const;
88 
89  virtual void goOnline(const double &kineticEnergy);
90 
91  virtual void goOffline();
92 
93  virtual ElementBase::ElementType getType() const;
94 
95  virtual void getDimensions(double &zBegin, double &zEnd) const;
96 
97  std::string getBeamStrippingShape();
98 
99  int checkPoint(const double &x, const double &y, const double &z);
100 
101  double checkPressure(const double &x, const double &y);
102 
103  void setPressure(double pressure) ;
104  double getPressure() const;
105 
106  void setTemperature(double temperature) ;
107  double getTemperature() const;
108 
109  void setPressureMapFN(std::string pmapfn);
110  virtual std::string getPressureMapFN() const;
111 
112  void setPScale(double ps);
113  virtual double getPScale() const;
114 
115  void setResidualGas(std::string gas);
116  virtual std::string getResidualGas() const;
117 
118  void setStop(bool stopflag);
119  virtual bool getStop() const;
120 
121 protected:
122 
123  void initR(double rmin, double dr, int nrad);
124 
125  void getPressureFromFile(const double &scaleFactor);
126 
127  inline int idx(int irad, int ktet) {return (ktet + PField.ntetS * irad);}
128 
129 private:
130 
132  std::string gas_m;
133  double pressure_m;
134  std::string pmapfn_m;
135  double pscale_m;
136  double temperature_m;
137  double stop_m;
139 
141  double minr_m;
142  double maxr_m;
143  double minz_m;
144  double maxz_m;
145 
148 
149 protected:
150  // object of Matrices including pressure field map and its derivates
152 
153  // object of parameters about the map grid
155 };
156 
157 #endif // CLASSIC_BeamStripping_HH
virtual void finalise()
virtual void goOffline()
virtual std::string getPressureMapFN() const
void initR(double rmin, double dr, int nrad)
int checkPoint(const double &x, const double &y, const double &z)
double pscale_m
stores the filename of the pressure map
double minr_m
size limits took from cyclotron
void getPressureFromFile(const double &scaleFactor)
virtual bool bends() const
Interface for a Cyclotron.
Definition: Cyclotron.h:91
double getPressure() const
virtual bool checkBeamStripping(PartBunchBase< double, 3 > *bunch, Cyclotron *cycl, const int turnnumber, const double t, const double tstep)
virtual void goOnline(const double &kineticEnergy)
ParticleMatterInteractionHandler * parmatint_m
std::string gas_m
parameters for BeamStripping
virtual ~BeamStripping()
PPositions PP
std::string filename
Definition: BeamStripping.h:28
virtual void accept(BeamlineVisitor &) const
Apply visitor to BeamStripping.
int idx(int irad, int ktet)
std::string pmapfn_m
mbar
void setPScale(double ps)
void setStop(bool stopflag)
virtual bool getStop() const
void setTemperature(double temperature)
void setPressureMapFN(std::string pmapfn)
double maxr_m
mm
double getTemperature() const
double minz_m
mm
std::string getBeamStrippingShape()
double checkPressure(const double &x, const double &y)
double rmin
Definition: BeamStripping.h:45
double Pfact
Definition: BeamStripping.h:51
double delr
Definition: BeamStripping.h:45
void setPressure(double pressure)
double temperature_m
a scale factor for the P-field
double dtet
Definition: BeamStripping.h:46
virtual double getPScale() const
virtual ElementBase::ElementType getType() const
Get element type std::string.
void setResidualGas(std::string gas)
double maxz_m
mm
const std::string name
virtual std::string getResidualGas() const
double stop_m
K.
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
PFieldData PField
Interface for a single beam element.
Definition: Component.h:51
std::vector< double > pfld
Definition: BeamStripping.h:30
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField)
Abstract algorithm.
double tetmin
Definition: BeamStripping.h:46
virtual void getDimensions(double &zBegin, double &zEnd) const
std::vector< double > rarr
Definition: BeamStripping.h:49