1 | #ifndef _H_BeamLineParser_
|
---|
2 | #define _H_BeamLineParser_
|
---|
3 |
|
---|
4 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
---|
5 | * *
|
---|
6 | * --<--<-- A fast simulator --<--<-- *
|
---|
7 | * / --<--<-- of particle --<--<-- *
|
---|
8 | * ----HECTOR----< *
|
---|
9 | * \ -->-->-- transport through -->-->-- *
|
---|
10 | * -->-->-- generic beamlines -->-->-- *
|
---|
11 | * *
|
---|
12 | * JINST 2:P09005 (2007) *
|
---|
13 | * X Rouby, J de Favereau, K Piotrzkowski (CP3) *
|
---|
14 | * http://www.fynu.ucl.ac.be/hector.html *
|
---|
15 | * *
|
---|
16 | * Center for Cosmology, Particle Physics and Phenomenology *
|
---|
17 | * Universite catholique de Louvain *
|
---|
18 | * Louvain-la-Neuve, Belgium *
|
---|
19 | * *
|
---|
20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
---|
21 |
|
---|
22 | /// \file H_BeamLineParser.h
|
---|
23 | /// \brief Reader for madx tables
|
---|
24 | ///
|
---|
25 | /// Notes : Verifier que tous les SBEND sont toujours appeles MB. Et seulement comme ca !
|
---|
26 | /// Verifier qu'il n'y a pas de probleme d'inversion H/V QUADRUPOLES
|
---|
27 | /// no distinction between H and Vkickers ?
|
---|
28 | /// The identification of the element is based on the values of k1l, k2l, hkick, vkick and on their name.
|
---|
29 |
|
---|
30 | // c++ #includes
|
---|
31 | #include <iostream>
|
---|
32 | #include <string>
|
---|
33 | #include <fstream>
|
---|
34 | #include <sstream>
|
---|
35 | using namespace std;
|
---|
36 |
|
---|
37 | // local defines
|
---|
38 | #define MADX_UNKNOWN 0
|
---|
39 | #define MADX_NAME 1
|
---|
40 | #define MADX_KEYWORD 2
|
---|
41 | #define MADX_S 3
|
---|
42 | #define MADX_L 4
|
---|
43 | #define MADX_K0L 5
|
---|
44 | #define MADX_K1L 6
|
---|
45 | #define MADX_K2L 7
|
---|
46 | #define MADX_K3L 8
|
---|
47 | #define MADX_HKICK 9
|
---|
48 | #define MADX_VKICK 10
|
---|
49 | #define MADX_BETX 11
|
---|
50 | #define MADX_ALFX 12
|
---|
51 | #define MADX_MUX 13
|
---|
52 | #define MADX_DX 14
|
---|
53 | #define MADX_DPX 15
|
---|
54 | #define MADX_X 16
|
---|
55 | #define MADX_PX 17
|
---|
56 | #define MADX_BETY 18
|
---|
57 | #define MADX_ALFY 19
|
---|
58 | #define MADX_MUY 20
|
---|
59 | #define MADX_DY 21
|
---|
60 | #define MADX_DPY 22
|
---|
61 | #define MADX_Y 23
|
---|
62 | #define MADX_PY 24
|
---|
63 | #define MADX_APERTYPE 25
|
---|
64 | #define MADX_APER_1 26
|
---|
65 | #define MADX_APER_2 27
|
---|
66 | #define MADX_APER_3 28
|
---|
67 | #define MADX_APER_4 29
|
---|
68 | #define MADX_KICK 30
|
---|
69 | #define MADX_PARENT 31
|
---|
70 | /* Apertures # parameters
|
---|
71 | CIRCLE 1
|
---|
72 | ELLIPSE 2
|
---|
73 | RECTANGLE 2
|
---|
74 | LHCSCREEN 3
|
---|
75 | MARGUERITE 3
|
---|
76 | RECTELLIPSE 4
|
---|
77 | RACETRACK 3
|
---|
78 | */
|
---|
79 |
|
---|
80 | extern int column_identification(const string& );
|
---|
81 |
|
---|
82 | /// \brief Reader for madx tables to use in H_BeamLine
|
---|
83 | ///
|
---|
84 | /// More info on http://project-mad9.web.cern.ch/project-mad9/mad/mad9/user/index.html
|
---|
85 | class H_BeamLineParser {
|
---|
86 |
|
---|
87 | public:
|
---|
88 | /// Constructor and destructor
|
---|
89 | //@{
|
---|
90 | H_BeamLineParser() {init();}
|
---|
91 | ~H_BeamLineParser() {}
|
---|
92 | //@}
|
---|
93 | void init();
|
---|
94 | /// Retrieve the data from the line it reads, and sets the corresponding variable.
|
---|
95 | void setProperties(istream& , const unsigned int );
|
---|
96 | void printProperties() const;
|
---|
97 | string name, apertype, keyword, parent;
|
---|
98 | /// Optical element longitudinal (co-moving) coordinate.
|
---|
99 | double s;
|
---|
100 | /// Length of the element.
|
---|
101 | double l;
|
---|
102 | /// Magnetic field strength.
|
---|
103 | //@{
|
---|
104 | double k0l, k1l, k2l, k3l, hkick, vkick;
|
---|
105 | //@}
|
---|
106 | /// Phase (mu), \f$ \alpha \f$(alf) and \f$ \beta \f$(bet) functions, given by MAD.
|
---|
107 | //@{
|
---|
108 | double mux, muy, betx, alfx, bety, alfy;
|
---|
109 | //@}
|
---|
110 | /// Positions and their dispersion
|
---|
111 | //@{
|
---|
112 | double x, y, dx, dy;
|
---|
113 | //@}
|
---|
114 | /// Momentum and their dispersion
|
---|
115 | //@{
|
---|
116 | double px, py, dpx, dpy;
|
---|
117 | //@}
|
---|
118 | /// Aperture parameters
|
---|
119 | //@{
|
---|
120 | double aper_1, aper_2, aper_3, aper_4;
|
---|
121 | //@}
|
---|
122 | };
|
---|
123 |
|
---|
124 | #endif
|
---|