34 #ifndef _MC_TEL_LOADED
36 #define _MC_TEL_LOADED 2
38 #ifndef _EVENTIO_BASIC_LOADED
57 typedef unsigned short UINT16;
60 typedef unsigned long UINT32;
63 typedef unsigned int UINT32;
185 #define IO_TYPE_MC_BASE 1200
186 #define IO_TYPE_MC_RUNH (IO_TYPE_MC_BASE+0)
187 #define IO_TYPE_MC_TELPOS (IO_TYPE_MC_BASE+1)
188 #define IO_TYPE_MC_EVTH (IO_TYPE_MC_BASE+2)
189 #define IO_TYPE_MC_TELOFF (IO_TYPE_MC_BASE+3)
190 #define IO_TYPE_MC_TELARRAY (IO_TYPE_MC_BASE+4)
191 #define IO_TYPE_MC_PHOTONS (IO_TYPE_MC_BASE+5)
192 #define IO_TYPE_MC_LAYOUT (IO_TYPE_MC_BASE+6)
193 #define IO_TYPE_MC_TRIGTIME (IO_TYPE_MC_BASE+7)
194 #define IO_TYPE_MC_PE (IO_TYPE_MC_BASE+8)
195 #define IO_TYPE_MC_EVTE (IO_TYPE_MC_BASE+9)
196 #define IO_TYPE_MC_RUNE (IO_TYPE_MC_BASE+10)
197 #define IO_TYPE_MC_LONGI (IO_TYPE_MC_BASE+11)
198 #define IO_TYPE_MC_INPUTCFG (IO_TYPE_MC_BASE+12)
199 #define IO_TYPE_MC_TELARRAY_HEAD (IO_TYPE_MC_BASE+13)
200 #define IO_TYPE_MC_TELARRAY_END (IO_TYPE_MC_BASE+14)
201 #define IO_TYPE_MC_EXTRA_PARAM (IO_TYPE_MC_BASE+15)
202 #define IO_TYPE_MC_ATMPROF (IO_TYPE_MC_BASE+16)
203 #define IO_TYPE_MC_PHOTONS3D (IO_TYPE_MC_BASE+17)
209 real *data,
int len);
220 double *y,
double *z,
double *r);
222 double *x,
double *y,
double *z,
double *r);
226 double *xoff,
double *yoff);
228 double *xoff,
double *yoff,
double *
weight);
230 double *toff,
double *xoff,
double *yoff);
232 double *toff,
double *xoff,
double *yoff,
double *
weight);
246 double photons,
struct bunch *bunches,
int nbunches,
247 int ext_bunches,
char *ext_fname);
249 double photons,
struct compact_bunch *cbunches,
int nbunches,
250 int ext_bunches,
char *ext_fname);
252 int *tel,
double *photons,
struct bunch *bunches,
int *nbunches);
256 double photons,
struct bunch3d *bunches3d,
int nbunches,
257 int ext_bunches,
char *ext_fname);
259 int *tel,
double *photons,
struct bunch3d *bunches3d,
int *nbunches);
263 double *data,
int ndim,
int np,
int nthick,
double thickstep);
265 int *type,
double *data,
int ndim,
int *np,
int *nthick,
266 double *thickstep,
int max_np);
270 int pixels,
double *xp,
double *yp);
272 int *type,
int *pixels,
double *xp,
double *yp);
276 int npe,
int pixels,
int flags,
int *pe_counts,
int *tstart,
277 double *t,
double *a,
int *photon_counts);
279 int max_pe,
int *array,
int *tel,
int *npe,
int *pixels,
int *flags,
280 int *pe_counts,
int *tstart,
double *t,
double *a,
int *photon_counts);
285 int print_shower_extra_parameters (
IO_BUFFER *iobuf);
290 void remember_corsika_atm_params(
float *hlay,
float *aatm,
float *batm,
float *catm);
291 int get_corsika_atm_params(
double *hlay,
double *aatm,
double *batm,
double *catm,
double *datm);
static int ntel
Number of telescopes set up.
Definition: iact.c:352
static size_t max_bunches
The default maximum number of bunches can later be adapted to CORSIKA.
Definition: sim_skeleton.c:63
Basic header file for eventio data format.
A data structure shared between io_simtel.c and atmo.c - which is used by both sim_telarray and the C...
int print_camera_layout(IO_BUFFER *iobuf)
Print the layout (pixel positions) of a camera used for converting from photons to photo-electrons in...
Definition: io_simtel.c:2159
int write_tel_pos(IO_BUFFER *iobuf, int ntel, double *x, double *y, double *z, double *r)
Write positions of telescopes/detectors within a system or array.
Definition: io_simtel.c:484
int read_atmprof(IO_BUFFER *iobuf, AtmProf *atmprof)
Read the atmospheric profile table as used in CORSIKA.
Definition: io_simtel.c:2944
int print_atmprof(IO_BUFFER *iobuf)
Print the atmospheric profile table as used in CORSIKA.
Definition: io_simtel.c:3066
int clear_shower_extra_parameters(ShowerExtraParam *ep)
Similar to init_shower_extra_parameters() but without any attempts to re-allocate or resize buffers.
Definition: io_simtel.c:2822
int write_tel_photons(IO_BUFFER *iobuf, int array, int tel, double photons, struct bunch *bunches, int nbunches, int ext_bunches, char *ext_fname)
Write all the photon bunches for one telescope to an I/O buffer.
Definition: io_simtel.c:1035
int print_shower_longitudinal(IO_BUFFER *iobuf)
Print CORSIKA shower longitudinal distributions.
Definition: io_simtel.c:2003
int write_atmprof(IO_BUFFER *iobuf, AtmProf *atmprof)
Write the atmospheric profile table as used in CORSIKA with ATMEXT option and set up with 'ATMOSPHERE...
Definition: io_simtel.c:2878
int print_tel_offset(IO_BUFFER *iobuf)
Print offsets and weights of randomly scattered arrays with respect to shower core.
Definition: io_simtel.c:773
int read_tel_photons(IO_BUFFER *iobuf, int max_bunches, int *array, int *tel, double *photons, struct bunch *bunches, int *nbunches)
Read bunches of Cherenkov photons for one telescope/detector.
Definition: io_simtel.c:1397
int print_tel_photons(IO_BUFFER *iobuf)
Print bunches of Cherenkov photons for one telescope/detector.
Definition: io_simtel.c:1604
int print_tel_pos(IO_BUFFER *iobuf)
Print positions of telescopes/detectors within a system or array.
Definition: io_simtel.c:577
int read_tel_block(IO_BUFFER *iobuf, int type, real *data, int maxlen)
Read a CORSIKA header/trailer block of given type (see mc_tel.h)
Definition: io_simtel.c:105
int read_tel_pos(IO_BUFFER *iobuf, int max_tel, int *ntel, double *x, double *y, double *z, double *r)
Read positions of telescopes/detectors within a system or array.
Definition: io_simtel.c:521
int write_tel_array_end(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih, int array)
End writing data for one array of telescopes/detectors.
Definition: io_simtel.c:947
int print_tel_block(IO_BUFFER *iobuf)
Print a CORSIKA header/trailer block of any type (see mc_tel.h)
Definition: io_simtel.c:165
int read_input_lines(IO_BUFFER *iobuf, struct linked_string *list)
Read a block with several character strings (normally containing the text of the CORSIKA inputs file)...
Definition: io_simtel.c:423
int begin_read_tel_array(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih, int *array)
Begin reading data for one array of telescopes/detectors.
Definition: io_simtel.c:880
int init_shower_extra_parameters(ShowerExtraParam *ep, size_t ni_max, size_t nf_max)
Initialize, resize, clear shower extra parameters.
Definition: io_simtel.c:2754
int print_photo_electrons(IO_BUFFER *iobuf)
List the the photoelectrons registered in a Cherenkov telescope camera.
Definition: io_simtel.c:2475
int write_camera_layout(IO_BUFFER *iobuf, int itel, int type, int pixels, double *xp, double *yp)
Write the layout (pixel positions) of a camera used for converting from photons to photo-electrons in...
Definition: io_simtel.c:2084
int read_tel_array_end(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih, int *array)
End reading data for one array of telescopes/detectors.
Definition: io_simtel.c:999
int end_read_tel_array(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih)
End reading data for one array of telescopes/detectors.
Definition: io_simtel.c:904
int begin_write_tel_array(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih, int array)
Begin writing data for one array of telescopes/detectors.
Definition: io_simtel.c:838
int read_tel_offset_w(IO_BUFFER *iobuf, int max_array, int *narray, double *toff, double *xoff, double *yoff, double *weight)
Read offsets and weights of randomly scattered arrays with respect to shower core.
Definition: io_simtel.c:710
int read_tel_array_head(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih, int *array)
Begin reading data for one array of telescopes/detectors.
Definition: io_simtel.c:973
int read_shower_longitudinal(IO_BUFFER *iobuf, int *event, int *type, double *data, int ndim, int *np, int *nthick, double *thickstep, int max_np)
Read CORSIKA shower longitudinal distributions.
Definition: io_simtel.c:1942
int end_write_tel_array(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih)
End writing data for one array of telescopes/detectors.
Definition: io_simtel.c:858
int write_input_lines(IO_BUFFER *iobuf, struct linked_string *list)
Write a linked list of character strings (normally containing the text of the CORSIKA inputs file) as...
Definition: io_simtel.c:370
int write_tel_offset_w(IO_BUFFER *iobuf, int narray, double toff, double *xoff, double *yoff, double *weight)
Write offsets and weights of randomly scattered arrays with respect to shower core.
Definition: io_simtel.c:650
int read_tel_offset(IO_BUFFER *iobuf, int max_array, int *narray, double *toff, double *xoff, double *yoff)
Read offsets of randomly scattered arrays with respect to shower core.
Definition: io_simtel.c:689
int read_photo_electrons(IO_BUFFER *iobuf, int max_pixel, int max_pe, int *array, int *tel, int *npe, int *pixels, int *flags, int *pe_counts, int *tstart, double *t, double *a, int *photon_counts)
Read the photoelectrons registered in a Cherenkov telescope camera.
Definition: io_simtel.c:2332
int write_tel_photons3d(IO_BUFFER *iobuf, int array, int tel, double photons, struct bunch3d *bunches3d, int nbunches, int ext_bunches, char *ext_fname)
Write all the photon bunches (3D) for one telescope to an I/O buffer.
Definition: io_simtel.c:1164
int write_tel_block(IO_BUFFER *iobuf, int type, int num, real *data, int len)
Write a CORSIKA block as given type number (see mc_tel.h).
Definition: io_simtel.c:72
int write_photo_electrons(IO_BUFFER *iobuf, int array, int tel, int npe, int pixels, int flags, int *pe_counts, int *tstart, double *t, double *a, int *photon_counts)
Write the photo-electrons registered in a Cherenkov telescope camera.
Definition: io_simtel.c:2226
int print_tel_photons3d(IO_BUFFER *iobuf)
Print 3D bunches of Cherenkov photons for one telescope/detector.
Definition: io_simtel.c:1773
int write_tel_offset(IO_BUFFER *iobuf, int narray, double toff, double *xoff, double *yoff)
Write offsets of randomly scattered arrays with respect to shower core.
Definition: io_simtel.c:621
int write_shower_longitudinal(IO_BUFFER *iobuf, int event, int type, double *data, int ndim, int np, int nthick, double thickstep)
Write CORSIKA shower longitudinal distributions.
Definition: io_simtel.c:1899
int write_tel_compact_photons(IO_BUFFER *iobuf, int array, int tel, double photons, struct compact_bunch *cbunches, int nbunches, int ext_bunches, char *ext_fname)
Write all the photon bunches for one telescope to an I/O buffer.
Definition: io_simtel.c:1297
int read_tel_photons3d(IO_BUFFER *iobuf, int max_bunches, int *array, int *tel, double *photons, struct bunch3d *bunches3d, int *nbunches)
Read bunches of Cherenkov photons for one telescope/detector.
Definition: io_simtel.c:1515
int read_camera_layout(IO_BUFFER *iobuf, int max_pixels, int *itel, int *type, int *pixels, double *xp, double *yp)
Read the layout (pixel positions) of a camera used for converting from photons to photo-electrons in ...
Definition: io_simtel.c:2120
int write_tel_array_head(IO_BUFFER *iobuf, IO_ITEM_HEADER *ih, int array)
Begin writing data for one array of telescopes/detectors.
Definition: io_simtel.c:926
The IO_BUFFER structure contains all data needed the manage the stuff.
Definition: io_basic.h:90
Atmospheric profile as stored in atmprof*.dat files - the actually used columns only.
Definition: mc_atmprof.h:48
A more complete, alternative bunch structure which can also represent upward-going photon bunches or ...
Definition: mc_tel.h:96
float cz
Direction cosines of photon direction,.
Definition: mc_tel.h:100
float ctime
usually with cz < 0 for downward.
Definition: mc_tel.h:102
float dist
Distance of emission point from arrival position (cm)
Definition: mc_tel.h:103
float photons
Number of photons in bunch.
Definition: mc_tel.h:97
float z
Arrival position relative to telescope (cm),.
Definition: mc_tel.h:98
float lambda
Wavelength in nanometers or 0.
Definition: mc_tel.h:104
Photons collected in bunches of identical direction, position, time, and wavelength.
Definition: mc_tel.h:74
float ctime
Arrival time (ns)
Definition: mc_tel.h:78
float photons
Number of photons in bunch.
Definition: mc_tel.h:75
float lambda
Wavelength in nanometers or 0.
Definition: mc_tel.h:80
float y
Arrival position relative to telescope (cm)
Definition: mc_tel.h:76
float zem
Height of emission point above sea level (cm)
Definition: mc_tel.h:79
float cy
Direction cosines of photon direction.
Definition: mc_tel.h:77
The compact_bunch struct is equivalent to the bunch struct except that we try to use less memory.
Definition: mc_tel.h:129
short cy
cx,cy*30000
Definition: mc_tel.h:132
short photons
ph*100
Definition: mc_tel.h:130
short lambda
(nm) or 0
Definition: mc_tel.h:135
short y
x,y*10 (mm)
Definition: mc_tel.h:131
short ctime
ctime*10 (0.1ns) after subtracting offset
Definition: mc_tel.h:133
short log_zem
log10(zem)*1000
Definition: mc_tel.h:134
The linked_string is mainly used to keep CORSIKA input.
Definition: mc_tel.h:151
A photo-electron produced by a photon hitting a pixel.
Definition: mc_tel.h:141
int lambda
The wavelength of the photon.
Definition: mc_tel.h:143
int pixel
The pixel that was hit.
Definition: mc_tel.h:142
double atime
The time [ns] when the photon hit the pixel.
Definition: mc_tel.h:144