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

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