48 "The \"TWISS3\" statement lists a named \"TWISS\" table in "
49 "Mais-Ripken representation.") {
51 (
"TABLE",
"Name of table to be listed");
53 (
"FILE",
"Name of file to receive output",
"TWISS3");
69 return new Twiss3(name,
this);
79 if(fileName ==
"TERM") {
82 std::ofstream os(fileName.c_str());
88 "Unable to open output stream \"" +
94 "Twiss table \"" + tableName +
"\" not found.");
106 std::streamsize old_prec = os.precision(6);
107 os.setf(std::ios::fixed, std::ios::floatfield);
111 os << std::string(124,
'-') <<
'\n';
112 os <<
"Element" << std::string(24,
' ') <<
"S"
113 << std::string(10,
' ') <<
"XC" << std::string(9,
' ') <<
"PXC"
114 << std::string(10,
' ') <<
"YC" << std::string(9,
' ') <<
"PYC"
115 << std::string(10,
' ') <<
"TC" << std::string(9,
' ') <<
"PTC\n";
119 <<
" BETT GAMY ALFT\n";
120 os << std::string(124,
'-') <<
'\n';
125 for(Twiss::TLine::const_iterator row = table->
begin();
126 row != table->
end(); ++row) {
127 if(row->getSelectionFlag()) {
128 std::string
name = row->getElement()->getName();
129 if(
int occur = row->getCounter()) {
130 std::ostringstream tos;
131 tos << name <<
'[' << occur <<
']' << std::ends;
135 if(name.length() > 16) {
137 os << std::string(name, 0, 13) <<
".. ";
140 os << name << std::string(16 - name.length(),
' ');
142 os << setw(16) << table->
getS(*row);
145 for(
int i = 0; i < 6; ++i) {
146 os << setw(12) << orbit[i];
150 for(
int mode = 0; mode < 3; ++mode) {
151 os << setw(4) << (mode + 1) << setw(12)
152 << table->
getMUi(*row, mode);
153 for(
int plane = 0; plane < 3; ++plane) {
154 os << setw(12) << table->
getBETik(*row, plane, mode)
155 << setw(12) << table->
getGAMik(*row, plane, mode)
156 << setw(12) << table->
getALFik(*row, plane, mode);
163 os << std::string(124,
'-') <<
std::endl;
167 os.setf(std::ios::fixed, std::ios::floatfield);
void formatPrint(std::ostream &, const Twiss *) const
Print Twiss table in Mais-Ripken representation.
TLine::const_iterator end() const
Access to last row.
double getGAMik(const Row &, int i1, int i2) const
Mais-Ripken gamma functions.
The base class for all OPAL actions.
TLine::const_iterator begin() const
Access to first row.
The base class for all OPAL exceptions.
double getBETik(const Row &, int i1, int i2) const
Mais-Ripken beta functions.
virtual void execute()
Execute the command.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
static OpalData * getInstance()
double getMUi(const Row &, int i1, int=0) const
Three modes, "naive" Twiss functions.
void format(std::ostream &, const Twiss *)
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
virtual Twiss3 * clone(const std::string &name)
Make clone.
Object * find(const std::string &name)
Find entry.
void printTableTitle(std::ostream &, const char *title) const
Print standard information about the TWISS table.
Twiss3()
Exemplar constructor.
double getALFik(const Row &, int i1, int i2) const
Mais-Ripken alpha functions.
FVector< double, 6 > getOrbit() const
Return initial closed orbit.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
double getS(const Row &, int=0, int=0) const
Arc length for given row.
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.