16 if (
side !=
beam1 &&
side !=
beam2)
throw std::runtime_error(
"Allowed side values are beam1 or beam2.");
20 std::shared_ptr<std::ifstream> twissFile(
new std::ifstream);
31 std::ios::fmtflags cout_flags = std::cout.flags();
33 std::cout << std::left
34 << std::setw(15) <<
"NAME"
35 << std::setw(15) <<
"KEYWORD"
37 << std::setw( 8) <<
"S"
38 << std::setw( 8) <<
"L"
39 << std::setw( 8) <<
"BETX"
40 << std::setw( 8) <<
"BETY"
41 << std::setw(10) <<
"HKICK"
42 << std::setw(10) <<
"VKICK"
43 << std::setw(10) <<
"K0L"
44 << std::setw(10) <<
"K1L"
45 << std::setw(10) <<
"K2L"
46 << std::setw(10) <<
"K3L"
47 << std::setw(15) <<
"APERTYPE"
48 << std::setw( 8) <<
"APER_1"
49 << std::setw( 8) <<
"APER_2"
50 << std::setw( 8) <<
"APER_3"
51 << std::setw( 8) <<
"APER_4"
54 while (
pfile.peek() ==
'@' ||
pfile.peek() ==
'*' ||
pfile.peek() ==
'$')
pfile.ignore(1000,
'\n');
58 std::string NAME, KEYWORD, PARENT;
59 double ENDPOS, LENGTH;
61 double K0L, K1L, K2L, K3L;
62 double X, PX, BETX, ALFX, MUX, DX, DPX;
63 double Y, PY, BETY, ALFY, MUY, DY, DPY;
65 double APER_1, APER_2, APER_3, APER_4;
67 pfile >> NAME >> KEYWORD >> PARENT >> ENDPOS >> LENGTH
69 >> K0L >> K1L >> K2L >> K3L
71 >> BETX >> BETY >> ALFX >> ALFY >> MUX >> MUY
72 >> DX >> DY >> DPX >> DPY
74 >> APER_1 >> APER_2 >> APER_3 >> APER_4;
76 if (ENDPOS > endMarker)
break;
78 if (NAME.find(
"DRIFT") == 1)
continue;
80 std::cout.precision(2);
81 std::cout << std::fixed
83 << std::setw(15) << NAME
84 << std::setw(15) << KEYWORD
86 << std::setw( 8) << ENDPOS
87 << std::setw( 8) << LENGTH
88 << std::setw( 8) << BETX
89 << std::setw( 8) << BETY;
90 std::cout.precision(6);
91 std::cout << std::setw(10) << HKICK
92 << std::setw(10) << VKICK
93 << std::setw(10) << K0L
94 << std::setw(10) << K1L
95 << std::setw(10) << K2L
96 << std::setw(10) << K3L;
97 std::cout.precision(4);
98 std::cout << std::setw(15) << APERTYPE
99 << std::setw( 8) << APER_1
100 << std::setw( 8) << APER_2
101 << std::setw( 8) << APER_3
102 << std::setw( 8) << APER_4
106 std::cout.flags(cout_flags);
119 if (
beamEnergy == -1)
throw std::runtime_error(
"Could not read beamEnergy from twiss file");