46 "The \"MATRIX\" statement lists the accumulated transfer matrix "
47 " for a named \"TWISS\" table.") {
49 (
"TABLE",
"Name of table to be listed");
51 (
"FILE",
"Name of file to receive output",
"MATRIX");
77 if(fileName ==
"TERM") {
80 std::ofstream os(fileName.c_str());
86 "Unable to open output stream \"" +
92 "Twiss table \"" + tableName +
"\" not found.");
104 std::streamsize old_prec = os.precision(6);
105 os.setf(std::ios::fixed, std::ios::floatfield);
109 os << std::string(118,
'-') <<
'\n';
110 os <<
"Element" << std::string(24,
' ') <<
"S Kick |"
111 << std::string(25,
' ') <<
"T r a n s f e r M a t r i x\n";
112 os << std::string(118,
'-') <<
'\n';
115 for(Twiss::TLine::const_iterator row = table->
begin();
116 row != table->
end(); ++row) {
117 if(row->getSelectionFlag()) {
119 std::string
name = row->getElement()->getName();
120 if(
int occur = row->getCounter()) {
121 std::ostringstream tos;
122 tos << name <<
'[' << occur <<
']' << std::ends;
126 if(name.length() > 16) {
128 os << std::string(name, 0, 13) <<
".. ";
131 os << name << std::string(16 - name.length(),
' ');
133 os << std::setw(16) << table->
getS(*row);
137 for(
int i = 0; i < 6; ++i) {
138 if(i != 0) os << std::string(32,
' ');
139 os << std::setw(12) << orbit[i] <<
" |";
140 for(
int j = 0; j < 6; ++j) {
141 os << std::setw(12) << matrix[i][j];
148 os << std::string(118,
'-') <<
std::endl;
152 os.setf(std::ios::fixed, std::ios::floatfield);
TLine::const_iterator end() const
Access to last row.
MatrixCmd()
Exemplar constructor.
The base class for all OPAL actions.
TLine::const_iterator begin() const
Access to first row.
The base class for all OPAL exceptions.
virtual MatrixCmd * clone(const std::string &name)
Make clone.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
static OpalData * getInstance()
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
void formatPrint(std::ostream &, const Twiss *) const
Print Twiss table in accumulated map representation.
Object * find(const std::string &name)
Find entry.
virtual void execute()
Execute the command.
void printTableTitle(std::ostream &, const char *title) const
Print standard information about the TWISS table.
FMatrix< double, 6, 6 > getMatrix(const Row &) const
Accumulated transfer map.
void format(std::ostream &, const Twiss *)
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.