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

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