source: trunk/MagicSoft/Simulation/Detector/Camera/creadparam.cxx@ 1231

Last change on this file since 1231 was 1231, checked in by blanch, 23 years ago
An item, which allows to switch off the storage of the RawEvt, has been introduced. It is called nowrite_RawEvt. To avoid confusion the item write_all_images has been moved to write_all_events.
File size: 44.0 KB
Line 
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.15 $
22//= $Author: blanch $
23//= $Date: 2002-03-04 17:15:51 $
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
70static char Input_filename[PATH_MAX_LENGTH]; //@< input filename
71static char Starfield_filename[PATH_MAX_LENGTH]; //@< starfield input filename
72static int Starfield_center[6]; //@< center of the starfield FOV
73 //@< RA(H,M,S) & DEC (D,M,S)
74static char Data_filename[PATH_MAX_LENGTH]; //@< data filename
75static char ROOT_filename[PATH_MAX_LENGTH]; //@< data filename
76static char Loop_filename[PATH_MAX_LENGTH]; //@< special data filename
77static char CT_filename[PATH_MAX_LENGTH]; //@< name of the CT def. file
78static char NSB_directory[PATH_MAX_LENGTH]; //@< database for NSB
79static int ElecNoise = TRUE; //@< Will we add ElecNoise?
80static float FADC_Noise = 2.0; //@< Value for FADC ElecNoise
81static float Trig_Noise = 0.3; //@< Factor for Trigger ElecNoise
82static int simulateNSB = TRUE; //@< Will we simulate NSB?
83static int anaPixels = -1; //@< number of pixels for the analysis
84static float meanNSB; //@< NSB mean value (per pixel)
85static int nphe2NSB=0; //@< Number of phe from shower to do NSB simulation
86static float qThreshold[TRIGGER_PIXELS]; //@< Threshold values
87static int Individual_Thres = FALSE;
88static float qTailCut; //@< Tail Cut value
89static int nIslandsCut; //@< Islands Cut value
90static int countIslands = TRUE; //@< Will we count the islands?
91static long int Seeds[2];
92static int *Skip;
93static int nSkip=0;
94static int Data_From_STDIN = FALSE;
95static int Read_Phe = FALSE;
96static int Read_Phe_All = FALSE;
97static int Write_All_Images = FALSE;
98static int Write_McEvt = TRUE;
99static int Write_McTrig = FALSE;
100static int Write_McFadc = FALSE;
101static int Write_RawEvt = TRUE;
102static int Write_All_Data = FALSE;
103static int Select_Energy = TRUE;
104static float Select_Energy_le = 0.0; //@< GeV
105static float Select_Energy_ue = 100000.0; //@< GeV
106static float Trigger_Radius;
107static int Set_Trigger_Radius=FALSE;
108static float fCorrection;
109static int Apply_Correction=FALSE;
110static int Trigger_Scan = FALSE;
111static int FADC_Scan = FALSE;
112static int Trigger_Loop = FALSE;
113static float Trigger_gate_length = 3.0;
114static float Trigger_over_time = 0.25;
115static float Trigger_response_ampl = 1.0;
116static float Trigger_response_fwhm = 2.0;
117static float Trigger_threshold = 7.0;
118static int Trigger_multiplicity = 4;
119static int Trigger_topology = 2;
120static float Trigger_loop_lthres = 3.0;
121static float Trigger_loop_uthres = 10.0;
122static float Trigger_loop_sthres = 1.0;
123static int Trigger_loop_lmult = 2;
124static int Trigger_loop_umult = 10;
125static int Trigger_loop_ltop = 0;
126static int Trigger_loop_utop = 2;
127static float FADC_response_ampl = MFADC_RESPONSE_AMPLITUDE;
128static float FADC_response_fwhm = MFADC_RESPONSE_FWHM;
129static float Telescope_axis_th = 0.; //<@ Theta of the axis telescope
130static float Telescope_axis_ph = 90.; //<@ Phi of the axis telescope
131static float Source_offset_th=0.; //<@ Displacement in Theta of the
132 //<@ source from the center
133static float Source_offset_ph=0.; //<@ Displacement in Phi of the
134 //<@ source from the center
135static int Corsika_vers=5200; //<@ Version of Corsika
136
137//!@}
138
139//!@subsection The function |readparam()|.
140
141//!-----------------------------------------------------------
142// @name creadparam
143//
144// @desc read parameters from the stdin / parameters file
145//
146// @var *filename Name of the parameters file (NULL->STDIN)
147//
148// @date Mon Sep 14 13:27:56 MET DST 1998
149//------------------------------------------------------------
150// @function
151
152//!@{
153void
154readparam(char * filename)
155{
156 char sign[] = GLUE_postp( PROGRAM, VERSION ); //@< initialize sign
157 char line[LINE_MAX_LENGTH]; //@< line to get from the stdin
158 char token[ITEM_MAX_LENGTH]; //@< a single token
159 int i, j, k; //@< dummy counters
160 float aux; //@< auxiliar variable
161 ifstream ifile;
162
163 // use cin or ifile (reading from STDIN or from parameters file?
164 if ( filename != NULL )
165 ifile.open( filename );
166
167 // get signature
168 if ( filename != NULL )
169 ifile.getline(line, LINE_MAX_LENGTH);
170 else
171 cin.getline(line, LINE_MAX_LENGTH);
172 line[strlen(SIGNATURE)] = '\0';
173 strcpy(sign, line);
174 cout<< '"' << sign << '"' << '\n';
175 cout<< "should be: " << SIGNATURE << '\n';
176 if (strcmp(sign, SIGNATURE) != 0) {
177 cerr << "ERROR: Signature of parameters file is not correct\n";
178 cerr << '"' << sign << '"' << '\n';
179 cerr << "should be: " << SIGNATURE << '\n';
180 exit(1);
181 }
182
183 // loop till the "end" directive is reached
184 int is_end = FALSE;
185 while (! is_end) {
186
187 // get line from file or stdin
188 if ( filename != NULL )
189 ifile.getline(line, LINE_MAX_LENGTH);
190 else
191 cin.getline(line, LINE_MAX_LENGTH);
192
193 // skip comments (start with '#')
194 if (line[0] == '#')
195 continue;
196
197 // show user comments (start with '>')
198 if (line[0] == '>') {
199 cout << line << endl << flush;
200 continue;
201 }
202
203 // look for each item at the beginning of the line
204 for (i=0; i<=end_file; i++)
205 if (strstr(line, ITEM_NAMES[i]) == line)
206 break;
207
208 // if it is not a valid line, just ignore it
209 if (i == end_file+1) {
210 cerr << "Skipping unknown token in [" << line << "]\n";
211 continue;
212 }
213
214 // case block for each directive
215 switch ( i ) {
216
217 case input_file: //@< name of the input file
218
219 // get the name of the input_file from the line
220 sscanf(line, "%s %s", token, Input_filename);
221
222 break;
223
224 case starfield_file: //@< name of the output file
225
226 // get the name of the output_file from the line
227 sscanf(line, "%s %s", token, Starfield_filename);
228
229 break;
230
231 case starfield_center: //@< name of the output file
232
233 // get the name of the output_file from the line
234 sscanf(line, "%s %i %i %i %i %i %i", token, &Starfield_center[0], &Starfield_center[1], &Starfield_center[2], &Starfield_center[3], &Starfield_center[4], &Starfield_center[5]);
235
236 break;
237
238 case data_file: //@< name of the data file
239
240 // get the name of the data_file from the line
241 sscanf(line, "%s %s", token, Data_filename);
242
243 break;
244
245 case root_file: //@< name of the ROOT file
246
247 // get the name of the data_file from the line
248 sscanf(line, "%s %s", token, ROOT_filename);
249 cout << '[' << ROOT_filename << ']' << endl << flush;
250
251 break;
252
253 case ct_file: //@< name of the telescope file
254
255 // get the name of the ct_file from the line
256 sscanf(line, "%s %s", token, CT_filename);
257
258 break;
259
260 case elec_noise_off: //@< add ElecNoise?
261
262 // we will not add electronic noise for FADC and Trigger channels.
263 ElecNoise = FALSE;
264 FADC_Noise = 0.0;
265 Trig_Noise =0.0;
266
267 break;
268
269 case fadc_noise: //@< FADC ElecNoise
270
271 // value for FADC Elec Noise
272 sscanf(line, "%s %f", token, &FADC_Noise);
273 ElecNoise = TRUE;
274
275 break;
276
277 case trig_noise: //@< add ElecNoise?
278
279 // factor for Trigger Elec Noise
280 sscanf(line, "%s %f", token, &Trig_Noise);
281 ElecNoise = TRUE;
282
283 break;
284
285 case nsb_on: //@< simulate NSB?
286
287 // we will simulate NSB
288 simulateNSB = TRUE;
289
290 break;
291
292 case nsb_off: //@< simulate NSB?
293
294 // we will NOT simulate NSB
295 simulateNSB = FALSE;
296
297 break;
298
299 case nsb_mean: //@< value of <NSB> per pixel
300
301 // get value of <NSB> (in photons)
302 sscanf(line, "%s %f %d", token, &meanNSB, &nphe2NSB);
303
304 break;
305
306 case nsb_directory: //@< name of the output file
307
308 // get the name of the output_file from the line
309 sscanf(line, "%s %s", token, NSB_directory);
310
311 break;
312
313 case ana_pixels: //@< number of pixels for analysis
314
315 // number of pixels for analysis
316 sscanf(line, "%s %d", token, &anaPixels);
317
318 break;
319
320 case pixel_thres: //@< value of threshold for trigger (q0)
321
322 // get value of threshold (in ph.e.)
323 sscanf(line, "%s %i %f", token,&k, &aux);
324 qThreshold[k]=aux;
325 Individual_Thres = TRUE;
326
327 break;
328
329 case tail_cut: //@< value of tail_cut (t0)
330
331 // get value of tail_cut (in ph.e.)
332 sscanf(line, "%s %f", token, &qTailCut);
333
334 break;
335
336 case islands_on: //@< DO count islands
337
338 // DO count islands
339 countIslands = TRUE;
340
341 break;
342
343 case islands_off: //@< do NOT count islands
344
345 // do NOT count islands
346 countIslands = FALSE;
347
348 break;
349
350 case islands_cut: //@< value of islands_cut (i0)
351
352 // get value of islands_cut (in ph.e.)
353 sscanf(line, "%s %d", token, &nIslandsCut);
354 countIslands = TRUE;
355
356 break;
357
358 case seeds: //@< values of seeds for random numbers
359
360 // get seeds
361 sscanf(line, "%s %ld %ld", token, &Seeds[0], &Seeds[1]);
362
363 break;
364
365 case skip: //@< skip pathological showers
366
367 // get showers to skip
368 cin >> nSkip;
369 Skip = new int[nSkip];
370 for (j=0; j<nSkip; ++j) {
371 cin >> Skip[j];
372 cout << Skip[j] << endl << flush;
373 }
374
375 break;
376
377 case data_from_stdin: //@< to read data from stdin
378
379 // change boolean value
380 Data_From_STDIN = TRUE;
381
382 break;
383
384 case read_phe: //@< to read PHE files
385
386 // change boolean value
387 Read_Phe = TRUE;
388
389 break;
390
391 case read_phe_all: //@< to read PHE files from write_all_events
392
393 // change boolean value
394 Read_Phe_All = TRUE;
395
396 break;
397
398 case write_all_events: //@< to write ALL the images
399
400 // change boolean value
401 Write_All_Images = TRUE;
402
403 break;
404
405 case nowrite_McEvt: //@< do not write the McEvt info
406
407 // change boolean value
408 Write_McEvt = FALSE;
409
410 break;
411
412 case write_McTrig: //@< to write the McTrig info
413
414 // change boolean value
415 Write_McTrig = TRUE;
416
417 break;
418
419 case write_McFadc: //@< to write the McFadc info
420
421 // change boolean value
422 Write_McFadc = TRUE;
423
424 break;
425
426 case nowrite_RawEvt: //@< to write the McFadc info
427
428 // change boolean value
429 Write_RawEvt = FALSE;
430
431 break;
432
433 case write_all_data: //@< to write single pixel data
434
435 // change boolean value
436 Write_All_Data = TRUE;
437
438 break;
439
440 case select_energy: //@< value of islands_cut (i0)
441
442 // get energy range
443 sscanf(line, "%s %f %f", token, &Select_Energy_le, &Select_Energy_ue);
444 Select_Energy = TRUE;
445
446 break;
447
448 case trigger_radius: //@< set radius of trigger area
449
450 // get trigger radius
451 sscanf(line, "%s %f", token, &Trigger_Radius);
452 Set_Trigger_Radius = TRUE;
453
454 break;
455
456 case correction: //@< apply a kind of correction to pixel values
457
458 // get trigger radius
459 sscanf(line, "%s %f", token, &fCorrection);
460 Apply_Correction = TRUE;
461
462 break;
463
464 case fadc_scan:
465
466 // change boolean value
467 FADC_Scan = TRUE;
468
469 break;
470
471 case fadc_prop:
472
473 // Get parameters for the fadc response for one phe
474 sscanf(line, "%s %f %f", token, &FADC_response_ampl,&FADC_response_fwhm);
475
476 break;
477
478 case trigger_scan:
479
480 // change boolean value
481 Trigger_Scan = TRUE;
482
483 break;
484 case trigger_prop:
485
486 // Get parameters for the diskriminator and the electronic
487 // response for one phe
488 sscanf(line, "%s %f %f %f %f", token, &Trigger_gate_length,&Trigger_over_time, &Trigger_response_ampl,&Trigger_response_fwhm);
489
490 break;
491
492 case trigger_loop:
493
494 // Get loop's limits
495 sscanf(line, "%s %f %f %f %d %d %d %d", token, &Trigger_loop_lthres, &Trigger_loop_uthres, &Trigger_loop_sthres, &Trigger_loop_lmult, &Trigger_loop_umult, &Trigger_loop_ltop, &Trigger_loop_utop );
496
497 // Set qThreshold to a global value
498 for(k=0;k<TRIGGER_PIXELS;k++){
499 qThreshold[k]=Trigger_loop_lthres;
500 }
501
502 // change boolean value
503 Trigger_Loop = TRUE;
504 Write_RawEvt = FALSE;
505 Individual_Thres = FALSE;
506
507 break;
508
509 case trigger_single:
510
511 // Get trigger conditions
512 sscanf(line, "%s %f %d %d", token, &Trigger_threshold, &Trigger_multiplicity, &Trigger_topology);
513
514 // Set qThreshold to a global value
515 for(k=0;k<TRIGGER_PIXELS;k++){
516 qThreshold[k]=Trigger_threshold;
517 }
518
519 // change boolean value
520 Trigger_Loop = FALSE;
521 Write_RawEvt = TRUE;
522 Individual_Thres = FALSE;
523
524 break;
525
526 case telescope_axis:
527
528 // Get axis of the telescope
529 sscanf(line, "%s %f %f", token, &Telescope_axis_th, &Telescope_axis_ph);
530
531 break;
532
533 case source_offset:
534
535 // Get offset of source
536 sscanf(line, "%s %f %f", token, &Source_offset_th, &Source_offset_ph);
537
538 break;
539
540 case corsika_vers:
541
542 // Get Corsika version
543 sscanf(line, "%s %i", token, &Corsika_vers);
544
545 break;
546
547 case Trigger_Loop_Output_Only_Specialists:
548
549 // get the name of the data_file from the line
550 sscanf(line, "%s %s", token, Loop_filename);
551 cout << '[' << Loop_filename << ']' << endl << flush;
552
553 // change boolean value
554 Write_RawEvt = TRUE;
555
556 break;
557
558 case end_file: //@< end of the parameters file
559
560 // show a short message
561 is_end = TRUE;
562
563 break;
564
565 } // switch ( i )
566
567 } // while (! is_end)
568
569 // after the loop is finished, return to the main function
570 return;
571}
572//!@}
573
574
575//!-----------------------------------------------------------
576// @name get_input_filename
577//
578// @desc get name of the input file
579//
580// @return Name of the Input file
581//
582// @date Mon Sep 14 13:27:56 MET DST 1998
583//------------------------------------------------------------
584// @function
585
586//!@{
587char *
588get_input_filename(void)
589{
590 return (Input_filename);
591}
592//!@}
593
594
595//!-----------------------------------------------------------
596// @name get_starfield_filename
597//
598// @desc get name of the starfield input file
599//
600// @return Name of the starfield file
601//
602// @date Tue Feb 15 16:02:18 CET 2000
603//------------------------------------------------------------
604// @function
605
606//!@{
607char *
608get_starfield_filename(void)
609{
610 return (Starfield_filename);
611}
612//!@}
613
614
615//!-----------------------------------------------------------
616// @name get_starfield_center
617//
618// @desc get center of the starfield FOV
619//
620// @return Central co-ordinates in RA and DEC for the centre of FOV
621//
622// @date Tue Feb 15 16:02:18 CET 2000
623//------------------------------------------------------------
624// @function
625
626//!@{
627void get_starfield_center(int *rh,int *rm,int *rs,int *dd,int *dm,int *ds)
628{
629 *rh=Starfield_center[0];
630 *rm=Starfield_center[1];
631 *rs=Starfield_center[2];
632 *dd=Starfield_center[3];
633 *dm=Starfield_center[4];
634 *ds=Starfield_center[5];
635}
636//!@}
637
638//!-----------------------------------------------------------
639// @name get_data_filename
640//
641// @desc get name of the data file
642//
643// @return Name of the Data file
644//
645// @date Mon Sep 14 13:27:56 MET DST 1998
646//------------------------------------------------------------
647// @function
648
649//!@{
650char *
651get_data_filename(void)
652{
653 return (Data_filename);
654}
655//!@}
656
657
658//!-----------------------------------------------------------
659// @name get_root_filename
660//
661// @desc get name of the ROOT file
662//
663// @return Name of the ROOT file
664//
665// @date Mon Sep 14 13:27:56 MET DST 1998
666//------------------------------------------------------------
667// @function
668
669//!@{
670char *
671get_root_filename(void)
672{
673 return (ROOT_filename);
674}
675//!@}
676//!-----------------------------------------------------------
677// @name get_loop_filename
678//
679// @desc get name of the special ROOT file
680//
681// @return Name of the special ROOT file
682//
683// @date Fri Jun 23 17:34:19 CEST 2000
684//------------------------------------------------------------
685// @function
686
687//!@{
688
689char *
690get_loop_filename(void)
691{
692 return (Loop_filename);
693}
694
695//!-----------------------------------------------------------
696// @name get_ct_filename
697//
698// @desc get name of CT definition file
699//
700// @return Name of the CT definition file
701//
702// @date Mon Sep 14 13:27:56 MET DST 1998
703//------------------------------------------------------------
704// @function
705
706//!@{
707char *
708get_ct_filename(void)
709{
710 return (CT_filename);
711}
712//!@}
713
714//!-----------------------------------------------------------
715// @name get_nsb_directory
716//
717// @desc get name of the directory where the database for NSB is
718//
719// @return Name of the NSB directory
720//
721// @date Tue Jan 30 12:07:56 MET 2001
722//------------------------------------------------------------
723// @function
724
725//!@{
726char *
727get_nsb_directory(void)
728{
729 return (NSB_directory);
730}
731//!@}
732
733
734
735//!-----------------------------------------------------------
736// @name add_elec_noise
737//
738// @desc are we going to add the ElecNoise?
739//
740// @date Mon Jan 14 19:27:56 MET DST 2002
741//------------------------------------------------------------
742// @function
743
744//!@{
745int
746add_elec_noise(float *fadc, float *trig)
747{
748 *fadc = FADC_Noise;
749 *trig = Trig_Noise;
750 return ( ElecNoise);
751}
752//!@}
753
754//!-----------------------------------------------------------
755// @name get_nsb
756//
757// @desc are we going to simulate NSB ?
758//
759// @var *n Mean value for the NSB (ph.e./pixel)
760// @return TRUE: we'll simulate NSB; FALSE: we won't
761//
762// @date Mon Sep 14 13:27:56 MET DST 1998
763//------------------------------------------------------------
764// @function
765
766//!@{
767int
768get_nsb(float *n, int *m)
769{
770 *n = meanNSB;
771 *m = nphe2NSB;
772 return ( simulateNSB );
773}
774//!@}
775
776
777//!-----------------------------------------------------------
778// @name get_threshold
779//
780// @desc get threshold value
781//
782// @return Value of the threshold q$_0$
783//
784// @date Mon Sep 14 13:27:56 MET DST 1998
785//------------------------------------------------------------
786// @function
787
788//!@{
789void
790get_threshold(float *t)
791{
792 for(int i=0;i<TRIGGER_PIXELS;i++)
793 t[i]=qThreshold[i];
794}
795//!@}
796
797
798//!-----------------------------------------------------------
799// @name get_indi_thres_pixel
800//
801// @desc get boolean information about global (FALSE) or
802// @desc individual (TRUE) pixel trigger threshold
803//
804// @return Value for the Individual_Thres
805//
806// @date Wed Jul 18 16:29:43 CEST 2001
807//------------------------------------------------------------
808// @function
809
810//!@{
811int get_indi_thres_pixel(void){
812 return Individual_Thres;
813}
814//!@}
815
816
817//!-----------------------------------------------------------
818// @name get_tail_cut
819//
820// @desc get tail cut value
821//
822// @return Value for the Tail-cut
823//
824// @date Mon Sep 14 13:27:56 MET DST 1998
825//------------------------------------------------------------
826// @function
827
828//!@{
829float
830get_tail_cut(void)
831{
832 return( qTailCut );
833}
834//!@}
835
836
837//!-----------------------------------------------------------
838// @name get_islands_cut
839//
840// @desc are we going to count the islands ?
841//
842// @var *n Cut on islands number
843// @return TRUE: we'll count the islands; FALSE: we won't
844//
845// @date Mon Sep 14 13:27:56 MET DST 1998
846//------------------------------------------------------------
847// @function
848
849//!@{
850int
851get_islands_cut(int *n)
852{
853 *n = nIslandsCut;
854 return ( countIslands );
855}
856//!@}
857
858
859//!-----------------------------------------------------------
860// @name get_ana_pixels
861//
862// @desc number of pixels for the analysis
863//
864// @return Number of pixels to use in the image parameters
865//
866// @date Mon Sep 14 13:27:56 MET DST 1998
867//------------------------------------------------------------
868// @function
869
870//!@{
871int
872get_ana_pixels(void)
873{
874 return ( anaPixels );
875}
876//!@}
877
878
879//!-----------------------------------------------------------
880// @name get_seeds
881//
882// @desc are we going to count the islands ?
883//
884// @var *n Number of the seed
885// @return N-th random-number Seed
886//
887// @date Mon Sep 14 13:27:56 MET DST 1998
888//------------------------------------------------------------
889// @function
890
891//!@{
892long int
893get_seeds(int n)
894{
895 return ( Seeds[n] );
896}
897//!@}
898
899
900//!-----------------------------------------------------------
901// @name get_skip_showers
902//
903// @desc get list of showers to skip
904//
905// @var *s1 Pointer to a vector of number of showers
906//
907// @date Mon Sep 14 13:27:56 MET DST 1998
908//------------------------------------------------------------
909// @function
910
911//!@{
912void
913get_skip_showers( int *s )
914{
915 int i;
916 for (i=0; i<nSkip; ++i)
917 s[i] = Skip[i];
918}
919//!@}
920
921
922//!-----------------------------------------------------------
923// @name get_nskip_showers
924//
925// @desc get number of showers to skip
926//
927// @return Number of showers to be skipped
928//
929// @date Mon Sep 14 13:27:56 MET DST 1998
930//------------------------------------------------------------
931// @function
932
933//!@{
934int
935get_nskip_showers( void )
936{
937 return( nSkip );
938}
939//!@}
940
941
942//!-----------------------------------------------------------
943// @name get_data_from_stdin
944//
945// @desc get whether we will read the data from the STDIN
946//
947// @return TRUE: we'll read data from STDIN; FALSE: we won't
948//
949// @date Wed Nov 25 13:21:00 MET 1998
950//------------------------------------------------------------
951// @function
952
953//!@{
954int
955get_data_from_stdin(void)
956{
957 return ( Data_From_STDIN );
958}
959//!@}
960
961
962//!-----------------------------------------------------------
963// @name get_read_phe
964//
965// @desc get whether we will read PHE files
966//
967// @return TRUE: we'll read PHE files; FALSE: we won't
968//
969// @date Wed Nov 25 13:21:00 MET 1998
970//------------------------------------------------------------
971// @function
972
973//!@{
974int
975get_read_phe(void)
976{
977 return ( Read_Phe );
978}
979//!@}
980
981
982//!-----------------------------------------------------------
983// @name get_read_phe_all
984//
985// @desc get whether we will read PHE files, with write_all_events
986//
987// @return TRUE: we'll do it; FALSE: we won't
988//
989// @date Wed Nov 25 13:21:00 MET 1998
990//------------------------------------------------------------
991// @function
992
993//!@{
994int
995get_read_phe_all(void)
996{
997 return ( Read_Phe_All );
998}
999//!@}
1000
1001
1002//!-----------------------------------------------------------
1003// @name write_all_events
1004//
1005// @desc write all images to .phe, even those without trigger
1006//
1007// @return TRUE: we'll write everything; FALSE: we won't
1008//
1009// @date Wed Nov 25 13:21:00 MET 1998
1010//------------------------------------------------------------
1011// @function
1012
1013//!@{
1014int
1015get_write_all_events(void)
1016{
1017 return ( Write_All_Images );
1018}
1019//!@}
1020
1021
1022//!-----------------------------------------------------------
1023// @name write_all_data
1024//
1025// @desc write single pixel data to file .dat
1026//
1027// @return TRUE: we'll write everything; FALSE: we won't
1028//
1029// @date Wed Nov 25 13:21:00 MET 1998
1030//------------------------------------------------------------
1031// @function
1032
1033//!@{
1034int
1035get_write_all_data(void)
1036{
1037 return ( Write_All_Data );
1038}
1039//!@}
1040
1041//!-----------------------------------------------------------
1042// @name write_McEvt
1043//
1044// @desc write the McEvt class for each event to the .root file
1045//
1046// @return TRUE: we'll write it; FALSE: we won't
1047//
1048//------------------------------------------------------------
1049// @function
1050
1051//!@{
1052int
1053get_write_McEvt(void)
1054{
1055 return ( Write_McEvt );
1056}
1057//!@}
1058
1059//!-----------------------------------------------------------
1060// @name write_McTrig
1061//
1062// @desc write the McTrig class for each event to the .root file
1063//
1064// @return TRUE: we'll write it; FALSE: we won't
1065//
1066//------------------------------------------------------------
1067// @function
1068
1069//!@{
1070int
1071get_write_McTrig(void)
1072{
1073 return ( Write_McTrig );
1074}
1075//!@}
1076
1077//!-----------------------------------------------------------
1078// @name write_McFadc
1079//
1080// @desc write the McFadc class for each event to the .root file
1081//
1082// @return TRUE: we'll write it; FALSE: we won't
1083//
1084//------------------------------------------------------------
1085// @function
1086
1087//!@{
1088int
1089get_write_McFadc(void)
1090{
1091 return ( Write_McFadc );
1092}
1093//!@}
1094
1095//!-----------------------------------------------------------
1096// @name write_RawEvt
1097//
1098// @desc write the RawEvt class for each event to the .root file
1099//
1100// @return TRUE: we'll write it; FALSE: we won't
1101//
1102//------------------------------------------------------------
1103// @function
1104
1105//!@{
1106int
1107get_write_RawEvt(void)
1108{
1109 return ( Write_RawEvt );
1110}
1111//!@}
1112
1113//!-----------------------------------------------------------
1114// @name get_select_energy
1115//
1116// @desc return energy range allowed for showers from .phe file
1117//
1118// @var *le Lower limit in the allowed energy range
1119// @var *ue Lower limit in the allowed energy range
1120// @return TRUE: we make selection on the energy; FALSE: we don't
1121//
1122// @date Wed Nov 25 13:21:00 MET 1998
1123//------------------------------------------------------------
1124// @function
1125
1126//!@{
1127int
1128get_select_energy(float *le, float *ue)
1129{
1130 *le = Select_Energy_le;
1131 *ue = Select_Energy_ue;
1132 return ( Select_Energy );
1133}
1134//!@}
1135
1136
1137//!-----------------------------------------------------------
1138// @name get_trigger_radius
1139//
1140// @desc return the radius of the trigger area in the camera (if set)
1141//
1142// @var *radius Radius of the trigger area in the camera
1143// @return TRUE: we choose a given radius for the trigger area
1144//
1145// @date Fri May 7 11:07:43 MET DST 1999
1146//------------------------------------------------------------
1147// @function
1148
1149//!@{
1150int get_trigger_radius(float *radius)
1151{
1152 *radius = Trigger_Radius;
1153 return ( Set_Trigger_Radius );
1154}
1155//!@}
1156
1157
1158//!-----------------------------------------------------------
1159// @name get_trigger_radius
1160//
1161// @desc return the radius of the trigger area in the camera (if set)
1162//
1163// @var *radius Radius of the trigger area in the camera
1164// @return TRUE: we choose a given radius for the trigger area
1165//
1166// @date Fri May 7 11:07:43 MET DST 1999
1167//------------------------------------------------------------
1168// @function
1169
1170//!@{
1171int get_correction(float *corr)
1172{
1173 *corr = fCorrection;
1174 return ( Apply_Correction );
1175}
1176//!@}
1177
1178//!-----------------------------------------------------------
1179// @name FADC_Scan
1180//
1181// @desc show the FADC signal for each event in the screen
1182//
1183// @return TRUE: we'll show it; FALSE: we won't
1184//
1185//------------------------------------------------------------
1186// @function
1187
1188//!@{
1189int
1190get_FADC_Scan(void)
1191{
1192 return ( FADC_Scan );
1193}
1194//!@}
1195
1196//!-----------------------------------------------------------
1197// @name Trigger_Scan
1198//
1199// @desc show the Trigger signal for each event in the screen
1200//
1201// @return TRUE: we'll show it; FALSE: we won't
1202//
1203//------------------------------------------------------------
1204// @function
1205
1206//!@{
1207int
1208get_Trigger_Scan(void)
1209{
1210 return ( Trigger_Scan );
1211}
1212//!@}
1213
1214//!-----------------------------------------------------------
1215// @name Fadc_Propeties
1216//
1217// @desc fix properties of the FADC response
1218//
1219//------------------------------------------------------------
1220// @function
1221
1222//!@{
1223void
1224get_FADC_properties(float *ra, float *rf)
1225{
1226 *ra=FADC_response_ampl;
1227 *rf=FADC_response_fwhm;
1228
1229}
1230//!@}
1231
1232//!-----------------------------------------------------------
1233// @name Trigger_Propeties
1234//
1235// @desc fix properties of the diskriminator and amplifier for Trigger
1236//
1237//------------------------------------------------------------
1238// @function
1239
1240//!@{
1241void
1242get_Trigger_properties(float *gl, float *ot, float *ra, float *rf)
1243{
1244 *gl=Trigger_gate_length;
1245 *ot=Trigger_over_time;
1246 *ra=Trigger_response_ampl;
1247 *rf=Trigger_response_fwhm;
1248
1249}
1250//!@}
1251
1252//!-----------------------------------------------------------
1253// @name Trigger_Loop
1254//
1255// @desc make a loop over Trigger conditions
1256//
1257// @return TRUE: we'll make it; FALSE: we won't
1258//
1259//------------------------------------------------------------
1260// @function
1261
1262//!@{
1263int
1264get_Trigger_Loop(float *lt, float *ut, float *st, int *lm, int *um, int *lg, int *ug)
1265{
1266 *lt=Trigger_loop_lthres;
1267 *ut=Trigger_loop_uthres;
1268 *st=Trigger_loop_sthres;
1269 *lm=Trigger_loop_lmult;
1270 *um=Trigger_loop_umult;
1271 *lg=Trigger_loop_ltop;
1272 *ug=Trigger_loop_utop;
1273 return ( Trigger_Loop );
1274}
1275//!@}
1276
1277//!-----------------------------------------------------------
1278// @name Trigger_Single
1279//
1280// @desc fix Trigger conditions
1281//
1282//------------------------------------------------------------
1283// @function
1284
1285//!@{
1286void
1287get_Trigger_Single(float *t, int *m, int *g)
1288{
1289 for(int i=0;i<TRIGGER_PIXELS;i++)
1290 t[i]=qThreshold[i];
1291 *m=Trigger_multiplicity;
1292 *g=Trigger_topology;
1293
1294}
1295//!@}
1296
1297//!-----------------------------------------------------------
1298// @name get_teles_axis
1299//
1300// @desc give axis of the telescope
1301//
1302//------------------------------------------------------------
1303// @function
1304
1305//!@{
1306void get_teles_axis(float *th, float *p){
1307 *th=Telescope_axis_th;
1308 *p=Telescope_axis_ph;
1309}
1310//!@}
1311
1312//!-----------------------------------------------------------
1313// @name get_source_off
1314//
1315// @desc give the offset of the source to the center of the camera
1316//
1317//------------------------------------------------------------
1318// @function
1319
1320//!@{
1321void get_source_off(float *th, float *p){
1322 *th=Source_offset_th;
1323 *p=Source_offset_ph;
1324}
1325//!@}
1326
1327//!-----------------------------------------------------------
1328// @name get_corsika_vers
1329//
1330// @desc give the vrsion of corsika
1331//
1332//------------------------------------------------------------
1333// @function
1334
1335//!@{
1336int get_corsika_ver(void){
1337 return(Corsika_vers);
1338}
1339//!@}
1340
1341
1342//=------------------------------------------------------------
1343//!@subsection Log of this file.
1344
1345//!@{
1346//
1347// $Log: not supported by cvs2svn $
1348// Revision 1.14 2002/02/28 15:07:23 blanch
1349// Small changes have been done to introduce thes step variable for the
1350// discriminator threshold in the trigger loop mode.
1351//
1352// Revision 1.13 2002/01/18 17:43:08 blanch
1353// Three new commands have been added: fadc_noise, trig_noise and
1354// elec_noise_off.
1355// A small bug in the SIGNATURE check has been solved.
1356//
1357// Revision 1.12 2001/11/13 17:05:14 blanch
1358// New input items int the input card parameter list have been included to fill
1359// the MMcRunHeader.
1360// There has been also some change to remove warnings in the compilation.
1361//
1362// Revision 1.11 2001/07/25 11:38:00 magicsol
1363// Minnor changes
1364//
1365// Revision 1.10 2001/07/19 09:28:30 blanch
1366// A new command, which allows to set individual trigger threshod for each pixel,
1367// has been added.
1368//
1369// Revision 1.9 2001/03/05 10:43:18 blanch
1370// New input commands have been added:
1371//
1372// - write_McFadc: to write the FADC simulation information.
1373// - fadc_prop: gives the shape of the single phe response of the FADC
1374//
1375// And new value has been added in the mean_NSB command that tells how many phes
1376// have to come from the shower to do the NSB simulation in that shower (it speeds
1377// up the simulation).
1378//
1379// Revision 1.8 2001/02/23 10:55:43 magicsol
1380// An input commmand that talls the path for the NSB database has been added.
1381//
1382// Revision 1.7 2001/01/15 12:37:48 magicsol
1383// It has been introduced the option to read from the input card the overlaping
1384// time.
1385//
1386// Revision 1.6 2000/09/21 11:47:33 harald
1387// Oscar found some smaller errors in the calculation of the pixel shape and
1388// corrected it.
1389//
1390// Revision 1.5 2000/07/04 14:13:02 MagicSol
1391// It reads from the general input card the parameters for the
1392// trigger analysi.
1393//
1394// Revision 1.4 2000/05/11 14:22:33 blanch
1395// New input card option has been introduced:
1396// trigger_loop lt ut lm um lg ug
1397// It forces the camera program to study several condition trigger implementations. Integers after key word fix limits of loop over thershold, multiplicity and topology.
1398//
1399// Revision 1.3 2000/03/24 18:14:05 blanch
1400// Parameters that tell as if we are going to see the diskriminator and/or FADC signal have been included.
1401//
1402// Revision 1.2 2000/02/18 17:45:43 petry
1403// This version belongs to camera.cxx 1.5.
1404// It has been put in the repository in order to be
1405// able to share the further development with others.
1406//
1407// If you need something working, wait or take an earlier one.
1408// See file README
1409//
1410// Revision 1.1.1.1 1999/11/05 11:59:34 harald
1411// This the starting point for CVS controlled further developments of the
1412// camera program. The program was originally written by Jose Carlos.
1413// But here you can find a "rootified" version to the program. This means
1414// that there is no hbook stuff in it now. Also the output of the
1415// program changed to the MagicRawDataFormat.
1416//
1417// The "rootification" was done by Dirk Petry and Harald Kornmayer.
1418//
1419// In the following you can see the README file of that version:
1420//
1421// ==================================================
1422//
1423// Fri Oct 22 1999 D.P.
1424//
1425// The MAGIC Monte Carlo System
1426//
1427// Camera Simulation Programme
1428// ---------------------------
1429//
1430// 1) Description
1431//
1432// This version is the result of the fusion of H.K.'s
1433// root_camera which is described below (section 2)
1434// and another version by D.P. which had a few additional
1435// useful features.
1436//
1437// The version compiles under Linux with ROOT 2.22 installed
1438// (variable ROOTSYS has to be set).
1439//
1440// Compile as before simply using "make" in the root_camera
1441// directory.
1442//
1443// All features of H.K.'s root_camera were retained.
1444//
1445// Additional features of this version are:
1446//
1447// a) HBOOK is no longer used and all references are removed.
1448//
1449// b) Instead of HBOOK, the user is given now the possibility of
1450// having Diagnostic data in ROOT format as a complement
1451// to the ROOT Raw data.
1452//
1453// This data is written to the file which is determined by
1454// the new input parameter "diag_file" in the camera parameter
1455// file.
1456//
1457// All source code file belonging to this part have filenames
1458// starting with "MDiag".
1459//
1460// The user can read the output file using the following commands
1461// in an interactive ROOT session:
1462//
1463// root [0] .L MDiag.so
1464// root [1] new TFile("diag.root");
1465// root [2] new TTreeViewer("T");
1466//
1467// This brings up a viewer from which all variables of the
1468// TTree can be accessed and histogrammed. This example
1469// assumes that you have named the file "diag.root", that
1470// you are using ROOT version 2.22 or later and that you have
1471// the shared object library "MDiag.so" which is produced
1472// by the Makefile along with the executable "camera".
1473//
1474// ! The contents of the so-called diag file is not yet fixed.
1475// ! At the moment it is what J.C.G. used to put into the HBOOK
1476// ! ntuple. In future versions the moments calculation can be
1477// ! removed and the parameter list be modified correspondingly.
1478//
1479// c) Now concatenated reflector files can be read. This is useful
1480// if you have run the reflector with different parameters but
1481// you want to continue the analysis with all reflector data
1482// going into ONE ROOT outputfile.
1483//
1484// The previous camera version contained a bug which made reading
1485// of two or more concatenated reflector files impossible.
1486//
1487// d) The reflector output format was changed. It is now version
1488// 0.4 .
1489// The change solely consists in a shortening of the flag
1490// definition in the file
1491//
1492// include-MC/MCCphoton.hxx
1493//
1494// ! IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
1495// ! do so by recompiling camera with the previous version of
1496// ! include-MC/MCCphoton.hxx.
1497//
1498// The change was necessary for saving space and better
1499// debugging. From now on, this format can be frozen.
1500//
1501// ! For producing reflector output in the new format, you
1502// ! of course have to recompile your reflector with the
1503// ! new include-MC/MCCphoton.hxx .
1504//
1505// e) A first version of the pixelization with the larger
1506// outer pixels is implemented. THIS IS NOT YET FULLY
1507// TESTED, but first rough tests show that it works
1508// at least to a good approximation.
1509//
1510// The present version implements the camera outline
1511// with 18 "gap-pixels" and 595 pixels in total as
1512// shown in
1513//
1514// http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
1515//
1516// This change involved
1517//
1518// (i) The file pixels.dat is no longer needed. Instead
1519// the coordinates are generated by the program itself
1520// (takes maybe 1 second). In the file
1521//
1522// pixel-coords.txt
1523//
1524// in the same directory as this README, you find a list
1525// of the coordinates generated by this new routine. It
1526// has the format
1527//
1528// number i j x y size-factor
1529//
1530// where i and j are J.C.G.'s so called biaxis hexagonal
1531// coordinates (for internal use) and x and y are the
1532// coordinates of the pixel centers in the standard camera
1533// coordinate system in units of centimeters. The value
1534// of "size-factor" determines the linear size of the pixel
1535// relative to the central pixels.
1536//
1537// (ii) The magic.def file has two additional parameters
1538// which give the number of central pixels and the
1539// number of gap pixels
1540//
1541// (iii) In camera.h and camera.cxx several changes were
1542// necessary, among them the introduction of several
1543// new functions
1544//
1545// The newly suggested outline with asymmetric Winston cones
1546// will be implemented in a later version.
1547//
1548// f) phe files can no longer be read since this contradicts
1549// our philosophy that the analysis should be done with other
1550// programs like e.g. EVITA and not with "camera" itself.
1551// This possibility was removed.
1552//
1553// g) ROOT is no longer invoked with an interactive interface.
1554// In this way, camera can better be run as a batch program and
1555// it uses less memory.
1556//
1557// h) small changes concerning the variable "t_chan" were necessary in
1558// order to avoid segmentation faults: The variable is used as an
1559// index and it went sometimes outside the limits when camera
1560// was reading proton data. This is because the reflector files
1561// don't contain the photons in a chronological order and also
1562// the timespread can be considerably longer that the foreseen
1563// digitisation timespan. Please see the source code of camera.cxx
1564// round about line 1090.
1565//
1566// j) several unused variables were removed, a few warning messages
1567// occur when you compile camera.cxx but these can be ignored at
1568// the moment.
1569//
1570// In general the program is of course not finished. It still needs
1571// debugging, proper trigger simulation, simulation of the asymmetric
1572// version of the outer pixels, proper NSB simulation, adaption of
1573// the diag "ntuple" contents to our need and others small improvements.
1574//
1575// In the directory rfl-files there is now a file in reflector format 0.4
1576// containing a single event produced by the starfiled adder. It has
1577// a duration of 30 ns and represents the region around the Crab Nebula.
1578// Using the enclosed input parameter file, camera should process this
1579// file without problems.
1580//
1581// 2) The README for the previous version of root_camera
1582//
1583// README for a preliminary version of the
1584// root_camera program.
1585//
1586// root_camera is based on the program "camera"of Jose Carlos
1587// Gonzalez. It was changed in the way that only the pixelisation
1588// and the distibution of the phe to the FADCs works in a
1589// first version.
1590//
1591// Using the #undef command most possibilities of the orignal
1592// program are switched of.
1593//
1594// The new parts are signed by
1595//
1596// - ROOT or __ROOT__
1597// nearly all important codelines for ROOT output are enclosed
1598// in structures like
1599// #ifdef __ROOT__
1600//
1601// code
1602//
1603// #endif __ROOT__
1604//
1605// In same case the new lines are signed by a comment with the word
1606// ROOT in it.
1607//
1608// For timing of the pulse some variable names are changed.
1609// (t0, t1, t --> t_ini, t_fin, t_1st, t_chan,...)
1610// Look also for this changes.
1611//
1612// For the new root-file is also a change in readparm-files
1613//
1614//
1615// - __DETAIL_TRIGGER__
1616//
1617// This is for the implementation of the current work on trigger
1618// studies. Because the class MTrigger is not well documented it
1619// isn´t a part of this tar file. Only a dummy File exists.
1620//
1621//
1622//
1623// With all files in the archive, the root_camera program should run.
1624//
1625// A reflector file is in the directory rfl-files
1626//
1627// ==================================================
1628//
1629// From now on, use CVS for development!!!!
1630//
1631//
1632//
1633// Revision 1.2 1999/10/22 15:01:28 petry
1634// version sent to H.K. and N.M. on Fri Oct 22 1999
1635//
1636// Revision 1.1.1.1 1999/10/21 16:35:11 petry
1637// first synthesised version
1638//
1639// Revision 1.6 1999/03/15 14:59:08 gonzalez
1640// camera-1_1
1641//
1642// Revision 1.5 1999/03/02 09:56:12 gonzalez
1643// *** empty log message ***
1644//
1645// Revision 1.4 1999/01/14 17:32:41 gonzalez
1646// Added to camera the STDIN input option (data_from_input)
1647//
1648//!@}
1649
1650//=EOF
Note: See TracBrowser for help on using the repository browser.