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

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