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

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