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

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