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

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