1 | //=//////////////////////////////////////////////////////////////////////
|
---|
2 | //=
|
---|
3 | //= readparam
|
---|
4 | //=
|
---|
5 | //= @file readparam.h
|
---|
6 | //= @desc Header file
|
---|
7 | //= @author J C Gonzalez
|
---|
8 | //= @email gonzalez@mppmu.mpg.de
|
---|
9 | //= @date Thu May 7 16:24:22 1998
|
---|
10 | //=
|
---|
11 | //=----------------------------------------------------------------------
|
---|
12 | //=
|
---|
13 | //= Created: Thu May 7 16:24:22 1998
|
---|
14 | //= Author: Jose Carlos Gonzalez
|
---|
15 | //= Purpose: Program for reflector simulation
|
---|
16 | //= Notes: See files README for details
|
---|
17 | //=
|
---|
18 | //=----------------------------------------------------------------------
|
---|
19 | //=
|
---|
20 | //= $RCSfile: readparam.h,v $
|
---|
21 | //= $Revision: 1.2 $
|
---|
22 | //= $Author: harald $
|
---|
23 | //= $Date: 2000-01-28 09:19:54 $
|
---|
24 | //=
|
---|
25 | //=//////////////////////////////////////////////////////////////////////
|
---|
26 |
|
---|
27 | // @T \newpage
|
---|
28 |
|
---|
29 | //!@section Source code of |readparam.h|.
|
---|
30 |
|
---|
31 | /*!@"
|
---|
32 |
|
---|
33 | In this section you can find the source code for the file
|
---|
34 | |readparam.h|. This file is mainly needed by |readparam.cxx|. Here
|
---|
35 | is located the definition of the commands you can use in the
|
---|
36 | parameters file. In this file, the first line must be |reflector|
|
---|
37 | |version|, where |version| is the appropiate version program which
|
---|
38 | can read the commands written in that parameters file. You cannot
|
---|
39 | mix parameters files and executables with different versions. The
|
---|
40 | current version is |reflector 0.3|. Each line starting with a \#
|
---|
41 | will be treated as a comment.
|
---|
42 |
|
---|
43 | The commands now available for the parameters file will be explained
|
---|
44 | in the documentation.
|
---|
45 |
|
---|
46 | A parameters file looks like this:
|
---|
47 |
|
---|
48 | |reflector 0.2|
|
---|
49 |
|
---|
50 | |verbose_level 2|
|
---|
51 |
|
---|
52 | |fixed_target 0. 0.|
|
---|
53 |
|
---|
54 | |max_events 1000|
|
---|
55 |
|
---|
56 | |data_paths 1|
|
---|
57 |
|
---|
58 | |/hd80/MC/CT1/data/low-za/p/run9|
|
---|
59 |
|
---|
60 | |output_file reflector.rfl|
|
---|
61 |
|
---|
62 | |ct_file ct1.def|
|
---|
63 |
|
---|
64 | |atm_model ATM_CORSIKA|
|
---|
65 |
|
---|
66 | |end_file|
|
---|
67 |
|
---|
68 | @"*/
|
---|
69 |
|
---|
70 | //!@{
|
---|
71 | #ifndef _readparam_
|
---|
72 | #define _readparam_
|
---|
73 |
|
---|
74 | #ifndef _this_
|
---|
75 | #define _this_ readparam
|
---|
76 | #endif
|
---|
77 | //!@}
|
---|
78 |
|
---|
79 | //!@subsection Include files.
|
---|
80 |
|
---|
81 | //!@{
|
---|
82 |
|
---|
83 | #include <iostream.h>
|
---|
84 | #include <fstream.h>
|
---|
85 | #include <stdlib.h>
|
---|
86 | #include <stdio.h>
|
---|
87 | #include <string.h>
|
---|
88 | #include <math.h>
|
---|
89 | #include <float.h>
|
---|
90 | #include <unistd.h>
|
---|
91 |
|
---|
92 | #include "jcmacros.h"
|
---|
93 | #include "jcdebug.h"
|
---|
94 |
|
---|
95 | #include "reflector-v.h"
|
---|
96 |
|
---|
97 | #include "atm.h"
|
---|
98 |
|
---|
99 | //!@}
|
---|
100 |
|
---|
101 | //!@subsection Macro-definitions, and constants.
|
---|
102 |
|
---|
103 | //!@{
|
---|
104 |
|
---|
105 | // now we define the list ITEM_LIST of possible items in
|
---|
106 | // the parameters file. note that they are functions of
|
---|
107 | // T(x). we will change T(x) to be the real item or the
|
---|
108 | // string of this item when needed
|
---|
109 |
|
---|
110 | #define ITEM_LIST /* LIST OF ITEMS IN THE PARAMETERS FILE */ \
|
---|
111 | T(data_paths), /* begin of the list of source data paths */ \
|
---|
112 | T(output_file), /* output file */ \
|
---|
113 | T(ct_file), /* file with the characteristics of the CT */ \
|
---|
114 | T(atm_model), /* changes the atmospheric model to be used */ \
|
---|
115 | T(verbose_level), /* defines verbose level of the output */ \
|
---|
116 | T(fixed_target), /* defines the position towards the CT is pointing */ \
|
---|
117 | T(max_events), /* maximum number of event to read */ \
|
---|
118 | T(range_events), /* analyze from event A to B */ \
|
---|
119 | T(energy_cuts), /* lowest/highest energy allowed */ \
|
---|
120 | T(parallel_beam), /* defines a parallel beam of light */ \
|
---|
121 | T(pm_parallel_beam),/* defines a parallel beam of light, out of a pixmap */ \
|
---|
122 | T(seeds), /* seeds for random number generation */ \
|
---|
123 | T(block), /* size of the block of files, when 'blocking' */ \
|
---|
124 | T(random_pointing), /* random CT pointing from each shower (hadrons) */ \
|
---|
125 | T(repeat_random), /* number of times a random pointing is to be done */ \
|
---|
126 | T(data_from_stdin), /* read data from STDIN */ \
|
---|
127 | T(data_to_stdout), /* read data from STDIN */ \
|
---|
128 | T(end_file) /* end of the parameters file */
|
---|
129 |
|
---|
130 | #define T(x) x // define T() as the name as it is
|
---|
131 |
|
---|
132 | enum ITEM_TYPE {
|
---|
133 | ITEM_LIST
|
---|
134 | };
|
---|
135 |
|
---|
136 | #undef T
|
---|
137 |
|
---|
138 | #define T(x) #x // define T() as the string of x
|
---|
139 |
|
---|
140 | const char *const ITEM_NAMES[] = {
|
---|
141 | ITEM_LIST
|
---|
142 | };
|
---|
143 |
|
---|
144 | #undef T
|
---|
145 |
|
---|
146 | #define LINE_MAX_LENGTH 400
|
---|
147 | #define ITEM_MAX_LENGTH 40
|
---|
148 | #define PATH_MAX_LENGTH 120
|
---|
149 |
|
---|
150 | // Verbose Levels
|
---|
151 | enum VerboseLevel {
|
---|
152 | VERBOSE_QUIET,
|
---|
153 | VERBOSE_MINIMAL,
|
---|
154 | VERBOSE_NORMAL,
|
---|
155 | VERBOSE_MAXIMAL
|
---|
156 | };
|
---|
157 |
|
---|
158 | #define VERBOSE_DEFAULT VERBOSE_QUIET
|
---|
159 |
|
---|
160 | // directory for intermediate storage of data from STDIN
|
---|
161 |
|
---|
162 | #define TMP_STDIN_DIR "/hd90/gonzalez/tmp"
|
---|
163 |
|
---|
164 | //!@}
|
---|
165 |
|
---|
166 | //!@subsection Prototypes of functions.
|
---|
167 |
|
---|
168 | //!@{
|
---|
169 |
|
---|
170 | //++
|
---|
171 | // prototypes
|
---|
172 | //--
|
---|
173 |
|
---|
174 | void readparam(char * filename);
|
---|
175 | int get_num_of_paths(void);
|
---|
176 | char *get_path_name(int i);
|
---|
177 | char *get_output_filename(void);
|
---|
178 | char *get_ct_filename(void);
|
---|
179 | int get_verbose(void);
|
---|
180 | int get_fixed_target(float *theta, float *phi);
|
---|
181 | int get_max_events(void);
|
---|
182 | void get_range_events(int *a, int *b);
|
---|
183 | void get_energy_cuts(float *low, float *high);
|
---|
184 | void get_parallel_beam(float *pb_theta, float *pb_phi,
|
---|
185 | float *pb_x, float *pb_y,
|
---|
186 | float *pb_lengthx, float *pb_lengthy,
|
---|
187 | float *pb_nx, float *pb_ny, float *pb_height);
|
---|
188 | int is_parallel_beam(void);
|
---|
189 | char * get_parallel_beam_pm(float *pb_scale, float *pb_height);
|
---|
190 | int is_parallel_beam_pm(void);
|
---|
191 | long int get_seeds(int n);
|
---|
192 | int get_block(void);
|
---|
193 | int get_data_from_stdin(void);
|
---|
194 | int get_data_to_stdout(void);
|
---|
195 | int get_random_pointing(float *maxdist);
|
---|
196 | int get_repeat_random(void);
|
---|
197 |
|
---|
198 | //!@}
|
---|
199 |
|
---|
200 | //!@{
|
---|
201 |
|
---|
202 | #endif // ! _readparam_
|
---|
203 |
|
---|
204 | //!@}
|
---|
205 |
|
---|
206 | //=------------------------------------------------------------
|
---|
207 | //!@subsection Log of this file.
|
---|
208 |
|
---|
209 | //!@{
|
---|
210 |
|
---|
211 | /*
|
---|
212 | * $Log: not supported by cvs2svn $
|
---|
213 | * Revision 1.14 2000/01/27 10:47:54 gonzalez
|
---|
214 | * JAN2000-STABLE
|
---|
215 | *
|
---|
216 | * Revision 1.13 1999/10/05 11:06:37 gonzalez
|
---|
217 | * Sep. 1999
|
---|
218 | *
|
---|
219 | * Revision 1.12 1999/03/24 16:33:02 gonzalez
|
---|
220 | * REFLECTOR 1.1: Release
|
---|
221 | *
|
---|
222 | * Revision 1.11 1999/01/21 16:03:41 gonzalez
|
---|
223 | * Only small modifications
|
---|
224 | *
|
---|
225 | * Revision 1.10 1999/01/19 18:07:18 gonzalez
|
---|
226 | * Bugs in STDIN-STDOUT version corrected.
|
---|
227 | *
|
---|
228 | * Revision 1.9 1999/01/14 17:35:40 gonzalez
|
---|
229 | * Both reading from STDIN (data_from_stdin) and
|
---|
230 | * writing to STDOUT (data_to_STDOUT) working.
|
---|
231 | *
|
---|
232 | */
|
---|
233 |
|
---|
234 | //!@}
|
---|
235 | //=EOF
|
---|