source: trunk/MagicSoft/Simulation/Detector/TimeCam/creadparam.h@ 5442

Last change on this file since 5442 was 353, checked in by harald, 25 years ago
this is just the starting point of the further development of the camera project to simulate MonteCarloShower for MAGIC. The TimeCam is using also the information of the arrival time of the cerenkov photons (or the photoelectrons). This is the status of the program as presented on the general MAGIC meeting in Barcelona! Each one is invited to collaborate!!!
File size: 15.3 KB
Line 
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.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.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 @- |output_file| filename :
50 Sets the name of the output file (|.phe|).
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 "timecam-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 */ \
140T(input_file), /* input file */ \
141T(output_file), /* output file */ \
142T(data_file), /* data file */ \
143T(diag_file), /* diagnostic output file (ROOT format) */ \
144T(root_file), /* ROOT file */ \
145T(ct_file), /* file with the characteristics of the CT */ \
146T(ana_pixels), /* size of the camera for parameters calculation */ \
147T(nsb_on), /* activates NSB simulation */ \
148T(nsb_off), /* de-activates NSB simulation */ \
149T(nsb_mean), /* mean value of NSB contribution per pixel */ \
150T(threshold), /* value of q0 for trigger */ \
151T(tail_cut), /* value of tail cut (t0) */ \
152T(islands_on), /* DO count islands */ \
153T(islands_off), /* do NOT count islands */ \
154T(islands_cut), /* value of islands cut (i0) */ \
155T(seeds), /* seeds for random number generation */ \
156T(data_from_stdin), /* to read data from STDIN */ \
157T(skip), /* skip pathological showers */ \
158T(read_phe_all), /* id., but was processed with write_all_images */ \
159T(read_phe), /* read an already camera processed file */ \
160T(write_all_images),/* write to file .phe ALL images (even w.o. trigger)*/ \
161T(nowrite_McEvt), /* nowrite to file .root McEvt infos */ \
162T(write_McTrig), /* write to file .root McTrig infos */ \
163T(write_RawEvt), /* write to file .root RawEvt infos */ \
164T(write_all_data), /* write to file .dat ALL image data */ \
165T(select_energy), /* energy range to read: only for .phe files */ \
166T(trigger_radius), /* trigger radius for the camera */ \
167T(correction), /* factor for correction in the pixel values */ \
168T(end_file) /* end of the parameters file */
169
170#define T(x) x // define T() as the name as it is
171
172enum ITEM_TYPE {
173 ITEM_LIST
174};
175
176#undef T
177
178#define T(x) #x // define T() as the string of x
179
180const char *const ITEM_NAMES[] = {
181 ITEM_LIST
182};
183
184#undef T
185
186#define LINE_MAX_LENGTH 400
187#define ITEM_MAX_LENGTH 40
188#define PATH_MAX_LENGTH 120
189
190// mean values of NSB contribution per pixel
191
192static const float Mean_NSB_MAGIC = 5.0; //@< for MAGIC
193static const float Mean_NSB_CT1 = 5.0; //@< for CT1
194
195//!@}
196
197//!@subsection Prototypes of functions.
198
199//!@{
200
201//++
202// prototypes
203//--
204
205void readparam(char * filename);
206char *get_input_filename(void);
207char *get_output_filename(void);
208char *get_data_filename(void);
209char *get_diag_filename(void);
210char *get_root_filename(void);
211char *get_ct_filename(void);
212int get_nsb(float *n);
213float get_threshold(void);
214float get_tail_cut(void);
215int get_islands_cut(int *n);
216long int get_seeds(int n);
217int get_ana_pixels(void);
218void get_skip_showers( int *s );
219int get_nskip_showers( void );
220int get_data_from_stdin(void);
221int get_read_phe(void);
222int get_read_phe_all(void);
223int get_write_all_images(void);
224//
225int get_write_McEvt(void);
226int get_write_McTrig(void);
227int get_write_RawEvt(void);
228//
229int get_write_all_data(void);
230int get_select_energy(float *le, float *ue);
231int get_trigger_radius(float *radius);
232int get_correction(float *corr);
233//!@}
234
235//!@{
236
237#endif // ! _creadparam_
238
239//!@}
240
241//=------------------------------------------------------------
242//!@subsection Log of this file.
243
244//!@{
245
246/*
247 * $Log: not supported by cvs2svn $
248 * Revision 1.1.1.1 1999/11/05 11:59:34 harald
249 * This the starting point for CVS controlled further developments of the
250 * camera program. The program was originally written by Jose Carlos.
251 * But here you can find a "rootified" version to the program. This means
252 * that there is no hbook stuff in it now. Also the output of the
253 * program changed to the MagicRawDataFormat.
254 *
255 * The "rootification" was done by Dirk Petry and Harald Kornmayer.
256 *
257 * In the following you can see the README file of that version:
258 *
259 * ==================================================
260 *
261 * Fri Oct 22 1999 D.P.
262 *
263 * The MAGIC Monte Carlo System
264 *
265 * Camera Simulation Programme
266 * ---------------------------
267 *
268 * 1) Description
269 *
270 * This version is the result of the fusion of H.K.'s
271 * root_camera which is described below (section 2)
272 * and another version by D.P. which had a few additional
273 * useful features.
274 *
275 * The version compiles under Linux with ROOT 2.22 installed
276 * (variable ROOTSYS has to be set).
277 *
278 * Compile as before simply using "make" in the root_camera
279 * directory.
280 *
281 * All features of H.K.'s root_camera were retained.
282 *
283 * Additional features of this version are:
284 *
285 * a) HBOOK is no longer used and all references are removed.
286 *
287 * b) Instead of HBOOK, the user is given now the possibility of
288 * having Diagnostic data in ROOT format as a complement
289 * to the ROOT Raw data.
290 *
291 * This data is written to the file which is determined by
292 * the new input parameter "diag_file" in the camera parameter
293 * file.
294 *
295 * All source code file belonging to this part have filenames
296 * starting with "MDiag".
297 *
298 * The user can read the output file using the following commands
299 * in an interactive ROOT session:
300 *
301 * root [0] .L MDiag.so
302 * root [1] new TFile("diag.root");
303 * root [2] new TTreeViewer("T");
304 *
305 * This brings up a viewer from which all variables of the
306 * TTree can be accessed and histogrammed. This example
307 * assumes that you have named the file "diag.root", that
308 * you are using ROOT version 2.22 or later and that you have
309 * the shared object library "MDiag.so" which is produced
310 * by the Makefile along with the executable "camera".
311 *
312 * ! The contents of the so-called diag file is not yet fixed.
313 * ! At the moment it is what J.C.G. used to put into the HBOOK
314 * ! ntuple. In future versions the moments calculation can be
315 * ! removed and the parameter list be modified correspondingly.
316 *
317 * c) Now concatenated reflector files can be read. This is useful
318 * if you have run the reflector with different parameters but
319 * you want to continue the analysis with all reflector data
320 * going into ONE ROOT outputfile.
321 *
322 * The previous camera version contained a bug which made reading
323 * of two or more concatenated reflector files impossible.
324 *
325 * d) The reflector output format was changed. It is now version
326 * 0.4 .
327 * The change solely consists in a shortening of the flag
328 * definition in the file
329 *
330 * include-MC/MCCphoton.hxx
331 *
332 * ! IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
333 * ! do so by recompiling camera with the previous version of
334 * ! include-MC/MCCphoton.hxx.
335 *
336 * The change was necessary for saving space and better
337 * debugging. From now on, this format can be frozen.
338 *
339 * ! For producing reflector output in the new format, you
340 * ! of course have to recompile your reflector with the
341 * ! new include-MC/MCCphoton.hxx .
342 *
343 * e) A first version of the pixelization with the larger
344 * outer pixels is implemented. THIS IS NOT YET FULLY
345 * TESTED, but first rough tests show that it works
346 * at least to a good approximation.
347 *
348 * The present version implements the camera outline
349 * with 18 "gap-pixels" and 595 pixels in total as
350 * shown in
351 *
352 * http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
353 *
354 * This change involved
355 *
356 * (i) The file pixels.dat is no longer needed. Instead
357 * the coordinates are generated by the program itself
358 * (takes maybe 1 second). In the file
359 *
360 * pixel-coords.txt
361 *
362 * in the same directory as this README, you find a list
363 * of the coordinates generated by this new routine. It
364 * has the format
365 *
366 * number i j x y size-factor
367 *
368 * where i and j are J.C.G.'s so called biaxis hexagonal
369 * coordinates (for internal use) and x and y are the
370 * coordinates of the pixel centers in the standard camera
371 * coordinate system in units of centimeters. The value
372 * of "size-factor" determines the linear size of the pixel
373 * relative to the central pixels.
374 *
375 * (ii) The magic.def file has two additional parameters
376 * which give the number of central pixels and the
377 * number of gap pixels
378 *
379 * (iii) In camera.h and camera.cxx several changes were
380 * necessary, among them the introduction of several
381 * new functions
382 *
383 * The newly suggested outline with asymmetric Winston cones
384 * will be implemented in a later version.
385 *
386 * f) phe files can no longer be read since this contradicts
387 * our philosophy that the analysis should be done with other
388 * programs like e.g. EVITA and not with "camera" itself.
389 * This possibility was removed.
390 *
391 * g) ROOT is no longer invoked with an interactive interface.
392 * In this way, camera can better be run as a batch program and
393 * it uses less memory.
394 *
395 * h) small changes concerning the variable "t_chan" were necessary in
396 * order to avoid segmentation faults: The variable is used as an
397 * index and it went sometimes outside the limits when camera
398 * was reading proton data. This is because the reflector files
399 * don't contain the photons in a chronological order and also
400 * the timespread can be considerably longer that the foreseen
401 * digitisation timespan. Please see the source code of camera.cxx
402 * round about line 1090.
403 *
404 * j) several unused variables were removed, a few warning messages
405 * occur when you compile camera.cxx but these can be ignored at
406 * the moment.
407 *
408 * In general the program is of course not finished. It still needs
409 * debugging, proper trigger simulation, simulation of the asymmetric
410 * version of the outer pixels, proper NSB simulation, adaption of
411 * the diag "ntuple" contents to our need and others small improvements.
412 *
413 * In the directory rfl-files there is now a file in reflector format 0.4
414 * containing a single event produced by the starfiled adder. It has
415 * a duration of 30 ns and represents the region around the Crab Nebula.
416 * Using the enclosed input parameter file, camera should process this
417 * file without problems.
418 *
419 * 2) The README for the previous version of root_camera
420 *
421 * README for a preliminary version of the
422 * root_camera program.
423 *
424 * root_camera is based on the program "camera"of Jose Carlos
425 * Gonzalez. It was changed in the way that only the pixelisation
426 * and the distibution of the phe to the FADCs works in a
427 * first version.
428 *
429 * Using the #undef command most possibilities of the orignal
430 * program are switched of.
431 *
432 * The new parts are signed by
433 *
434 * - ROOT or __ROOT__
435 * nearly all important codelines for ROOT output are enclosed
436 * in structures like
437 * #ifdef __ROOT__
438 *
439 * code
440 *
441 * #endif __ROOT__
442 *
443 * In same case the new lines are signed by a comment with the word
444 * ROOT in it.
445 *
446 * For timing of the pulse some variable names are changed.
447 * (t0, t1, t --> t_ini, t_fin, t_1st, t_chan,...)
448 * Look also for this changes.
449 *
450 * For the new root-file is also a change in readparm-files
451 *
452 *
453 * - __DETAIL_TRIGGER__
454 *
455 * This is for the implementation of the current work on trigger
456 * studies. Because the class MTrigger is not well documented it
457 * isn´t a part of this tar file. Only a dummy File exists.
458 *
459 *
460 *
461 * With all files in the archive, the root_camera program should run.
462 *
463 * A reflector file is in the directory rfl-files
464 *
465 * ==================================================
466 *
467 * From now on, use CVS for development!!!!
468 *
469 *
470 *
471 * Revision 1.2 1999/10/22 15:01:29 petry
472 * version sent to H.K. and N.M. on Fri Oct 22 1999
473 *
474 * Revision 1.1.1.1 1999/10/21 16:35:11 petry
475 * first synthesised version
476 *
477 * Revision 1.7 1999/03/15 14:59:09 gonzalez
478 * camera-1_1
479 *
480 * Revision 1.6 1999/03/02 09:56:13 gonzalez
481 * *** empty log message ***
482 *
483 * Revision 1.5 1999/01/14 17:32:43 gonzalez
484 * Added to camera the STDIN input option (data_from_input)
485 *
486 */
487
488//!@}
489//=EOF
Note: See TracBrowser for help on using the repository browser.