-
Notifications
You must be signed in to change notification settings - Fork 1
/
error.tex
573 lines (470 loc) · 21.5 KB
/
error.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
%%\title{Error Definitions}
\chapter{Error Definitions}
\label{chap:error}
This chapter describes the commands which provide error assignment and
output of errors assigned to elements. It is possible to assign
alignment errors and field errors to single beam elements or to ranges
or classes of beam elements.
Elements, classes or ranges of elements are selected by the
\hyperref[sec:select]{\texttt{SELECT}} command.
ATTENTION: since errors can only be assigned to machine elements, it is
necessary to \hyperref[sec:flatten]{\texttt{FLATTEN}} a sequence
if it includes other sequences.
Errors can be specified with both constant or random values.
Error definitions consist of four types of statements listed below. They
may be entered after having selected a beam line by means of a
\hyperref[sec:use]{\texttt{USE}} command.
WARNING: any further \hyperref[sec:use]{\texttt{USE}} command
will destroy the assigned errors. Use the
\hyperref[sec:esave]{\texttt{ESAVE}} option to save and reload errors.
WARNING: if errors are to be applied to a thin sequence produced by \hyperref[chap:makethin]{\texttt{MAKETHIN}}, it is advisable to save the sequence on a file and then reload it, in order for \madx to reinitialize its data structures in a suitable way.
%\href{http://consult.cern.ch/xwho/people/1808}{Werner Herr} 18.6.2002
%\input{error/error_align}
%%\title{EALIGN}
% Changed by: Hans Grote, 13-Sep-2000
% Changed by: Werner Herr, 19-Jun-2002
% Changed by: Hans Grote, 19-Jun-2002
% Changed by: Werner Herr, 24-Jul-2002
% Changed by: Werner Herr, 02-Sep-2002
% Changed by: Hans Grote, 25-Sep-2002
\section{EALIGN: Alignment Errors} %EALIGN: Define Misalignments}
\label{sec:ealign}
Alignment errors are defined by the \texttt{EALIGN} command.
The misalignments refer to the
\hyperref[sec:reference]{local reference system} for a
perfectly aligned machine.
Misalignments are defined as displacements along the three coordinate
axes, and rotations about the coordinate axes.
Alignment errors can be assigned to all beam elements except drift
spaces.
The effect of misalignments is treated in a linear
approximation.
\hyperref[sec:monitor]{Beam Position Monitors} can be given readout errors as
well as readout scaling errors in both horizontal and vertical planes.
Monitor readout and scaling errors are ignored for all elements other than
\hyperref[sec:monitor]{monitors}.
Each new \texttt{EALIGN} statement replaces the misalignment errors for all
elements in its range, unless the logical \texttt{ADD} attribute of
\hyperref[sec:eoption]{\texttt{EOPTION}} has been specified.
Alignment errors are defined by the statement
\madbox{
xxxxxxxx\= \kill
SELECT, \>FLAG=ERROR, RANGE=range, CLASS=name, PATTERN=string; \\
EALIGN, \>DX=real, DY=real, DS=real, \\
\>DPHI=real, DTHETA=real, DPSI=real, \\
\>MREX=real, MREY=real, \\
\>MSCALX=real, MSCALY=real,\\
\>AREX=real, AREY=real;
}
for elements selected by the
\hyperref[sec:select]{\texttt{SELECT}} command.
\begin{figure}[ht]
\centering
\setlength{\unitlength}{1pt}
\includegraphics{figures/f-xsdisp.pdf}
\caption{Alignment errors in the $(x,s)$-plane}
\label{F-XSDISP}
\end{figure}
\begin{figure}[htb]
\centering
\setlength{\unitlength}{1pt}
\includegraphics{figures/f-xydisp.pdf}
\caption{Alignment errors in the $(x,y)$-plane}
\label{F-XYDISP}
\end{figure}
%% \begin{figure}[ht]
%% \centering
%% \setlength{\unitlength}{1pt}
%% \begin{picture}(400,140)(0,30)
%% \thinlines
%% \put(50,75){\line(1,0){96}}
%% \put(154,75){\vector(1,0){246}}
%% \put(50,75){\makebox(0,0)[r]{\shortstack{original \\beam line}}}
%% \put(390,65){\makebox(0,0)[r]{s}}
%% \put(150,75){\circle{8}}
%% \put(150,75){\circle*{2}}
%% \put(140,85){\makebox(0,0){x}}
%% \put(150,30){\line(0,1){41}}
%% \put(150,79){\vector(0,1){91}}
%% \put(140,160){\makebox(0,0){y}}
%% \put(130,55){\vector(1,1){15}}
%% \put(130,55){\makebox(0,0)[tr]{\shortstack{original entrance \\
%% of the magnet}}}
%% \thicklines
%% \put(150,55){\vector(1,0){50}}
%% \put(175,45){\makebox(0,0){DS}}
%% \put(130,75){\vector(0,1){50}}
%% \put(125,100){\makebox(0,0)[r]{DY}}
%% \thinlines
%% \put(125,125){\line(1,0){185}}
%% \put(200,50){\line(0,1){120}}
%% \put(200,125){\circle*{4}}
%% \thicklines
%% \put(168,133){\vector(4,-1){144}}
%% \put(189,81){\vector(1,4){22}}
%% \bezier{30}(300,125)(300,113)(297,101)
%% \put(299,109){\vector(-1,-4){2}}
%% \put(305,113){\makebox(0,0)[l]{DPHI}}
%% \put(278,97){\line(1,4){4}}
%% \put(198,117){\line(1,4){4}}
%% \put(202,133){\line(4,-1){80}}
%% \put(198,117){\line(4,-1){80}}
%% \put(150,67){\line(1,0){80}}
%% \put(150,83){\line(1,0){80}}
%% \put(150,67){\line(0,1){4}}
%% \put(150,79){\line(0,1){4}}
%% \put(230,67){\line(0,1){16}}
%% \end{picture}
%% \caption{Example of Misplacement in the $(y,s)$-plane (WRONG)}
%% \label{F-YSDISP}
%% \end{figure}
\begin{figure}[ht]
\centering
\setlength{\unitlength}{1pt}
\includegraphics{figures/f-ysdisp.pdf}
\caption{Alignment errors in the $(y,s)$-plane}
\label{F-YSDISP}
\end{figure}
The attributes are:
\begin{madlist}
\ttitem{DX} The misalignment in the \textit{x}-direction for the entry of
the beam element. (Default:~0~m). \\
\texttt{DX}$>$0 displaces the element in the positive \textit{x}-direction
\ttitem{DY} The misalignment in the \textit{y}-direction for the entry of
the beam element. (Default:~0~m). \\
\texttt{DY}$>$0 displaces the element in the positive \textit{y}-direction
\ttitem{DS} The misalignment in the \textit{s}-direction for the entry of
the beam element. (Default:~0~m). \\
\texttt{DS}$>$0 displaces the element in the positive \textit{s}-direction
\ttitem{DPHI} The rotation around the \textit{x}-axis. (Default:~0~rad). \\
A positive angle gives a greater \textit{y}-coordinate for the exit
than for the entry.
\ttitem{DTHETA} The rotation around the \textit{y}-axis according to the
right hand rule. (Default:~0~rad).
\ttitem{DPSI} The rotation around the \textit{s}-axis according to the
right hand rule. (Default:~0~rad).
\ttitem{MREX} The horizontal read error for a monitor. This is ignored if
the element is not a monitor. \\
If \texttt{MREX}$>$0 the reading for \textit{x} is too high (default: 0 m).
\ttitem{MREY} The vertical read error for a monitor. This is ignored if
the element is not a monitor. \\
If \texttt{MREY}$>$0, the reading for \textit{y} is too high (default: 0 m).
\ttitem{MSCALX} The relative horizontal scaling error for a monitor. This
is ignored if the element is not a monitor. \\
If \texttt{MSCALX}$>$0 the reading for \textit{x} is too high (default: 0). A
value of 0.5 implies that the actual reading is multiplied by 1.5.
\ttitem{MSCALY} The relative vertical scaling error for a monitor. This is
ignored if the element is not a monitor. \\
If \texttt{MSCALY}$>$0 the reading for \textit{y} is too high (default: 0). A
value of -0.3 implies that the actual reading is multiplied by 0.7.
\ttitem{AREX} The misalignment in the \textit{x}-direction for the entry
of an aperture limit (default: 0 m). \\
\texttt{AREX}$>$0 displaces the element in the positive \textit{x}-direction
\ttitem{AREY} The misalignment in the \textit{y}-direction for the entry
of an aperture limit (default: 0 m). \\
\texttt{AREY}$>$0 displaces the element in the positive \textit{y}-direction
\end{madlist}
\begin{figure}[htb]
\centering
\setlength{\unitlength}{1pt}
\includegraphics{figures/f-ermoni.pdf}
\caption{Readout errors in a monitor}
\label{F-ERMONI}
\end{figure}
\textbf{Examples:}
\madxmp{
SELECT, FLAG = ERROR, CLASS = MQ; \\
EALIGN, DX = 0.002, DY = 0.0004*RANF(), DPHI = 0.0002*GAUSS();
}
Assigns alignment errors to all elements of class \texttt{MQ}.
\madxmp{
SELECT, FLAG = ERROR, PATTERN = "QF.*"; \\
EALIGN, DX = 0.001*TGAUSS(2.5), DY = 0.0001*RANF();
}
Assigns alignment errors to all elements starting with \texttt{"QF"}. \texttt{
TGAUSS(2.5)} specifies a Gaussian distribution cut at 2.5 sigma.
%\href{http://consult.cern.ch/xwho/people/1808} {Last updated:} 02.9.2002 \\
%\href{http://consult.cern.ch/xwho/people/1808}{Werner Herr} 18.6.2002
%\input{error/error_field}
%%\title{Field Errors}
% Changed by: Hans Grote, 19-Jun-2002
\section{EFCOMP: Field Errors}
\label{sec:efcomp}
Field errors can be entered as relative or absolute errors. Different
multipole components can be specified with different kinds of errors
(relative or absolute). Relations between absolute and relative field
errors are listed below.
In \madeight two commands were used for that purpose: \texttt{EFIELD}
and \texttt{EFCOMP}.
Only \texttt{EFCOMP} was implemented in \madx since it provides the full
functionality
of \texttt{EFIELD} and there was no need for duplication.
All field errors are specified as the integrated value $\int K ds$
of the \hyperref[sec:sign-convention]{field components} along the magnet axis
in $m^{-i}$. There is no provision
to specify a global relative excitation error affecting all field
components in a combined function magnet. Such an error may only be
entered by defining the same relative error for all field components.
Field errors can be specified for all magnetic elements by the statement
%% \begin{verbatim}
%% SELECT, FLAG = ERROR, RANGE = range, CLASS = name, PATTERN = string;
%% EFCOMP, ORDER := integer, RADIUS := real,
%% DKN := {dkn(0), dkn(1), dkn(2),...},
%% DKS := {dks(0), dks(1), dks(2),...},
%% DKNR := {dknr(0),dknr(1),dknr(2),...},
%% DKSR := {dksr(0),dksr(1),dksr(2),...};
%% \end{verbatim}
\madbox{
xxxxxxxx\=xxxxxx\= \kill
SELECT, \>FLAG=ERROR, RANGE=range, CLASS=name, PATTERN=string; \\
EFCOMP, \>ORDER=integer, RADIUS=real, \\
xxxxxxxx\=xxxxxx\=xxxxxxxxxx\=xxxxxxxxx\= \kill
\>DKN= \>\{dkn(0), \>dkn(1), \>dkn(2),\ldots\}, \\
\>DKS= \>\{dks(0), \>dks(1), \>dks(2),\ldots\}, \\
\>DKNR=\>\{dknr(0), \>dknr(1), \>dknr(2),\ldots\}, \\
\>DKSR=\>\{dksr(0), \>dksr(1), \>dksr(2),\ldots\};
}
for elements selected by the
\hyperref[sec:select]{\texttt{SELECT}} command.
Each new \texttt{EFCOMP} statement replaces the field errors for all
elements in its range(s). Previous field errors present in the range are
discarded or incremented depending on the setting of
\texttt{ADD} logical attribute of the
\hyperref[sec:eoption]{\texttt{EOPTION}} command.
\texttt{EFCOMP} defines the field errors in terms of
relative or absolute components.
The attributes are:
\begin{madlist}
\ttitem{ORDER} If relative errors are entered for multipoles, this defines
the order of the base component to which the relative errors
refer. This reference strength $k_{ref}$ always refers to the
normal component. In order to use a skew component as the reference, the
reference radius should be specified as a negative number. (Default:~0) \\
Please note that this implies to specify $k_0$ to assign
relative field errors to a bending magnet since $k_0$ is used
for the normalization and NOT the ANGLE.
\ttitem{RADIUS} radius \textit{R} where dknr(i) or dksr(i) are specified
for 0...i...20 (default 1 m). This attribute is required if dknr(i) or
dksr(i) are specified. If \textit{R} is negative, the skew component is
used for the reference strength.
\ttitem{DKN(i)} Absolute error for the normal multipole strength with
(2i+2) poles. (Default:~0~m$^{-i}$).
\ttitem{DKS(i)} Absolute error for the skewed multipole strength with
(2i+2) poles. (Default:~0~m$^{-i}$).
\ttitem{DKNR(i)} Relative error for the normal multipole strength with
(2i+2) poles. (Default:~0). The absolute error is computed from \texttt{DKNR(i)} using the following formula
$$\Delta K_{i}=\texttt{DKNR(i)}\cdot\left(k_{ref}\right)\cdot R^{n-j}\cdot\frac{j!}{n!}$$
where $n$ is the order of the reference strength, $k_{ref}$, specified in \texttt{ORDER}, and $R$ is the \texttt{RADIUS}.
\ttitem{DKSR(i)} Relative error for the skewed multipole strength with
(2i+2) poles. (Default:~0). The absolute error is computed from \texttt{DKSR(i)} using the following formula
$$\Delta K_{i}=\texttt{DKSR(i)}\cdot\left(k_{ref}\right)\cdot |R|^{n-j}\cdot\frac{j!}{n!}$$
where $n$ is the order of the reference strength, $k_{ref}$, specified in \texttt{ORDER}, and $R$ is the \texttt{RADIUS}.
\end{madlist}
Please note that even though that any order of field errors can be specified
for all elements, only those which are defined for an element will be taken into account.
Only \texttt{K0} and \texttt{K1} are be considered for \hyperref[sec:bend]{\texttt{BEND}}
transfer map, and, in addition, \texttt{K2} and \texttt{K1S} for radiation effect. Only
\texttt{K1} and \texttt{K1S} are considered for \hyperref[sec:quadrupole]{\texttt{QUADRUPOLE}};
\texttt{K2} and \texttt{K2S} - for \hyperref[sec:sextupole]{\texttt{SEXTUPOLE}}. Only
\hyperref[sec:multipole]{\texttt{THIN MULTIPOLE}} considers the erros of all orders.
\textbf{Time memory effects:}
The relative errors can be corrected for possible time memory effects. A
correction term is computed and added to the relative error.
The correction term is parametrized as a 3rd order polynomial in the
reference strength $k_{ref}$ according to:
\[ \Delta = \sum (c_i * {\mathit k}^{i}_{ref}) i = 0...3\]
The coefficients $c_i$ for the polynomial must be supplied in the
command.
Two additional parameters and options are required:
\begin{madlist}
\ttitem{HYSTER} if it is set to 1 applies the correction term derived from the
reference strength and the coefficients.
\ttitem{HCOEFFN, HCOEFFS} normal and skew coefficients for the computation
of the correction term. The four coefficients are specified in increasing
order, starting with the 0th order. Each group of four coefficients is
valid for one order of the field errors. Trailing zeros can be omitted,
preceding zeros must be given.
\end{madlist}
\textbf{Examples:}
Example to assign relative errors to quadrupoles:
%% \begin{verbatim}
%% select, flag = error, pattern = "q.*";
%% efcomp, order = 1, radius = 0.010,
%% dknr := {0, 4e-1, 1e-1, 2e-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
%% dksr := {0, 4e-1, 1e-1, 2e-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
%% \end{verbatim}
\madxmp{
xxxxxxxx\=xxxxxxx\= \kill
SELECT, FLAG=error, PATTERN="q.*"; \\
EFCOMP, \>ORDER=1, RADIUS=0.010, \\
\>DKNR=\{\>0, 4e-1, 1e-1, 2e-3, 0, 0, 0, 0, 0, 0, \\
\> \>0, 0, 0, 0, 0, 0, 0, 0, 0, 0\}, \\
\>DKSR=\{\>0, 4e-1, 1e-1, 2e-3, 0, 0, 0, 0, 0, 0, \\
\> \>0, 0, 0, 0, 0, 0, 0, 0, 0, 0\};
}
Example to add time memory effect to relative errors:
%% \begin{verbatim}
%% select, flag = error, pattern = "^q.*";
%% efcomp, order = 1, radius = 0.020, hyster = 1,
%% hcoeffn := {0.000, 0.000, 0.000, 0.000, // coefficients multipole order 0
%% 0.001, 0.000, 0.000, 0.000, // coefficients multipole order 1
%% 0.000, 0.000, 0.002, 0.000}, // coefficients multipole order 2
%% dknr := {0, 1e-2, 2e-4, 4e-5, 1e-5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
%% dksr := {0, 1e-2, 2e-4, 4e-5, 1e-5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
%% \end{verbatim}
\madxmp{
xxxxxxxx\=xxxxxxx\= \kill
SELECT, \>FLAG=error, PATTER="\^ q.*"; [FIXME] \\
EFCOMP, \>ORDER=1, RADIUS=0.020, HYSTER=1, \\
\>DKNR=\{\>0, 1e-2, 2e-4, 4e-5, 1.e-5, 0, 0, 0, 0, 0, \\
\> \>0, 0, 0, 0, 0, 0, 0, 0, 0, 0\}, \\
\>DKSR=\{\>0, 1e-2, 2e-4, 4e-5, 1.e-5, 0, 0, 0, 0, 0, \\
\> \>0, 0, 0, 0, 0, 0, 0, 0, 0, 0\}, \\
xxxxxxxx\=xxxxxxxxx\=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\= \kill
\>HCOEFFN=\{\>0.000, 0.000, 0.000, 0.000, \>! coeff. mult. order 0 \\
\> \>0.001, 0.000, 0.000, 0.000, \>! coeff. mult. order 1 \\
\> \>0.000, 0.000, 0.002, 0.000\};\>! coeff. mult. order 2
}
See also: \hyperref[subsubsec:random]{random values}
and \hyperref[sec:defer]{deferred expressions}.
%\href{http://consult.cern.ch/xwho/people/1808}{Werner Herr} 6.12.2004
%\input{error/error_option}
%%\title{EOPTION}
% Changed by: Hans Grote, 13-Sep-2000
% Changed by: Werner Herr, 19-Jun-2002
\section{EOPTION: Set Options for Error Definition} %EOPTION: Set Error Options}
\label{sec:eoption}
The error option command specifies different seeds for random values:
\vspace{2mm}
\madbox{
EOPTION, SEED=real, ADD=logical;
}\vspace{5mm}
\begin{madlist}
\ttitem{SEED} Selects a particular sequence of random values.
A \texttt{SEED} value is an integer in the range [0...999999999] (default:
123456789). Note that the seed set with this command is shared with the \hyperref[sec:track]{\texttt{TRACK}} and \hyperref[sec:coption]{\texttt{COPTION}} commands. See
also: \hyperref[subsubsec:random]{Random Values}.
\ttitem{ADD} If this logical flag is set, an \texttt{EALIGN} or \texttt{EFCOMP}
causes the errors to be added on top of existing ones. If it is not set,
new errors overwrite any previous definitions. The default value is
TRUE if it is omitted in the \texttt{EOPTION} command. The default value is
false if no \texttt{EOPTION} command is used.
\\Please note a recent modification: the default value for the ADD
option is only applied as long as the ADD option has not been set
explicitly.
\\Once it was set with \texttt{EOPTION}, it is NOT reset to the default when
the \texttt{ADD} option is omitted in subsequent calls to \texttt{EOPTION}.
\end{madlist}
Example:
\madxmp{EOPTION, SEED = 987456321;}
The random number generator for \madx is taken from
\cite{knuth1981}.
%\input{error/error_print}
%\href{http://consult.cern.ch/xwho/people/1808}{Werner Herr} 18.6.2002
%%\title{EPRINT}
% Changed by: Hans Grote, 13-Sep-2000
\section{EPRINT: List Machine Imperfections}
\label{sec:eprint}
This command prints a table of errors assigned to elements. The range
for these elements has to be specified. Field errors are printed as
absolute errors, because all relative errors are transformed to the
corresponding absolute error at definition time. An error print is
requested by the statement
\madbox{
SELECT, FLAG=ERROR, RANGE=range, CLASS=name, PATTERN=string;\\
EPRINT;
}
and elements are now selected by the
\hyperref[sec:select]{\texttt{SELECT}} command.
A listing for ALL elements, i.e. not only the selected, can be obtained
with the command
\madbox{
EPRINT, FULL=TRUE;
}
In that case, the \texttt{SELECT} command has no effect.
% \href{http://consult.cern.ch/xwho/people/1808}{Werner Herr} 18.6.2002
%\input{error/error_save}
%%\title{ESAVE}
% Changed by: Hans Grote, 13-Sep-2000
% Changed by: Werner Herr, 19-Jun-2002
% Changed by: Hans Grote, 30-Sep-2002
% ESAVE: Save Machine Imperfections and read back from file}
\section{ESAVE: Writing errors to a file}
\label{sec:esave}
\madbox{
ESAVE, FILE=string;
}
This command saves a table of errors assigned to elements on a file,
using a format which can be read in again to obtain the same
results. This allows dumping the errors and reloading them after a new
USE command. The range for these elements has to be specified. An error
save is requested by the statement
Example:
\madxmp{
SELECT, FLAG=ERROR, RANGE=range, CLASS=name, PATTERN=string;
ESAVE, FILE=err.file;
}
and elements selected by the \hyperref[sec:select]{\texttt{SELECT}}
command are saved to the file.
To save the errors of all elements to a file, one can use:
\madxmp{
SELECT, FLAG = ERROR, FULL; \\
ESAVE, FILE = err.file;
}
\textbf{Please note: in case of field errors, the absolute errors are
saved and not relative errors. }
\section{ETABLE: Saving the errors to a table}
\label{sec:etable}
\madbox{
ESAVE, TABLE=string;
}
This command saves a table of errors assigned to elements on a table,
using a format which can be read in again to obtain the same
results. This allows storing the errors and reloading them after a new
USE command.
Example:
\madxmp{
SELECT, FLAG=myerrortable, RANGE=range, CLASS=name, PATTERN=string; \\
ETABLE, TABLE=myerrortable;
}
and elements selected by the \hyperref[sec:select]{\texttt{SELECT}}
command are stored to the table.
\section{SETERR: Reading errors from a table or file}
\label{sec:seterr}
To assign errors from a file is not a priori straightforward. It may be
required to re-assign existing errors after a \hyperref[sec:use]{\texttt{USE}}
command was executed since the \texttt{USE} command deletes all errors attached to
a sequence).
Errors stored in the form of an internal table (\textit{errtab}) can be
directly attached to the appropriate positions in the sequence with the
command:
\madbox{
SETERR, TABLE=errtab;
}
The table \textit{errtab} can be generated internally or from an
external file (\textit{errfile}) with the generic command \texttt{READTABLE}.
The command sequence:
\madxmp{
READTABLE, file=errfile, table=errtab; \\
SETERR, TABLE=errtab;
}
reads the file \textit{errfile} into the table \textit{errtab} and the
command \texttt{SETERR} attaches the errors to the elements in the active
sequence.
The file \textit{errfile} can be produced by a preceding \texttt{ESAVE} command
or any other utility. It should follow the format of a file generated
with \texttt{ESAVE} (see example program).
\textbf{Please note:}
\begin{enumerate}
\item To assign correctly the errors from the file to the elements in
the sequence, all elements must have individual names, otherwise an
identification is not possible. Elements in the file not identified
in the active sequence are ignored.
\item Errors are assigned to ALL elements found in the file and the
\texttt{FLAG=ERROR} is set. Therefore the number of elements selected
corresponding to a command like
\\ \texttt{SELECT, FLAG=ERROR,...;}
\\ can be different after the execution of \texttt{SETERR}.
\end{enumerate}
%\href{http://consult.cern.ch/xwho/people/1808}{Werner Herr} 18.6.2002
%% EOF