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

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