OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Split.cpp
Go to the documentation of this file.
1 #include "Aperture/Split.h"
3 #include "Structure/Beam.h"
8 #include "Physics/Physics.h"
10 #include "AbsBeamline/RBend.h"
11 #include "AbsBeamline/SBend.h"
12 #include "AbsBeamline/Cyclotron.h"
13 #include "Utilities/Timer.h"
14 #include <fstream>
15 #include <sstream>
16 #include <iomanip>
17 #include <string>
18 
19 using namespace std;
20 
21 // Local structures.
22 // ------------------------------------------------------------------------
23 
24 namespace {
25 
26  //return the inverse of the "alpha,beta,gamma" transformation matrix
27 
28  FMatrix<double, 3, 3> sp_invers(double c, double c_prim, double s, double s_prim) {
30  double det = -pow(c_prim, 3) * pow(s, 3) + 3 * c * s_prim * pow(c_prim, 2)
31  * pow(s, 2) - 3 * pow(c, 2) * c_prim * s * pow(s_prim, 2) + pow(c, 3) * pow(s_prim, 3);
32 
33  M(0, 0) = (-c_prim * s * pow(s_prim, 2) + c * pow(s_prim, 3)) / det;
34  M(0, 1) = (-2 * c_prim * pow(s, 2) * s_prim + 2 * c * s * pow(s_prim, 2)) / det;
35  M(0, 2) = (-c_prim * pow(s, 3) + c * pow(s, 2) * s_prim) / det;
36  M(1, 0) = (-pow(c_prim, 2) * s * s_prim + c * c_prim * pow(s_prim, 2)) / det;
37  M(1, 1) = (-pow(c_prim, 2) * pow(s, 2) + pow(c, 2) * pow(s_prim, 2)) / det;
38  M(1, 2) = (-c * c_prim * pow(s, 2) + pow(c, 2) * s * s_prim) / det;
39  M(2, 0) = (-pow(c_prim, 3) * s + c * pow(c_prim, 2) * s_prim) / det;
40  M(2, 1) = (-2 * c * pow(c_prim, 2) * s + 2 * pow(c, 2) * c_prim * s_prim) / det;
41  M(2, 2) = (-pow(c, 2) * c_prim * s + pow(c, 3) * s_prim) / det;
42 
43  return M;
44  }
45 
46  struct ColDesc {
47 
48  // Column name.
49  const char *colName;
50 
51  // Pointer to the row method which returns the column value.
52  double(MSplit::*get)(const MSplit::A_row &, int, int) const;
53 
54  // Default field width and precision.
55  int printWidth, printPrecision;
56 
57  // Indices to be given to get().
58  int ind_1, ind_2;
59  };
60 
61 
62  // The complete column entries table.
63  const ColDesc allColumns[] = {
64 
65  // "Naive" maximum Twiss.
66  { "BETXMAX", &MSplit::getBETXMAX, 10, 6, 0, 0 },
67  { "BETYMAX", &MSplit::getBETYMAX, 10, 6, 0, 0 },
68  { 0, 0, 0, 0, 0, 0 }
69  };
70 
71 
72  // The default column entries table.
73  const ColDesc defaultColumns[] = {
74  // "Naive" maximum Twiss.
75  { "BETXMAX", &MSplit::getBETXMAX, 10, 6, 0, 0 },
76  { "BETYMAX", &MSplit::getBETYMAX, 10, 6, 0, 0 },
77  { 0, 0, 0, 0, 0, 0 }
78  };
79 
80  const ColDesc *findCol(const MSplit &table, const std::string &colName) {
81  for(const ColDesc *col = allColumns; col->colName; ++col) {
82  if(colName == col->colName) {
83  return col;
84  }
85  }
86 
87  throw OpalException("Split::findCol()",
88  "Split table \"" + table.getOpalName() +
89  "\" has no column named \"" + colName + "\".");
90  }
91 
92 
93  // Local class Column.
94  // Returns the value for a given column in the current row of a given
95  // table.
96  class Column: public Expressions::Scalar<double> {
97 
98  public:
99 
100  //: Constructor.
101  // Identify the table by its name [b]tab[/b], and the column by its
102  // name [b]col[/b] and the function [b]col[/b].
103  // The row is specified as the ``current'' row of the table.
104  Column(const MSplit &tab, const std::string &colName, const ColDesc &desc);
105 
106  Column(const Column &);
107  virtual ~Column();
108 
109  //: Make clone.
110  virtual Expressions::Scalar<double> *clone() const;
111 
112  //: Evaluate.
113  virtual double evaluate() const;
114 
115  //: Print expression.
116  virtual void print(std::ostream &os, int precedence = 99) const;
117 
118  private:
119 
120  // Not implemented.
121  Column();
122  const Column &operator=(const Column &);
123 
124  // The Table referred.
125  const MSplit &itsTable;
126 
127  // Column name.
128  std::string colName;
129 
130  // The function returning the column value.
131  double(MSplit::*get)(const MSplit::A_row &, int, int) const;
132 
133  // The indices to be transmitted to get().
134  int ind_1, ind_2;
135  };
136 
137 
138  // Implementation.
139  // ------------------------------------------------------------------------
140 
141  Column::Column(const MSplit &tab, const std::string &colName, const ColDesc &desc):
142  itsTable(tab), colName(colName),
143  get(desc.get), ind_1(desc.ind_1), ind_2(desc.ind_2)
144  {}
145 
146 
147  Column::Column(const Column &rhs):
148  Expressions::Scalar<double>(rhs),
149  itsTable(rhs.itsTable), colName(rhs.colName),
150  get(rhs.get), ind_1(rhs.ind_1), ind_2(rhs.ind_2)
151  {}
152 
153 
154  Column::~Column()
155  {}
156 
157 
158  Expressions::Scalar<double> *Column::clone() const {
159  return new Column(*this);
160  }
161 
162 
163  double Column::evaluate() const {
164  return (itsTable.*get)(itsTable.getCurrent(), ind_1, ind_2);
165  }
166 
167 
168  void Column::print(std::ostream &os, int) const {
169  os << colName;
170  }
171 
172 };
173 
175  DefaultVisitor(itsTable, false, false),
176  Table(SIZE, "SPLIT", "help"), itsTable() {
178  ("LINE", "The beam line use to filling");
180  ("BEAM", "The beam to be used", "UNNAMED_BEAM");
182  ("NSLICE", "the number of slices of the interpolation inside the optic element", 10);
184  ("STATIC", "recalculation if static equal false", true);
186  ("FILE", "Name of file to receive SPLIT output", "SPLIT.dat");
187 
189 }
190 MSplit::MSplit(const std::string &name, MSplit *parent):
191  DefaultVisitor(itsTable, false, false),
192  Table(name, parent), itsTable(name)
193 {}
194 
195 MSplit::A_row::A_row(const A_row &a): FlaggedElmPtr(a), Interpol(a.Interpol) {}
196 
197 inline double MSplit::A_row::getBeta_x(int ind) {
198  return Interpol[ind].Beta_x;
199 }
200 inline double MSplit::A_row::getBeta_y(int ind) {
201  return Interpol[ind].Beta_y;
202 }
203 inline double MSplit::A_row::getAlpha_x(int ind) {
204  return Interpol[ind].Alpha_x;
205 }
206 inline double MSplit::A_row::getAlpha_y(int ind) {
207  return Interpol[ind].Alpha_y;
208 }
209 inline double MSplit::A_row::getDisp_x(int ind) {
210  return Interpol[ind].Disp_x;
211 }
212 inline double MSplit::A_row::getDisp_x_prim(int ind) {
213  return Interpol[ind].Disp_x_prim;
214 }
215 inline double MSplit::A_row::getDisp_y(int ind) {
216  return Interpol[ind].Disp_y;
217 }
218 inline double MSplit::A_row::getDisp_y_prim(int ind) {
219  return Interpol[ind].Disp_y_prim;
220 }
221 
222 //iterator used for the displacement in the list of optic elments
224  return itsTable.begin();
225 }
226 MSplit::A_Tline::const_iterator MSplit::begin() const {
227  return itsTable.begin();
228 }
230  return itsTable.end();
231 }
232 MSplit::A_Tline::const_iterator MSplit::end() const {
233  return itsTable.end();
234 }
235 
236 double MSplit::getBETXMAX(const A_row &row, int i1, int i2) const {
237  double max;
238  double nslice = Attributes::getReal(itsAttr[NSLICE]);
239  max = row.Interpol[0].Beta_x;
240  for(int i = 1; i < nslice; ++i) {
241  if(max < row.Interpol[i].Beta_x) max = row.Interpol[i].Beta_x;
242  }
243  return max;
244 }
245 
246 double MSplit::getBETYMAX(const A_row &row, int i1, int i2) const {
247  double max;
248  double nslice = Attributes::getReal(itsAttr[NSLICE]);
249  max = row.Interpol[0].Beta_y;
250  for(int i = 1; i < nslice; ++i) {
251  if(max < row.Interpol[i].Beta_y) max = row.Interpol[i].Beta_y;
252 
253  }
254  return max;
255 }
256 
258  BMultipoleField f = m.getField();
259  double K = f.normal(2) * 0.299792458;
260 
261  const PartData &p = beam->getReference();
262 
263  data.kq = K / (p.getP() / 1e9);
264  data.k0s = 0;
265  data.l = m.getElementLength();
266  data.phi = 0;
267 
268  data.courb = 0;
269  data.type = "multi";
270 
271 
272 }
273 
274 void MSplit::visitRBend(const RBend &rb) {
275  const RBendGeometry &geom = rb.getGeometry();
276  data.l = geom.getElementLength();
277  if(data.l != 0) {
278  data.phi = geom.getBendAngle();
280  data.e2 = rb.getExitFaceRotation();
281  data.type = "rbend";
282  data.courb = 2 * sin(data.phi / 2) / data.l;
283  data.l = data.phi / data.courb;
284 
285  BMultipoleField f = rb.getField();
286  double K = f.normal(2) * 0.299792458;
287 
288  const PartData &p = beam->getReference();
289 
290 
291  data.kq = K / (p.getP() / 1e9);
292  data.k0s = f.skew(1) * 0.299792458 / (p.getP() / 1e9);
293 
294  }
295 }
296 
298  ERRORMSG("MSplit::visitCyclotron(const Cyclotron &cy) not implemented");
299 }
300 
301 void MSplit::visitSBend(const SBend &sb) {
302  const PlanarArcGeometry &geom = sb.getGeometry();
303  data.l = geom.getElementLength();
304  if(data.l != 0) {
305  data.phi = geom.getBendAngle();
307  data.e2 = sb.getExitFaceRotation();
308  data.type = "sbend";
309  data.courb = data.phi / data.l;
310 
311  BMultipoleField f = sb.getField();
312  double K = f.normal(2) * 0.299792458;
313  const PartData &p = beam->getReference();
314 
315  data.kq = K / (p.getP() / 1e9);
316  data.k0s = f.skew(1) * 0.299792458 / (p.getP() / 1e9);
317 
318  }
319 
320 }
321 
323  data.type = "drift";
324  data.l = eb.getElementLength();
325  data.courb = 0;
326  data.phi = 0;
327  data.kq = 0;
328  data.k0s = 0;
329 }
330 
331 
333  double Kx, Ky;
334 
335 
336  if(data.l != 0) {
339 
340  Kx = data.kq + pow(data.courb, 2);
341  Ky = -data.kq + pow(data.k0s, 2);
342 
343  a.Interpol[nslice-1].Beta_x = tp->getBETi(*i, 0, 0);
344  a.Interpol[nslice-1].Beta_y = tp->getBETi(*i, 1, 0);
345  a.Interpol[nslice-1].Disp_x = tp->getDisp(*i, 0, 0);
346  a.Interpol[nslice-1].Disp_y = tp->getDisp(*i, 2, 0);
347  a.Interpol[nslice-1].Alpha_x = tp->getALFi(*i, 0, 0);
348  a.Interpol[nslice-1].Alpha_y = tp->getALFi(*i, 1, 0);
349  a.Interpol[nslice-1].Disp_x_prim = tp->getDisp(*i, 1, 0);
350  a.Interpol[nslice-1].Disp_y_prim = tp->getDisp(*i, 3, 0);
351 
352  Euler_x(0) = tp->getBETi(*i, 0, 0);
353  Euler_x(1) = tp->getALFi(*i, 0, 0);
354  Euler_x(2) = (1 + pow(Euler_x(1), 2)) / Euler_x(0);
355  Euler_y(0) = tp->getBETi(*i, 1, 0);
356  Euler_y(1) = tp->getALFi(*i, 1, 0);
357  Euler_y(2) = (1 + pow(Euler_y(1), 2)) / Euler_y(0);
358 
359  Dispx(0) = tp->getDisp(*i, 0, 0);
360  Dispx(1) = tp->getDisp(*i, 1, 0);
361  Dispy(0) = tp->getDisp(*i, 2, 0);
362  Dispy(1) = tp->getDisp(*i, 3, 0);
363 
364  if(data.type.compare("rbend") == 0) {
365  //propagation of x twiss function through the exit face
366  Transf_mat(0, 0) = 1;
367  Transf_mat(0, 1) = 0;
368  Transf_mat(1, 0) = data.courb * tan(data.e2 + data.phi / 2);
369  Transf_mat(1, 1) = 1;
370  Transf_mat(0, 2) = 0;
371  Transf_mat(1, 2) = 0;
372 
373  Mx = sp_invers(Transf_mat(0, 0), Transf_mat(1, 0), Transf_mat(0, 1), Transf_mat(1, 1));
374 
375  Euler_x(0) = Mx(0, 0) * tp->getBETi(*i, 0, 0) + Mx(0, 1) * tp->getALFi(*i, 0, 0) + Mx(0, 2) *
376  (1 + pow(tp->getALFi(*i, 0, 0), 2)) / tp->getBETi(*i, 0, 0);
377  Euler_x(1) = Mx(1, 0) * tp->getBETi(*i, 0, 0) + Mx(1, 1) * tp->getALFi(*i, 0, 0) + Mx(1, 2) *
378  (1 + pow(tp->getALFi(*i, 0, 0), 2)) / tp->getBETi(*i, 0, 0);
379  Euler_x(2) = (1 + pow(Euler_x(1), 2)) / Euler_x(0);
380 
381  Dispx(0) = (Transf_mat(1, 1) * (tp->getDisp(*i, 0, 0) - Transf_mat(0, 2)) +
382  Transf_mat(0, 1) * (Transf_mat(1, 2) - tp->getDisp(*i, 1, 0))) /
383  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
384  Dispx(1) = (Transf_mat(0, 0) * (tp->getDisp(*i, 1, 0) - Transf_mat(1, 2)) +
385  Transf_mat(1, 0) * (Transf_mat(0, 2) - tp->getDisp(*i, 0, 0))) /
386  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
387 
388  //propagation of y twiss function through the exit face
389 
390  Transf_mat(3, 3) = 1;
391  Transf_mat(3, 4) = 0;
392  Transf_mat(4, 3) = -data.courb * tan(data.e2 + data.phi / 2);
393  Transf_mat(4, 4) = 1;
394  Transf_mat(3, 5) = 0;
395  Transf_mat(4, 5) = 0;
396 
397  My = sp_invers(Transf_mat(3, 3), Transf_mat(4, 3), Transf_mat(3, 4), Transf_mat(4, 4));
398 
399  Euler_y(0) = My(0, 0) * tp->getBETi(*i, 1, 0) + My(0, 1) * tp->getALFi(*i, 1, 0) + My(0, 2) *
400  (1 + pow(tp->getALFi(*i, 1, 0), 2)) / tp->getBETi(*i, 1, 0);
401  Euler_y(1) = My(1, 0) * tp->getBETi(*i, 1, 0) + My(1, 1) * tp->getALFi(*i, 1, 0) + My(1, 2) *
402  (1 + pow(tp->getALFi(*i, 1, 0), 2)) / tp->getBETi(*i, 1, 0);
403  Euler_y(2) = (1 + pow(Euler_y(1), 2)) / Euler_y(0);
404 
405  Dispy(0) = (Transf_mat(4, 4) * (tp->getDisp(*i, 2, 0) - Transf_mat(3, 5)) +
406  Transf_mat(3, 4) * (Transf_mat(4, 5) - tp->getDisp(*i, 3, 0))) /
407  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
408  Dispy(1) = (Transf_mat(3, 3) * (tp->getDisp(*i, 3, 0) - Transf_mat(4, 5)) +
409  Transf_mat(4, 3) * (Transf_mat(3, 5) - tp->getDisp(*i, 2, 0))) /
410  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
411 
412  } else if(data.type.compare("sbend") == 0) {
413  //propagetion of x twiss function through the exit face
414  Transf_mat(0, 0) = 1;
415  Transf_mat(0, 1) = 0;
416  Transf_mat(1, 0) = data.courb * tan(data.e2);
417  Transf_mat(1, 1) = 1;
418  Transf_mat(0, 2) = 0;
419  Transf_mat(1, 2) = 0;
420 
421  Mx = sp_invers(Transf_mat(0, 0), Transf_mat(1, 0), Transf_mat(0, 1), Transf_mat(1, 1));
422 
423  Euler_x(0) = Mx(0, 0) * tp->getBETi(*i, 0, 0) + Mx(0, 1) * tp->getALFi(*i, 0, 0) + Mx(0, 2) *
424  (1 + pow(tp->getALFi(*i, 0, 0), 2)) / tp->getBETi(*i, 0, 0);
425  Euler_x(1) = Mx(1, 0) * tp->getBETi(*i, 0, 0) + Mx(1, 1) * tp->getALFi(*i, 0, 0) + Mx(1, 2) *
426  (1 + pow(tp->getALFi(*i, 0, 0), 2)) / tp->getBETi(*i, 0, 0);
427  Euler_x(2) = (1 + pow(Euler_x(1), 2)) / Euler_x(0);
428 
429  Dispx(0) = (Transf_mat(1, 1) * (tp->getDisp(*i, 0, 0) - Transf_mat(0, 2)) +
430  Transf_mat(0, 1) * (Transf_mat(1, 2) - tp->getDisp(*i, 1, 0))) /
431  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
432  Dispx(1) = (Transf_mat(0, 0) * (tp->getDisp(*i, 1, 0) - Transf_mat(1, 2)) +
433  Transf_mat(1, 0) * (Transf_mat(0, 2) - tp->getDisp(*i, 0, 0))) /
434  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
435 
436  //propagetion of y twiss function through the exit face
437 
438  Transf_mat(3, 3) = 1;
439  Transf_mat(3, 4) = 0;
440  Transf_mat(4, 3) = -data.courb * tan(data.e2);
441  Transf_mat(4, 4) = 1;
442  Transf_mat(3, 5) = 0;
443  Transf_mat(4, 5) = 0;
444 
445  My = sp_invers(Transf_mat(3, 3), Transf_mat(4, 3), Transf_mat(3, 4), Transf_mat(4, 4));
446 
447  Euler_y(0) = My(0, 0) * tp->getBETi(*i, 1, 0) + My(0, 1) * tp->getALFi(*i, 1, 0) + My(0, 2) *
448  (1 + pow(tp->getALFi(*i, 1, 0), 2)) / tp->getBETi(*i, 1, 0);
449  Euler_y(1) = My(1, 0) * tp->getBETi(*i, 1, 0) + My(1, 1) * tp->getALFi(*i, 1, 0) + My(1, 2) *
450  (1 + pow(tp->getALFi(*i, 1, 0), 2)) / tp->getBETi(*i, 1, 0);
451  Euler_y(2) = (1 + pow(Euler_y(1), 2)) / Euler_y(0);
452 
453  Dispy(0) = (Transf_mat(4, 4) * (tp->getDisp(*i, 2, 0) - Transf_mat(3, 5)) +
454  Transf_mat(3, 4) * (Transf_mat(4, 5) - tp->getDisp(*i, 3, 0))) /
455  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
456  Dispy(1) = (Transf_mat(3, 3) * (tp->getDisp(*i, 3, 0) - Transf_mat(4, 5)) +
457  Transf_mat(4, 3) * (Transf_mat(3, 5) - tp->getDisp(*i, 2, 0))) /
458  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
459 
460  }
461 
462  if(abs(Kx) < 1e-6) {
463  for(int j = 1; j <= nslice - 1; ++j) {
464 
465  //expansion of the transformation matrix coefficients at third order
466  Transf_mat(0, 0) = 1 - Kx * pow(data.l * j / nslice, 2) / 2;
467  Transf_mat(0, 1) = data.l * j / nslice * (1 - Kx / 6 * pow(data.l * j / nslice, 2));
468  Transf_mat(1, 0) = -Kx * Transf_mat(0, 1);
469  Transf_mat(1, 1) = Transf_mat(0, 0);
470  Transf_mat(0, 2) = data.courb / 2 * pow(data.l * j / nslice, 2);
471  Transf_mat(1, 2) = data.courb * data.l * j / nslice * (1 - Kx / 6 * pow(data.l * j / nslice, 2));
472 
473  Mx = sp_invers(Transf_mat(0, 0), Transf_mat(1, 0), Transf_mat(0, 1), Transf_mat(1, 1));
474 
475  //Filling of the vectors containing Beta et Disp inside the element
476 
477  a.Interpol[nslice-j-1].Beta_x = Mx(0, 0) * Euler_x(0) + Mx(0, 1) * Euler_x(1) + Mx(0, 2) * Euler_x(2);
478  a.Interpol[nslice-j-1].Alpha_x = Mx(1, 0) * Euler_x(0) + Mx(1, 1) * Euler_x(1) + Mx(1, 2) * Euler_x(2);
479 
480  a.Interpol[nslice-j-1].Disp_x = (Transf_mat(1, 1) * (Dispx(0) - Transf_mat(0, 2)) +
481  Transf_mat(0, 1) * (Transf_mat(1, 2) - Dispx(1))) /
482  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
483  a.Interpol[nslice-j-1].Disp_x_prim = (Transf_mat(0, 0) * (Dispx(1) - Transf_mat(1, 2)) +
484  Transf_mat(1, 0) * (Transf_mat(0, 2) - Dispx(0))) /
485  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
486 
487  }
488  } else if(Kx > 0) {
489  for(int j = 1; j <= nslice - 1; ++j) {
490  Transf_mat(0, 0) = cos(data.l / nslice * j * sqrt(Kx));
491  Transf_mat(0, 1) = sin(data.l / nslice * j * sqrt(Kx)) / sqrt(Kx);
492  Transf_mat(1, 0) = -Kx * Transf_mat(0, 1);
493  Transf_mat(1, 1) = Transf_mat(0, 0);
494  Transf_mat(0, 2) = data.courb * (1 - cos(data.l / nslice * j * sqrt(Kx))) / Kx;
495  Transf_mat(1, 2) = data.courb * sin(data.l / nslice * j * sqrt(Kx)) / sqrt(Kx);
496 
497  Mx = sp_invers(Transf_mat(0, 0), Transf_mat(1, 0), Transf_mat(0, 1), Transf_mat(1, 1));
498  a.Interpol[nslice-j-1].Beta_x = Mx(0, 0) * Euler_x(0) + Mx(0, 1) * Euler_x(1) + Mx(0, 2) * Euler_x(2);
499  a.Interpol[nslice-j-1].Alpha_x = Mx(1, 0) * Euler_x(0) + Mx(1, 1) * Euler_x(1) + Mx(1, 2) * Euler_x(2);
500 
501  a.Interpol[nslice-j-1].Disp_x = (Transf_mat(1, 1) * (Dispx(0) - Transf_mat(0, 2)) +
502  Transf_mat(0, 1) * (Transf_mat(1, 2) - Dispx(1))) /
503  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
504  a.Interpol[nslice-j-1].Disp_x_prim = (Transf_mat(0, 0) * (Dispx(1) - Transf_mat(1, 2)) +
505  Transf_mat(1, 0) * (Transf_mat(0, 2) - Dispx(0))) /
506  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
507  }
508  }
509 
510  else { //if(Kx<0)
511  for(int j = 1; j <= nslice - 1; ++j) {
512  Transf_mat(0, 0) = cosh(data.l / nslice * j * sqrt(-Kx));
513  Transf_mat(0, 1) = sinh(data.l / nslice * j * sqrt(-Kx)) / sqrt(-Kx);
514  Transf_mat(1, 0) = -Kx * Transf_mat(0, 1);
515  Transf_mat(1, 1) = Transf_mat(0, 0);
516  Transf_mat(0, 2) = data.courb * (1 - cosh(data.l / nslice * j * sqrt(-Kx))) / -Kx;
517  Transf_mat(1, 2) = data.courb * sinh(data.l / nslice * j * sqrt(-Kx)) / sqrt(-Kx);
518 
519  Mx = sp_invers(Transf_mat(0, 0), Transf_mat(1, 0), Transf_mat(0, 1), Transf_mat(1, 1));
520  a.Interpol[nslice-j-1].Beta_x = Mx(0, 0) * Euler_x(0) + Mx(0, 1) * Euler_x(1) + Mx(0, 2) * Euler_x(2);
521  a.Interpol[nslice-j-1].Alpha_x = Mx(1, 0) * Euler_x(0) + Mx(1, 1) * Euler_x(1) + Mx(1, 2) * Euler_x(2);
522 
523  a.Interpol[nslice-j-1].Disp_x = (Transf_mat(1, 1) * (Dispx(0) - Transf_mat(0, 2)) +
524  Transf_mat(0, 1) * (Transf_mat(1, 2) - Dispx(1))) /
525  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
526  a.Interpol[nslice-j-1].Disp_x_prim = (Transf_mat(0, 0) * (Dispx(1) - Transf_mat(1, 2)) +
527  Transf_mat(1, 0) * (Transf_mat(0, 2) - Dispx(0))) /
528  (Transf_mat(1, 1) * Transf_mat(0, 0) - Transf_mat(1, 0) * Transf_mat(0, 1));
529  }
530  }
531  if(abs(Ky) < 1e-6) {
532  for(int j = 1; j <= nslice - 1; ++j) {
533  //expansion of the transformation matrix coefficients at third order
534 
535  Transf_mat(3, 3) = 1 - Ky * pow(data.l * j / nslice, 2) / 2;
536  Transf_mat(3, 4) = data.l * j / nslice * (1 - Ky / 6 * pow(data.l * j / nslice, 2));
537  Transf_mat(4, 3) = -Ky * Transf_mat(3, 4);
538  Transf_mat(4, 4) = Transf_mat(3, 3);
539  Transf_mat(3, 5) = data.k0s / 2 * pow(data.l * j / nslice, 2);
540  Transf_mat(4, 5) = data.k0s * data.l * j / nslice * (1 - Ky / 6 * pow(data.l * j / nslice, 2));
541 
542  My = sp_invers(Transf_mat(3, 3), Transf_mat(4, 3), Transf_mat(3, 4), Transf_mat(4, 4));
543  a.Interpol[nslice-j-1].Beta_y = My(0, 0) * Euler_y(0) + My(0, 1) * Euler_y(1) + My(0, 2) * Euler_y(2);
544  a.Interpol[nslice-j-1].Alpha_y = My(1, 0) * Euler_y(0) + My(1, 1) * Euler_y(1) + My(1, 2) * Euler_y(2);
545 
546  a.Interpol[nslice-j-1].Disp_y = (Transf_mat(4, 4) * (Dispy(0) - Transf_mat(3, 5)) +
547  Transf_mat(3, 4) * (Transf_mat(4, 5) - Dispy(1))) /
548  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
549  a.Interpol[nslice-j-1].Disp_y_prim = (Transf_mat(3, 3) * (Dispy(1) - Transf_mat(4, 5)) +
550  Transf_mat(4, 3) * (Transf_mat(3, 5) - Dispy(0))) /
551  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
552  }
553 
554  } else if(Ky > 0) {
555  for(int j = 1; j <= nslice - 1; ++j) {
556  Transf_mat(3, 3) = cos(data.l / nslice * j * sqrt(Ky));
557  Transf_mat(3, 4) = sin(data.l / nslice * j * sqrt(Ky)) / sqrt(Ky);
558  Transf_mat(4, 3) = -Ky * Transf_mat(3, 4);
559  Transf_mat(4, 4) = Transf_mat(3, 3);
560  Transf_mat(3, 5) = data.k0s * (1 - cos(data.l / nslice * j * sqrt(Ky))) / Ky;
561  Transf_mat(4, 5) = data.k0s * sin(data.l / nslice * j * sqrt(Ky)) / sqrt(Ky);
562 
563  My = sp_invers(Transf_mat(3, 3), Transf_mat(4, 3), Transf_mat(3, 4), Transf_mat(4, 4));
564  a.Interpol[nslice-j-1].Beta_y = My(0, 0) * Euler_y(0) + My(0, 1) * Euler_y(1) + My(0, 2) * Euler_y(2);
565  a.Interpol[nslice-j-1].Alpha_y = My(1, 0) * Euler_y(0) + My(1, 1) * Euler_y(1) + My(1, 2) * Euler_y(2);
566 
567  a.Interpol[nslice-j-1].Disp_y = (Transf_mat(4, 4) * (Dispy(0) - Transf_mat(3, 5)) +
568  Transf_mat(3, 4) * (Transf_mat(4, 5) - Dispy(1))) /
569  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
570  a.Interpol[nslice-j-1].Disp_y_prim = (Transf_mat(3, 3) * (Dispy(1) - Transf_mat(4, 5)) +
571  Transf_mat(4, 3) * (Transf_mat(3, 5) - Dispy(0))) /
572  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
573  }
574  }
575 
576  else { //if(Ky<0)
577  for(int j = 1; j <= nslice - 1; ++j) {
578  Transf_mat(3, 3) = cosh(data.l / nslice * j * sqrt(-Ky));
579  Transf_mat(3, 4) = sinh(data.l / nslice * j * sqrt(-Ky)) / sqrt(-Ky);
580  Transf_mat(4, 3) = -Ky * Transf_mat(3, 4);
581  Transf_mat(4, 4) = Transf_mat(3, 3);
582  Transf_mat(3, 5) = data.k0s * (1 - cosh(data.l / nslice * j * sqrt(-Ky))) / -Ky;
583  Transf_mat(4, 5) = data.k0s * sinh(data.l / nslice * j * sqrt(-Ky)) / sqrt(-Ky);
584 
585  My = sp_invers(Transf_mat(3, 3), Transf_mat(4, 3), Transf_mat(3, 4), Transf_mat(4, 4));
586  a.Interpol[nslice-j-1].Beta_y = My(0, 0) * Euler_y(0) + My(0, 1) * Euler_y(1) + My(0, 2) * Euler_y(2);
587  a.Interpol[nslice-j-1].Alpha_y = My(1, 0) * Euler_y(0) + My(1, 1) * Euler_y(1) + My(1, 2) * Euler_y(2);
588 
589  a.Interpol[nslice-j-1].Disp_y = (Transf_mat(4, 4) * (Dispy(0) - Transf_mat(3, 5)) +
590  Transf_mat(3, 4) * (Transf_mat(4, 5) - Dispy(1))) /
591  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
592  a.Interpol[nslice-j-1].Disp_y_prim = (Transf_mat(3, 3) * (Dispy(1) - Transf_mat(4, 5)) +
593  Transf_mat(4, 3) * (Transf_mat(3, 5) - Dispy(0))) /
594  (Transf_mat(4, 4) * Transf_mat(3, 3) - Transf_mat(4, 3) * Transf_mat(3, 4));
595  }
596  }
597 
598  } else {
599  for(int j = 0; j < nslice; ++j) {
600  a.Interpol[j].Beta_x = tp->getBETi(*i, 0, 0);
601  a.Interpol[j].Beta_y = tp->getBETi(*i, 1, 0);
602  a.Interpol[j].Disp_x = tp->getDisp(*i, 0, 0);
603  a.Interpol[j].Disp_y = tp->getDisp(*i, 2, 0);
604  a.Interpol[j].Alpha_x = tp->getALFi(*i, 0, 0);
605  a.Interpol[j].Alpha_y = tp->getALFi(*i, 1, 0);
606  a.Interpol[j].Disp_x_prim = tp->getDisp(*i, 1, 0);
607  a.Interpol[j].Disp_y_prim = tp->getDisp(*i, 3, 0);
608  }
609  }
610 }
611 
613  const std::string &beamName = Attributes::getString(itsAttr[BEAM]);
614  beam = Beam::find(beamName);
615  fill();
617 }
618 
619 void MSplit::fill() {
620  if(refill) run();
621  refill = false;
622 }
623 
624 void MSplit::run() {
625  itsTable.erase(itsTable.begin(), itsTable.end());
626 
627  int nslice = static_cast<int>(Attributes::getReal(itsAttr[NSLICE]));
629  Table *t = Table::find(itsLine);
630  tp = dynamic_cast<Twiss *>(t);
631 
632  if(tp == 0) {
633  throw OpalException("MSplit::execute()", "Unknown Twiss Table\"" + itsLine + "\".");
634  }
635  tp->fill();
636  std::string file = Attributes::getString(itsAttr[FILE]);
637  ofstream outFile(file.c_str());
638  if(!outFile) {
639  cerr << "MSplit: Cannot open output file."
640  << endl;
641  exit(-1);
642  }
643 
644  outFile.setf(std::ios::scientific, std::ios::floatfield);
645 
646  OPALTimer::Timer timer;
647  outFile << "@ NAME %s " << getOpalName() << endl;
648  outFile << "@ DATE %s " << timer.date() << endl;
649  outFile << "@ TIME %s " << timer.time() << endl;
650  outFile << "@ ORIGIN %s OPAL_9.5/7\n";
651  outFile << "@ COMMENT %s " << endl;
652 
653  outFile << "*" << setw(15) << "NAME" << setw(15) << "S"
654  << setw(15) << "L" << setw(15) << "angle" << setw(15) << "K1"
655  << setw(15) << "BETX" << setw(15) << "BETY" << setw(15)
656  << "ALFX" << setw(15) << "ALFY" << setw(15) << "DX"
657  << setw(15) << "DPX"
658  << setw(15) << "DY" << setw(15) << "DPY" << endl;
659 
660  outFile << "$" << setw(15) << "%23s" << setw(15) << "%e" << setw(15) << "%e"
661  << setw(15) << "%e" << setw(15) << "%e" << setw(15) << "%e"
662  << setw(15) << "%e" << setw(15) << "%e" << setw(15)
663  << "%e" << setw(15) << "%e" << setw(15) << "%e" << setw(15) << "%e"
664  << setw(15) << "%e" << endl;
665 
666 
667  for(i = tp->begin(); i != tp->end(); ++i) {
668  A_row row(*i, nslice);
669  i->accept(*this);
670  calcul(i, row, nslice, tp);
671  itsTable.append(row);
672  }
673 
674 }
675 
677  return *current;
678 }
679 
681  return itsTable.getElementLength();
682 }
683 
684 double MSplit::getCell(const PlaceRep &place, const std::string &colName) {
685  A_row &row = findRow(place);
686  const ColDesc *col = findCol(*this, colName);
687  return (this->*(col->get))(row, col->ind_1, col->ind_2);
688 }
689 const Beamline *MSplit::getLine() const {
690  return &itsTable;
691 }
693  CellArray columns;
694  for(const ColDesc *col = defaultColumns; col->colName; ++col) {
696  new Column(*this, col->colName, *col);
697  columns.push_back(Cell(expr, col->printWidth, col->printPrecision));
698  }
699  return columns;
700 }
701 std::vector<double> MSplit::getColumn(const RangeRep &rng, const std::string
702  &colName) {
703  const ColDesc *col = findCol(*this, colName);
704  RangeRep range(rng);
705  range.initialize();
706  std::vector<double> column;
707 
708  for(A_Tline::const_iterator row = begin(); row != end(); ++row) {
709  range.enter(*row);
710  if(range.isActive()) {
711  column.push_back((this->*(col->get))(*row, col->ind_1, col->ind_2));
712  }
713  range.leave(*row);
714  }
715 
716  return column;
717 }
718 std::vector<double> MSplit::getRow(const PlaceRep &pos, const
719  std::vector<std::string> &cols) {
720  A_row &row = findRow(pos);
721  std::vector<double> result;
722 
723  if(cols.empty()) {
724  // Standard column selection.
725  for(const ColDesc *col = defaultColumns; col->colName != 0; ++col) {
726  result.push_back((this->*col->get)(row, col->ind_1, col->ind_2));
727  }
728  } else {
729  // User column selection.
730  for(std::vector<std::string>::const_iterator iter = cols.begin();
731  iter != cols.end(); ++iter) {
732  const ColDesc *col = findCol(*this, *iter);
733  result.push_back((this->*(col->get))(row, col->ind_1, col->ind_2));
734  }
735  }
736 
737  return result;
738 }
739 bool MSplit::isDependent(const std::string &name) const {
740  // Test if name refers to USE attribute.
741  if(itsLine == name) return true;
742 
743  // Test if name occurs in table.
744  for(A_Tline::const_iterator row = begin(); row != end(); ++row) {
745  if(row->getElement()->getName() == name) return true;
746  }
747 
748  // Otherwise replacement is not required.
749  return false;
750 }
751 bool MSplit::matches(Table *rhs) const { return false; }
753  const ColDesc *col = findCol(*this, colname);
754  return new Column(*this, colname, *col);
755 }
756 Object *MSplit::clone(const std::string &name) {
757  return new MSplit(name, this);
758 }
759 
760 void MSplit::printTable(std::ostream &, const CellArray &)const {};
761 
763  PlaceRep row(place);
764  row.initialize();
765 
766  for(A_Tline::iterator i = begin(); i != end(); ++i) {
767  row.enter(*i);
768  if(row.isActive()) return *i;
769  row.leave(*i);
770  }
771 
772  std::ostringstream os;
773  os << row << std::ends;
774  throw OpalException("MSplit::findRow()", "A_row \"" + os.str() +
775  "\" not found in twiss table \"" + getOpalName() + "\".");
776 }
virtual double getExitFaceRotation() const =0
Get exit pole face rotation.
double phi
Definition: Split.h:21
std::vector< Cell > CellArray
An array of cell descriptors.
Definition: Table.h:63
Twiss::TLine::iterator i
Definition: Split.h:129
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
A scalar expression.
Definition: Expressions.h:79
virtual void fill()=0
Refill the buffer.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
bool refill
Refill flag.
Definition: Table.h:158
constexpr double e
The value of .
Definition: Physics.h:40
Interface for basic beam line object.
Definition: ElementBase.h:128
TLine::const_iterator end() const
Access to last row.
Definition: Twiss.cpp:561
double normal(int) const
Get component.
double getBETYMAX(const A_row &, int i1=0, int i2=0) const
Definition: Split.cpp:246
virtual std::vector< double > getColumn(const RangeRep &rng, const std::string &colName)
Return column [b]col[/b] of this table, limited by [b]range[/b].
Definition: Split.cpp:701
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
A templated representation for matrices.
Definition: IdealMapper.h:26
virtual Expressions::PtrToScalar< double > makeColumnExpression(const std::string &colname) const
Definition: Split.cpp:752
virtual BMultipoleField & getField() override=0
Get multipole field.
const Beam * beam
Definition: Split.h:127
T det(const AntiSymTenzor< T, 3 > &t)
Interface for a Cyclotron.
Definition: Cyclotron.h:91
TLine::const_iterator begin() const
Access to first row.
Definition: Twiss.cpp:551
double getBeta_y(int ind)
Definition: Split.cpp:200
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:123
void leave(const FlaggedElmPtr &) const
Leave an element or line.
Definition: RangeRep.cpp:81
virtual bool matches(Table *rhs) const
Check that [b]rhs[/b] is of same type as [b]this[/b].
Definition: Split.cpp:751
A simple arc in the XZ plane.
The base class for all OPAL exceptions.
Definition: OpalException.h:28
virtual void applyDefault(const ElementBase &)
Definition: Split.cpp:322
Tps< T > sin(const Tps< T > &x)
Sine.
Definition: TpsMath.h:111
std::string itsLine
Definition: Split.h:146
#define ERRORMSG(msg)
Definition: IpplInfo.h:399
virtual std::vector< double > getRow(const PlaceRep &pos, const std::vector< std::string > &cols)
Return a table row.
Definition: Split.cpp:718
A_Tline::const_iterator end() const
Definition: Split.cpp:232
virtual double getElementLength() const
Get design length.
Definition: TBeamline.h:311
void enter(const FlaggedElmPtr &) const
Enter an element or line.
Definition: RangeRep.cpp:71
Particle reference data.
Definition: PartData.h:38
Definition: RBend.h:73
virtual PlanarArcGeometry & getGeometry() override=0
Get SBend geometry.
virtual bool isDependent(const std::string &name) const
Find out if table depends on the object identified by [b]name[/b].
Definition: Split.cpp:739
Tps< T > tan(const Tps< T > &x)
Tangent.
Definition: TpsMath.h:147
virtual double getEntryFaceRotation() const =0
Get pole entry face rotation.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
bool isActive() const
Return status.
Definition: PlaceRep.cpp:98
bool dynamic
Flag dynamic table.
Definition: Table.h:153
Default algorithms.
Interface for general multipole.
Definition: Multipole.h:46
std::string date() const
Return date.
Definition: Timer.cpp:35
bool getBool(const Attribute &attr)
Return logical value.
Definition: Attributes.cpp:66
bool isActive() const
Test for active range.
Definition: RangeRep.cpp:66
Tps< T > cosh(const Tps< T > &x)
Hyperbolic cosine.
Definition: TpsMath.h:222
MSplit()
Definition: Split.cpp:174
virtual double getExitFaceRotation() const =0
Get exit pole face rotation.
double getBendAngle() const
Get angle.
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
virtual double getLength()
Return the length of the table.
Definition: Split.cpp:680
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:284
void initialize()
Initialise data for search.
Definition: RangeRep.cpp:55
virtual void printTable(std::ostream &, const CellArray &) const
Print list for the table.
Definition: Split.cpp:760
A_Tline::const_iterator begin() const
Definition: Split.cpp:226
double getAlpha_y(int ind)
Definition: Split.cpp:206
virtual Object * clone(const std::string &name)
Return a clone.
Definition: Split.cpp:756
double courb
Definition: Split.h:21
double skew(int) const
Get component.
FVector< double, 3 > Euler_y
Definition: Split.h:136
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
virtual CellArray getDefault() const
Return the default print columns.
Definition: Split.cpp:692
FVector< double, 3 > Euler_x
Definition: Split.h:135
void enter(const FlaggedElmPtr &) const
Enter an element or line.
Definition: PlaceRep.cpp:70
double k0s
Definition: Split.h:21
constexpr double c
The velocity of light in m/s.
Definition: Physics.h:52
static Beam * find(const std::string &name)
Find named BEAM.
Definition: Beam.cpp:150
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition: Object.cpp:194
double getBeta_x(int ind)
Definition: Split.cpp:197
double getDisp_x(int ind)
Definition: Split.cpp:209
FVector< double, 2 > Dispy
Definition: Split.h:140
virtual void visitRBend(const RBend &)
Apply the algorithm to a rectangular bend.
Definition: Split.cpp:274
Definition: SBend.h:68
static Table * find(const std::string &name)
Find named Table.
Definition: Table.cpp:41
double getBETi(const Row &, int i1, int=0) const
Definition: Twiss.cpp:1111
Twiss * tp
Definition: Split.h:128
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
Definition: TpsMath.h:76
std::string type
Definition: Split.h:22
void initialize()
Initialise data for search.
Definition: PlaceRep.cpp:64
Representation of a range within a beam line or sequence.
Definition: RangeRep.h:34
void leave(const FlaggedElmPtr &) const
Leave an element or line.
Definition: PlaceRep.cpp:84
virtual double getElementLength() const
Get element length.
Class Twiss.
Definition: Twiss.h:41
An abstract sequence of beam line components.
Definition: Beamline.h:37
std::vector< pt_interpol > Interpol
Definition: Split.h:60
virtual double getElementLength() const
Get element length.
double getDisp(const Row &, int i1, int=0) const
Dispersion.
Definition: Twiss.cpp:1234
double getAlpha_x(int ind)
Definition: Split.cpp:203
Definition: Split.h:16
virtual void fill()
Refill the buffer.
Definition: Split.cpp:619
Tps< T > sqrt(const Tps< T > &x)
Square root.
Definition: TpsMath.h:91
virtual void visitMultipole(const Multipole &)
Apply the algorithm to a multipole.
Definition: Split.cpp:257
virtual double getEntryFaceRotation() const =0
Get pole entry face rotation.
The geometry for a RBend element.
Definition: RBendGeometry.h:41
double getP() const
The constant reference momentum per particle.
Definition: PartData.h:117
A_row & findRow(const PlaceRep &row)
Definition: Split.cpp:762
double getBETXMAX(const A_row &, int i1=0, int i2=0) const
Definition: Split.cpp:236
The magnetic field of a multipole.
virtual void visitSBend(const SBend &)
Apply the algorithm to a sector bend.
Definition: Split.cpp:301
std::string time() const
Return time.
Definition: Timer.cpp:42
A_Tline::const_iterator current
Definition: Split.h:144
const PartData & getReference() const
Return the embedded CLASSIC PartData.
Definition: Beam.cpp:183
void calcul(Twiss::TLine::iterator i, A_row &a, int order, Twiss *tp)
Definition: Split.cpp:332
The base class for all OPAL objects.
Definition: Object.h:48
Tps< T > cos(const Tps< T > &x)
Cosine.
Definition: TpsMath.h:129
virtual void visitCyclotron(const Cyclotron &)
Apply the algorithm to an cyclotron.
Definition: Split.cpp:297
FVector< double, 2 > Dispx
Definition: Split.h:139
void execute()
Apply the algorithm to the top-level beamline.
Definition: Split.cpp:612
double getDisp_x_prim(int ind)
Definition: Split.cpp:212
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
Definition: Attributes.cpp:56
const std::string name
Descriptor for printing a table cell.
Definition: Table.h:47
virtual double getCell(const PlaceRep &place, const std::string &colName)
Return value in selected table cell.
Definition: Split.cpp:684
virtual void append(const T &)
Append a T object.
Definition: TBeamline.h:434
double e2
Definition: Split.h:21
virtual const Beamline * getLine() const
Return embedded CLASSIC beamline.
Definition: Split.cpp:689
void run()
Definition: Split.cpp:624
double getDisp_y(int ind)
Definition: Split.cpp:215
A_Tline itsTable
Definition: Split.h:125
const A_row & getCurrent() const
Definition: Split.cpp:676
virtual RBendGeometry & getGeometry() override=0
Get RBend geometry.
virtual double getBendAngle() const
Get angle.
std::string::iterator iterator
Definition: MSLang.h:16
double e1
Definition: Split.h:21
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
double getDisp_y_prim(int ind)
Definition: Split.cpp:218
The base class for all OPAL tables.
Definition: Table.h:42
#define K
Definition: integrate.cpp:118
double l
Definition: Split.h:21
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
double getALFi(const Row &, int i1, int=0) const
Definition: Twiss.cpp:1137
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:205
FMatrix< double, 6, 6 > Transf_mat
Definition: Split.h:132
Tps< T > sinh(const Tps< T > &x)
Hyperbolic sine.
Definition: TpsMath.h:204
double kq
Definition: Split.h:21
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
struct MSplit::Data data
A section of a beam line.
Definition: FlaggedElmPtr.h:36
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307