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

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