1 | <head> |
---|
2 | <title>Element Classes</title> |
---|
3 | <!-- Changed by: Chris ISELIN, 24-Jan-1997 --> |
---|
4 | <!-- Changed by: Hans Grote, 25-Sep-2002 --> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body bgcolor="#ffffff"> |
---|
8 | |
---|
9 | <h1>Element Classes</h1> |
---|
10 | |
---|
11 | The concept of element classes solves the problem of addressing |
---|
12 | instances of elements in the accelerator in a convenient manner. |
---|
13 | It will first be explained by an example. |
---|
14 | All the quadrupoles in the accelerator form a class QUADRUPOLE. |
---|
15 | Let us define three subclasses for the focussing quadrupoles, |
---|
16 | the defocussing quadrupoles, and the skewed quadrupoles: |
---|
17 | <pre> |
---|
18 | MQF: QUADRUPOLE,L=LQM,K1=KQD; ! Focussing quadrupoles |
---|
19 | MQD: QUADRUPOLE,L=LQM,K1=KQF; ! Defocussing quadrupoles |
---|
20 | MQT: QUADRUPOLE,L=LQT; ! Skewed quadrupoles |
---|
21 | </pre> |
---|
22 | These classes can be thought of as new keywords which define |
---|
23 | elements with specified default attributes. |
---|
24 | We now use theses classes to define the real quadrupoles: |
---|
25 | <pre> |
---|
26 | QD1: MQD; ! Defocussing quadrupoles |
---|
27 | QD2: MQD; |
---|
28 | QD3: MQD; |
---|
29 | ... |
---|
30 | QF1: MQF; ! Focussing quadrupoles |
---|
31 | QF2: MQF; |
---|
32 | QF3: MQF; |
---|
33 | ... |
---|
34 | QT1: MQT,K1S=KQT1; ! Skewed quadrupoles |
---|
35 | QT2: MQT,K1S=KQT2; |
---|
36 | ... |
---|
37 | </pre> |
---|
38 | These quadrupoles inherit all unspecified attributes from their class. |
---|
39 | This allows to build up a hierarchy of objects with a rather |
---|
40 | economic input structure. |
---|
41 | <p> |
---|
42 | The full power of the class concept is revealed when object classes |
---|
43 | are used to select instances of elements for various purposes. |
---|
44 | Example: |
---|
45 | <pre> |
---|
46 | select,flag=twiss,class=QUADRUPOLE; ! Select all quadrupoles for the |
---|
47 | ! Twiss TFS file |
---|
48 | </pre> |
---|
49 | <p> |
---|
50 | More formally, for each element keyword MAD maintains a |
---|
51 | class of elements with the same name. |
---|
52 | A defined element becomes itself a class which can be used |
---|
53 | to define new objects, |
---|
54 | which will become members of this class. |
---|
55 | A new object inherits all attributes from its class; |
---|
56 | but its definition may override some of those values by new ones. |
---|
57 | All class and object names can be used in range selections, |
---|
58 | providing a powerful mechanism to specify positions |
---|
59 | for matching constraints and printing. |
---|
60 | |
---|
61 | <address><a href="http://www.cern.ch/Hans.Grote/hansg_sign.html">hansg</a>, |
---|
62 | January 24, 1997 |
---|
63 | </address> |
---|
64 | |
---|
65 | </body> |
---|