| 1 | //=//////////////////////////////////////////////////////////////////////
|
|---|
| 2 | //=
|
|---|
| 3 | //= creadparam
|
|---|
| 4 | //=
|
|---|
| 5 | //= @file creadparam.h
|
|---|
| 6 | //= @desc Header 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.h,v $
|
|---|
| 21 | //= $Revision: 1.23 $
|
|---|
| 22 | //= $Author: blanch $
|
|---|
| 23 | //= $Date: 2004-01-30 09:55:33 $
|
|---|
| 24 | //=
|
|---|
| 25 | //=//////////////////////////////////////////////////////////////////////
|
|---|
| 26 |
|
|---|
| 27 | // @T \newpage
|
|---|
| 28 |
|
|---|
| 29 | //!@section Source code of |creadparam.h|.
|
|---|
| 30 |
|
|---|
| 31 | /*!@"
|
|---|
| 32 |
|
|---|
| 33 | In this section you can find the source code for the file
|
|---|
| 34 | |creadparam.h|. This file is mainly needed by
|
|---|
| 35 | |creadparam.cxx|. Here is located the definition of the commands you
|
|---|
| 36 | can use in the parameters file. In this file, the first line must be
|
|---|
| 37 | |camera 'version'|, where |'version'| is the appropiate version of
|
|---|
| 38 | the output format (NOT the version of the camera program) which can
|
|---|
| 39 | read the commands written in that parameters file. You cannot mix
|
|---|
| 40 | parameters files and executables with different versions. The
|
|---|
| 41 | current version is |camera 0.2|.
|
|---|
| 42 |
|
|---|
| 43 | The commands now available for the parameters file are:
|
|---|
| 44 |
|
|---|
| 45 | @itemize
|
|---|
| 46 |
|
|---|
| 47 | @- |input_file| filename :
|
|---|
| 48 | Sets the name of the input file (|.rfl|).
|
|---|
| 49 | @- |starfield_file| filename :
|
|---|
| 50 | Sets the name of the starfield input file (|.rfl|).
|
|---|
| 51 | @- |ct_file| filename :
|
|---|
| 52 | Sets the name of the CT definition file (|.def|).
|
|---|
| 53 | @- |data_file| filename :
|
|---|
| 54 | Sets the name of the output data file (|.dat|).
|
|---|
| 55 | @- |elec_noise_off| :
|
|---|
| 56 | De-activates ElecNoise for FADC and Trigger channels. By default it is on.
|
|---|
| 57 | @- |fadc_noise_off| :
|
|---|
| 58 | Sets the ElecNoise for FADC.
|
|---|
| 59 | @- |trig_noise_off| :
|
|---|
| 60 | Sets the ElecNoise for trigger system.
|
|---|
| 61 | @- |nsb_on| :
|
|---|
| 62 | Activates the NSB simulation. This is the default.
|
|---|
| 63 | @- |nsb_off| :
|
|---|
| 64 | De-activates the NSB simulation.
|
|---|
| 65 | @- |nsb_mean| number :
|
|---|
| 66 | Sets the mean value for the NSB.
|
|---|
| 67 | Default value: 6 for CT1, 6 for MAGIC.
|
|---|
| 68 | This implies always |nsb_on|.
|
|---|
| 69 | @- |threshold| number :
|
|---|
| 70 | Sets the Threshold value q0. Default value: 10.
|
|---|
| 71 | @- |tail_cut| number :
|
|---|
| 72 | Sets the Tail-Cut value.
|
|---|
| 73 | Default value: 7.
|
|---|
| 74 | @- |islands_cut| number :
|
|---|
| 75 | Sets the Islands-Cut value i0.
|
|---|
| 76 | Default value: 10.
|
|---|
| 77 | @- |end_file|
|
|---|
| 78 | Last command in the parameters file.
|
|---|
| 79 |
|
|---|
| 80 | @enditemize
|
|---|
| 81 |
|
|---|
| 82 | @ignoreHTML
|
|---|
| 83 | A parameters file (a small one) looks like this:
|
|---|
| 84 |
|
|---|
| 85 | |camera 0.2|
|
|---|
| 86 |
|
|---|
| 87 | |input_file gm100-500.rfl|
|
|---|
| 88 |
|
|---|
| 89 | |output_file gm100-500.phe|
|
|---|
| 90 |
|
|---|
| 91 | |output_file gm100-500.dat|
|
|---|
| 92 |
|
|---|
| 93 | |ct_file magic.def|
|
|---|
| 94 |
|
|---|
| 95 | |threshold 10.0|
|
|---|
| 96 |
|
|---|
| 97 | |tail_cut 7.0|
|
|---|
| 98 |
|
|---|
| 99 | |nsb_mean 5.0|
|
|---|
| 100 |
|
|---|
| 101 | |end_file|
|
|---|
| 102 | @endignoreHTML
|
|---|
| 103 |
|
|---|
| 104 | @"*/
|
|---|
| 105 |
|
|---|
| 106 | //!@{
|
|---|
| 107 |
|
|---|
| 108 | #ifndef _creadparam_
|
|---|
| 109 | #define _creadparam_
|
|---|
| 110 |
|
|---|
| 111 | #ifndef _this_
|
|---|
| 112 | #define _this_ creadparam
|
|---|
| 113 | #endif
|
|---|
| 114 |
|
|---|
| 115 | //!@}
|
|---|
| 116 |
|
|---|
| 117 | //!@subsection Include files.
|
|---|
| 118 |
|
|---|
| 119 | //!@{
|
|---|
| 120 |
|
|---|
| 121 | #include <iostream.h>
|
|---|
| 122 | #include <fstream.h>
|
|---|
| 123 | #include <stdlib.h>
|
|---|
| 124 | #include <stdio.h>
|
|---|
| 125 | #include <string.h>
|
|---|
| 126 | #include <math.h>
|
|---|
| 127 | #include <float.h>
|
|---|
| 128 |
|
|---|
| 129 | #include "jcmacros.h"
|
|---|
| 130 | #include "jcdebug.h"
|
|---|
| 131 |
|
|---|
| 132 | #include "camera-v.h"
|
|---|
| 133 |
|
|---|
| 134 | #include "MTriggerDefine.h"
|
|---|
| 135 | #include "MFadcDefine.h"
|
|---|
| 136 | #include "Mdefine.h"
|
|---|
| 137 |
|
|---|
| 138 | //!@}
|
|---|
| 139 |
|
|---|
| 140 | //!@subsection Macro-definitions, and constants.
|
|---|
| 141 |
|
|---|
| 142 | //!@{
|
|---|
| 143 |
|
|---|
| 144 | // now we define the list PM_ITEM_LIST of possible items in
|
|---|
| 145 | // the parameters file. note that they are functions of
|
|---|
| 146 | // T(x). we will change T(x) to be the real item or the
|
|---|
| 147 | // string of this item when needed
|
|---|
| 148 |
|
|---|
| 149 | #define PM_ITEM_LIST /* LIST OF ITEMS IN THE PARAMETERS FILE */ \
|
|---|
| 150 | T(input_file), /* input file */ \
|
|---|
| 151 | T(starfield_file), /* starfield file */ \
|
|---|
| 152 | T(starfield_center),/* center of thestarfield FOV */ \
|
|---|
| 153 | T(data_file), /* data file */ \
|
|---|
| 154 | T(root_file), /* ROOT file */ \
|
|---|
| 155 | T(ct_num), /* number of CT, which is number of reflector files */ \
|
|---|
| 156 | T(ct_geom), /* class with the geometry of the CT camera */ \
|
|---|
| 157 | T(qe_file), /* file with the characteristics of the CT */ \
|
|---|
| 158 | T(elec_noise_off), /* de-activates ElecNoise for FADC and Trigger channels */\
|
|---|
| 159 | T(fadc_pedestal), /* Pedestal value for FADC */\
|
|---|
| 160 | T(fadc_noise), /* ElecNoise for FADC */\
|
|---|
| 161 | T(trig_noise), /* ElecNoise for trigger */\
|
|---|
| 162 | T(sfr_on), /* starfield rotation */ \
|
|---|
| 163 | T(nsb_on), /* activates NSB simulation */ \
|
|---|
| 164 | T(nsb_off), /* de-activates NSB simulation */ \
|
|---|
| 165 | T(nsb_mean), /* mean value of NSB contribution per pixel */ \
|
|---|
| 166 | T(nsb_directory), /* database for the NSB */ \
|
|---|
| 167 | T(nsb_dir_outer), /* database for the NSB */ \
|
|---|
| 168 | T(pixel_thres), /* value of q0 for trigger for a given pixel */ \
|
|---|
| 169 | T(secure_disc), /* Ac value to rise discrimnator threshold */ \
|
|---|
| 170 | T(seeds), /* seeds for random number generation */ \
|
|---|
| 171 | T(data_from_stdin), /* to read data from STDIN */ \
|
|---|
| 172 | T(skip), /* skip pathological showers */ \
|
|---|
| 173 | T(write_all_events),/* write to file .phe ALL images (even w.o. trigger)*/ \
|
|---|
| 174 | T(nowrite_McEvt), /* nowrite to file .root McEvt infos */ \
|
|---|
| 175 | T(write_McTrig), /* write to file .root McTrig infos */ \
|
|---|
| 176 | T(write_McFadc), /* write to file .root McFadc infos */ \
|
|---|
| 177 | T(nowrite_RawEvt), /* write to file .root RawData infos */ \
|
|---|
| 178 | T(select_energy), /* energy range to read: only for .phe files */ \
|
|---|
| 179 | T(trigger_scan), /* show signal in the diskriminator */ \
|
|---|
| 180 | T(fadc_scan), /* show fadc signal */ \
|
|---|
| 181 | T(trigger_loop), /* make loop over trigger conditions */ \
|
|---|
| 182 | T(trigger_prop), /* values of trigger properties */ \
|
|---|
| 183 | T(fadc_prop), /* values of fadc properties */ \
|
|---|
| 184 | T(fadc_outer), /* values of fadc properties for outer pixels */ \
|
|---|
| 185 | T(trigger_single), /* trigger conditions */ \
|
|---|
| 186 | T(Trigger_Loop_Output_Only_Specialists), /* special steercard */ \
|
|---|
| 187 | T(source_offset), /* Displacement of the source from the center */ \
|
|---|
| 188 | T(high_to_low), /* Displacement of the source from the center */ \
|
|---|
| 189 | T(sigma_xy_cm_spot), /* Additional gaussian spread of mirror spot on camera */ \
|
|---|
| 190 | T(trigger_delay), /* Delay in ns between beginning of FADC
|
|---|
| 191 | time window and the trigger instant.*/ \
|
|---|
| 192 | T(end_file) /* end of the parameters file */
|
|---|
| 193 |
|
|---|
| 194 | #define T(x) x // define T() as the name as it is
|
|---|
| 195 |
|
|---|
| 196 | enum ITEM_TYPE {
|
|---|
| 197 | PM_ITEM_LIST
|
|---|
| 198 | };
|
|---|
| 199 |
|
|---|
| 200 | #undef T
|
|---|
| 201 |
|
|---|
| 202 | #define T(x) #x // define T() as the string of x
|
|---|
| 203 |
|
|---|
| 204 | const char *const ITEM_NAMES[] = {
|
|---|
| 205 | PM_ITEM_LIST
|
|---|
| 206 | };
|
|---|
| 207 |
|
|---|
| 208 | #undef T
|
|---|
| 209 |
|
|---|
| 210 | #define LINE_MAX_LENGTH 400
|
|---|
| 211 | #define ITEM_MAX_LENGTH 40
|
|---|
| 212 | #define PATH_MAX_LENGTH 120
|
|---|
| 213 |
|
|---|
| 214 | //!@}
|
|---|
| 215 |
|
|---|
| 216 | //!@subsection Prototypes of functions.
|
|---|
| 217 |
|
|---|
| 218 | //!@{
|
|---|
| 219 |
|
|---|
| 220 | //++
|
|---|
| 221 | // prototypes
|
|---|
| 222 | //--
|
|---|
| 223 |
|
|---|
| 224 | void readparam(char * filename);
|
|---|
| 225 | char *get_input_filename(int i);
|
|---|
| 226 | char *get_starfield_filename(void);
|
|---|
| 227 | void get_starfield_center(int *rh,int *rm,int *rs,int *dd,int *dm,int *ds);
|
|---|
| 228 | int get_starfield_rotate(void);
|
|---|
| 229 | char *get_data_filename(void);
|
|---|
| 230 | char *get_root_filename(void);
|
|---|
| 231 | char *get_loop_filename(void);
|
|---|
| 232 | int get_ct_number(void);
|
|---|
| 233 | int get_ct_geometry(void);
|
|---|
| 234 | char *get_qe_filename(int ict=0);
|
|---|
| 235 | char *get_nsb_directory(void);
|
|---|
| 236 | char *get_nsb_directory_outer(void);
|
|---|
| 237 | int add_elec_noise(float *fadc, float *digi, float *trig);
|
|---|
| 238 | int get_nsb(float *n, int *m);
|
|---|
| 239 | long int get_seeds(int n);
|
|---|
| 240 | void get_skip_showers( int *s );
|
|---|
| 241 | int get_nskip_showers( void );
|
|---|
| 242 | int get_data_from_stdin(void);
|
|---|
| 243 | int get_write_all_events(void);
|
|---|
| 244 | int get_write_McEvt(void);
|
|---|
| 245 | int get_write_McTrig(void);
|
|---|
| 246 | int get_write_McFadc(void);
|
|---|
| 247 | int get_write_RawEvt(void);
|
|---|
| 248 | int get_select_energy(float *le, float *ue);
|
|---|
| 249 | int get_FADC_Scan(void);
|
|---|
| 250 | int get_Trigger_Scan(void);
|
|---|
| 251 | void get_Trigger_properties(float *gl, float *ot, float *ra, float *rf);
|
|---|
| 252 | void get_FADC_properties(float *ra, float *rf, float *rao, float *rfo);
|
|---|
| 253 | float get_FADC_pedestal(void);
|
|---|
| 254 | int get_Trigger_Loop(float *lt, float *ut, float *st, int *lm, int *um, int *lg, int *ug);
|
|---|
| 255 | void get_Trigger_Single(float **t, int *m, int *g);
|
|---|
| 256 | void get_threshold(float *t);
|
|---|
| 257 | void get_secure_threhold(float *ac, float *disc);
|
|---|
| 258 | int get_indi_thres_pixel(void);
|
|---|
| 259 | void get_source_off(float *th, float *p);
|
|---|
| 260 | float get_High_to_Low(void);
|
|---|
| 261 | float get_sigma_xy_cm_spot(void);
|
|---|
| 262 | float get_trig_delay(void);
|
|---|
| 263 | //!@}
|
|---|
| 264 |
|
|---|
| 265 | //!@{
|
|---|
| 266 |
|
|---|
| 267 | #endif // ! _creadparam_
|
|---|
| 268 |
|
|---|
| 269 | //!@}
|
|---|
| 270 |
|
|---|
| 271 | //=------------------------------------------------------------
|
|---|
| 272 | //!@subsection Log of this file.
|
|---|
| 273 |
|
|---|
| 274 | //!@{
|
|---|
| 275 |
|
|---|
| 276 | /*
|
|---|
| 277 | * $Log: not supported by cvs2svn $
|
|---|
| 278 | * Revision 1.22 2003/10/26 19:51:30 blanch
|
|---|
| 279 | * Header file for creadparam.cxx version 1.25
|
|---|
| 280 | *
|
|---|
| 281 | * Revision 1.21 2003/10/17 19:40:47 blanch
|
|---|
| 282 | * *** empty log message ***
|
|---|
| 283 | *
|
|---|
| 284 | * Revision 1.20 2003/09/23 17:38:59 blanch
|
|---|
| 285 | * *** empty log message ***
|
|---|
| 286 | *
|
|---|
| 287 | * Revision 1.19 2003/09/23 16:52:43 blanch
|
|---|
| 288 | * Header file for creadparam.cxx 1.22
|
|---|
| 289 | *
|
|---|
| 290 | * Revision 1.18 2003/09/15 10:23:31 blanch
|
|---|
| 291 | * Hedaer file for creadparam.cxx 1.21
|
|---|
| 292 | *
|
|---|
| 293 | * Revision 1.17 2003/07/17 18:05:13 blanch
|
|---|
| 294 | * Header file for creadparam.cxx 1.20
|
|---|
| 295 | *
|
|---|
| 296 | * Revision 1.16 2003/01/14 13:37:32 blanch
|
|---|
| 297 | * Option to set a dc value to rise the discriminator threshold has been added.
|
|---|
| 298 | *
|
|---|
| 299 | * Revision 1.15 2002/07/16 16:20:59 blanch
|
|---|
| 300 | * Modifications done for the camera.cxx version, where a first implementation
|
|---|
| 301 | * of the Star Field Rotation has been introduced.
|
|---|
| 302 | *
|
|---|
| 303 | * Revision 1.14 2002/03/15 15:17:57 blanch
|
|---|
| 304 | * Header file for creadparam.cxx v 1.16
|
|---|
| 305 | *
|
|---|
| 306 | * Revision 1.13 2002/03/04 17:20:50 blanch
|
|---|
| 307 | * Header file for creadparam.cxx 1.15
|
|---|
| 308 | *
|
|---|
| 309 | * Revision 1.12 2002/02/28 15:08:01 blanch
|
|---|
| 310 | * Header file for creadparam.cxx 1.14.
|
|---|
| 311 | *
|
|---|
| 312 | * Revision 1.11 2002/01/18 17:45:37 blanch
|
|---|
| 313 | * Header file for creadparam.cxx 1.13.
|
|---|
| 314 | *
|
|---|
| 315 | * Revision 1.10 2001/11/13 17:06:01 blanch
|
|---|
| 316 | * Header file for creadparam.cxx version 1.12
|
|---|
| 317 | *
|
|---|
| 318 | * Revision 1.9 2001/07/19 09:29:02 blanch
|
|---|
| 319 | * Header file for creadparam.cxx vrsion 1.10
|
|---|
| 320 | *
|
|---|
| 321 | * Revision 1.8 2001/03/05 10:44:44 blanch
|
|---|
| 322 | * Header file of creadparam.cxx version 1.9
|
|---|
| 323 | *
|
|---|
| 324 | * Revision 1.7 2001/02/23 10:56:10 magicsol
|
|---|
| 325 | * Header file for creadparam.cxx version 1.8
|
|---|
| 326 | *
|
|---|
| 327 | * Revision 1.6 2001/01/15 12:38:00 magicsol
|
|---|
| 328 | * *** empty log message ***
|
|---|
| 329 | *
|
|---|
| 330 | * Revision 1.5 2000/07/04 14:13:34 MagicSol
|
|---|
| 331 | * *** empty log message ***
|
|---|
| 332 | *
|
|---|
| 333 | * Revision 1.4 2000/05/11 14:23:28 blanch
|
|---|
| 334 | * Thi version owns to the version 1.4 of creadparam.cxx.
|
|---|
| 335 | *
|
|---|
| 336 | * Revision 1.3 2000/03/24 18:15:46 blanch
|
|---|
| 337 | * *** empty log message ***
|
|---|
| 338 | *
|
|---|
| 339 | * Revision 1.2 2000/02/18 17:50:07 petry
|
|---|
| 340 | * This version belongs to camera.cxx 1.5.
|
|---|
| 341 | * It version has been put in the repository in order to be
|
|---|
| 342 | * able to share the further development with others.
|
|---|
| 343 | *
|
|---|
| 344 | * If you need something working, wait or take an earlier one.
|
|---|
| 345 | * See file README
|
|---|
| 346 | *
|
|---|
| 347 | * Revision 1.1.1.1 1999/11/05 11:59:34 harald
|
|---|
| 348 | * This the starting point for CVS controlled further developments of the
|
|---|
| 349 | * camera program. The program was originally written by Jose Carlos.
|
|---|
| 350 | * But here you can find a "rootified" version to the program. This means
|
|---|
| 351 | * that there is no hbook stuff in it now. Also the output of the
|
|---|
| 352 | * program changed to the MagicRawDataFormat.
|
|---|
| 353 | *
|
|---|
| 354 | * The "rootification" was done by Dirk Petry and Harald Kornmayer.
|
|---|
| 355 | *
|
|---|
| 356 | * Revision 1.2 1999/10/22 15:01:29 petry
|
|---|
| 357 | * version sent to H.K. and N.M. on Fri Oct 22 1999
|
|---|
| 358 | *
|
|---|
| 359 | * Revision 1.1.1.1 1999/10/21 16:35:11 petry
|
|---|
| 360 | * first synthesised version
|
|---|
| 361 | *
|
|---|
| 362 | * Revision 1.7 1999/03/15 14:59:09 gonzalez
|
|---|
| 363 | * camera-1_1
|
|---|
| 364 | *
|
|---|
| 365 | * Revision 1.6 1999/03/02 09:56:13 gonzalez
|
|---|
| 366 | * *** empty log message ***
|
|---|
| 367 | *
|
|---|
| 368 | * Revision 1.5 1999/01/14 17:32:43 gonzalez
|
|---|
| 369 | * Added to camera the STDIN input option (data_from_input)
|
|---|
| 370 | *
|
|---|
| 371 | */
|
|---|
| 372 |
|
|---|
| 373 | //!@}
|
|---|
| 374 | //=EOF
|
|---|