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.32 $
|
---|
22 | //= $Author: moralejo $
|
---|
23 | //= $Date: 2005-02-10 19:28:10 $
|
---|
24 | //=
|
---|
25 | //=//////////////////////////////////////////////////////////////////////
|
---|
26 |
|
---|
27 | #ifndef _creadparam_
|
---|
28 | #define _creadparam_
|
---|
29 |
|
---|
30 | #ifndef _this_
|
---|
31 | #define _this_ creadparam
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | //!@}
|
---|
35 |
|
---|
36 | //!@subsection Include files.
|
---|
37 |
|
---|
38 | //!@{
|
---|
39 |
|
---|
40 | #include <iostream>
|
---|
41 | #include <fstream>
|
---|
42 | #include <string>
|
---|
43 |
|
---|
44 | #include <stdlib.h>
|
---|
45 | #include <stdio.h>
|
---|
46 | #include <math.h>
|
---|
47 | #include <float.h>
|
---|
48 |
|
---|
49 | #include "jcmacros.h"
|
---|
50 | #include "jcdebug.h"
|
---|
51 |
|
---|
52 | #include "camera-v.h"
|
---|
53 |
|
---|
54 | #include "MTriggerDefine.h"
|
---|
55 | #include "MFadcDefine.h"
|
---|
56 | #include "Mdefine.h"
|
---|
57 |
|
---|
58 | //!@}
|
---|
59 |
|
---|
60 | //!@subsection Macro-definitions, and constants.
|
---|
61 |
|
---|
62 | //!@{
|
---|
63 |
|
---|
64 | // now we define the list PM_ITEM_LIST of possible items in
|
---|
65 | // the parameters file. note that they are functions of
|
---|
66 | // T(x). we will change T(x) to be the real item or the
|
---|
67 | // string of this item when needed
|
---|
68 |
|
---|
69 | #define PM_ITEM_LIST /* LIST OF ITEMS IN THE PARAMETERS FILE */ \
|
---|
70 | T(input_file), /* input file */ \
|
---|
71 | T(starfield_file), /* starfield file */ \
|
---|
72 | T(starfield_center),/* center of thestarfield FOV */ \
|
---|
73 | T(data_file), /* data file */ \
|
---|
74 | T(root_file), /* ROOT file */ \
|
---|
75 | T(ct_num), /* number of CT, which is number of reflector files */ \
|
---|
76 | T(ct_geom), /* class with the geometry of the CT camera */ \
|
---|
77 | T(qe_file), /* file with the characteristics of the CT */ \
|
---|
78 | T(elec_noise_off), /* de-activates ElecNoise for FADC and Trigger channels */\
|
---|
79 | T(fadc_pedestal), /* Pedestal value for FADC */\
|
---|
80 | T(fadc_noise), /* ElecNoise for FADC */\
|
---|
81 | T(trig_noise), /* ElecNoise for trigger */\
|
---|
82 | T(sfr_on), /* starfield rotation */ \
|
---|
83 | T(nsb_on), /* activates NSB simulation */ \
|
---|
84 | T(nsb_off), /* de-activates NSB simulation */ \
|
---|
85 | T(nsb_mean), /* mean value of NSB contribution per pixel */ \
|
---|
86 | T(nsb_directory), /* database for the NSB */ \
|
---|
87 | T(nsb_dir_outer), /* database for the NSB */ \
|
---|
88 | T(pixel_thres), /* value of q0 for trigger for a given pixel */ \
|
---|
89 | T(secure_disc), /* Ac value to rise discrimnator threshold */ \
|
---|
90 | T(seeds), /* seeds for random number generation */ \
|
---|
91 | T(data_from_stdin), /* to read data from STDIN */ \
|
---|
92 | T(skip), /* skip pathological showers */ \
|
---|
93 | T(write_all_event_headers),/* write to file .phe ALL event headers (even w.o. trigger)*/ \
|
---|
94 | T(nowrite_McEvt), /* nowrite to file .root McEvt infos */ \
|
---|
95 | T(write_McTrig), /* write to file .root McTrig infos */ \
|
---|
96 | T(write_McFadc), /* write to file .root McFadc infos */ \
|
---|
97 | T(nowrite_RawEvt), /* write to file .root RawData infos */ \
|
---|
98 | T(select_energy), /* energy range to read: only for .phe files */ \
|
---|
99 | T(trigger_scan), /* show signal in the diskriminator */ \
|
---|
100 | T(fadc_scan), /* show fadc signal */ \
|
---|
101 | T(trigger_loop), /* make loop over trigger conditions */ \
|
---|
102 | T(trigger_prop), /* values of trigger properties */ \
|
---|
103 | T(fadc_prop), /* values of fadc properties */ \
|
---|
104 | T(fadc_outer), /* values of fadc properties for outer pixels */ \
|
---|
105 | T(fadc_GHz), /* FADC sampling frequency (GHz) */ \
|
---|
106 | T(trigger_single), /* trigger conditions */ \
|
---|
107 | T(Trigger_Loop_Output_Only_Specialists), /* special steercard */ \
|
---|
108 | T(high_to_low), /* High to Low gain ratio */ \
|
---|
109 | T(sigma_xy_cm_spot), /* Additional gaussian spread of mirror spot on camera */ \
|
---|
110 | T(sigma_x_cm_spot), /* Additional gaussian spread of mirror in x axis spot on camera */ \
|
---|
111 | T(sigma_y_cm_spot), /* Additional gaussian spread of mirror in y axis spot on camera */ \
|
---|
112 | T(misspoint_deg), /* Additional misspointing of Telescope direction*/ \
|
---|
113 | T(trigger_delay), /* Delay in ns between beginning of FADC
|
---|
114 | time window and the trigger instant.*/ \
|
---|
115 | T(telescope_location_cm), /* Telescope coordinates in Corsika system */ \
|
---|
116 | T(mirror_fraction), /* Fraction of dish mirror really operative */ \
|
---|
117 | T(calibration_run), /* option to produce a calibration file */ \
|
---|
118 | T(gain_fluctuations_off), /* Switches off PMT gain fluctuations for signal */ \
|
---|
119 | T(noise_gain_fluctuations_off), /* Switches off PMT gain fluctuations for NSB noise */ \
|
---|
120 | T(pmt_jitter_ns), /* Sets the time jitter of each phe in the PMT */ \
|
---|
121 | T(end_file) /* end of the parameters file */
|
---|
122 |
|
---|
123 | #define T(x) x // define T() as the name as it is
|
---|
124 |
|
---|
125 | enum ITEM_TYPE {
|
---|
126 | PM_ITEM_LIST
|
---|
127 | };
|
---|
128 |
|
---|
129 | #undef T
|
---|
130 |
|
---|
131 | #define T(x) #x // define T() as the string of x
|
---|
132 |
|
---|
133 | const char *const ITEM_NAMES[] = {
|
---|
134 | PM_ITEM_LIST
|
---|
135 | };
|
---|
136 |
|
---|
137 | #undef T
|
---|
138 |
|
---|
139 | #define LINE_MAX_LENGTH 400
|
---|
140 | #define ITEM_MAX_LENGTH 40
|
---|
141 | #define PATH_MAX_LENGTH 256
|
---|
142 |
|
---|
143 | //!@}
|
---|
144 |
|
---|
145 | //!@subsection Prototypes of functions.
|
---|
146 |
|
---|
147 | //!@{
|
---|
148 |
|
---|
149 | //++
|
---|
150 | // prototypes
|
---|
151 | //--
|
---|
152 |
|
---|
153 | void readparam(char * filename);
|
---|
154 | char *get_input_filename(int i);
|
---|
155 | char *get_starfield_filename(void);
|
---|
156 | void get_starfield_center(int *rh,int *rm,int *rs,int *dd,int *dm,int *ds);
|
---|
157 | int get_starfield_rotate(void);
|
---|
158 | char *get_data_filename(void);
|
---|
159 | char *get_root_filename(void);
|
---|
160 | char *get_loop_filename(void);
|
---|
161 | int get_ct_number(void);
|
---|
162 | int get_ct_geometry(int ict);
|
---|
163 | char *get_qe_filename(int ict=0);
|
---|
164 | char *get_nsb_directory(void);
|
---|
165 | char *get_nsb_directory_outer(void);
|
---|
166 | int add_elec_noise(float *fadcinner, float* fadcouter,
|
---|
167 | float *digi, float *trig);
|
---|
168 | int get_nsb(float *n, int *m);
|
---|
169 | long int get_seeds(int n);
|
---|
170 | void get_skip_showers( int *s );
|
---|
171 | int get_nskip_showers( void );
|
---|
172 | int get_data_from_stdin(void);
|
---|
173 | int get_write_all_event_headers(void);
|
---|
174 | int get_write_McEvt(void);
|
---|
175 | int get_write_McTrig(void);
|
---|
176 | int get_write_McFadc(void);
|
---|
177 | int get_write_RawEvt(void);
|
---|
178 | int get_select_energy(float *le, float *ue);
|
---|
179 | int get_FADC_Scan(void);
|
---|
180 | int get_Trigger_Scan(void);
|
---|
181 | void get_Trigger_properties(float *gl, float *ot, float *ra, float *rf);
|
---|
182 | void get_FADC_properties(int *shape, float *ra, float *rf,int *shapeo, float *rao, float *rfo,
|
---|
183 | float *fadc_spns, int *fadc_slices);
|
---|
184 | float get_FADC_pedestal(void);
|
---|
185 | int get_Trigger_Loop(float *lt, float *ut, float *st, int *lm, int *um, int *lg, int *ug);
|
---|
186 | void get_Trigger_Single(float **t, int *m, int *g);
|
---|
187 | void get_threshold(float *t);
|
---|
188 | void get_secure_threhold(float *ac, float *disc);
|
---|
189 | int get_indi_thres_pixel(void);
|
---|
190 | float get_High_to_Low(void);
|
---|
191 | float get_sigma_xy_cm_spot(float *x, float *y);
|
---|
192 | int get_misspointing(float *x, float *y);
|
---|
193 | float get_trig_delay(void);
|
---|
194 | float get_telescope_location_cm(int j, int icoor);
|
---|
195 | float get_mirror_fraction(int j);
|
---|
196 | float get_pmt_jitter_ns();
|
---|
197 |
|
---|
198 | int is_calibration_run();
|
---|
199 | void get_calibration_properties(float *lambda, float *sigma_lambda, float *phot_per_pix,
|
---|
200 | float *sigma_time, int *nevents, int *selected_pixel);
|
---|
201 | int apply_gain_fluctuations();
|
---|
202 | int apply_noise_gain_fluctuations();
|
---|
203 | //!@}
|
---|
204 |
|
---|
205 | //!@{
|
---|
206 |
|
---|
207 | #endif // ! _creadparam_
|
---|
208 |
|
---|
209 | //!@}
|
---|
210 |
|
---|
211 | //=------------------------------------------------------------
|
---|
212 | //!@subsection Log of this file.
|
---|
213 |
|
---|
214 | //!@{
|
---|
215 |
|
---|
216 | /*
|
---|
217 | * $Log: not supported by cvs2svn $
|
---|
218 | * Revision 1.31 2004/12/15 01:56:39 MAGIC
|
---|
219 | *
|
---|
220 | * Added input card option pmt_jitter_ns to simulate the time jitter of
|
---|
221 | * PMTs. The input parameter is the sigma of a gaussian, which by
|
---|
222 | * default is sigma=0.25 ns. This jitter is applied to each phe-
|
---|
223 | * independently. We have not applied this to the NSB noise, since the
|
---|
224 | * arrival time of NSB photons is random and nothing would change.
|
---|
225 | *
|
---|
226 | * Revision 1.30 2004/11/17 11:36:07 moralejo
|
---|
227 | * *** empty log message ***
|
---|
228 | *
|
---|
229 | * Revision 1.29 2004/10/26 13:58:59 moralejo
|
---|
230 | *
|
---|
231 | * Added option gain_fluctuations_off
|
---|
232 | *
|
---|
233 | * Revision 1.28 2004/10/13 17:05:05 moralejo
|
---|
234 | * *** empty log message ***
|
---|
235 | *
|
---|
236 | * Revision 1.27 2004/10/12 13:32:02 moralejo
|
---|
237 | * *** empty log message ***
|
---|
238 | *
|
---|
239 | * Revision 1.26 2004/09/17 14:48:21 moralejo
|
---|
240 | *
|
---|
241 | * Changes to adapt headers to c++ style.
|
---|
242 | *
|
---|
243 | * Revision 1.25 2004/09/16 15:27:08 moralejo
|
---|
244 | * Updated in CVS after some time (see changes below)
|
---|
245 | *
|
---|
246 | *
|
---|
247 | * Revision 1.23 2004/01/30 09:55:33 blanch
|
---|
248 | * New "trigger_delay" and "sigma_xy_cm_spot" commands.
|
---|
249 | *
|
---|
250 | * Revision 1.22 2003/10/26 19:51:30 blanch
|
---|
251 | * Header file for creadparam.cxx version 1.25
|
---|
252 | *
|
---|
253 | * Revision 1.21 2003/10/17 19:40:47 blanch
|
---|
254 | * *** empty log message ***
|
---|
255 | *
|
---|
256 | * Revision 1.20 2003/09/23 17:38:59 blanch
|
---|
257 | * *** empty log message ***
|
---|
258 | *
|
---|
259 | * Revision 1.19 2003/09/23 16:52:43 blanch
|
---|
260 | * Header file for creadparam.cxx 1.22
|
---|
261 | *
|
---|
262 | * Revision 1.18 2003/09/15 10:23:31 blanch
|
---|
263 | * Hedaer file for creadparam.cxx 1.21
|
---|
264 | *
|
---|
265 | * Revision 1.17 2003/07/17 18:05:13 blanch
|
---|
266 | * Header file for creadparam.cxx 1.20
|
---|
267 | *
|
---|
268 | * Revision 1.16 2003/01/14 13:37:32 blanch
|
---|
269 | * Option to set a dc value to rise the discriminator threshold has been added.
|
---|
270 | *
|
---|
271 | * Revision 1.15 2002/07/16 16:20:59 blanch
|
---|
272 | * Modifications done for the camera.cxx version, where a first implementation
|
---|
273 | * of the Star Field Rotation has been introduced.
|
---|
274 | *
|
---|
275 | * Revision 1.14 2002/03/15 15:17:57 blanch
|
---|
276 | * Header file for creadparam.cxx v 1.16
|
---|
277 | *
|
---|
278 | * Revision 1.13 2002/03/04 17:20:50 blanch
|
---|
279 | * Header file for creadparam.cxx 1.15
|
---|
280 | *
|
---|
281 | * Revision 1.12 2002/02/28 15:08:01 blanch
|
---|
282 | * Header file for creadparam.cxx 1.14.
|
---|
283 | *
|
---|
284 | * Revision 1.11 2002/01/18 17:45:37 blanch
|
---|
285 | * Header file for creadparam.cxx 1.13.
|
---|
286 | *
|
---|
287 | * Revision 1.10 2001/11/13 17:06:01 blanch
|
---|
288 | * Header file for creadparam.cxx version 1.12
|
---|
289 | *
|
---|
290 | * Revision 1.9 2001/07/19 09:29:02 blanch
|
---|
291 | * Header file for creadparam.cxx vrsion 1.10
|
---|
292 | *
|
---|
293 | * Revision 1.8 2001/03/05 10:44:44 blanch
|
---|
294 | * Header file of creadparam.cxx version 1.9
|
---|
295 | *
|
---|
296 | * Revision 1.7 2001/02/23 10:56:10 magicsol
|
---|
297 | * Header file for creadparam.cxx version 1.8
|
---|
298 | *
|
---|
299 | * Revision 1.6 2001/01/15 12:38:00 magicsol
|
---|
300 | * *** empty log message ***
|
---|
301 | *
|
---|
302 | * Revision 1.5 2000/07/04 14:13:34 MagicSol
|
---|
303 | * *** empty log message ***
|
---|
304 | *
|
---|
305 | * Revision 1.4 2000/05/11 14:23:28 blanch
|
---|
306 | * Thi version owns to the version 1.4 of creadparam.cxx.
|
---|
307 | *
|
---|
308 | * Revision 1.3 2000/03/24 18:15:46 blanch
|
---|
309 | * *** empty log message ***
|
---|
310 | *
|
---|
311 | * Revision 1.2 2000/02/18 17:50:07 petry
|
---|
312 | * This version belongs to camera.cxx 1.5.
|
---|
313 | * It version has been put in the repository in order to be
|
---|
314 | * able to share the further development with others.
|
---|
315 | *
|
---|
316 | * If you need something working, wait or take an earlier one.
|
---|
317 | * See file README
|
---|
318 | *
|
---|
319 | * Revision 1.1.1.1 1999/11/05 11:59:34 harald
|
---|
320 | * This the starting point for CVS controlled further developments of the
|
---|
321 | * camera program. The program was originally written by Jose Carlos.
|
---|
322 | * But here you can find a "rootified" version to the program. This means
|
---|
323 | * that there is no hbook stuff in it now. Also the output of the
|
---|
324 | * program changed to the MagicRawDataFormat.
|
---|
325 | *
|
---|
326 | * The "rootification" was done by Dirk Petry and Harald Kornmayer.
|
---|
327 | *
|
---|
328 | * Revision 1.2 1999/10/22 15:01:29 petry
|
---|
329 | * version sent to H.K. and N.M. on Fri Oct 22 1999
|
---|
330 | *
|
---|
331 | * Revision 1.1.1.1 1999/10/21 16:35:11 petry
|
---|
332 | * first synthesised version
|
---|
333 | *
|
---|
334 | * Revision 1.7 1999/03/15 14:59:09 gonzalez
|
---|
335 | * camera-1_1
|
---|
336 | *
|
---|
337 | * Revision 1.6 1999/03/02 09:56:13 gonzalez
|
---|
338 | * *** empty log message ***
|
---|
339 | *
|
---|
340 | * Revision 1.5 1999/01/14 17:32:43 gonzalez
|
---|
341 | * Added to camera the STDIN input option (data_from_input)
|
---|
342 | *
|
---|
343 | */
|
---|
344 |
|
---|
345 | //!@}
|
---|
346 | //=EOF
|
---|