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

Last change on this file since 10100 was 6713, checked in by moralejo, 20 years ago
Changed meaning of pmt_jitter: now it is not the jitter per phe-, but the jitter of the total pulse in each pixel (and independent from pixel to pixel).
File size: 51.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.39 $
22//= $Author: moralejo $
23//= $Date: 2005-03-02 21:45:30 $
24//=
25//=//////////////////////////////////////////////////////////////////////
26
27
28#include "creadparam.h"
29#include "camera.h" // Needed for MAX_NUMBER_OF_CTS
30
31// Here we define the global variables where the values from the
32// parameters file are stored.
33
34static char **Input_filename; //@< input filename
35static char Starfield_filename[PATH_MAX_LENGTH]; //@< starfield input filename
36static int Starfield_center[6]={0,0,0,0,0,0}; //@< center of the starfield FOV
37 //@< RA(H,M,S) & DEC (D,M,S)
38static char Data_filename[PATH_MAX_LENGTH]; //@< data filename
39static char ROOT_filename[PATH_MAX_LENGTH]; //@< data filename
40static char Loop_filename[PATH_MAX_LENGTH]; //@< special data filename
41static char CT_geom_string[256]; //@< Contains geometry ids of CTs
42static int CT_number = 1; //@< Number of CT
43static char **QE_filename; //@< name of the qe file
44static char NSB_directory[PATH_MAX_LENGTH]; //@< database for NSB
45static char NSB_outer_directory[PATH_MAX_LENGTH]; //@< database for NSB
46static int Starfield_rotate = FALSE; //@< switch on starfield rotation
47static int ElecNoise = TRUE; //@< Will we add ElecNoise?
48static float FADC_pedestal = 10.0; //@< Value for FADC Pedestal
49static float FADC_Noise_inner = 2.0; //@< Value for FADC ElecNoise
50static float FADC_Noise_outer = 2.0; //@< Value for FADC ElecNoise
51static float Digital_Noise = 0.0; //@< Value for FADC digital Noise
52static float Trig_Noise = 0.3; //@< Factor for Trigger ElecNoise
53static int simulateNSB = TRUE; //@< Will we simulate NSB?
54static float meanNSB; //@< NSB mean value (per pixel)
55static int nphe2NSB=0; //@< Number of phe from shower to do NSB simulation
56static float **qThreshold; //@< Threshold values
57static int Individual_Thres = FALSE;
58static float RiseDisc = -1.0;
59static float SecureDisc = 7.0;
60static long int Seeds[2]={69184,10406};
61static int *Skip;
62static int nSkip=0;
63static int Data_From_STDIN = FALSE;
64static int Write_All_Event_Headers = TRUE;
65static int Write_McEvt = TRUE;
66static int Write_McTrig = FALSE;
67static int Write_McFadc = FALSE;
68static int Write_RawEvt = TRUE;
69static int Select_Energy = TRUE;
70static float Select_Energy_le = 0.0; //@< GeV
71static float Select_Energy_ue = 100000.0; //@< GeV
72static int Trigger_Scan = FALSE;
73static int FADC_Scan = FALSE;
74static int Trigger_Loop = FALSE;
75static float Trigger_gate_length = 3.0;
76static float Trigger_over_time = 0.25;
77static float Trigger_response_ampl = 1.0;
78static float Trigger_response_fwhm = 2.0;
79static float Trigger_threshold[MAX_NUMBER_OF_CTS];
80static int Trigger_multiplicity[MAX_NUMBER_OF_CTS];
81static int Trigger_topology[MAX_NUMBER_OF_CTS];
82static float Trigger_loop_lthres = 3.0;
83static float Trigger_loop_uthres = 10.0;
84static float Trigger_loop_sthres = 1.0;
85static int Trigger_loop_lmult = 2;
86static int Trigger_loop_umult = 10;
87static int Trigger_loop_ltop = 0;
88static int Trigger_loop_utop = 2;
89static int FADC_shape = 0;
90static float FADC_response_ampl = MFADC_RESPONSE_INTEGRAL;
91static float FADC_response_fwhm = MFADC_RESPONSE_FWHM;
92static int FADC_shape_out = 0;
93static float FADC_resp_ampl_out = MFADC_RESPONSE_INTEGRAL;
94static float FADC_resp_fwhm_out = MFADC_RESPONSE_FWHM;
95static float FADC_slices_per_ns = FADC_SLICES_PER_NSEC;
96static int FADC_slices_written = FADC_SLICES;
97static float High_to_Low = 10.0; // Low gain channel respect to High
98
99static float sigma_x_spot = 0.; // Sigma in x and y (cm) for additional
100static float sigma_y_spot = 0.; // gaussian spread of the mirror spot.
101
102static float misp_x = 0.; // Mispointing in x
103static float misp_y = 0.; // Mispointing in y
104
105static float trig_delay = 19.; // Delay in ns between beginning of FADC
106 // time window and the trigger instant.
107
108static float pmt_jitter = 0.2; // Time jitter in ns (sigma of gaussian); it is the
109 // jitter, due to the PMT, of the whole pulse from the pixel!
110
111static float CTcoor[MAX_NUMBER_OF_CTS][3];
112
113static float m_fraction[MAX_NUMBER_OF_CTS];
114
115static int CalibrationRun = 0; // > 0 if a calibration run has been chosen
116static float lambda = 0.; // Mean wavelength for photons of calibration pulses.
117static float sigma_lambda = 0.; // Sigma of wavelength distribution for calibration.
118static float phot_per_pix = 0.; // Average number of photons per inner pixel for calibration.
119static float fwhm_time = 0.; // Time spread (FWHM of gaussian) of calibration photons.
120static int nevents = 0; // Number of events in calibration run.
121static int selected_pixel = -1; // Selected pixel: if >= 0 ==> only this pixel is filled!
122
123static int gain_fluctuations = 1; // Is 0 if PMT gain fluctuations are disabled for signal
124static int noise_gain_fluctuations = 1; // Is 0 if PMT gain fluctuations are disabled for NSB noise
125
126// Coordinates of CT locations, in centimeters, in the Corsika system.
127
128void
129readparam(char * filename)
130{
131 char sign[] = GLUE_postp( PROGRAM, VERSION ); //@< initialize sign
132 char line[LINE_MAX_LENGTH]; //@< line to get from the stdin
133 char token[ITEM_MAX_LENGTH]; //@< a single token
134 int i, j, k; //@< dummy counters
135 float aux, aux1, aux2; //@< auxiliar variable
136 int aux3, aux4; //@< auxiliar variable
137 ifstream ifile;
138 char filename_tmp[PATH_MAX_LENGTH];
139
140
141 memset((char*)CT_geom_string, 0, sizeof(CT_geom_string));
142
143 Input_filename = new char *[MAX_NUMBER_OF_CTS];
144 QE_filename = new char *[MAX_NUMBER_OF_CTS];
145 qThreshold = new float *[MAX_NUMBER_OF_CTS];
146
147 for (int i = 0; i < MAX_NUMBER_OF_CTS; i++)
148 {
149 Input_filename[i] = new char[PATH_MAX_LENGTH];
150 QE_filename[i] = new char[PATH_MAX_LENGTH];
151 qThreshold[i] = new float[CAMERA_PIXELS];
152 CTcoor[i][0] = 0.; CTcoor[i][1] = 0.; CTcoor[i][2] = 0.;
153 m_fraction[i] = 1.;
154 }
155
156 // use cin or ifile (reading from STDIN or from parameters file?
157 if ( filename != NULL )
158 ifile.open( filename );
159
160 // get signature
161 if ( filename != NULL )
162 ifile.getline(line, LINE_MAX_LENGTH);
163 else
164 cin.getline(line, LINE_MAX_LENGTH);
165 line[strlen(SIGNATURE)] = '\0';
166 strcpy(sign, line);
167 cout<< '"' << sign << '"' << '\n';
168 if (strcmp(sign, SIGNATURE) != 0) {
169 cerr << "ERROR: Signature of parameters file is not correct\n";
170 cerr << '"' << sign << '"' << '\n';
171 cerr << "should be: " << SIGNATURE << '\n';
172 exit(1);
173 }
174
175 // loop till the "end" directive is reached
176 int is_end = FALSE;
177 while (! is_end) {
178
179 // get line from file or stdin
180 if ( filename != NULL )
181 ifile.getline(line, LINE_MAX_LENGTH);
182 else
183 cin.getline(line, LINE_MAX_LENGTH);
184
185 // skip comments (start with '#')
186 if (line[0] == '#')
187 continue;
188
189 // show user comments (start with '>')
190 if (line[0] == '>') {
191 cout << line << endl << flush;
192 continue;
193 }
194
195 // look for each item at the beginning of the line
196 for (i=0; i<=end_file; i++)
197 if (strstr(line, ITEM_NAMES[i]) == line)
198 break;
199
200 // if it is not a valid line, just ignore it
201 if (i == end_file+1) {
202 cerr << "ERROR: Unknown token in [" << line << "]\n";
203 exit(-1);
204 }
205
206 // case block for each directive
207 switch ( i ) {
208
209 case input_file: //@< name of the input file
210
211 // get the name of the input_file from the line
212 sscanf(line, "%s %i %s", token,&k, filename_tmp);
213 if(k>99 || k<0){
214 printf("ERROR : The input_file command in input card is faulty. \n\t Most likely the control index for CT is missing.\n");
215 exit(1);
216 }
217 strcpy(&Input_filename[k][0],&filename_tmp[0]);
218 break;
219
220 case starfield_file: //@< name of the output file
221
222 // get the name of the output_file from the line
223 sscanf(line, "%s %s", token, Starfield_filename);
224
225 break;
226
227 case starfield_center: //@< name of the output file
228
229 // get the name of the output_file from the line
230 sscanf(line, "%s %i %i %i %i %i %i", token, &Starfield_center[0], &Starfield_center[1], &Starfield_center[2], &Starfield_center[3], &Starfield_center[4], &Starfield_center[5]);
231
232 break;
233
234 case data_file: //@< name of the data file
235
236 // get the name of the data_file from the line
237 sscanf(line, "%s %s", token, Data_filename);
238
239 break;
240
241 case root_file: //@< name of the ROOT file
242
243 // get the name of the data_file from the line
244 sscanf(line, "%s %s", token, ROOT_filename);
245 cout << '[' << ROOT_filename << ']' << endl << flush;
246
247 break;
248
249 case ct_num: //@< number of telescopes
250
251 // get the name of the ct_file from the line
252 sscanf(line, "%s %i", token, &CT_number);
253
254 break;
255
256 case ct_geom: //@< name of the telescope file
257
258 // get the name of the ct_file from the line
259 sscanf(line, "%s %s", token, CT_geom_string);
260 if ( strlen(CT_geom_string) > MAX_NUMBER_OF_CTS )
261 {
262 printf("\nError: ct_geom option read from input card wrong:\n");
263 printf("Number of digits (%d) is larger than maximum number\n",strlen(CT_geom_string) );
264 printf("of allowed telescopes (%d). Exiting.\n\n", MAX_NUMBER_OF_CTS);
265 exit(1);
266 }
267
268 break;
269
270 case qe_file: //@< name of the telescope file
271
272 // get the name of the ct_file from the line
273 sscanf(line, "%s %i %s", token, &k, filename_tmp);
274 strcpy(&QE_filename[k][0],&filename_tmp[0]);
275
276 break;
277
278 case elec_noise_off: //@< add ElecNoise?
279
280 // we will not add electronic noise for FADC and Trigger channels.
281 ElecNoise = FALSE;
282 FADC_Noise_inner = 0.0;
283 FADC_Noise_outer = 0.0;
284 Trig_Noise =0.0;
285
286 break;
287
288 case fadc_pedestal: //@< FADC pedestal
289
290 // value for FADC Pedestal
291 sscanf(line, "%s %f", token, &FADC_pedestal);
292
293 //
294 // A. Moralejo:
295 // Require integer mean pedestal. Although it seems a silly
296 // restriction, this saves lots of trouble (due to rounding
297 // happening in the FADC), particularly when running the
298 // simulation with no noise (NSB or electronic):
299 //
300
301 if (fmod((double)FADC_pedestal, (double)1.) > 1.e-4)
302 {
303 printf("ERROR : requested average FADC pedestal (%f) is not integer. Please use an integer value.\n", FADC_pedestal);
304 exit(1);
305 }
306
307 break;
308
309 case high_to_low: //@< High to Low gain ratio
310
311 // Value for the Low Gain channel respect to the High gain
312 sscanf(line, "%s %f", token, &High_to_Low);
313
314 break;
315
316 case fadc_noise: //@< FADC ElecNoise
317
318 // value for FADC Elec Noise
319 sscanf(line, "%s %f %f %f", token,
320 &FADC_Noise_inner, &FADC_Noise_outer,
321 &Digital_Noise);
322
323 ElecNoise = TRUE;
324
325 break;
326
327 case trig_noise: //@< add ElecNoise?
328
329 // factor for Trigger Elec Noise
330 sscanf(line, "%s %f", token, &Trig_Noise);
331 ElecNoise = TRUE;
332
333 break;
334
335 case sfr_on: //@< simulate starfield rotation?
336
337 // we will simulate Starfield rotation
338 Starfield_rotate = TRUE;
339
340 break;
341
342
343 case nsb_on: //@< simulate NSB?
344
345 // we will simulate NSB
346 simulateNSB = TRUE;
347
348 break;
349
350 case nsb_off: //@< simulate NSB?
351
352 // we will NOT simulate NSB
353 simulateNSB = FALSE;
354
355 break;
356
357 case nsb_mean: //@< value of <NSB> per pixel
358
359 // get value of <NSB> (in photons)
360 sscanf(line, "%s %f %d", token, &meanNSB, &nphe2NSB);
361
362 break;
363
364 case nsb_directory: //@< name of the output file
365
366 // get the name of the NSB diretory for inner pixels
367 sscanf(line, "%s %s", token, NSB_directory);
368
369 break;
370
371 case nsb_dir_outer: //@< name of the output file
372
373 // get the name of the NSB diretory for outer pixels
374 sscanf(line, "%s %s", token, NSB_outer_directory);
375
376 break;
377
378 case pixel_thres: //@< value of threshold for trigger (q0)
379
380 // get value of threshold (in ph.e.)
381 sscanf(line, "%s %i %f", token,&k, &aux);
382 if(k>99 || k<0){
383 printf("ERROR : The input_file command in input card is faulty. \n\t Most likely the control index for CT is missing.\n");
384 exit(1);
385 }
386 qThreshold[0][k]=aux;
387 Individual_Thres = TRUE;
388
389 break;
390
391 case secure_disc: //@< value of secure threshold
392
393 // get value of secure threshold (in ph.e.)
394 sscanf(line, "%s %f %f", token,&aux, &aux2);
395 RiseDisc=aux;
396 SecureDisc=aux2;
397
398 break;
399
400 case seeds: //@< values of seeds for random numbers
401
402 // get seeds
403 sscanf(line, "%s %ld %ld", token, &Seeds[0], &Seeds[1]);
404
405 break;
406
407 case skip: //@< skip pathological showers
408
409 // get showers to skip
410 cin >> nSkip;
411 Skip = new int[nSkip];
412 for (j=0; j<nSkip; ++j) {
413 cin >> Skip[j];
414 cout << Skip[j] << endl << flush;
415 }
416
417 break;
418
419 case data_from_stdin: //@< to read data from stdin
420
421 // change boolean value
422 Data_From_STDIN = TRUE;
423
424 break;
425
426 case no_write_all_event_headers: //@< to write ALL the event headers
427
428 // change boolean value
429 Write_All_Event_Headers = FALSE;
430
431 break;
432
433 case nowrite_McEvt: //@< do not write the McEvt info
434
435 // change boolean value
436 Write_McEvt = FALSE;
437
438 break;
439
440 case write_McTrig: //@< to write the McTrig info
441
442 // change boolean value
443 Write_McTrig = TRUE;
444
445 break;
446
447 case write_McFadc: //@< to write the McFadc info
448
449 // change boolean value
450 Write_McFadc = TRUE;
451
452 break;
453
454 case nowrite_RawEvt: //@< to write the McFadc info
455
456 // change boolean value
457 Write_RawEvt = FALSE;
458
459 break;
460
461 case select_energy: //@< value of islands_cut (i0)
462
463 // get energy range
464 sscanf(line, "%s %f %f", token, &Select_Energy_le, &Select_Energy_ue);
465 Select_Energy = TRUE;
466
467 break;
468
469 case fadc_scan:
470
471 // change boolean value
472 FADC_Scan = TRUE;
473
474 break;
475
476 case fadc_prop:
477
478 // Get parameters for the fadc response for one phe
479 sscanf(line, "%s %i %f %f", token, &FADC_shape, &FADC_response_ampl,&FADC_response_fwhm);
480
481 break;
482
483 case fadc_outer:
484
485 // Get parameters for the fadc response for one phe
486 sscanf(line, "%s %i %f %f", token, &FADC_shape_out, &FADC_resp_ampl_out,&FADC_resp_fwhm_out);
487
488 break;
489
490 case fadc_GHz:
491
492 // Get FADC sampling frequency in GHz (default 0.3)
493 sscanf(line, "%s %f %i", token, &FADC_slices_per_ns, &FADC_slices_written);
494
495 break;
496
497 case trigger_scan:
498
499 // change boolean value
500 Trigger_Scan = TRUE;
501
502 break;
503 case trigger_prop:
504
505 // Get parameters for the diskriminator and the electronic
506 // response for one phe
507 sscanf(line, "%s %f %f %f %f", token, &Trigger_gate_length,&Trigger_over_time, &Trigger_response_ampl,&Trigger_response_fwhm);
508
509 break;
510
511 case trigger_loop:
512
513 // Get loop's limits
514 sscanf(line, "%s %f %f %f %d %d %d %d", token, &Trigger_loop_lthres, &Trigger_loop_uthres, &Trigger_loop_sthres, &Trigger_loop_lmult, &Trigger_loop_umult, &Trigger_loop_ltop, &Trigger_loop_utop );
515
516 // Set qThreshold to a global value
517 for(k=0;k<CAMERA_PIXELS;k++){
518 qThreshold[0][k]=Trigger_loop_lthres;
519 }
520
521 // change boolean value
522 Trigger_Loop = TRUE;
523 Write_RawEvt = FALSE;
524 Individual_Thres = FALSE;
525
526 break;
527
528 case trigger_single:
529
530 // Get trigger conditions
531 sscanf(line, "%s %d %f %d %d", token, &j, &aux, &aux3, &aux4);
532 if(j>99 || j<0){
533 printf("ERROR : The input_file command in input card is faulty. \n\t Most likely the control index for CT is missing.\n");
534 exit(1);
535 }
536 Trigger_threshold[j]=aux;
537 Trigger_multiplicity[j]=aux3;
538 Trigger_topology[j]=aux4;
539
540 // Set qThreshold to a global value
541 for(k=0;k<CAMERA_PIXELS;k++){
542 qThreshold[j][k]=Trigger_threshold[j];
543 }
544
545 // change boolean value
546 Trigger_Loop = FALSE;
547 Write_RawEvt = TRUE;
548 Individual_Thres = FALSE;
549
550 break;
551
552 case Trigger_Loop_Output_Only_Specialists:
553
554 // get the name of the data_file from the line
555 sscanf(line, "%s %s", token, Loop_filename);
556 cout << '[' << Loop_filename << ']' << endl << flush;
557
558 // change boolean value
559 Write_RawEvt = TRUE;
560
561 break;
562
563 case trigger_delay:
564
565 sscanf(line, "%s %f", token, &trig_delay);
566 break;
567
568 case pmt_jitter_ns:
569
570 sscanf(line, "%s %f", token, &pmt_jitter);
571 break;
572
573
574 case sigma_xy_cm_spot:
575
576 sscanf(line, "%s %f", token, &sigma_x_spot);
577 sigma_y_spot=sigma_x_spot;
578 break;
579
580 case sigma_x_cm_spot:
581
582 sscanf(line, "%s %f", token, &sigma_x_spot);
583 break;
584
585 case sigma_y_cm_spot:
586
587 sscanf(line, "%s %f", token, &sigma_y_spot);
588 break;
589
590 case misspoint_deg:
591
592 sscanf(line, "%s %f %f", token, &misp_x, &misp_y);
593 break;
594
595 case telescope_location_cm:
596
597 if ( 5 != sscanf(line, "%s %d %f %f %f", token, &j, &aux, &aux1, &aux2) )
598 {
599 printf("\nError: wrong number of arguments for command telescope_location_cm.\n");
600 printf("Usage: telescope_location_cm ct_id x y z\n");
601 printf("Coordinates must be written in centimeters.");
602 printf("Exiting.\n\n");
603 exit(1);
604 }
605
606 if (j >= MAX_NUMBER_OF_CTS)
607 {
608 printf("\nError: coordinates were supplied for a telescope index (%d)\n", j);
609 printf("larger than allowed. Valid telescope ids range from 0 to %d. Exiting.\n\n", MAX_NUMBER_OF_CTS-1);
610 exit(1);
611 }
612 CTcoor[j][0] = aux;
613 CTcoor[j][1] = aux1;
614 CTcoor[j][2] = aux2;
615
616 break;
617
618 case mirror_fraction:
619
620 sscanf(line, "%s %d %f", token, &j, &aux);
621 m_fraction[j] = aux;
622
623 break;
624
625 case calibration_run:
626
627 sscanf(line, "%s %f %f %f %f %i %i", token, &lambda, &sigma_lambda, &phot_per_pix,
628 &fwhm_time, &nevents, &selected_pixel);
629
630 CalibrationRun = 1;
631
632 break;
633
634 case gain_fluctuations_off:
635
636 gain_fluctuations = 0;
637
638 break;
639
640 case noise_gain_fluctuations_off:
641
642 noise_gain_fluctuations = 0;
643
644 break;
645
646 case end_file: //@< end of the parameters file
647
648 // show a short message
649 is_end = TRUE;
650
651 break;
652
653
654 } // switch ( i )
655
656 } // while (! is_end)
657
658 // after the loop is finished, return to the main function
659 return;
660}
661//!@}
662
663
664//!-----------------------------------------------------------
665// @name get_input_filename
666//
667// @desc get name of the input file
668//
669// @return Name of the Input file
670//
671// @date Mon Sep 14 13:27:56 MET DST 1998
672//------------------------------------------------------------
673// @function
674
675//!@{
676char *
677get_input_filename(int i)
678{
679 return (Input_filename[i]);
680}
681//!@}
682
683
684//!-----------------------------------------------------------
685// @name get_starfield_filename
686//
687// @desc get name of the starfield input file
688//
689// @return Name of the starfield file
690//
691// @date Tue Feb 15 16:02:18 CET 2000
692//------------------------------------------------------------
693// @function
694
695//!@{
696char *
697get_starfield_filename(void)
698{
699 return (Starfield_filename);
700}
701//!@}
702
703
704//!-----------------------------------------------------------
705// @name get_starfield_center
706//
707// @desc get center of the starfield FOV
708//
709// @return Central co-ordinates in RA and DEC for the centre of FOV
710//
711// @date Tue Feb 15 16:02:18 CET 2000
712//------------------------------------------------------------
713// @function
714
715//!@{
716void get_starfield_center(int *rh,int *rm,int *rs,int *dd,int *dm,int *ds)
717{
718 *rh=Starfield_center[0];
719 *rm=Starfield_center[1];
720 *rs=Starfield_center[2];
721 *dd=Starfield_center[3];
722 *dm=Starfield_center[4];
723 *ds=Starfield_center[5];
724}
725//!-----------------------------------------------------------
726// @name get_starfield_rotate
727//
728// @Starfield_rotate
729//
730// @return
731//
732//------------------------------------------------------------
733// @function
734
735//!@{
736int
737get_starfield_rotate(void)
738{
739 return(Starfield_rotate);
740}
741
742
743//!@}
744//!-----------------------------------------------------------
745// @name get_data_filename
746//
747// @desc get name of the data file
748//
749// @return Name of the Data file
750//
751// @date Mon Sep 14 13:27:56 MET DST 1998
752//------------------------------------------------------------
753// @function
754
755//!@{
756char *
757get_data_filename(void)
758{
759 return (Data_filename);
760}
761//!@}
762
763
764//!-----------------------------------------------------------
765// @name get_root_filename
766//
767// @desc get name of the ROOT file
768//
769// @return Name of the ROOT file
770//
771// @date Mon Sep 14 13:27:56 MET DST 1998
772//------------------------------------------------------------
773// @function
774
775//!@{
776char *
777get_root_filename(void)
778{
779 return (ROOT_filename);
780}
781//!@}
782//!-----------------------------------------------------------
783// @name get_loop_filename
784//
785// @desc get name of the special ROOT file
786//
787// @return Name of the special ROOT file
788//
789// @date Fri Jun 23 17:34:19 CEST 2000
790//------------------------------------------------------------
791// @function
792
793//!@{
794
795char *
796get_loop_filename(void)
797{
798 return (Loop_filename);
799}
800//!@}
801
802//!-----------------------------------------------------------
803// @name get_ct_number
804//
805// @desc get number of CT
806//
807// @return number of CT
808//
809// @date Tue Jul 29 01:48:26 CEST 2003
810//------------------------------------------------------------
811// @function
812
813//!@{
814int
815get_ct_number(void)
816{
817 return (CT_number);
818}
819//!@}
820
821//!-----------------------------------------------------------
822// @name get_ct_geometry
823//
824// @desc get geometry of CT
825//
826// @return geometry of CT
827//
828// @date Mon Sep 14 13:27:56 MET DST 1998
829//------------------------------------------------------------
830// @function
831
832//!@{
833int
834get_ct_geometry(int ict)
835{
836 char dummy[2];
837 strncpy(dummy, &(CT_geom_string[ict]), 1);
838 dummy[1] = '\0';
839
840 return ((int)atoi(dummy));
841}
842//!@}
843
844//!-----------------------------------------------------------
845// @name get_qe_filename
846//
847// @desc get name of QE definition file
848//
849// @return Name of the QE definition file
850//
851// @date Thu Jul 10 14:10:13 CEST 2003
852//------------------------------------------------------------
853// @function
854
855//!@{
856char *
857get_qe_filename(int ict)
858{
859 return (QE_filename[ict]);
860}
861//!@}
862
863//!-----------------------------------------------------------
864// @name get_nsb_directory
865//
866// @desc get name of the directory where the database for NSB is
867//
868// @return Name of the NSB directory
869//
870// @date Tue Jan 30 12:07:56 MET 2001
871//------------------------------------------------------------
872// @function
873
874//!@{
875char *
876get_nsb_directory(void)
877{
878 return (NSB_directory);
879}
880//!@}
881
882
883
884//!-----------------------------------------------------------
885// @name get_nsb_directory_outer
886//
887// @desc get name of the directory where the database for NSB is
888//
889// @return Name of the NSB directory for outer pixels
890//
891// @date Thu Jul 10 14:10:13 CEST 2003
892//------------------------------------------------------------
893// @function
894
895//!@{
896char *
897get_nsb_directory_outer(void)
898{
899 return (NSB_outer_directory);
900}
901//!@}
902
903
904
905//!-----------------------------------------------------------
906// @name add_elec_noise
907//
908// @desc are we going to add the ElecNoise?
909//
910// @date Mon Jan 14 19:27:56 MET DST 2002
911//------------------------------------------------------------
912// @function
913
914//!@{
915int
916add_elec_noise(float *fadcinner, float*fadcouter, float *digi, float *trig)
917{
918 *fadcinner = FADC_Noise_inner;
919 *fadcouter = FADC_Noise_outer;
920
921 *digi = Digital_Noise;
922 *trig = Trig_Noise;
923
924 return ( ElecNoise);
925}
926//!@}
927
928//!-----------------------------------------------------------
929// @name get_nsb
930//
931// @desc are we going to simulate NSB ?
932//
933// @var *n Mean value for the NSB (ph.e./pixel)
934// @return TRUE: we'll simulate NSB; FALSE: we won't
935//
936// @date Mon Sep 14 13:27:56 MET DST 1998
937//------------------------------------------------------------
938// @function
939
940//!@{
941int
942get_nsb(float *n, int *m)
943{
944 *n = meanNSB;
945 *m = nphe2NSB;
946 return ( simulateNSB );
947}
948//!@}
949
950
951//!-----------------------------------------------------------
952// @name get_threshold
953//
954// @desc get threshold value
955//
956// @return Value of the threshold q$_0$
957//
958// @date Mon Sep 14 13:27:56 MET DST 1998
959//------------------------------------------------------------
960// @function
961
962//!@{
963void
964get_threshold(float *t)
965{
966 for(int i=0;i<CAMERA_PIXELS;i++)
967 t[i]=qThreshold[0][i];
968}
969//!@}
970
971//!-----------------------------------------------------------
972// @name get_secure_threhold
973//
974// @desc get values for secure threshold.
975//
976// @return AC (ac)value above which discriminator threshold rised to disc
977//
978// @date Wed Jul 18 16:29:43 CEST 2001
979//------------------------------------------------------------
980// @function
981
982//!@{
983void
984get_secure_threhold(float *ac, float *disc)
985{
986 *ac=RiseDisc;
987 *disc=SecureDisc;
988}
989//!@}
990
991//!-----------------------------------------------------------
992// @name get_indi_thres_pixel
993//
994// @desc get boolean information about global (FALSE) or
995// @desc individual (TRUE) pixel trigger threshold
996//
997// @return Value for the Individual_Thres
998//
999// @date Wed Jul 18 16:29:43 CEST 2001
1000//------------------------------------------------------------
1001// @function
1002
1003//!@{
1004int get_indi_thres_pixel(void){
1005 return Individual_Thres;
1006}
1007//!@}
1008
1009
1010//!-----------------------------------------------------------
1011// @name get_seeds
1012//
1013// @desc are we going to count the islands ?
1014//
1015// @var *n Number of the seed
1016// @return N-th random-number Seed
1017//
1018// @date Mon Sep 14 13:27:56 MET DST 1998
1019//------------------------------------------------------------
1020// @function
1021
1022//!@{
1023long int
1024get_seeds(int n)
1025{
1026 return ( Seeds[n] );
1027}
1028//!@}
1029
1030
1031//!-----------------------------------------------------------
1032// @name get_skip_showers
1033//
1034// @desc get list of showers to skip
1035//
1036// @var *s1 Pointer to a vector of number of showers
1037//
1038// @date Mon Sep 14 13:27:56 MET DST 1998
1039//------------------------------------------------------------
1040// @function
1041
1042//!@{
1043void
1044get_skip_showers( int *s )
1045{
1046 int i;
1047 for (i=0; i<nSkip; ++i)
1048 s[i] = Skip[i];
1049}
1050//!@}
1051
1052
1053//!-----------------------------------------------------------
1054// @name get_nskip_showers
1055//
1056// @desc get number of showers to skip
1057//
1058// @return Number of showers to be skipped
1059//
1060// @date Mon Sep 14 13:27:56 MET DST 1998
1061//------------------------------------------------------------
1062// @function
1063
1064//!@{
1065int
1066get_nskip_showers( void )
1067{
1068 return( nSkip );
1069}
1070//!@}
1071
1072
1073//!-----------------------------------------------------------
1074// @name get_data_from_stdin
1075//
1076// @desc get whether we will read the data from the STDIN
1077//
1078// @return TRUE: we'll read data from STDIN; FALSE: we won't
1079//
1080// @date Wed Nov 25 13:21:00 MET 1998
1081//------------------------------------------------------------
1082// @function
1083
1084//!@{
1085int
1086get_data_from_stdin(void)
1087{
1088 return ( Data_From_STDIN );
1089}
1090//!@}
1091
1092
1093//!-----------------------------------------------------------
1094// @name write_all_event_headers
1095//
1096// @desc write all event headers to output, even those without
1097// trigger
1098//
1099// @return TRUE: we'll write everything; FALSE: we won't
1100//
1101// @date Wed Nov 25 13:21:00 MET 1998
1102//------------------------------------------------------------
1103// @function
1104
1105//!@{
1106int
1107get_write_all_event_headers(void)
1108{
1109 return ( Write_All_Event_Headers );
1110}
1111//!@}
1112
1113//!-----------------------------------------------------------
1114// @name write_McEvt
1115//
1116// @desc write the McEvt class for each event to the .root file
1117//
1118// @return TRUE: we'll write it; FALSE: we won't
1119//
1120//------------------------------------------------------------
1121// @function
1122
1123//!@{
1124int
1125get_write_McEvt(void)
1126{
1127 return ( Write_McEvt );
1128}
1129//!@}
1130
1131//!-----------------------------------------------------------
1132// @name write_McTrig
1133//
1134// @desc write the McTrig class for each event to the .root file
1135//
1136// @return TRUE: we'll write it; FALSE: we won't
1137//
1138//------------------------------------------------------------
1139// @function
1140
1141//!@{
1142int
1143get_write_McTrig(void)
1144{
1145 return ( Write_McTrig );
1146}
1147//!@}
1148
1149//!-----------------------------------------------------------
1150// @name write_McFadc
1151//
1152// @desc write the McFadc class for each event to the .root file
1153//
1154// @return TRUE: we'll write it; FALSE: we won't
1155//
1156//------------------------------------------------------------
1157// @function
1158
1159//!@{
1160int
1161get_write_McFadc(void)
1162{
1163 return ( Write_McFadc );
1164}
1165//!@}
1166
1167//!-----------------------------------------------------------
1168// @name write_RawEvt
1169//
1170// @desc write the RawEvt class for each event to the .root file
1171//
1172// @return TRUE: we'll write it; FALSE: we won't
1173//
1174//------------------------------------------------------------
1175// @function
1176
1177//!@{
1178int
1179get_write_RawEvt(void)
1180{
1181 return ( Write_RawEvt );
1182}
1183//!@}
1184
1185//!-----------------------------------------------------------
1186// @name get_select_energy
1187//
1188// @desc return energy range allowed for showers from .phe file
1189//
1190// @var *le Lower limit in the allowed energy range
1191// @var *ue Lower limit in the allowed energy range
1192// @return TRUE: we make selection on the energy; FALSE: we don't
1193//
1194// @date Wed Nov 25 13:21:00 MET 1998
1195//------------------------------------------------------------
1196// @function
1197
1198//!@{
1199int
1200get_select_energy(float *le, float *ue)
1201{
1202 *le = Select_Energy_le;
1203 *ue = Select_Energy_ue;
1204 return ( Select_Energy );
1205}
1206//!@}
1207
1208//!-----------------------------------------------------------
1209// @name FADC_Scan
1210//
1211// @desc show the FADC signal for each event in the screen
1212//
1213// @return TRUE: we'll show it; FALSE: we won't
1214//
1215//------------------------------------------------------------
1216// @function
1217
1218//!@{
1219int
1220get_FADC_Scan(void)
1221{
1222 return ( FADC_Scan );
1223}
1224//!@}
1225
1226//!-----------------------------------------------------------
1227// @name Trigger_Scan
1228//
1229// @desc show the Trigger signal for each event in the screen
1230//
1231// @return TRUE: we'll show it; FALSE: we won't
1232//
1233//------------------------------------------------------------
1234// @function
1235
1236//!@{
1237int
1238get_Trigger_Scan(void)
1239{
1240 return ( Trigger_Scan );
1241}
1242//!@}
1243
1244//!-----------------------------------------------------------
1245// @name Fadc_Propeties
1246//
1247// @desc fix properties of the FADC response
1248//
1249//------------------------------------------------------------
1250// @function
1251
1252//!@{
1253void
1254get_FADC_properties(int *shape,float *ra, float *rf,
1255 int *shapeo, float *rao, float *rfo,
1256 float *fadc_spns, int *fadc_slices)
1257{
1258 *shape = FADC_shape;
1259 *ra = FADC_response_ampl;
1260 *rf = FADC_response_fwhm;
1261 *shapeo = FADC_shape_out;
1262 *rao = FADC_resp_ampl_out;
1263 *rfo = FADC_resp_fwhm_out;
1264 *fadc_spns = FADC_slices_per_ns;
1265 *fadc_slices = FADC_slices_written;
1266}
1267//!@}
1268
1269//!-----------------------------------------------------------
1270// @name Trigger_Propeties
1271//
1272// @desc fix properties of the diskriminator and amplifier for Trigger
1273//
1274//------------------------------------------------------------
1275// @function
1276
1277//!@{
1278void
1279get_Trigger_properties(float *gl, float *ot, float *ra, float *rf)
1280{
1281 *gl=Trigger_gate_length;
1282 *ot=Trigger_over_time;
1283 *ra=Trigger_response_ampl;
1284 *rf=Trigger_response_fwhm;
1285
1286}
1287//!@}
1288
1289//!-----------------------------------------------------------
1290// @name Trigger_Loop
1291//
1292// @desc make a loop over Trigger conditions
1293//
1294// @return TRUE: we'll make it; FALSE: we won't
1295//
1296//------------------------------------------------------------
1297// @function
1298
1299//!@{
1300int
1301get_Trigger_Loop(float *lt, float *ut, float *st, int *lm, int *um, int *lg, int *ug)
1302{
1303 *lt=Trigger_loop_lthres;
1304 *ut=Trigger_loop_uthres;
1305 *st=Trigger_loop_sthres;
1306 *lm=Trigger_loop_lmult;
1307 *um=Trigger_loop_umult;
1308 *lg=Trigger_loop_ltop;
1309 *ug=Trigger_loop_utop;
1310 return ( Trigger_Loop );
1311}
1312//!@}
1313
1314//!-----------------------------------------------------------
1315// @name Trigger_Single
1316//
1317// @desc fix Trigger conditions
1318//
1319//------------------------------------------------------------
1320// @function
1321
1322//!@{
1323void
1324get_Trigger_Single(float **t, int *m, int *g)
1325{
1326 for(int j=0;j<MAX_NUMBER_OF_CTS;j++){
1327 for(int i=0;i<CAMERA_PIXELS;i++)
1328 t[j][i]=qThreshold[j][i];
1329 m[j]=Trigger_multiplicity[j];
1330 g[j]=Trigger_topology[j];
1331 }
1332}
1333//!@}
1334
1335//!-----------------------------------------------------------
1336// @name get_FADC_pedestal
1337//
1338// @desc get the value for the FADC pedestals
1339//
1340//------------------------------------------------------------
1341// @function
1342
1343//!@{
1344
1345
1346float get_FADC_pedestal(void){
1347
1348 return FADC_pedestal;
1349
1350}
1351
1352//!@}
1353//!-----------------------------------------------------------
1354// @name get_High_to_Low
1355//
1356// @desc get the conversion factor between high and low gain
1357//
1358//------------------------------------------------------------
1359// @function
1360
1361//!@{
1362
1363
1364float get_High_to_Low(void){
1365
1366 return High_to_Low;
1367
1368}
1369
1370int get_misspointing(float *x, float *y){
1371
1372 *x=misp_x;
1373 *y=misp_y;
1374
1375 if (misp_x == 0.0 && misp_y==0.0)
1376 return 0;
1377 else
1378 return 1;
1379
1380}
1381
1382float get_sigma_xy_cm_spot(float *x, float *y){
1383
1384 *x=sigma_x_spot;
1385 *y=sigma_y_spot;
1386
1387 if (sigma_x_spot > 0.0 || sigma_y_spot >0.0)
1388 return 1.0;
1389 else
1390 return -1.0;
1391
1392}
1393
1394float get_trig_delay(void){
1395
1396 return trig_delay;
1397
1398}
1399
1400float get_pmt_jitter_ns(){
1401
1402 return pmt_jitter;
1403
1404}
1405
1406float get_telescope_location_cm(int j, int icoor){
1407
1408 return CTcoor[j][icoor];
1409
1410}
1411
1412float get_mirror_fraction(int j){
1413 return m_fraction[j];
1414}
1415
1416int is_calibration_run(){
1417 return CalibrationRun;
1418}
1419
1420void get_calibration_properties(float *a, float *b, float *c, float *d, int *e, int *f)
1421{
1422 *a = lambda;
1423 *b = sigma_lambda;
1424 *c = phot_per_pix;
1425 *d = fwhm_time / 2.35; // Convert from FWHM to sigma of gaussian
1426 *e = nevents;
1427 *f = selected_pixel;
1428}
1429
1430int apply_gain_fluctuations()
1431{
1432 return gain_fluctuations;
1433}
1434
1435int apply_noise_gain_fluctuations()
1436{
1437 return noise_gain_fluctuations;
1438}
1439
1440
1441//=------------------------------------------------------------
1442//!@subsection Log of this file.
1443
1444//!@{
1445//
1446// $Log: not supported by cvs2svn $
1447// Revision 1.38 2005/03/02 20:49:19 moralejo
1448//
1449// Changed default pulse position in the FADC window. Now the high gain peak
1450// is around the 5th slice (changed default value of trigger_delay from 25 to
1451// 19 ns)
1452//
1453// Revision 1.37 2005/02/17 09:15:28 moralejo
1454//
1455// Set as default option that of writing all event headers to output file,
1456// not only those of the triggered events. To disable it, set the input card
1457// flag "no_write_all_event_headers".
1458//
1459// Changed such that output images for events below the minimum number of
1460// photoelectrons nphe2NSB required to simulate the noise (NSB & electronic)
1461// will be empty. This will avoid the problem of these events being processed,
1462// without any noise, later in the chain. Although those images are not in the
1463// output, one can still check in the headers (MMcTrig) how many such events
1464// with less than nphe2NSB photoelectrons would have triggered.
1465//
1466// Revision 1.36 2005/02/10 19:28:10 moralejo
1467//
1468// Substituted input card option "write_all_events" by
1469// "write_all_event_headers". If set, this will make camera to write out
1470// the event headers of all the processed events, no matter whether they
1471// have triggered or not.
1472//
1473// Revision 1.35 2004/12/15 01:56:39 MAGIC
1474//
1475// Added input card option pmt_jitter_ns to simulate the time jitter of
1476// PMTs. The input parameter is the sigma of a gaussian, which by
1477// default is sigma=0.25 ns. This jitter is applied to each phe-
1478// independently. We have not applied this to the NSB noise, since the
1479// arrival time of NSB photons is random and nothing would change.
1480//
1481// Revision 1.34 2004/11/17 11:36:07 moralejo
1482// *** empty log message ***
1483//
1484// Revision 1.33 2004/10/26 13:58:59 moralejo
1485//
1486// Added option gain_fluctuations_off
1487//
1488// Revision 1.32 2004/10/14 16:53:49 moralejo
1489//
1490// Added option calibration_run
1491//
1492// Revision 1.31 2004/10/13 17:05:05 moralejo
1493// *** empty log message ***
1494//
1495// Revision 1.30 2004/10/12 13:32:02 moralejo
1496// *** empty log message ***
1497//
1498// Revision 1.29 2004/09/17 14:48:21 moralejo
1499//
1500// Changes to adapt headers to c++ style.
1501//
1502// Revision 1.28 2004/09/16 15:27:08 moralejo
1503// Updated in CVS after some time (see changes below)
1504//
1505//
1506// Revision 1.27 2004/05/12 A. Moralejo
1507//
1508// Changed fadc_noise command: now the two first numbers are respectively
1509// the analogic electronic noise for inner (small) and outer (big) pixels
1510// respectively. Last number is still the FADC digital noise which affects
1511// equallly inner and outer pixels (as well as high and low gain).
1512//
1513// Revision 1.26 2004/01/30 09:58:39 blanch
1514// [Changes done mainly by A. Moralejo]
1515//
1516// Two new commands of the input card have been added:
1517//
1518// sigma_xy_cm_spot: to enlarge the point spread function.
1519// trigger_delay: to center the FADC signal
1520//
1521// There is also a check that the Pedestal is an integer, otherwise it
1522// becames complex to get a reasonable rms for events without electronic noise.
1523//
1524// Revision 1.25 2003/10/26 19:45:38 blanch
1525// The write_all_data input card command has been removed.
1526//
1527// Revision 1.24 2003/10/17 19:40:24 blanch
1528// The gain ratio between the high and low FADC gain is controlled from the
1529// input card.
1530//
1531// Revision 1.23 2003/09/23 17:38:48 blanch
1532// ana_pixels command has been removed.
1533//
1534// Revision 1.22 2003/09/23 16:52:07 blanch
1535// We do not read ct_file anymore.
1536//
1537// Revision 1.21 2003/09/15 10:17:09 blanch
1538// Some modifications in the input card has been done for the multitelescope
1539// configuration.
1540//
1541// Revision 1.20 2003/07/17 18:04:53 blanch
1542// Some new parameters to be read have been introduced
1543//
1544// - FADC pedestals
1545// - Response outer FADC
1546// - Qe file
1547//
1548// The obsolete ones have been removed.
1549//
1550// Revision 1.19 2003/02/12 13:47:32 blanch
1551// *** empty log message ***
1552//
1553// Revision 1.18 2003/01/14 13:37:47 blanch
1554// Option to set a dc value to rise the discriminator threshold has been added.
1555//
1556// Revision 1.17 2002/07/16 16:20:41 blanch
1557// Modifications done for the camera.cxx version, where a first implementation
1558// of the Star Field Rotation has been introduced.
1559//
1560// Revision 1.16 2002/03/15 15:17:18 blanch
1561// Several modification needed to simulate the actual trigger zone.
1562//
1563// Revision 1.15 2002/03/04 17:15:51 blanch
1564// An item, which allows to switch off the storage of the RawEvt, has been
1565// introduced. It is called nowrite_RawEvt. To avoid confusion the item
1566// write_all_images has been moved to write_all_events.
1567//
1568// Revision 1.14 2002/02/28 15:07:23 blanch
1569// Small changes have been done to introduce thes step variable for the
1570// discriminator threshold in the trigger loop mode.
1571//
1572// Revision 1.13 2002/01/18 17:43:08 blanch
1573// Three new commands have been added: fadc_noise, trig_noise and
1574// elec_noise_off.
1575// A small bug in the SIGNATURE check has been solved.
1576//
1577// Revision 1.12 2001/11/13 17:05:14 blanch
1578// New input items int the input card parameter list have been included to fill
1579// the MMcRunHeader.
1580// There has been also some change to remove warnings in the compilation.
1581//
1582// Revision 1.11 2001/07/25 11:38:00 magicsol
1583// Minnor changes
1584//
1585// Revision 1.10 2001/07/19 09:28:30 blanch
1586// A new command, which allows to set individual trigger threshod for each pixel,
1587// has been added.
1588//
1589// Revision 1.9 2001/03/05 10:43:18 blanch
1590// New input commands have been added:
1591//
1592// - write_McFadc: to write the FADC simulation information.
1593// - fadc_prop: gives the shape of the single phe response of the FADC
1594//
1595// And new value has been added in the mean_NSB command that tells how many phes
1596// have to come from the shower to do the NSB simulation in that shower (it speeds
1597// up the simulation).
1598//
1599// Revision 1.8 2001/02/23 10:55:43 magicsol
1600// An input commmand that talls the path for the NSB database has been added.
1601//
1602// Revision 1.7 2001/01/15 12:37:48 magicsol
1603// It has been introduced the option to read from the input card the overlaping
1604// time.
1605//
1606// Revision 1.6 2000/09/21 11:47:33 harald
1607// Oscar found some smaller errors in the calculation of the pixel shape and
1608// corrected it.
1609//
1610// Revision 1.5 2000/07/04 14:13:02 MagicSol
1611// It reads from the general input card the parameters for the
1612// trigger analysi.
1613//
1614// Revision 1.4 2000/05/11 14:22:33 blanch
1615// New input card option has been introduced:
1616// trigger_loop lt ut lm um lg ug
1617// It forces the camera program to study several condition trigger implementations. Integers after key word fix limits of loop over thershold, multiplicity and topology.
1618//
1619// Revision 1.3 2000/03/24 18:14:05 blanch
1620// Parameters that tell as if we are going to see the diskriminator and/or FADC signal have been included.
1621//
1622// Revision 1.2 2000/02/18 17:45:43 petry
1623// This version belongs to camera.cxx 1.5.
1624// It has been put in the repository in order to be
1625// able to share the further development with others.
1626//
1627// If you need something working, wait or take an earlier one.
1628// See file README
1629//
1630// Revision 1.1.1.1 1999/11/05 11:59:34 harald
1631// This the starting point for CVS controlled further developments of the
1632// camera program. The program was originally written by Jose Carlos.
1633// But here you can find a "rootified" version to the program. This means
1634// that there is no hbook stuff in it now. Also the output of the
1635// program changed to the MagicRawDataFormat.
1636//
1637// The "rootification" was done by Dirk Petry and Harald Kornmayer.
1638//
1639// In the following you can see the README file of that version:
1640//
1641// ==================================================
1642//
1643// Fri Oct 22 1999 D.P.
1644//
1645// The MAGIC Monte Carlo System
1646//
1647// Camera Simulation Programme
1648// ---------------------------
1649//
1650// 1) Description
1651//
1652// This version is the result of the fusion of H.K.'s
1653// root_camera which is described below (section 2)
1654// and another version by D.P. which had a few additional
1655// useful features.
1656//
1657// The version compiles under Linux with ROOT 2.22 installed
1658// (variable ROOTSYS has to be set).
1659//
1660// Compile as before simply using "make" in the root_camera
1661// directory.
1662//
1663// All features of H.K.'s root_camera were retained.
1664//
1665// Additional features of this version are:
1666//
1667// a) HBOOK is no longer used and all references are removed.
1668//
1669// b) Instead of HBOOK, the user is given now the possibility of
1670// having Diagnostic data in ROOT format as a complement
1671// to the ROOT Raw data.
1672//
1673// This data is written to the file which is determined by
1674// the new input parameter "diag_file" in the camera parameter
1675// file.
1676//
1677// All source code file belonging to this part have filenames
1678// starting with "MDiag".
1679//
1680// The user can read the output file using the following commands
1681// in an interactive ROOT session:
1682//
1683// root [0] .L MDiag.so
1684// root [1] new TFile("diag.root");
1685// root [2] new TTreeViewer("T");
1686//
1687// This brings up a viewer from which all variables of the
1688// TTree can be accessed and histogrammed. This example
1689// assumes that you have named the file "diag.root", that
1690// you are using ROOT version 2.22 or later and that you have
1691// the shared object library "MDiag.so" which is produced
1692// by the Makefile along with the executable "camera".
1693//
1694// ! The contents of the so-called diag file is not yet fixed.
1695// ! At the moment it is what J.C.G. used to put into the HBOOK
1696// ! ntuple. In future versions the moments calculation can be
1697// ! removed and the parameter list be modified correspondingly.
1698//
1699// c) Now concatenated reflector files can be read. This is useful
1700// if you have run the reflector with different parameters but
1701// you want to continue the analysis with all reflector data
1702// going into ONE ROOT outputfile.
1703//
1704// The previous camera version contained a bug which made reading
1705// of two or more concatenated reflector files impossible.
1706//
1707// d) The reflector output format was changed. It is now version
1708// 0.4 .
1709// The change solely consists in a shortening of the flag
1710// definition in the file
1711//
1712// include-MC/MCCphoton.hxx
1713//
1714// ! IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
1715// ! do so by recompiling camera with the previous version of
1716// ! include-MC/MCCphoton.hxx.
1717//
1718// The change was necessary for saving space and better
1719// debugging. From now on, this format can be frozen.
1720//
1721// ! For producing reflector output in the new format, you
1722// ! of course have to recompile your reflector with the
1723// ! new include-MC/MCCphoton.hxx .
1724//
1725// e) A first version of the pixelization with the larger
1726// outer pixels is implemented. THIS IS NOT YET FULLY
1727// TESTED, but first rough tests show that it works
1728// at least to a good approximation.
1729//
1730// The present version implements the camera outline
1731// with 18 "gap-pixels" and 595 pixels in total as
1732// shown in
1733//
1734// http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
1735//
1736// This change involved
1737//
1738// (i) The file pixels.dat is no longer needed. Instead
1739// the coordinates are generated by the program itself
1740// (takes maybe 1 second). In the file
1741//
1742// pixel-coords.txt
1743//
1744// in the same directory as this README, you find a list
1745// of the coordinates generated by this new routine. It
1746// has the format
1747//
1748// number i j x y size-factor
1749//
1750// where i and j are J.C.G.'s so called biaxis hexagonal
1751// coordinates (for internal use) and x and y are the
1752// coordinates of the pixel centers in the standard camera
1753// coordinate system in units of centimeters. The value
1754// of "size-factor" determines the linear size of the pixel
1755// relative to the central pixels.
1756//
1757// (ii) The magic.def file has two additional parameters
1758// which give the number of central pixels and the
1759// number of gap pixels
1760//
1761// (iii) In camera.h and camera.cxx several changes were
1762// necessary, among them the introduction of several
1763// new functions
1764//
1765// The newly suggested outline with asymmetric Winston cones
1766// will be implemented in a later version.
1767//
1768// f) phe files can no longer be read since this contradicts
1769// our philosophy that the analysis should be done with other
1770// programs like e.g. EVITA and not with "camera" itself.
1771// This possibility was removed.
1772//
1773// g) ROOT is no longer invoked with an interactive interface.
1774// In this way, camera can better be run as a batch program and
1775// it uses less memory.
1776//
1777// h) small changes concerning the variable "t_chan" were necessary in
1778// order to avoid segmentation faults: The variable is used as an
1779// index and it went sometimes outside the limits when camera
1780// was reading proton data. This is because the reflector files
1781// don't contain the photons in a chronological order and also
1782// the timespread can be considerably longer that the foreseen
1783// digitisation timespan. Please see the source code of camera.cxx
1784// round about line 1090.
1785//
1786// j) several unused variables were removed, a few warning messages
1787// occur when you compile camera.cxx but these can be ignored at
1788// the moment.
1789//
1790// In general the program is of course not finished. It still needs
1791// debugging, proper trigger simulation, simulation of the asymmetric
1792// version of the outer pixels, proper NSB simulation, adaption of
1793// the diag "ntuple" contents to our need and others small improvements.
1794//
1795// In the directory rfl-files there is now a file in reflector format 0.4
1796// containing a single event produced by the starfiled adder. It has
1797// a duration of 30 ns and represents the region around the Crab Nebula.
1798// Using the enclosed input parameter file, camera should process this
1799// file without problems.
1800//
1801// 2) The README for the previous version of root_camera
1802//
1803// README for a preliminary version of the
1804// root_camera program.
1805//
1806// root_camera is based on the program "camera"of Jose Carlos
1807// Gonzalez. It was changed in the way that only the pixelisation
1808// and the distibution of the phe to the FADCs works in a
1809// first version.
1810//
1811// Using the #undef command most possibilities of the orignal
1812// program are switched of.
1813//
1814// The new parts are signed by
1815//
1816// - ROOT or __ROOT__
1817// nearly all important codelines for ROOT output are enclosed
1818// in structures like
1819// #ifdef __ROOT__
1820//
1821// code
1822//
1823// #endif __ROOT__
1824//
1825// In same case the new lines are signed by a comment with the word
1826// ROOT in it.
1827//
1828// For timing of the pulse some variable names are changed.
1829// (t0, t1, t --> t_ini, t_fin, t_1st, t_chan,...)
1830// Look also for this changes.
1831//
1832// For the new root-file is also a change in readparm-files
1833//
1834//
1835// - __DETAIL_TRIGGER__
1836//
1837// This is for the implementation of the current work on trigger
1838// studies. Because the class MTrigger is not well documented it
1839// isn´t a part of this tar file. Only a dummy File exists.
1840//
1841//
1842//
1843// With all files in the archive, the root_camera program should run.
1844//
1845// A reflector file is in the directory rfl-files
1846//
1847// ==================================================
1848//
1849// From now on, use CVS for development!!!!
1850//
1851//
1852//
1853// Revision 1.2 1999/10/22 15:01:28 petry
1854// version sent to H.K. and N.M. on Fri Oct 22 1999
1855//
1856// Revision 1.1.1.1 1999/10/21 16:35:11 petry
1857// first synthesised version
1858//
1859// Revision 1.6 1999/03/15 14:59:08 gonzalez
1860// camera-1_1
1861//
1862// Revision 1.5 1999/03/02 09:56:12 gonzalez
1863// *** empty log message ***
1864//
1865// Revision 1.4 1999/01/14 17:32:41 gonzalez
1866// Added to camera the STDIN input option (data_from_input)
1867//
1868//!@}
1869
1870//=EOF
Note: See TracBrowser for help on using the repository browser.