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

Last change on this file since 427 was 409, checked in by MagicSol, 24 years ago
It reads from the general input card the parameters for the trigger analysi.
File size: 34.4 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.5 $
22//= $Author: MagicSol $
23//= $Date: 2000-07-04 14:13:02 $
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 = TRUE;
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 simulateNSB = TRUE;
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", token, &Trigger_gate_length, &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
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
425 break;
426
427 case Trigger_Loop_Output_Only_Specialists:
428
429 // get the name of the data_file from the line
430 sscanf(line, "%s %s", token, Loop_filename);
431 cout << '[' << Loop_filename << ']' << endl << flush;
432
433 // change boolean value
434 Write_RawEvt = TRUE;
435
436 break;
437
438 case end_file: //@< end of the parameters file
439
440 // show a short message
441 is_end = TRUE;
442
443 break;
444
445 } // switch ( i )
446
447 } // while (! is_end)
448
449 // after the loop is finished, return to the main function
450 return;
451}
452//!@}
453
454
455//!-----------------------------------------------------------
456// @name get_input_filename
457//
458// @desc get name of the input file
459//
460// @return Name of the Input file
461//
462// @date Mon Sep 14 13:27:56 MET DST 1998
463//------------------------------------------------------------
464// @function
465
466//!@{
467char *
468get_input_filename(void)
469{
470 return (Input_filename);
471}
472//!@}
473
474
475//!-----------------------------------------------------------
476// @name get_starfield_filename
477//
478// @desc get name of the starfield input file
479//
480// @return Name of the starfield file
481//
482// @date Tue Feb 15 16:02:18 CET 2000
483//------------------------------------------------------------
484// @function
485
486//!@{
487char *
488get_starfield_filename(void)
489{
490 return (Starfield_filename);
491}
492//!@}
493
494
495//!-----------------------------------------------------------
496// @name get_data_filename
497//
498// @desc get name of the data file
499//
500// @return Name of the Data file
501//
502// @date Mon Sep 14 13:27:56 MET DST 1998
503//------------------------------------------------------------
504// @function
505
506//!@{
507char *
508get_data_filename(void)
509{
510 return (Data_filename);
511}
512//!@}
513
514
515//!-----------------------------------------------------------
516// @name get_root_filename
517//
518// @desc get name of the ROOT file
519//
520// @return Name of the ROOT file
521//
522// @date Mon Sep 14 13:27:56 MET DST 1998
523//------------------------------------------------------------
524// @function
525
526//!@{
527char *
528get_root_filename(void)
529{
530 return (ROOT_filename);
531}
532//!@}
533//!-----------------------------------------------------------
534// @name get_loop_filename
535//
536// @desc get name of the special ROOT file
537//
538// @return Name of the special ROOT file
539//
540// @date Fri Jun 23 17:34:19 CEST 2000
541//------------------------------------------------------------
542// @function
543
544//!@{
545
546char *
547get_loop_filename(void)
548{
549 return (Loop_filename);
550}
551
552//!-----------------------------------------------------------
553// @name get_ct_filename
554//
555// @desc get name of CT definition file
556//
557// @return Name of the CT definition file
558//
559// @date Mon Sep 14 13:27:56 MET DST 1998
560//------------------------------------------------------------
561// @function
562
563//!@{
564char *
565get_ct_filename(void)
566{
567 return (CT_filename);
568}
569//!@}
570
571
572//!-----------------------------------------------------------
573// @name get_nsb
574//
575// @desc are we going to simulate NSB ?
576//
577// @var *n Mean value for the NSB (ph.e./pixel)
578// @return TRUE: we'll simulate NSB; FALSE: we won't
579//
580// @date Mon Sep 14 13:27:56 MET DST 1998
581//------------------------------------------------------------
582// @function
583
584//!@{
585int
586get_nsb(float *n)
587{
588 *n = meanNSB;
589 return ( simulateNSB );
590}
591//!@}
592
593
594//!-----------------------------------------------------------
595// @name get_threshold
596//
597// @desc get threshold value
598//
599// @return Value of the threshold q$_0$
600//
601// @date Mon Sep 14 13:27:56 MET DST 1998
602//------------------------------------------------------------
603// @function
604
605//!@{
606float
607get_threshold(void)
608{
609 return( qThreshold );
610}
611//!@}
612
613
614//!-----------------------------------------------------------
615// @name get_tail_cut
616//
617// @desc get tail cut value
618//
619// @return Value for the Tail-cut
620//
621// @date Mon Sep 14 13:27:56 MET DST 1998
622//------------------------------------------------------------
623// @function
624
625//!@{
626float
627get_tail_cut(void)
628{
629 return( qTailCut );
630}
631//!@}
632
633
634//!-----------------------------------------------------------
635// @name get_islands_cut
636//
637// @desc are we going to count the islands ?
638//
639// @var *n Cut on islands number
640// @return TRUE: we'll count the islands; FALSE: we won't
641//
642// @date Mon Sep 14 13:27:56 MET DST 1998
643//------------------------------------------------------------
644// @function
645
646//!@{
647int
648get_islands_cut(int *n)
649{
650 *n = nIslandsCut;
651 return ( countIslands );
652}
653//!@}
654
655
656//!-----------------------------------------------------------
657// @name get_ana_pixels
658//
659// @desc number of pixels for the analysis
660//
661// @return Number of pixels to use in the image parameters
662//
663// @date Mon Sep 14 13:27:56 MET DST 1998
664//------------------------------------------------------------
665// @function
666
667//!@{
668int
669get_ana_pixels(void)
670{
671 return ( anaPixels );
672}
673//!@}
674
675
676//!-----------------------------------------------------------
677// @name get_seeds
678//
679// @desc are we going to count the islands ?
680//
681// @var *n Number of the seed
682// @return N-th random-number Seed
683//
684// @date Mon Sep 14 13:27:56 MET DST 1998
685//------------------------------------------------------------
686// @function
687
688//!@{
689long int
690get_seeds(int n)
691{
692 return ( Seeds[n] );
693}
694//!@}
695
696
697//!-----------------------------------------------------------
698// @name get_skip_showers
699//
700// @desc get list of showers to skip
701//
702// @var *s1 Pointer to a vector of number of showers
703//
704// @date Mon Sep 14 13:27:56 MET DST 1998
705//------------------------------------------------------------
706// @function
707
708//!@{
709void
710get_skip_showers( int *s )
711{
712 int i;
713 for (i=0; i<nSkip; ++i)
714 s[i] = Skip[i];
715}
716//!@}
717
718
719//!-----------------------------------------------------------
720// @name get_nskip_showers
721//
722// @desc get number of showers to skip
723//
724// @return Number of showers to be skipped
725//
726// @date Mon Sep 14 13:27:56 MET DST 1998
727//------------------------------------------------------------
728// @function
729
730//!@{
731int
732get_nskip_showers( void )
733{
734 return( nSkip );
735}
736//!@}
737
738
739//!-----------------------------------------------------------
740// @name get_data_from_stdin
741//
742// @desc get whether we will read the data from the STDIN
743//
744// @return TRUE: we'll read data from STDIN; FALSE: we won't
745//
746// @date Wed Nov 25 13:21:00 MET 1998
747//------------------------------------------------------------
748// @function
749
750//!@{
751int
752get_data_from_stdin(void)
753{
754 return ( Data_From_STDIN );
755}
756//!@}
757
758
759//!-----------------------------------------------------------
760// @name get_read_phe
761//
762// @desc get whether we will read PHE files
763//
764// @return TRUE: we'll read PHE files; FALSE: we won't
765//
766// @date Wed Nov 25 13:21:00 MET 1998
767//------------------------------------------------------------
768// @function
769
770//!@{
771int
772get_read_phe(void)
773{
774 return ( Read_Phe );
775}
776//!@}
777
778
779//!-----------------------------------------------------------
780// @name get_read_phe_all
781//
782// @desc get whether we will read PHE files, with write_all_images
783//
784// @return TRUE: we'll do it; FALSE: we won't
785//
786// @date Wed Nov 25 13:21:00 MET 1998
787//------------------------------------------------------------
788// @function
789
790//!@{
791int
792get_read_phe_all(void)
793{
794 return ( Read_Phe_All );
795}
796//!@}
797
798
799//!-----------------------------------------------------------
800// @name write_all_images
801//
802// @desc write all images to .phe, even those without trigger
803//
804// @return TRUE: we'll write everything; FALSE: we won't
805//
806// @date Wed Nov 25 13:21:00 MET 1998
807//------------------------------------------------------------
808// @function
809
810//!@{
811int
812get_write_all_images(void)
813{
814 return ( Write_All_Images );
815}
816//!@}
817
818
819//!-----------------------------------------------------------
820// @name write_all_data
821//
822// @desc write single pixel data to file .dat
823//
824// @return TRUE: we'll write everything; FALSE: we won't
825//
826// @date Wed Nov 25 13:21:00 MET 1998
827//------------------------------------------------------------
828// @function
829
830//!@{
831int
832get_write_all_data(void)
833{
834 return ( Write_All_Data );
835}
836//!@}
837
838//!-----------------------------------------------------------
839// @name write_McEvt
840//
841// @desc write the McEvt class for each event to the .root file
842//
843// @return TRUE: we'll write it; FALSE: we won't
844//
845//------------------------------------------------------------
846// @function
847
848//!@{
849int
850get_write_McEvt(void)
851{
852 return ( Write_McEvt );
853}
854//!@}
855
856//!-----------------------------------------------------------
857// @name write_McTrig
858//
859// @desc write the McTrig class for each event to the .root file
860//
861// @return TRUE: we'll write it; FALSE: we won't
862//
863//------------------------------------------------------------
864// @function
865
866//!@{
867int
868get_write_McTrig(void)
869{
870 return ( Write_McTrig );
871}
872//!@}
873
874//!-----------------------------------------------------------
875// @name write_RawEvt
876//
877// @desc write the RawEvt class for each event to the .root file
878//
879// @return TRUE: we'll write it; FALSE: we won't
880//
881//------------------------------------------------------------
882// @function
883
884//!@{
885int
886get_write_RawEvt(void)
887{
888 return ( Write_RawEvt );
889}
890//!@}
891
892//!-----------------------------------------------------------
893// @name get_select_energy
894//
895// @desc return energy range allowed for showers from .phe file
896//
897// @var *le Lower limit in the allowed energy range
898// @var *ue Lower limit in the allowed energy range
899// @return TRUE: we make selection on the energy; FALSE: we don't
900//
901// @date Wed Nov 25 13:21:00 MET 1998
902//------------------------------------------------------------
903// @function
904
905//!@{
906int
907get_select_energy(float *le, float *ue)
908{
909 *le = Select_Energy_le;
910 *ue = Select_Energy_ue;
911 return ( Select_Energy );
912}
913//!@}
914
915
916//!-----------------------------------------------------------
917// @name get_trigger_radius
918//
919// @desc return the radius of the trigger area in the camera (if set)
920//
921// @var *radius Radius of the trigger area in the camera
922// @return TRUE: we choose a given radius for the trigger area
923//
924// @date Fri May 7 11:07:43 MET DST 1999
925//------------------------------------------------------------
926// @function
927
928//!@{
929int get_trigger_radius(float *radius)
930{
931 *radius = Trigger_Radius;
932 return ( Set_Trigger_Radius );
933}
934//!@}
935
936
937//!-----------------------------------------------------------
938// @name get_trigger_radius
939//
940// @desc return the radius of the trigger area in the camera (if set)
941//
942// @var *radius Radius of the trigger area in the camera
943// @return TRUE: we choose a given radius for the trigger area
944//
945// @date Fri May 7 11:07:43 MET DST 1999
946//------------------------------------------------------------
947// @function
948
949//!@{
950int get_correction(float *corr)
951{
952 *corr = fCorrection;
953 return ( Apply_Correction );
954}
955//!@}
956
957//!-----------------------------------------------------------
958// @name FADC_Scan
959//
960// @desc show the FADC signal for each event in the screen
961//
962// @return TRUE: we'll show it; FALSE: we won't
963//
964//------------------------------------------------------------
965// @function
966
967//!@{
968int
969get_FADC_Scan(void)
970{
971 return ( FADC_Scan );
972}
973//!@}
974
975//!-----------------------------------------------------------
976// @name Trigger_Scan
977//
978// @desc show the Trigger signal for each event in the screen
979//
980// @return TRUE: we'll show it; FALSE: we won't
981//
982//------------------------------------------------------------
983// @function
984
985//!@{
986int
987get_Trigger_Scan(void)
988{
989 return ( Trigger_Scan );
990}
991//!@}
992
993//!-----------------------------------------------------------
994// @name Trigger_Propeties
995//
996// @desc fix properties of the diskriminator and amplifier for Trigger
997//
998//------------------------------------------------------------
999// @function
1000
1001//!@{
1002void
1003get_Trigger_properties(float *gl, float *ra, float *rf)
1004{
1005 *gl=Trigger_gate_length;
1006 *ra=Trigger_response_ampl;
1007 *rf=Trigger_response_fwhm;
1008}
1009//!@}
1010
1011//!-----------------------------------------------------------
1012// @name Trigger_Loop
1013//
1014// @desc make a loop over Trigger conditions
1015//
1016// @return TRUE: we'll make it; FALSE: we won't
1017//
1018//------------------------------------------------------------
1019// @function
1020
1021//!@{
1022int
1023get_Trigger_Loop(int *lt, int *ut, int *lm, int *um, int *lg, int *ug)
1024{
1025 *lt=Trigger_loop_lthres;
1026 *ut=Trigger_loop_uthres;
1027 *lm=Trigger_loop_lmult;
1028 *um=Trigger_loop_umult;
1029 *lg=Trigger_loop_ltop;
1030 *ug=Trigger_loop_utop;
1031 return ( Trigger_Loop );
1032}
1033//!@}
1034
1035//!-----------------------------------------------------------
1036// @name Trigger_Single
1037//
1038// @desc fix Trigger conditions
1039//
1040//------------------------------------------------------------
1041// @function
1042
1043//!@{
1044void
1045get_Trigger_Single(float *t, int *m, int *g)
1046{
1047 *t=Trigger_threshold;
1048 *m=Trigger_multiplicity;
1049 *g=Trigger_topology;
1050
1051}
1052//!@}
1053
1054//=------------------------------------------------------------
1055//!@subsection Log of this file.
1056
1057//!@{
1058//
1059// $Log: not supported by cvs2svn $
1060// Revision 1.4 2000/05/11 14:22:33 blanch
1061// New input card option has been introduced:
1062// trigger_loop lt ut lm um lg ug
1063// It forces the camera program to study several condition trigger implementations. Integers after key word fix limits of loop over thershold, multiplicity and topology.
1064//
1065// Revision 1.3 2000/03/24 18:14:05 blanch
1066// Parameters that tell as if we are going to see the diskriminator and/or FADC signal have been included.
1067//
1068// Revision 1.2 2000/02/18 17:45:43 petry
1069// This version belongs to camera.cxx 1.5.
1070// It has been put in the repository in order to be
1071// able to share the further development with others.
1072//
1073// If you need something working, wait or take an earlier one.
1074// See file README
1075//
1076// Revision 1.1.1.1 1999/11/05 11:59:34 harald
1077// This the starting point for CVS controlled further developments of the
1078// camera program. The program was originally written by Jose Carlos.
1079// But here you can find a "rootified" version to the program. This means
1080// that there is no hbook stuff in it now. Also the output of the
1081// program changed to the MagicRawDataFormat.
1082//
1083// The "rootification" was done by Dirk Petry and Harald Kornmayer.
1084//
1085// In the following you can see the README file of that version:
1086//
1087// ==================================================
1088//
1089// Fri Oct 22 1999 D.P.
1090//
1091// The MAGIC Monte Carlo System
1092//
1093// Camera Simulation Programme
1094// ---------------------------
1095//
1096// 1) Description
1097//
1098// This version is the result of the fusion of H.K.'s
1099// root_camera which is described below (section 2)
1100// and another version by D.P. which had a few additional
1101// useful features.
1102//
1103// The version compiles under Linux with ROOT 2.22 installed
1104// (variable ROOTSYS has to be set).
1105//
1106// Compile as before simply using "make" in the root_camera
1107// directory.
1108//
1109// All features of H.K.'s root_camera were retained.
1110//
1111// Additional features of this version are:
1112//
1113// a) HBOOK is no longer used and all references are removed.
1114//
1115// b) Instead of HBOOK, the user is given now the possibility of
1116// having Diagnostic data in ROOT format as a complement
1117// to the ROOT Raw data.
1118//
1119// This data is written to the file which is determined by
1120// the new input parameter "diag_file" in the camera parameter
1121// file.
1122//
1123// All source code file belonging to this part have filenames
1124// starting with "MDiag".
1125//
1126// The user can read the output file using the following commands
1127// in an interactive ROOT session:
1128//
1129// root [0] .L MDiag.so
1130// root [1] new TFile("diag.root");
1131// root [2] new TTreeViewer("T");
1132//
1133// This brings up a viewer from which all variables of the
1134// TTree can be accessed and histogrammed. This example
1135// assumes that you have named the file "diag.root", that
1136// you are using ROOT version 2.22 or later and that you have
1137// the shared object library "MDiag.so" which is produced
1138// by the Makefile along with the executable "camera".
1139//
1140// ! The contents of the so-called diag file is not yet fixed.
1141// ! At the moment it is what J.C.G. used to put into the HBOOK
1142// ! ntuple. In future versions the moments calculation can be
1143// ! removed and the parameter list be modified correspondingly.
1144//
1145// c) Now concatenated reflector files can be read. This is useful
1146// if you have run the reflector with different parameters but
1147// you want to continue the analysis with all reflector data
1148// going into ONE ROOT outputfile.
1149//
1150// The previous camera version contained a bug which made reading
1151// of two or more concatenated reflector files impossible.
1152//
1153// d) The reflector output format was changed. It is now version
1154// 0.4 .
1155// The change solely consists in a shortening of the flag
1156// definition in the file
1157//
1158// include-MC/MCCphoton.hxx
1159//
1160// ! IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
1161// ! do so by recompiling camera with the previous version of
1162// ! include-MC/MCCphoton.hxx.
1163//
1164// The change was necessary for saving space and better
1165// debugging. From now on, this format can be frozen.
1166//
1167// ! For producing reflector output in the new format, you
1168// ! of course have to recompile your reflector with the
1169// ! new include-MC/MCCphoton.hxx .
1170//
1171// e) A first version of the pixelization with the larger
1172// outer pixels is implemented. THIS IS NOT YET FULLY
1173// TESTED, but first rough tests show that it works
1174// at least to a good approximation.
1175//
1176// The present version implements the camera outline
1177// with 18 "gap-pixels" and 595 pixels in total as
1178// shown in
1179//
1180// http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
1181//
1182// This change involved
1183//
1184// (i) The file pixels.dat is no longer needed. Instead
1185// the coordinates are generated by the program itself
1186// (takes maybe 1 second). In the file
1187//
1188// pixel-coords.txt
1189//
1190// in the same directory as this README, you find a list
1191// of the coordinates generated by this new routine. It
1192// has the format
1193//
1194// number i j x y size-factor
1195//
1196// where i and j are J.C.G.'s so called biaxis hexagonal
1197// coordinates (for internal use) and x and y are the
1198// coordinates of the pixel centers in the standard camera
1199// coordinate system in units of centimeters. The value
1200// of "size-factor" determines the linear size of the pixel
1201// relative to the central pixels.
1202//
1203// (ii) The magic.def file has two additional parameters
1204// which give the number of central pixels and the
1205// number of gap pixels
1206//
1207// (iii) In camera.h and camera.cxx several changes were
1208// necessary, among them the introduction of several
1209// new functions
1210//
1211// The newly suggested outline with asymmetric Winston cones
1212// will be implemented in a later version.
1213//
1214// f) phe files can no longer be read since this contradicts
1215// our philosophy that the analysis should be done with other
1216// programs like e.g. EVITA and not with "camera" itself.
1217// This possibility was removed.
1218//
1219// g) ROOT is no longer invoked with an interactive interface.
1220// In this way, camera can better be run as a batch program and
1221// it uses less memory.
1222//
1223// h) small changes concerning the variable "t_chan" were necessary in
1224// order to avoid segmentation faults: The variable is used as an
1225// index and it went sometimes outside the limits when camera
1226// was reading proton data. This is because the reflector files
1227// don't contain the photons in a chronological order and also
1228// the timespread can be considerably longer that the foreseen
1229// digitisation timespan. Please see the source code of camera.cxx
1230// round about line 1090.
1231//
1232// j) several unused variables were removed, a few warning messages
1233// occur when you compile camera.cxx but these can be ignored at
1234// the moment.
1235//
1236// In general the program is of course not finished. It still needs
1237// debugging, proper trigger simulation, simulation of the asymmetric
1238// version of the outer pixels, proper NSB simulation, adaption of
1239// the diag "ntuple" contents to our need and others small improvements.
1240//
1241// In the directory rfl-files there is now a file in reflector format 0.4
1242// containing a single event produced by the starfiled adder. It has
1243// a duration of 30 ns and represents the region around the Crab Nebula.
1244// Using the enclosed input parameter file, camera should process this
1245// file without problems.
1246//
1247// 2) The README for the previous version of root_camera
1248//
1249// README for a preliminary version of the
1250// root_camera program.
1251//
1252// root_camera is based on the program "camera"of Jose Carlos
1253// Gonzalez. It was changed in the way that only the pixelisation
1254// and the distibution of the phe to the FADCs works in a
1255// first version.
1256//
1257// Using the #undef command most possibilities of the orignal
1258// program are switched of.
1259//
1260// The new parts are signed by
1261//
1262// - ROOT or __ROOT__
1263// nearly all important codelines for ROOT output are enclosed
1264// in structures like
1265// #ifdef __ROOT__
1266//
1267// code
1268//
1269// #endif __ROOT__
1270//
1271// In same case the new lines are signed by a comment with the word
1272// ROOT in it.
1273//
1274// For timing of the pulse some variable names are changed.
1275// (t0, t1, t --> t_ini, t_fin, t_1st, t_chan,...)
1276// Look also for this changes.
1277//
1278// For the new root-file is also a change in readparm-files
1279//
1280//
1281// - __DETAIL_TRIGGER__
1282//
1283// This is for the implementation of the current work on trigger
1284// studies. Because the class MTrigger is not well documented it
1285// isn´t a part of this tar file. Only a dummy File exists.
1286//
1287//
1288//
1289// With all files in the archive, the root_camera program should run.
1290//
1291// A reflector file is in the directory rfl-files
1292//
1293// ==================================================
1294//
1295// From now on, use CVS for development!!!!
1296//
1297//
1298//
1299// Revision 1.2 1999/10/22 15:01:28 petry
1300// version sent to H.K. and N.M. on Fri Oct 22 1999
1301//
1302// Revision 1.1.1.1 1999/10/21 16:35:11 petry
1303// first synthesised version
1304//
1305// Revision 1.6 1999/03/15 14:59:08 gonzalez
1306// camera-1_1
1307//
1308// Revision 1.5 1999/03/02 09:56:12 gonzalez
1309// *** empty log message ***
1310//
1311// Revision 1.4 1999/01/14 17:32:41 gonzalez
1312// Added to camera the STDIN input option (data_from_input)
1313//
1314//!@}
1315
1316//=EOF
Note: See TracBrowser for help on using the repository browser.