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