1 | #ifndef __RFL_INIT__
|
---|
2 | #define __RFL_INIT__
|
---|
3 |
|
---|
4 | /* Constant definitions */
|
---|
5 | #define LINE_MAX_LENGTH 128 /* parsing buffer sz. */
|
---|
6 | #define NR_OF_CPHOTONS 65535 /* CPhotons sz. */
|
---|
7 | #define PH_IN_DATABLOCK 39 /* Photons in datablk */
|
---|
8 | #define SHOW_ME 500 /* How many evts among two logs */
|
---|
9 | #define FALSE 0
|
---|
10 | #define TRUE 1
|
---|
11 |
|
---|
12 | /* Macros */
|
---|
13 | #define ARRAY_SZ(A) (sizeof(A)/sizeof(A[0]))
|
---|
14 |
|
---|
15 | /* Tags inside reflector file */
|
---|
16 | #define SIZE_OF_FLAGS 13
|
---|
17 |
|
---|
18 | #define FLAG_START_OF_RUN "\nSTART---RUN\n"
|
---|
19 | #define FLAG_START_OF_EVENT "\nSTART-EVENT\n"
|
---|
20 | #define FLAG_END_OF_EVENT "\nEND---EVENT\n"
|
---|
21 | #define FLAG_END_OF_RUN "\nEND-----RUN\n"
|
---|
22 | #define FLAG_END_OF_FILE "\nEND----FILE\n"
|
---|
23 | #define FLAG_END_OF_STDIN "\nEND---STDIN\n"
|
---|
24 |
|
---|
25 | /* Prototypes */
|
---|
26 | void init(char *filename);
|
---|
27 |
|
---|
28 | /* External declarations */
|
---|
29 | extern FILE *filelist; /* filelist ptr */
|
---|
30 | extern FILE *rflfile; /* reflector (out)file */
|
---|
31 | extern FILE *cerfile; /* current cerfile */
|
---|
32 | extern char cername[]; /* current cername */
|
---|
33 | extern long first_Event; /* first proc. event */
|
---|
34 | extern long last_Event; /* last proc. event */
|
---|
35 | extern long max_Events; /* max proc. events */
|
---|
36 | extern float low_Ecut; /* lower Ecut (GeV) */
|
---|
37 | extern float high_Ecut; /* upper Ecut (GeV) */
|
---|
38 |
|
---|
39 | extern int is_Fixed_Target; /* fixed target? */
|
---|
40 | extern float fixed_Theta; /* zenith angle (rad) */
|
---|
41 | extern float fixed_Phi; /* azi (0N->90E) (rad) */
|
---|
42 |
|
---|
43 | extern float Telescope_x, Telescope_y; /* Telescope coordinates (cm) */
|
---|
44 |
|
---|
45 | extern int wobble_position;
|
---|
46 |
|
---|
47 | extern int is_Random_Pointing; /* random pointing? */
|
---|
48 | extern float Random_Pointing_MaxDist; /* in metres */
|
---|
49 | extern int nRepeat_Random; /* nr of times a sh. is reused */
|
---|
50 | extern long Seeds[2]; /* random seeds */
|
---|
51 |
|
---|
52 | extern float ct_Focal_mean; /* focal dist. (mean) (cm) */
|
---|
53 | extern float ct_PSpread_mean; /* pt. spread fn. (mean) (cm) */
|
---|
54 | extern float ct_PSpread_std; /* pt. spread fn. (std) (cm) */
|
---|
55 | extern float ct_BlackSpot_rad; /* black spot radius (cm) */
|
---|
56 | extern float ct_RMirror; /* rad. of single mirror (cm) */
|
---|
57 | extern int ct_NMirrors; /* number of mirrors */
|
---|
58 | extern float ct_CameraWidth; /* camera width (cm) */
|
---|
59 | extern int ct_NPixels; /* number of pixels */
|
---|
60 | extern float ct_PixelWidth; /* pixel width (cm) */
|
---|
61 |
|
---|
62 |
|
---|
63 | typedef struct
|
---|
64 | { int i; /* mirror id */
|
---|
65 | float f, /* focal length (cm) */
|
---|
66 | sx, sy, /* curvilinear coords. (cm) */
|
---|
67 | x, y, z, /* rectangular coords. (cm) */
|
---|
68 | theta, phi, /* angles of mirror axis */
|
---|
69 | xn, yn, zn; /* versor of mirror axis */
|
---|
70 | } mirror;
|
---|
71 |
|
---|
72 | extern mirror *ct_data; /* ptr to mirror data */
|
---|
73 | extern int nReflectivity; /* nr of refl. table elements */
|
---|
74 | extern float *Reflectivity[]; /* ptr to refl. table */
|
---|
75 | extern float *AxisDeviation[]; /* ptr to axisdev. table */
|
---|
76 |
|
---|
77 | /* Photon structures */
|
---|
78 | typedef struct
|
---|
79 | { float w, /* photon wavelength (nm) */
|
---|
80 | x, y, /* (ground) impact point (cm) */
|
---|
81 | u, v, /* direction cosines */
|
---|
82 | t, /* arrival time (ns) */
|
---|
83 | h; /* production height (cm) */
|
---|
84 | } photon;
|
---|
85 |
|
---|
86 | typedef struct
|
---|
87 | { float w, /* cphoton wavelength (nm) */
|
---|
88 | x, y, /* (chamber) imp. point (cm) */
|
---|
89 | u, v, /* direction cosines */
|
---|
90 | t, /* arrival time (ns) */
|
---|
91 | h, /* production height (cm) */
|
---|
92 | phi; /* (chamber) inc. angle (rad) */
|
---|
93 | } cphoton;
|
---|
94 | extern cphoton *CPhotons;
|
---|
95 |
|
---|
96 | /* Strings */
|
---|
97 | #define RFL__START_MSG /* program, version */ \
|
---|
98 | "\n ################################################\n" \
|
---|
99 | " %s %s\n\n Simulation of the reflector\n" \
|
---|
100 | " - J.C. Gonzalez - May 1998\n" \
|
---|
101 | " Single file version\n" \
|
---|
102 | " - D. Bastieri & C. Bigongiari - Jan 2000\n" \
|
---|
103 | " Version 0.6\n" \
|
---|
104 | " - A. Moralejo - October 2002\n" \
|
---|
105 | " ################################################\n\n"
|
---|
106 | #define SIGN_ERROR_FTL /* program, version */ \
|
---|
107 | "Signature of parameters file is not correct.\n" \
|
---|
108 | " *** Should be: **%s %s**.\n"
|
---|
109 | #define SKIP_TOKEN_MSG /* skipped token */ \
|
---|
110 | " *** Skipping unknown token [%s].\n"
|
---|
111 | #define GEOM_NSPEC_FTL /* no parms */ \
|
---|
112 | "No geometry file given.\n" \
|
---|
113 | " *** Please specify its name after the \"ct_file\" directive.\n"
|
---|
114 | #define CPHS_ALLOC_FTL /* cphotons */ \
|
---|
115 | "Cannot allocate enough memory space for %d cphotons.\n"
|
---|
116 | #define CPHS_ALLOC_LOG /* cphotons */ \
|
---|
117 | "Allocated memory for %d cphotons.\n"
|
---|
118 | #define CERF_NFND__MSG /* cername */ \
|
---|
119 | " *** Cerfile \"%s\" not found.\n"
|
---|
120 | #define CERF_OPEN__LOG /* cername */ \
|
---|
121 | "Opened cerfile \"%s\".\n"
|
---|
122 | #define CERF_ERROR_LOG /* cername */ \
|
---|
123 | "Error while reading cerfile \"%s\": skipping it.\n"
|
---|
124 | #define EVTN_WRONG_ERR /* first, last, cername */ \
|
---|
125 | " *** Event boundaries [%ld, %ld] wrong for \"%s\".\n" \
|
---|
126 | " *** Reading all events.\n"
|
---|
127 | #define TEMP_ERROR_FTL /* no parms */ \
|
---|
128 | "Cannot open a temporary file: unable to handle overflow."
|
---|
129 | #define INFO_EVENT_LOG /* run, evt, energy */ \
|
---|
130 | "Run %.0f, event %.0f: energy = %f.\n"
|
---|
131 | #define MEM__FREE__MSG /* no parms */ \
|
---|
132 | "Freeing up allocated memory.\n"
|
---|
133 | #define VECT_FREE__LOG /* vector name */ \
|
---|
134 | " ... freeing up [%s]\n"
|
---|
135 | #define RFLF_CLOSE_LOG /* no parms */ \
|
---|
136 | "Closing reflector file.\n"
|
---|
137 | #define RFL__EXIT__MSG /* program, version */ \
|
---|
138 | "%s %s: done.\n\n"
|
---|
139 |
|
---|
140 | #endif
|
---|