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