1 | //=//////////////////////////////////////////////////////////////////////
|
---|
2 | //=
|
---|
3 | //= creadparam
|
---|
4 | //=
|
---|
5 | //= @file creadparam.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: creadparam.h,v $
|
---|
21 | //= $Revision: 1.7 $
|
---|
22 | //= $Author: magicsol $
|
---|
23 | //= $Date: 2001-02-23 10:56:10 $
|
---|
24 | //=
|
---|
25 | //=//////////////////////////////////////////////////////////////////////
|
---|
26 |
|
---|
27 | // @T \newpage
|
---|
28 |
|
---|
29 | //!@section Source code of |creadparam.h|.
|
---|
30 |
|
---|
31 | /*!@"
|
---|
32 |
|
---|
33 | In this section you can find the source code for the file
|
---|
34 | |creadparam.h|. This file is mainly needed by
|
---|
35 | |creadparam.cxx|. Here is located the definition of the commands you
|
---|
36 | can use in the parameters file. In this file, the first line must be
|
---|
37 | |camera 'version'|, where |'version'| is the appropiate version of
|
---|
38 | the output format (NOT the version of the camera program) which can
|
---|
39 | read the commands written in that parameters file. You cannot mix
|
---|
40 | parameters files and executables with different versions. The
|
---|
41 | current version is |camera 0.2|.
|
---|
42 |
|
---|
43 | The commands now available for the parameters file are:
|
---|
44 |
|
---|
45 | @itemize
|
---|
46 |
|
---|
47 | @- |input_file| filename :
|
---|
48 | Sets the name of the input file (|.rfl|).
|
---|
49 | @- |starfield_file| filename :
|
---|
50 | Sets the name of the starfield input file (|.rfl|).
|
---|
51 | @- |ct_file| filename :
|
---|
52 | Sets the name of the CT definition file (|.def|).
|
---|
53 | @- |data_file| filename :
|
---|
54 | Sets the name of the output data file (|.dat|).
|
---|
55 | @- |nsb_on| :
|
---|
56 | Activates the NSB simulation. This is the default.
|
---|
57 | @- |nsb_off| :
|
---|
58 | De-activates the NSB simulation.
|
---|
59 | @- |nsb_mean| number :
|
---|
60 | Sets the mean value for the NSB.
|
---|
61 | Default value: 6 for CT1, 6 for MAGIC.
|
---|
62 | This implies always |nsb_on|.
|
---|
63 | @- |threshold| number :
|
---|
64 | Sets the Threshold value q0. Default value: 10.
|
---|
65 | @- |tail_cut| number :
|
---|
66 | Sets the Tail-Cut value.
|
---|
67 | Default value: 7.
|
---|
68 | @- |islands_cut| number :
|
---|
69 | Sets the Islands-Cut value i0.
|
---|
70 | Default value: 10.
|
---|
71 | @- |end_file|
|
---|
72 | Last command in the parameters file.
|
---|
73 |
|
---|
74 | @enditemize
|
---|
75 |
|
---|
76 | @ignoreHTML
|
---|
77 | A parameters file (a small one) looks like this:
|
---|
78 |
|
---|
79 | |camera 0.2|
|
---|
80 |
|
---|
81 | |input_file gm100-500.rfl|
|
---|
82 |
|
---|
83 | |output_file gm100-500.phe|
|
---|
84 |
|
---|
85 | |output_file gm100-500.dat|
|
---|
86 |
|
---|
87 | |ct_file magic.def|
|
---|
88 |
|
---|
89 | |threshold 10.0|
|
---|
90 |
|
---|
91 | |tail_cut 7.0|
|
---|
92 |
|
---|
93 | |nsb_mean 5.0|
|
---|
94 |
|
---|
95 | |end_file|
|
---|
96 | @endignoreHTML
|
---|
97 |
|
---|
98 | @"*/
|
---|
99 |
|
---|
100 | //!@{
|
---|
101 |
|
---|
102 | #ifndef _creadparam_
|
---|
103 | #define _creadparam_
|
---|
104 |
|
---|
105 | #ifndef _this_
|
---|
106 | #define _this_ creadparam
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | //!@}
|
---|
110 |
|
---|
111 | //!@subsection Include files.
|
---|
112 |
|
---|
113 | //!@{
|
---|
114 |
|
---|
115 | #include <iostream.h>
|
---|
116 | #include <fstream.h>
|
---|
117 | #include <stdlib.h>
|
---|
118 | #include <stdio.h>
|
---|
119 | #include <string.h>
|
---|
120 | #include <math.h>
|
---|
121 | #include <float.h>
|
---|
122 |
|
---|
123 | #include "jcmacros.h"
|
---|
124 | #include "jcdebug.h"
|
---|
125 |
|
---|
126 | #include "camera-v.h"
|
---|
127 |
|
---|
128 | //!@}
|
---|
129 |
|
---|
130 | //!@subsection Macro-definitions, and constants.
|
---|
131 |
|
---|
132 | //!@{
|
---|
133 |
|
---|
134 | // now we define the list ITEM_LIST of possible items in
|
---|
135 | // the parameters file. note that they are functions of
|
---|
136 | // T(x). we will change T(x) to be the real item or the
|
---|
137 | // string of this item when needed
|
---|
138 |
|
---|
139 | #define ITEM_LIST /* LIST OF ITEMS IN THE PARAMETERS FILE */ \
|
---|
140 | T(input_file), /* input file */ \
|
---|
141 | T(starfield_file), /* starfield file */ \
|
---|
142 | T(data_file), /* data file */ \
|
---|
143 | T(root_file), /* ROOT file */ \
|
---|
144 | T(ct_file), /* file with the characteristics of the CT */ \
|
---|
145 | T(ana_pixels), /* size of the camera for parameters calculation */ \
|
---|
146 | T(nsb_on), /* activates NSB simulation */ \
|
---|
147 | T(nsb_off), /* de-activates NSB simulation */ \
|
---|
148 | T(nsb_mean), /* mean value of NSB contribution per pixel */ \
|
---|
149 | T(nsb_directory), /* database for the NSB */ \
|
---|
150 | T(threshold), /* value of q0 for trigger */ \
|
---|
151 | T(tail_cut), /* value of tail cut (t0) */ \
|
---|
152 | T(islands_on), /* DO count islands */ \
|
---|
153 | T(islands_off), /* do NOT count islands */ \
|
---|
154 | T(islands_cut), /* value of islands cut (i0) */ \
|
---|
155 | T(seeds), /* seeds for random number generation */ \
|
---|
156 | T(data_from_stdin), /* to read data from STDIN */ \
|
---|
157 | T(skip), /* skip pathological showers */ \
|
---|
158 | T(read_phe_all), /* id., but was processed with write_all_images */ \
|
---|
159 | T(read_phe), /* read an already camera processed file */ \
|
---|
160 | T(write_all_images),/* write to file .phe ALL images (even w.o. trigger)*/ \
|
---|
161 | T(nowrite_McEvt), /* nowrite to file .root McEvt infos */ \
|
---|
162 | T(write_McTrig), /* write to file .root McTrig infos */ \
|
---|
163 | T(write_all_data), /* write to file .dat ALL image data */ \
|
---|
164 | T(select_energy), /* energy range to read: only for .phe files */ \
|
---|
165 | T(trigger_radius), /* trigger radius for the camera */ \
|
---|
166 | T(correction), /* factor for correction in the pixel values */ \
|
---|
167 | T(trigger_scan), /* show signal in the diskriminator */ \
|
---|
168 | T(fadc_scan), /* show fadc signal */ \
|
---|
169 | T(trigger_loop), /* make loop over trigger conditions */ \
|
---|
170 | T(trigger_prop), /* values of trigger properties */ \
|
---|
171 | T(trigger_single), /* trigger conditions */ \
|
---|
172 | T(Trigger_Loop_Output_Only_Specialists), /* special steercard */ \
|
---|
173 | T(end_file) /* end of the parameters file */
|
---|
174 |
|
---|
175 | #define T(x) x // define T() as the name as it is
|
---|
176 |
|
---|
177 | enum ITEM_TYPE {
|
---|
178 | ITEM_LIST
|
---|
179 | };
|
---|
180 |
|
---|
181 | #undef T
|
---|
182 |
|
---|
183 | #define T(x) #x // define T() as the string of x
|
---|
184 |
|
---|
185 | const char *const ITEM_NAMES[] = {
|
---|
186 | ITEM_LIST
|
---|
187 | };
|
---|
188 |
|
---|
189 | #undef T
|
---|
190 |
|
---|
191 | #define LINE_MAX_LENGTH 400
|
---|
192 | #define ITEM_MAX_LENGTH 40
|
---|
193 | #define PATH_MAX_LENGTH 120
|
---|
194 |
|
---|
195 | // mean values of NSB contribution per pixel
|
---|
196 |
|
---|
197 | static const float Mean_NSB_MAGIC = 5.0; //@< for MAGIC
|
---|
198 | static const float Mean_NSB_CT1 = 5.0; //@< for CT1
|
---|
199 |
|
---|
200 | //!@}
|
---|
201 |
|
---|
202 | //!@subsection Prototypes of functions.
|
---|
203 |
|
---|
204 | //!@{
|
---|
205 |
|
---|
206 | //++
|
---|
207 | // prototypes
|
---|
208 | //--
|
---|
209 |
|
---|
210 | void readparam(char * filename);
|
---|
211 | char *get_input_filename(void);
|
---|
212 | char *get_starfield_filename(void);
|
---|
213 | char *get_data_filename(void);
|
---|
214 | char *get_root_filename(void);
|
---|
215 | char *get_loop_filename(void);
|
---|
216 | char *get_ct_filename(void);
|
---|
217 | char *get_nsb_directory(void);
|
---|
218 | int get_nsb(float *n);
|
---|
219 | float get_threshold(void);
|
---|
220 | float get_tail_cut(void);
|
---|
221 | int get_islands_cut(int *n);
|
---|
222 | long int get_seeds(int n);
|
---|
223 | int get_ana_pixels(void);
|
---|
224 | void get_skip_showers( int *s );
|
---|
225 | int get_nskip_showers( void );
|
---|
226 | int get_data_from_stdin(void);
|
---|
227 | int get_read_phe(void);
|
---|
228 | int get_read_phe_all(void);
|
---|
229 | int get_write_all_images(void);
|
---|
230 | //
|
---|
231 | int get_write_McEvt(void);
|
---|
232 | int get_write_McTrig(void);
|
---|
233 | int get_write_RawEvt(void);
|
---|
234 | //
|
---|
235 | int get_write_all_data(void);
|
---|
236 | int get_select_energy(float *le, float *ue);
|
---|
237 | int get_trigger_radius(float *radius);
|
---|
238 | int get_correction(float *corr);
|
---|
239 | int get_FADC_Scan(void);
|
---|
240 | int get_Trigger_Scan(void);
|
---|
241 | void get_Trigger_properties(float *gl, float *ot, float *ra, float *rf);
|
---|
242 | int get_Trigger_Loop(int *lt, int *ut, int *lm, int *um, int *lg, int *ug);
|
---|
243 | void get_Trigger_Single(float *t, int *m, int *g);
|
---|
244 | //!@}
|
---|
245 |
|
---|
246 | //!@{
|
---|
247 |
|
---|
248 | #endif // ! _creadparam_
|
---|
249 |
|
---|
250 | //!@}
|
---|
251 |
|
---|
252 | //=------------------------------------------------------------
|
---|
253 | //!@subsection Log of this file.
|
---|
254 |
|
---|
255 | //!@{
|
---|
256 |
|
---|
257 | /*
|
---|
258 | * $Log: not supported by cvs2svn $
|
---|
259 | * Revision 1.6 2001/01/15 12:38:00 magicsol
|
---|
260 | * *** empty log message ***
|
---|
261 | *
|
---|
262 | * Revision 1.5 2000/07/04 14:13:34 MagicSol
|
---|
263 | * *** empty log message ***
|
---|
264 | *
|
---|
265 | * Revision 1.4 2000/05/11 14:23:28 blanch
|
---|
266 | * Thi version owns to the version 1.4 of creadparam.cxx.
|
---|
267 | *
|
---|
268 | * Revision 1.3 2000/03/24 18:15:46 blanch
|
---|
269 | * *** empty log message ***
|
---|
270 | *
|
---|
271 | * Revision 1.2 2000/02/18 17:50:07 petry
|
---|
272 | * This version belongs to camera.cxx 1.5.
|
---|
273 | * It version has been put in the repository in order to be
|
---|
274 | * able to share the further development with others.
|
---|
275 | *
|
---|
276 | * If you need something working, wait or take an earlier one.
|
---|
277 | * See file README
|
---|
278 | *
|
---|
279 | * Revision 1.1.1.1 1999/11/05 11:59:34 harald
|
---|
280 | * This the starting point for CVS controlled further developments of the
|
---|
281 | * camera program. The program was originally written by Jose Carlos.
|
---|
282 | * But here you can find a "rootified" version to the program. This means
|
---|
283 | * that there is no hbook stuff in it now. Also the output of the
|
---|
284 | * program changed to the MagicRawDataFormat.
|
---|
285 | *
|
---|
286 | * The "rootification" was done by Dirk Petry and Harald Kornmayer.
|
---|
287 | *
|
---|
288 | * Revision 1.2 1999/10/22 15:01:29 petry
|
---|
289 | * version sent to H.K. and N.M. on Fri Oct 22 1999
|
---|
290 | *
|
---|
291 | * Revision 1.1.1.1 1999/10/21 16:35:11 petry
|
---|
292 | * first synthesised version
|
---|
293 | *
|
---|
294 | * Revision 1.7 1999/03/15 14:59:09 gonzalez
|
---|
295 | * camera-1_1
|
---|
296 | *
|
---|
297 | * Revision 1.6 1999/03/02 09:56:13 gonzalez
|
---|
298 | * *** empty log message ***
|
---|
299 | *
|
---|
300 | * Revision 1.5 1999/01/14 17:32:43 gonzalez
|
---|
301 | * Added to camera the STDIN input option (data_from_input)
|
---|
302 | *
|
---|
303 | */
|
---|
304 |
|
---|
305 | //!@}
|
---|
306 | //=EOF
|
---|