1 | //=//////////////////////////////////////////////////////////////////////
|
---|
2 | //=
|
---|
3 | //= creadparam
|
---|
4 | //=
|
---|
5 | //= @file creadparam.cxx
|
---|
6 | //= @desc Reading of parameters 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.cxx,v $
|
---|
21 | //= $Revision: 1.1.1.1 $
|
---|
22 | //= $Author: harald $
|
---|
23 | //= $Date: 2000-02-08 15:13:44 $
|
---|
24 | //=
|
---|
25 | //=//////////////////////////////////////////////////////////////////////
|
---|
26 |
|
---|
27 | // @T \newpage
|
---|
28 |
|
---|
29 | //!@section Source code of |creadparam.cxx|.
|
---|
30 |
|
---|
31 | /*!@"
|
---|
32 |
|
---|
33 | This section describes briefly the source code for the file
|
---|
34 | |creadparam.cxx|. This file is very closely related to the file
|
---|
35 | |readparams.cxx| from the |reflector| program. Actually, this later
|
---|
36 | file was the ancestror of the file you are looking at.
|
---|
37 |
|
---|
38 | All the defines it uses are located in the file |creadparam.h|. In
|
---|
39 | the first one we can see the definitions of the commands available
|
---|
40 | for the parameters file. We describe these commands in a later
|
---|
41 | section.
|
---|
42 |
|
---|
43 | @"*/
|
---|
44 |
|
---|
45 | //!@subsection Includes and Global variables definition.
|
---|
46 |
|
---|
47 | /*!@"
|
---|
48 |
|
---|
49 | All the defines are located in the file {\tt creadparam.h}.
|
---|
50 |
|
---|
51 | @"*/
|
---|
52 |
|
---|
53 | //!@{
|
---|
54 |
|
---|
55 | #include "creadparam.h"
|
---|
56 |
|
---|
57 | //!@}
|
---|
58 |
|
---|
59 | //!@subsection Definition of global variables.
|
---|
60 |
|
---|
61 | /*!@"
|
---|
62 |
|
---|
63 | Here we define the global variables where the values from the
|
---|
64 | parameters file are stored.
|
---|
65 |
|
---|
66 | @"*/
|
---|
67 |
|
---|
68 | //!@{
|
---|
69 |
|
---|
70 | static char Input_filename[PATH_MAX_LENGTH]; //@< input filename
|
---|
71 | static char Output_filename[PATH_MAX_LENGTH]; //@< output filename
|
---|
72 | static char Data_filename[PATH_MAX_LENGTH]; //@< data filename
|
---|
73 | static char DIAG_filename[PATH_MAX_LENGTH]; //@< data filename
|
---|
74 | static char ROOT_filename[PATH_MAX_LENGTH]; //@< data filename
|
---|
75 | static char CT_filename[PATH_MAX_LENGTH]; //@< name of the CT def. file
|
---|
76 | static int simulateNSB = TRUE; //@< Will we simulate NSB?
|
---|
77 | static int anaPixels = -1; //@< number of pixels for the analysis
|
---|
78 | static float meanNSB; //@< NSB mean value (per pixel)
|
---|
79 | static float qThreshold; //@< Threshold value
|
---|
80 | static float qTailCut; //@< Tail Cut value
|
---|
81 | static int nIslandsCut; //@< Islands Cut value
|
---|
82 | static int countIslands = TRUE; //@< Will we count the islands?
|
---|
83 | static long int Seeds[2];
|
---|
84 | static int *Skip;
|
---|
85 | static int nSkip=0;
|
---|
86 | static int Data_From_STDIN = FALSE;
|
---|
87 | static int Read_Phe = FALSE;
|
---|
88 | static int Read_Phe_All = FALSE;
|
---|
89 | static int Write_All_Images = FALSE;
|
---|
90 | static int Write_McEvt = TRUE;
|
---|
91 | static int Write_McTrig = FALSE;
|
---|
92 | static int Write_RawEvt = FALSE;
|
---|
93 | static int Write_All_Data = FALSE;
|
---|
94 | static int Select_Energy = TRUE;
|
---|
95 | static float Select_Energy_le = 0.0; //@< GeV
|
---|
96 | static float Select_Energy_ue = 100000.0; //@< GeV
|
---|
97 | static float Trigger_Radius;
|
---|
98 | static int Set_Trigger_Radius=FALSE;
|
---|
99 | static float fCorrection;
|
---|
100 | static int Apply_Correction=FALSE;
|
---|
101 | //!@}
|
---|
102 |
|
---|
103 | //!@subsection The function |readparam()|.
|
---|
104 |
|
---|
105 | //!-----------------------------------------------------------
|
---|
106 | // @name creadparam
|
---|
107 | //
|
---|
108 | // @desc read parameters from the stdin / parameters file
|
---|
109 | //
|
---|
110 | // @var *filename Name of the parameters file (NULL->STDIN)
|
---|
111 | //
|
---|
112 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
113 | //------------------------------------------------------------
|
---|
114 | // @function
|
---|
115 |
|
---|
116 | //!@{
|
---|
117 | void
|
---|
118 | readparam(char * filename)
|
---|
119 | {
|
---|
120 | char sign[] = GLUE_postp( PROGRAM, VERSION ); //@< initialize sign
|
---|
121 | char line[LINE_MAX_LENGTH]; //@< line to get from the stdin
|
---|
122 | char token[ITEM_MAX_LENGTH]; //@< a single token
|
---|
123 | int i, j; //@< dummy counters
|
---|
124 | ifstream ifile;
|
---|
125 |
|
---|
126 | // use cin or ifile (reading from STDIN or from parameters file?
|
---|
127 | if ( filename != NULL )
|
---|
128 | ifile.open( filename );
|
---|
129 |
|
---|
130 | // get signature
|
---|
131 | if ( filename != NULL )
|
---|
132 | ifile.getline(line, LINE_MAX_LENGTH);
|
---|
133 | else
|
---|
134 | cin.getline(line, LINE_MAX_LENGTH);
|
---|
135 | line[strlen(SIGNATURE)] = '\0';
|
---|
136 | strcpy(line, sign);
|
---|
137 | if (strcmp(sign, SIGNATURE) != 0) {
|
---|
138 | cerr << "ERROR: Signature of parameters file is not correct\n";
|
---|
139 | cerr << '"' << sign << '"' << '\n';
|
---|
140 | cerr << "should be: " << SIGNATURE << '\n';
|
---|
141 | exit(1);
|
---|
142 | }
|
---|
143 |
|
---|
144 | // loop till the "end" directive is reached
|
---|
145 | int is_end = FALSE;
|
---|
146 | while (! is_end) {
|
---|
147 |
|
---|
148 | // get line from file or stdin
|
---|
149 | if ( filename != NULL )
|
---|
150 | ifile.getline(line, LINE_MAX_LENGTH);
|
---|
151 | else
|
---|
152 | cin.getline(line, LINE_MAX_LENGTH);
|
---|
153 |
|
---|
154 | // skip comments (start with '#')
|
---|
155 | if (line[0] == '#')
|
---|
156 | continue;
|
---|
157 |
|
---|
158 | // show user comments (start with '>')
|
---|
159 | if (line[0] == '>') {
|
---|
160 | cout << line << endl << flush;
|
---|
161 | continue;
|
---|
162 | }
|
---|
163 |
|
---|
164 | // look for each item at the beginning of the line
|
---|
165 | for (i=0; i<=end_file; i++)
|
---|
166 | if (strstr(line, ITEM_NAMES[i]) == line)
|
---|
167 | break;
|
---|
168 |
|
---|
169 | // if it is not a valid line, just ignore it
|
---|
170 | if (i == end_file+1) {
|
---|
171 | cerr << "Skipping unknown token in [" << line << "]\n";
|
---|
172 | continue;
|
---|
173 | }
|
---|
174 |
|
---|
175 | // case block for each directive
|
---|
176 | switch ( i ) {
|
---|
177 |
|
---|
178 | case input_file: //@< name of the input file
|
---|
179 |
|
---|
180 | // get the name of the input_file from the line
|
---|
181 | sscanf(line, "%s %s", token, Input_filename);
|
---|
182 |
|
---|
183 | break;
|
---|
184 |
|
---|
185 | case output_file: //@< name of the output file
|
---|
186 |
|
---|
187 | // get the name of the output_file from the line
|
---|
188 | sscanf(line, "%s %s", token, Output_filename);
|
---|
189 |
|
---|
190 | break;
|
---|
191 |
|
---|
192 | case data_file: //@< name of the data file
|
---|
193 |
|
---|
194 | // get the name of the data_file from the line
|
---|
195 | sscanf(line, "%s %s", token, Data_filename);
|
---|
196 |
|
---|
197 | break;
|
---|
198 |
|
---|
199 | case diag_file: //@< name of the DIAG file
|
---|
200 |
|
---|
201 | // get the name of the data_file from the line
|
---|
202 | sscanf(line, "%s %s", token, DIAG_filename);
|
---|
203 | cout << '[' << DIAG_filename << ']' << endl << flush;
|
---|
204 |
|
---|
205 | break;
|
---|
206 |
|
---|
207 | case root_file: //@< name of the ROOT file
|
---|
208 |
|
---|
209 | // get the name of the data_file from the line
|
---|
210 | sscanf(line, "%s %s", token, ROOT_filename);
|
---|
211 | cout << '[' << ROOT_filename << ']' << endl << flush;
|
---|
212 |
|
---|
213 | break;
|
---|
214 |
|
---|
215 | case ct_file: //@< name of the telescope file
|
---|
216 |
|
---|
217 | // get the name of the ct_file from the line
|
---|
218 | sscanf(line, "%s %s", token, CT_filename);
|
---|
219 |
|
---|
220 | break;
|
---|
221 |
|
---|
222 | case nsb_on: //@< simulate NSB?
|
---|
223 |
|
---|
224 | // we will simulate NSB
|
---|
225 | simulateNSB = TRUE;
|
---|
226 |
|
---|
227 | break;
|
---|
228 |
|
---|
229 | case nsb_off: //@< simulate NSB?
|
---|
230 |
|
---|
231 | // we will NOT simulate NSB
|
---|
232 | simulateNSB = FALSE;
|
---|
233 |
|
---|
234 | break;
|
---|
235 |
|
---|
236 | case nsb_mean: //@< value of <NSB> per pixel
|
---|
237 |
|
---|
238 | // get value of <NSB> (in photons)
|
---|
239 | sscanf(line, "%s %f", token, &meanNSB);
|
---|
240 | simulateNSB = TRUE;
|
---|
241 |
|
---|
242 | break;
|
---|
243 |
|
---|
244 | case ana_pixels: //@< number of pixels for analysis
|
---|
245 |
|
---|
246 | // number of pixels for analysis
|
---|
247 | sscanf(line, "%s %d", token, &anaPixels);
|
---|
248 |
|
---|
249 | break;
|
---|
250 |
|
---|
251 | case threshold: //@< value of threshold for trigger (q0)
|
---|
252 |
|
---|
253 | // get value of threshold (in ph.e.)
|
---|
254 | sscanf(line, "%s %f", token, &qThreshold);
|
---|
255 |
|
---|
256 | break;
|
---|
257 |
|
---|
258 | case tail_cut: //@< value of tail_cut (t0)
|
---|
259 |
|
---|
260 | // get value of tail_cut (in ph.e.)
|
---|
261 | sscanf(line, "%s %f", token, &qTailCut);
|
---|
262 |
|
---|
263 | break;
|
---|
264 |
|
---|
265 | case islands_on: //@< DO count islands
|
---|
266 |
|
---|
267 | // DO count islands
|
---|
268 | countIslands = TRUE;
|
---|
269 |
|
---|
270 | break;
|
---|
271 |
|
---|
272 | case islands_off: //@< do NOT count islands
|
---|
273 |
|
---|
274 | // do NOT count islands
|
---|
275 | countIslands = FALSE;
|
---|
276 |
|
---|
277 | break;
|
---|
278 |
|
---|
279 | case islands_cut: //@< value of islands_cut (i0)
|
---|
280 |
|
---|
281 | // get value of islands_cut (in ph.e.)
|
---|
282 | sscanf(line, "%s %d", token, &nIslandsCut);
|
---|
283 | countIslands = TRUE;
|
---|
284 |
|
---|
285 | break;
|
---|
286 |
|
---|
287 | case seeds: //@< values of seeds for random numbers
|
---|
288 |
|
---|
289 | // get seeds
|
---|
290 | sscanf(line, "%s %ld %ld", token, &Seeds[0], &Seeds[1]);
|
---|
291 |
|
---|
292 | break;
|
---|
293 |
|
---|
294 | case skip: //@< skip pathological showers
|
---|
295 |
|
---|
296 | // get showers to skip
|
---|
297 | cin >> nSkip;
|
---|
298 | Skip = new int[nSkip];
|
---|
299 | for (j=0; j<nSkip; ++j) {
|
---|
300 | cin >> Skip[j];
|
---|
301 | cout << Skip[j] << endl << flush;
|
---|
302 | }
|
---|
303 |
|
---|
304 | break;
|
---|
305 |
|
---|
306 | case data_from_stdin: //@< to read data from stdin
|
---|
307 |
|
---|
308 | // change boolean value
|
---|
309 | Data_From_STDIN = TRUE;
|
---|
310 |
|
---|
311 | break;
|
---|
312 |
|
---|
313 | case read_phe: //@< to read PHE files
|
---|
314 |
|
---|
315 | // change boolean value
|
---|
316 | Read_Phe = TRUE;
|
---|
317 |
|
---|
318 | break;
|
---|
319 |
|
---|
320 | case read_phe_all: //@< to read PHE files from write_all_images
|
---|
321 |
|
---|
322 | // change boolean value
|
---|
323 | Read_Phe_All = TRUE;
|
---|
324 |
|
---|
325 | break;
|
---|
326 |
|
---|
327 | case write_all_images: //@< to write ALL the images
|
---|
328 |
|
---|
329 | // change boolean value
|
---|
330 | Write_All_Images = TRUE;
|
---|
331 |
|
---|
332 | break;
|
---|
333 |
|
---|
334 | case nowrite_McEvt: //@< do not write the McEvt info
|
---|
335 |
|
---|
336 | // change boolean value
|
---|
337 | Write_McEvt = FALSE;
|
---|
338 |
|
---|
339 | break;
|
---|
340 |
|
---|
341 | case write_McTrig: //@< to write the McTrig info
|
---|
342 |
|
---|
343 | // change boolean value
|
---|
344 | Write_McTrig = TRUE;
|
---|
345 |
|
---|
346 | break;
|
---|
347 |
|
---|
348 | case write_RawEvt: //@< to write the RawEvt data
|
---|
349 |
|
---|
350 | // change boolean value
|
---|
351 | Write_RawEvt = TRUE;
|
---|
352 |
|
---|
353 | break;
|
---|
354 |
|
---|
355 |
|
---|
356 |
|
---|
357 |
|
---|
358 | case write_all_data: //@< to write single pixel data
|
---|
359 |
|
---|
360 | // change boolean value
|
---|
361 | Write_All_Data = TRUE;
|
---|
362 |
|
---|
363 | break;
|
---|
364 |
|
---|
365 | case select_energy: //@< value of islands_cut (i0)
|
---|
366 |
|
---|
367 | // get energy range
|
---|
368 | sscanf(line, "%s %f %f", token, &Select_Energy_le, &Select_Energy_ue);
|
---|
369 | Select_Energy = TRUE;
|
---|
370 |
|
---|
371 | break;
|
---|
372 |
|
---|
373 | case trigger_radius: //@< set radius of trigger area
|
---|
374 |
|
---|
375 | // get trigger radius
|
---|
376 | sscanf(line, "%s %f", token, &Trigger_Radius);
|
---|
377 | Set_Trigger_Radius = TRUE;
|
---|
378 |
|
---|
379 | break;
|
---|
380 |
|
---|
381 | case correction: //@< apply a kind of correction to pixel values
|
---|
382 |
|
---|
383 | // get trigger radius
|
---|
384 | sscanf(line, "%s %f", token, &fCorrection);
|
---|
385 | Apply_Correction = TRUE;
|
---|
386 |
|
---|
387 | break;
|
---|
388 |
|
---|
389 | case end_file: //@< end of the parameters file
|
---|
390 |
|
---|
391 | // show a short message
|
---|
392 | is_end = TRUE;
|
---|
393 |
|
---|
394 | break;
|
---|
395 |
|
---|
396 | } // switch ( i )
|
---|
397 |
|
---|
398 | } // while (! is_end)
|
---|
399 |
|
---|
400 | // after the loop is finished, return to the main function
|
---|
401 | return;
|
---|
402 | }
|
---|
403 | //!@}
|
---|
404 |
|
---|
405 |
|
---|
406 | //!-----------------------------------------------------------
|
---|
407 | // @name get_input_filename
|
---|
408 | //
|
---|
409 | // @desc get name of the input file
|
---|
410 | //
|
---|
411 | // @return Name of the Input file
|
---|
412 | //
|
---|
413 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
414 | //------------------------------------------------------------
|
---|
415 | // @function
|
---|
416 |
|
---|
417 | //!@{
|
---|
418 | char *
|
---|
419 | get_input_filename(void)
|
---|
420 | {
|
---|
421 | return (Input_filename);
|
---|
422 | }
|
---|
423 | //!@}
|
---|
424 |
|
---|
425 |
|
---|
426 | //!-----------------------------------------------------------
|
---|
427 | // @name get_output_filename
|
---|
428 | //
|
---|
429 | // @desc get name of the output file
|
---|
430 | //
|
---|
431 | // @return Name of the Output file
|
---|
432 | //
|
---|
433 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
434 | //------------------------------------------------------------
|
---|
435 | // @function
|
---|
436 |
|
---|
437 | //!@{
|
---|
438 | char *
|
---|
439 | get_output_filename(void)
|
---|
440 | {
|
---|
441 | return (Output_filename);
|
---|
442 | }
|
---|
443 | //!@}
|
---|
444 |
|
---|
445 |
|
---|
446 | //!-----------------------------------------------------------
|
---|
447 | // @name get_data_filename
|
---|
448 | //
|
---|
449 | // @desc get name of the data file
|
---|
450 | //
|
---|
451 | // @return Name of the Data file
|
---|
452 | //
|
---|
453 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
454 | //------------------------------------------------------------
|
---|
455 | // @function
|
---|
456 |
|
---|
457 | //!@{
|
---|
458 | char *
|
---|
459 | get_data_filename(void)
|
---|
460 | {
|
---|
461 | return (Data_filename);
|
---|
462 | }
|
---|
463 | //!@}
|
---|
464 |
|
---|
465 |
|
---|
466 | //!-----------------------------------------------------------
|
---|
467 | // @name get_diag_filename
|
---|
468 | //
|
---|
469 | // @desc get name of the diagnostic output file
|
---|
470 | //
|
---|
471 | // @return Name of the DIAG file
|
---|
472 | //
|
---|
473 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
474 | //------------------------------------------------------------
|
---|
475 | // @function
|
---|
476 |
|
---|
477 | //!@{
|
---|
478 | char *
|
---|
479 | get_diag_filename(void)
|
---|
480 | {
|
---|
481 | return (DIAG_filename);
|
---|
482 | }
|
---|
483 | //!@}
|
---|
484 |
|
---|
485 |
|
---|
486 | //!-----------------------------------------------------------
|
---|
487 | // @name get_root_filename
|
---|
488 | //
|
---|
489 | // @desc get name of the ROOT file
|
---|
490 | //
|
---|
491 | // @return Name of the ROOT file
|
---|
492 | //
|
---|
493 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
494 | //------------------------------------------------------------
|
---|
495 | // @function
|
---|
496 |
|
---|
497 | //!@{
|
---|
498 | char *
|
---|
499 | get_root_filename(void)
|
---|
500 | {
|
---|
501 | return (ROOT_filename);
|
---|
502 | }
|
---|
503 | //!@}
|
---|
504 |
|
---|
505 |
|
---|
506 |
|
---|
507 | //!-----------------------------------------------------------
|
---|
508 | // @name get_ct_filename
|
---|
509 | //
|
---|
510 | // @desc get name of CT definition file
|
---|
511 | //
|
---|
512 | // @return Name of the CT definition file
|
---|
513 | //
|
---|
514 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
515 | //------------------------------------------------------------
|
---|
516 | // @function
|
---|
517 |
|
---|
518 | //!@{
|
---|
519 | char *
|
---|
520 | get_ct_filename(void)
|
---|
521 | {
|
---|
522 | return (CT_filename);
|
---|
523 | }
|
---|
524 | //!@}
|
---|
525 |
|
---|
526 |
|
---|
527 | //!-----------------------------------------------------------
|
---|
528 | // @name get_nsb
|
---|
529 | //
|
---|
530 | // @desc are we going to simulate NSB ?
|
---|
531 | //
|
---|
532 | // @var *n Mean value for the NSB (ph.e./pixel)
|
---|
533 | // @return TRUE: we'll simulate NSB; FALSE: we won't
|
---|
534 | //
|
---|
535 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
536 | //------------------------------------------------------------
|
---|
537 | // @function
|
---|
538 |
|
---|
539 | //!@{
|
---|
540 | int
|
---|
541 | get_nsb(float *n)
|
---|
542 | {
|
---|
543 | *n = meanNSB;
|
---|
544 | return ( simulateNSB );
|
---|
545 | }
|
---|
546 | //!@}
|
---|
547 |
|
---|
548 |
|
---|
549 | //!-----------------------------------------------------------
|
---|
550 | // @name get_threshold
|
---|
551 | //
|
---|
552 | // @desc get threshold value
|
---|
553 | //
|
---|
554 | // @return Value of the threshold q$_0$
|
---|
555 | //
|
---|
556 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
557 | //------------------------------------------------------------
|
---|
558 | // @function
|
---|
559 |
|
---|
560 | //!@{
|
---|
561 | float
|
---|
562 | get_threshold(void)
|
---|
563 | {
|
---|
564 | return( qThreshold );
|
---|
565 | }
|
---|
566 | //!@}
|
---|
567 |
|
---|
568 |
|
---|
569 | //!-----------------------------------------------------------
|
---|
570 | // @name get_tail_cut
|
---|
571 | //
|
---|
572 | // @desc get tail cut value
|
---|
573 | //
|
---|
574 | // @return Value for the Tail-cut
|
---|
575 | //
|
---|
576 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
577 | //------------------------------------------------------------
|
---|
578 | // @function
|
---|
579 |
|
---|
580 | //!@{
|
---|
581 | float
|
---|
582 | get_tail_cut(void)
|
---|
583 | {
|
---|
584 | return( qTailCut );
|
---|
585 | }
|
---|
586 | //!@}
|
---|
587 |
|
---|
588 |
|
---|
589 | //!-----------------------------------------------------------
|
---|
590 | // @name get_islands_cut
|
---|
591 | //
|
---|
592 | // @desc are we going to count the islands ?
|
---|
593 | //
|
---|
594 | // @var *n Cut on islands number
|
---|
595 | // @return TRUE: we'll count the islands; FALSE: we won't
|
---|
596 | //
|
---|
597 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
598 | //------------------------------------------------------------
|
---|
599 | // @function
|
---|
600 |
|
---|
601 | //!@{
|
---|
602 | int
|
---|
603 | get_islands_cut(int *n)
|
---|
604 | {
|
---|
605 | *n = nIslandsCut;
|
---|
606 | return ( countIslands );
|
---|
607 | }
|
---|
608 | //!@}
|
---|
609 |
|
---|
610 |
|
---|
611 | //!-----------------------------------------------------------
|
---|
612 | // @name get_ana_pixels
|
---|
613 | //
|
---|
614 | // @desc number of pixels for the analysis
|
---|
615 | //
|
---|
616 | // @return Number of pixels to use in the image parameters
|
---|
617 | //
|
---|
618 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
619 | //------------------------------------------------------------
|
---|
620 | // @function
|
---|
621 |
|
---|
622 | //!@{
|
---|
623 | int
|
---|
624 | get_ana_pixels(void)
|
---|
625 | {
|
---|
626 | return ( anaPixels );
|
---|
627 | }
|
---|
628 | //!@}
|
---|
629 |
|
---|
630 |
|
---|
631 | //!-----------------------------------------------------------
|
---|
632 | // @name get_seeds
|
---|
633 | //
|
---|
634 | // @desc are we going to count the islands ?
|
---|
635 | //
|
---|
636 | // @var *n Number of the seed
|
---|
637 | // @return N-th random-number Seed
|
---|
638 | //
|
---|
639 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
640 | //------------------------------------------------------------
|
---|
641 | // @function
|
---|
642 |
|
---|
643 | //!@{
|
---|
644 | long int
|
---|
645 | get_seeds(int n)
|
---|
646 | {
|
---|
647 | return ( Seeds[n] );
|
---|
648 | }
|
---|
649 | //!@}
|
---|
650 |
|
---|
651 |
|
---|
652 | //!-----------------------------------------------------------
|
---|
653 | // @name get_skip_showers
|
---|
654 | //
|
---|
655 | // @desc get list of showers to skip
|
---|
656 | //
|
---|
657 | // @var *s1 Pointer to a vector of number of showers
|
---|
658 | //
|
---|
659 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
660 | //------------------------------------------------------------
|
---|
661 | // @function
|
---|
662 |
|
---|
663 | //!@{
|
---|
664 | void
|
---|
665 | get_skip_showers( int *s )
|
---|
666 | {
|
---|
667 | int i;
|
---|
668 | for (i=0; i<nSkip; ++i)
|
---|
669 | s[i] = Skip[i];
|
---|
670 | }
|
---|
671 | //!@}
|
---|
672 |
|
---|
673 |
|
---|
674 | //!-----------------------------------------------------------
|
---|
675 | // @name get_nskip_showers
|
---|
676 | //
|
---|
677 | // @desc get number of showers to skip
|
---|
678 | //
|
---|
679 | // @return Number of showers to be skipped
|
---|
680 | //
|
---|
681 | // @date Mon Sep 14 13:27:56 MET DST 1998
|
---|
682 | //------------------------------------------------------------
|
---|
683 | // @function
|
---|
684 |
|
---|
685 | //!@{
|
---|
686 | int
|
---|
687 | get_nskip_showers( void )
|
---|
688 | {
|
---|
689 | return( nSkip );
|
---|
690 | }
|
---|
691 | //!@}
|
---|
692 |
|
---|
693 |
|
---|
694 | //!-----------------------------------------------------------
|
---|
695 | // @name get_data_from_stdin
|
---|
696 | //
|
---|
697 | // @desc get whether we will read the data from the STDIN
|
---|
698 | //
|
---|
699 | // @return TRUE: we'll read data from STDIN; FALSE: we won't
|
---|
700 | //
|
---|
701 | // @date Wed Nov 25 13:21:00 MET 1998
|
---|
702 | //------------------------------------------------------------
|
---|
703 | // @function
|
---|
704 |
|
---|
705 | //!@{
|
---|
706 | int
|
---|
707 | get_data_from_stdin(void)
|
---|
708 | {
|
---|
709 | return ( Data_From_STDIN );
|
---|
710 | }
|
---|
711 | //!@}
|
---|
712 |
|
---|
713 |
|
---|
714 | //!-----------------------------------------------------------
|
---|
715 | // @name get_read_phe
|
---|
716 | //
|
---|
717 | // @desc get whether we will read PHE files
|
---|
718 | //
|
---|
719 | // @return TRUE: we'll read PHE files; FALSE: we won't
|
---|
720 | //
|
---|
721 | // @date Wed Nov 25 13:21:00 MET 1998
|
---|
722 | //------------------------------------------------------------
|
---|
723 | // @function
|
---|
724 |
|
---|
725 | //!@{
|
---|
726 | int
|
---|
727 | get_read_phe(void)
|
---|
728 | {
|
---|
729 | return ( Read_Phe );
|
---|
730 | }
|
---|
731 | //!@}
|
---|
732 |
|
---|
733 |
|
---|
734 | //!-----------------------------------------------------------
|
---|
735 | // @name get_read_phe_all
|
---|
736 | //
|
---|
737 | // @desc get whether we will read PHE files, with write_all_images
|
---|
738 | //
|
---|
739 | // @return TRUE: we'll do it; FALSE: we won't
|
---|
740 | //
|
---|
741 | // @date Wed Nov 25 13:21:00 MET 1998
|
---|
742 | //------------------------------------------------------------
|
---|
743 | // @function
|
---|
744 |
|
---|
745 | //!@{
|
---|
746 | int
|
---|
747 | get_read_phe_all(void)
|
---|
748 | {
|
---|
749 | return ( Read_Phe_All );
|
---|
750 | }
|
---|
751 | //!@}
|
---|
752 |
|
---|
753 |
|
---|
754 | //!-----------------------------------------------------------
|
---|
755 | // @name write_all_images
|
---|
756 | //
|
---|
757 | // @desc write all images to .phe, even those without trigger
|
---|
758 | //
|
---|
759 | // @return TRUE: we'll write everything; FALSE: we won't
|
---|
760 | //
|
---|
761 | // @date Wed Nov 25 13:21:00 MET 1998
|
---|
762 | //------------------------------------------------------------
|
---|
763 | // @function
|
---|
764 |
|
---|
765 | //!@{
|
---|
766 | int
|
---|
767 | get_write_all_images(void)
|
---|
768 | {
|
---|
769 | return ( Write_All_Images );
|
---|
770 | }
|
---|
771 | //!@}
|
---|
772 |
|
---|
773 |
|
---|
774 | //!-----------------------------------------------------------
|
---|
775 | // @name write_all_data
|
---|
776 | //
|
---|
777 | // @desc write single pixel data to file .dat
|
---|
778 | //
|
---|
779 | // @return TRUE: we'll write everything; FALSE: we won't
|
---|
780 | //
|
---|
781 | // @date Wed Nov 25 13:21:00 MET 1998
|
---|
782 | //------------------------------------------------------------
|
---|
783 | // @function
|
---|
784 |
|
---|
785 | //!@{
|
---|
786 | int
|
---|
787 | get_write_all_data(void)
|
---|
788 | {
|
---|
789 | return ( Write_All_Data );
|
---|
790 | }
|
---|
791 | //!@}
|
---|
792 |
|
---|
793 |
|
---|
794 | //!-----------------------------------------------------------
|
---|
795 | // @name write_McEvt
|
---|
796 | //
|
---|
797 | // @desc write the McEvt class for each event to the .root file
|
---|
798 | //
|
---|
799 | // @return TRUE: we'll write it; FALSE: we won't
|
---|
800 | //
|
---|
801 | //------------------------------------------------------------
|
---|
802 | // @function
|
---|
803 |
|
---|
804 | //!@{
|
---|
805 | int
|
---|
806 | get_write_McEvt(void)
|
---|
807 | {
|
---|
808 | return ( Write_McEvt );
|
---|
809 | }
|
---|
810 | //!@}
|
---|
811 |
|
---|
812 | //!-----------------------------------------------------------
|
---|
813 | // @name write_McTrig
|
---|
814 | //
|
---|
815 | // @desc write the McTrig class for each event to the .root file
|
---|
816 | //
|
---|
817 | // @return TRUE: we'll write it; FALSE: we won't
|
---|
818 | //
|
---|
819 | //------------------------------------------------------------
|
---|
820 | // @function
|
---|
821 |
|
---|
822 | //!@{
|
---|
823 | int
|
---|
824 | get_write_McTrig(void)
|
---|
825 | {
|
---|
826 | return ( Write_McTrig );
|
---|
827 | }
|
---|
828 | //!@}
|
---|
829 |
|
---|
830 | //!-----------------------------------------------------------
|
---|
831 | // @name write_RawEvt
|
---|
832 | //
|
---|
833 | // @desc write the RawEvt class for each event to the .root file
|
---|
834 | //
|
---|
835 | // @return TRUE: we'll write it; FALSE: we won't
|
---|
836 | //
|
---|
837 | //------------------------------------------------------------
|
---|
838 | // @function
|
---|
839 |
|
---|
840 | //!@{
|
---|
841 | int
|
---|
842 | get_write_RawEvt(void)
|
---|
843 | {
|
---|
844 | return ( Write_RawEvt );
|
---|
845 | }
|
---|
846 | //!@}
|
---|
847 |
|
---|
848 |
|
---|
849 | //!-----------------------------------------------------------
|
---|
850 | // @name get_select_energy
|
---|
851 | //
|
---|
852 | // @desc return energy range allowed for showers from .phe file
|
---|
853 | //
|
---|
854 | // @var *le Lower limit in the allowed energy range
|
---|
855 | // @var *ue Lower limit in the allowed energy range
|
---|
856 | // @return TRUE: we make selection on the energy; FALSE: we don't
|
---|
857 | //
|
---|
858 | // @date Wed Nov 25 13:21:00 MET 1998
|
---|
859 | //------------------------------------------------------------
|
---|
860 | // @function
|
---|
861 |
|
---|
862 | //!@{
|
---|
863 | int
|
---|
864 | get_select_energy(float *le, float *ue)
|
---|
865 | {
|
---|
866 | *le = Select_Energy_le;
|
---|
867 | *ue = Select_Energy_ue;
|
---|
868 | return ( Select_Energy );
|
---|
869 | }
|
---|
870 | //!@}
|
---|
871 |
|
---|
872 |
|
---|
873 | //!-----------------------------------------------------------
|
---|
874 | // @name get_trigger_radius
|
---|
875 | //
|
---|
876 | // @desc return the radius of the trigger area in the camera (if set)
|
---|
877 | //
|
---|
878 | // @var *radius Radius of the trigger area in the camera
|
---|
879 | // @return TRUE: we choose a given radius for the trigger area
|
---|
880 | //
|
---|
881 | // @date Fri May 7 11:07:43 MET DST 1999
|
---|
882 | //------------------------------------------------------------
|
---|
883 | // @function
|
---|
884 |
|
---|
885 | //!@{
|
---|
886 | int get_trigger_radius(float *radius)
|
---|
887 | {
|
---|
888 | *radius = Trigger_Radius;
|
---|
889 | return ( Set_Trigger_Radius );
|
---|
890 | }
|
---|
891 | //!@}
|
---|
892 |
|
---|
893 |
|
---|
894 | //!-----------------------------------------------------------
|
---|
895 | // @name get_trigger_radius
|
---|
896 | //
|
---|
897 | // @desc return the radius of the trigger area in the camera (if set)
|
---|
898 | //
|
---|
899 | // @var *radius Radius of the trigger area in the camera
|
---|
900 | // @return TRUE: we choose a given radius for the trigger area
|
---|
901 | //
|
---|
902 | // @date Fri May 7 11:07:43 MET DST 1999
|
---|
903 | //------------------------------------------------------------
|
---|
904 | // @function
|
---|
905 |
|
---|
906 | //!@{
|
---|
907 | int get_correction(float *corr)
|
---|
908 | {
|
---|
909 | *corr = fCorrection;
|
---|
910 | return ( Apply_Correction );
|
---|
911 | }
|
---|
912 | //!@}
|
---|
913 |
|
---|
914 |
|
---|
915 | //=------------------------------------------------------------
|
---|
916 | //!@subsection Log of this file.
|
---|
917 |
|
---|
918 | //!@{
|
---|
919 | //
|
---|
920 | // $Log: not supported by cvs2svn $
|
---|
921 | // Revision 1.1.1.1 1999/11/05 11:59:34 harald
|
---|
922 | // This the starting point for CVS controlled further developments of the
|
---|
923 | // camera program. The program was originally written by Jose Carlos.
|
---|
924 | // But here you can find a "rootified" version to the program. This means
|
---|
925 | // that there is no hbook stuff in it now. Also the output of the
|
---|
926 | // program changed to the MagicRawDataFormat.
|
---|
927 | //
|
---|
928 | // The "rootification" was done by Dirk Petry and Harald Kornmayer.
|
---|
929 | //
|
---|
930 | // In the following you can see the README file of that version:
|
---|
931 | //
|
---|
932 | // ==================================================
|
---|
933 | //
|
---|
934 | // Fri Oct 22 1999 D.P.
|
---|
935 | //
|
---|
936 | // The MAGIC Monte Carlo System
|
---|
937 | //
|
---|
938 | // Camera Simulation Programme
|
---|
939 | // ---------------------------
|
---|
940 | //
|
---|
941 | // 1) Description
|
---|
942 | //
|
---|
943 | // This version is the result of the fusion of H.K.'s
|
---|
944 | // root_camera which is described below (section 2)
|
---|
945 | // and another version by D.P. which had a few additional
|
---|
946 | // useful features.
|
---|
947 | //
|
---|
948 | // The version compiles under Linux with ROOT 2.22 installed
|
---|
949 | // (variable ROOTSYS has to be set).
|
---|
950 | //
|
---|
951 | // Compile as before simply using "make" in the root_camera
|
---|
952 | // directory.
|
---|
953 | //
|
---|
954 | // All features of H.K.'s root_camera were retained.
|
---|
955 | //
|
---|
956 | // Additional features of this version are:
|
---|
957 | //
|
---|
958 | // a) HBOOK is no longer used and all references are removed.
|
---|
959 | //
|
---|
960 | // b) Instead of HBOOK, the user is given now the possibility of
|
---|
961 | // having Diagnostic data in ROOT format as a complement
|
---|
962 | // to the ROOT Raw data.
|
---|
963 | //
|
---|
964 | // This data is written to the file which is determined by
|
---|
965 | // the new input parameter "diag_file" in the camera parameter
|
---|
966 | // file.
|
---|
967 | //
|
---|
968 | // All source code file belonging to this part have filenames
|
---|
969 | // starting with "MDiag".
|
---|
970 | //
|
---|
971 | // The user can read the output file using the following commands
|
---|
972 | // in an interactive ROOT session:
|
---|
973 | //
|
---|
974 | // root [0] .L MDiag.so
|
---|
975 | // root [1] new TFile("diag.root");
|
---|
976 | // root [2] new TTreeViewer("T");
|
---|
977 | //
|
---|
978 | // This brings up a viewer from which all variables of the
|
---|
979 | // TTree can be accessed and histogrammed. This example
|
---|
980 | // assumes that you have named the file "diag.root", that
|
---|
981 | // you are using ROOT version 2.22 or later and that you have
|
---|
982 | // the shared object library "MDiag.so" which is produced
|
---|
983 | // by the Makefile along with the executable "camera".
|
---|
984 | //
|
---|
985 | // ! The contents of the so-called diag file is not yet fixed.
|
---|
986 | // ! At the moment it is what J.C.G. used to put into the HBOOK
|
---|
987 | // ! ntuple. In future versions the moments calculation can be
|
---|
988 | // ! removed and the parameter list be modified correspondingly.
|
---|
989 | //
|
---|
990 | // c) Now concatenated reflector files can be read. This is useful
|
---|
991 | // if you have run the reflector with different parameters but
|
---|
992 | // you want to continue the analysis with all reflector data
|
---|
993 | // going into ONE ROOT outputfile.
|
---|
994 | //
|
---|
995 | // The previous camera version contained a bug which made reading
|
---|
996 | // of two or more concatenated reflector files impossible.
|
---|
997 | //
|
---|
998 | // d) The reflector output format was changed. It is now version
|
---|
999 | // 0.4 .
|
---|
1000 | // The change solely consists in a shortening of the flag
|
---|
1001 | // definition in the file
|
---|
1002 | //
|
---|
1003 | // include-MC/MCCphoton.hxx
|
---|
1004 | //
|
---|
1005 | // ! IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
|
---|
1006 | // ! do so by recompiling camera with the previous version of
|
---|
1007 | // ! include-MC/MCCphoton.hxx.
|
---|
1008 | //
|
---|
1009 | // The change was necessary for saving space and better
|
---|
1010 | // debugging. From now on, this format can be frozen.
|
---|
1011 | //
|
---|
1012 | // ! For producing reflector output in the new format, you
|
---|
1013 | // ! of course have to recompile your reflector with the
|
---|
1014 | // ! new include-MC/MCCphoton.hxx .
|
---|
1015 | //
|
---|
1016 | // e) A first version of the pixelization with the larger
|
---|
1017 | // outer pixels is implemented. THIS IS NOT YET FULLY
|
---|
1018 | // TESTED, but first rough tests show that it works
|
---|
1019 | // at least to a good approximation.
|
---|
1020 | //
|
---|
1021 | // The present version implements the camera outline
|
---|
1022 | // with 18 "gap-pixels" and 595 pixels in total as
|
---|
1023 | // shown in
|
---|
1024 | //
|
---|
1025 | // http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
|
---|
1026 | //
|
---|
1027 | // This change involved
|
---|
1028 | //
|
---|
1029 | // (i) The file pixels.dat is no longer needed. Instead
|
---|
1030 | // the coordinates are generated by the program itself
|
---|
1031 | // (takes maybe 1 second). In the file
|
---|
1032 | //
|
---|
1033 | // pixel-coords.txt
|
---|
1034 | //
|
---|
1035 | // in the same directory as this README, you find a list
|
---|
1036 | // of the coordinates generated by this new routine. It
|
---|
1037 | // has the format
|
---|
1038 | //
|
---|
1039 | // number i j x y size-factor
|
---|
1040 | //
|
---|
1041 | // where i and j are J.C.G.'s so called biaxis hexagonal
|
---|
1042 | // coordinates (for internal use) and x and y are the
|
---|
1043 | // coordinates of the pixel centers in the standard camera
|
---|
1044 | // coordinate system in units of centimeters. The value
|
---|
1045 | // of "size-factor" determines the linear size of the pixel
|
---|
1046 | // relative to the central pixels.
|
---|
1047 | //
|
---|
1048 | // (ii) The magic.def file has two additional parameters
|
---|
1049 | // which give the number of central pixels and the
|
---|
1050 | // number of gap pixels
|
---|
1051 | //
|
---|
1052 | // (iii) In camera.h and camera.cxx several changes were
|
---|
1053 | // necessary, among them the introduction of several
|
---|
1054 | // new functions
|
---|
1055 | //
|
---|
1056 | // The newly suggested outline with asymmetric Winston cones
|
---|
1057 | // will be implemented in a later version.
|
---|
1058 | //
|
---|
1059 | // f) phe files can no longer be read since this contradicts
|
---|
1060 | // our philosophy that the analysis should be done with other
|
---|
1061 | // programs like e.g. EVITA and not with "camera" itself.
|
---|
1062 | // This possibility was removed.
|
---|
1063 | //
|
---|
1064 | // g) ROOT is no longer invoked with an interactive interface.
|
---|
1065 | // In this way, camera can better be run as a batch program and
|
---|
1066 | // it uses less memory.
|
---|
1067 | //
|
---|
1068 | // h) small changes concerning the variable "t_chan" were necessary in
|
---|
1069 | // order to avoid segmentation faults: The variable is used as an
|
---|
1070 | // index and it went sometimes outside the limits when camera
|
---|
1071 | // was reading proton data. This is because the reflector files
|
---|
1072 | // don't contain the photons in a chronological order and also
|
---|
1073 | // the timespread can be considerably longer that the foreseen
|
---|
1074 | // digitisation timespan. Please see the source code of camera.cxx
|
---|
1075 | // round about line 1090.
|
---|
1076 | //
|
---|
1077 | // j) several unused variables were removed, a few warning messages
|
---|
1078 | // occur when you compile camera.cxx but these can be ignored at
|
---|
1079 | // the moment.
|
---|
1080 | //
|
---|
1081 | // In general the program is of course not finished. It still needs
|
---|
1082 | // debugging, proper trigger simulation, simulation of the asymmetric
|
---|
1083 | // version of the outer pixels, proper NSB simulation, adaption of
|
---|
1084 | // the diag "ntuple" contents to our need and others small improvements.
|
---|
1085 | //
|
---|
1086 | // In the directory rfl-files there is now a file in reflector format 0.4
|
---|
1087 | // containing a single event produced by the starfiled adder. It has
|
---|
1088 | // a duration of 30 ns and represents the region around the Crab Nebula.
|
---|
1089 | // Using the enclosed input parameter file, camera should process this
|
---|
1090 | // file without problems.
|
---|
1091 | //
|
---|
1092 | // 2) The README for the previous version of root_camera
|
---|
1093 | //
|
---|
1094 | // README for a preliminary version of the
|
---|
1095 | // root_camera program.
|
---|
1096 | //
|
---|
1097 | // root_camera is based on the program "camera"of Jose Carlos
|
---|
1098 | // Gonzalez. It was changed in the way that only the pixelisation
|
---|
1099 | // and the distibution of the phe to the FADCs works in a
|
---|
1100 | // first version.
|
---|
1101 | //
|
---|
1102 | // Using the #undef command most possibilities of the orignal
|
---|
1103 | // program are switched of.
|
---|
1104 | //
|
---|
1105 | // The new parts are signed by
|
---|
1106 | //
|
---|
1107 | // - ROOT or __ROOT__
|
---|
1108 | // nearly all important codelines for ROOT output are enclosed
|
---|
1109 | // in structures like
|
---|
1110 | // #ifdef __ROOT__
|
---|
1111 | //
|
---|
1112 | // code
|
---|
1113 | //
|
---|
1114 | // #endif __ROOT__
|
---|
1115 | //
|
---|
1116 | // In same case the new lines are signed by a comment with the word
|
---|
1117 | // ROOT in it.
|
---|
1118 | //
|
---|
1119 | // For timing of the pulse some variable names are changed.
|
---|
1120 | // (t0, t1, t --> t_ini, t_fin, t_1st, t_chan,...)
|
---|
1121 | // Look also for this changes.
|
---|
1122 | //
|
---|
1123 | // For the new root-file is also a change in readparm-files
|
---|
1124 | //
|
---|
1125 | //
|
---|
1126 | // - __DETAIL_TRIGGER__
|
---|
1127 | //
|
---|
1128 | // This is for the implementation of the current work on trigger
|
---|
1129 | // studies. Because the class MTrigger is not well documented it
|
---|
1130 | // isn´t a part of this tar file. Only a dummy File exists.
|
---|
1131 | //
|
---|
1132 | //
|
---|
1133 | //
|
---|
1134 | // With all files in the archive, the root_camera program should run.
|
---|
1135 | //
|
---|
1136 | // A reflector file is in the directory rfl-files
|
---|
1137 | //
|
---|
1138 | // ==================================================
|
---|
1139 | //
|
---|
1140 | // From now on, use CVS for development!!!!
|
---|
1141 | //
|
---|
1142 | //
|
---|
1143 | //
|
---|
1144 | // Revision 1.2 1999/10/22 15:01:28 petry
|
---|
1145 | // version sent to H.K. and N.M. on Fri Oct 22 1999
|
---|
1146 | //
|
---|
1147 | // Revision 1.1.1.1 1999/10/21 16:35:11 petry
|
---|
1148 | // first synthesised version
|
---|
1149 | //
|
---|
1150 | // Revision 1.6 1999/03/15 14:59:08 gonzalez
|
---|
1151 | // camera-1_1
|
---|
1152 | //
|
---|
1153 | // Revision 1.5 1999/03/02 09:56:12 gonzalez
|
---|
1154 | // *** empty log message ***
|
---|
1155 | //
|
---|
1156 | // Revision 1.4 1999/01/14 17:32:41 gonzalez
|
---|
1157 | // Added to camera the STDIN input option (data_from_input)
|
---|
1158 | //
|
---|
1159 | //!@}
|
---|
1160 |
|
---|
1161 | //=EOF
|
---|