source: trunk/MagicSoft/Simulation/Detector/Reflector/reflector.h@ 6175

Last change on this file since 6175 was 348, checked in by harald, 25 years ago
A new version from JoseCarlosGonzalez. The old routine for random_pointing was not correct. This one should be okay!!
File size: 7.7 KB
Line 
1//=//////////////////////////////////////////////////////////////////////
2//=
3//= reflector
4//=
5//= @file reflector.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:
17//=
18//=----------------------------------------------------------------------
19//=
20//= $RCSfile: reflector.h,v $
21//= $Revision: 1.2 $
22//= $Author: harald $
23//= $Date: 2000-01-28 09:19:54 $
24//=
25//=//////////////////////////////////////////////////////////////////////
26
27// @T \newpage
28
29//!@section Source code of |reflector.h|.
30
31/*!@"
32
33 This section shows the include file |reflector.h|
34
35@"*/
36
37//!@{
38
39#ifndef _this_
40#define _this_ readparam
41#endif
42
43//!@}
44
45//=-----------------------------------------------------------
46//!@subsection Include files.
47
48//!@{
49
50#include <iostream.h>
51#include <fstream.h>
52#include <stdlib.h>
53#include <stdio.h>
54#include <string.h>
55#include <stdarg.h>
56#include <math.h>
57#include <sys/types.h>
58#include <dirent.h>
59#include <unistd.h>
60
61#include "jcmacros.h"
62#include "jcdebug.h"
63
64#include "reflector-v.h"
65
66#include "readparam.h"
67#include "atm.h"
68
69#include "lagrange.h"
70
71#include "COREventHeader.hxx"
72#include "CORParticle.hxx"
73#include "CORStatfile.hxx"
74#include "MCEventHeader.hxx"
75#include "MCCphoton.hxx"
76
77// command line options available
78#define COMMAND_LINE_OPTIONS "f:h"
79
80// This is C++, but RANLIB routines are written in pure ANSI C.
81// In order to read easily these routines, we must include
82// the following directive
83extern "C" {
84
85#include "ranlib.h"
86
87}
88
89//!@}
90
91// @subsection Macro-definitions, and constants
92
93//!@{
94
95// random numbers
96#define RandomNumber ranf()
97
98// Speed of Light in vacuum, in m/s
99const float Speed_of_Light_vacuum = 299792458.0; // EXACT!!
100const float Speed_of_Light_air = Speed_of_Light_vacuum / 1.000293;
101
102// Speed of Light in vacuum, in cm/ns
103const float Speed_of_Light_vacuum_cmns = Speed_of_Light_vacuum / 1.0e7;
104const float Speed_of_Light_air_cmns = Speed_of_Light_air / 1.0e7;
105
106// now we define the list CT_ITEM_LIST of possible items in
107// the CT definition file.
108
109#define CT_ITEM_LIST /* LIST OF ITEMS IN THE CT DEFINITION FILE */ \
110T(type), /* type of definition file */ \
111T(focal_distance), /* focal distance */ \
112T(focal_std), /* std(focal distance) */ \
113T(point_spread), /* point spread */ \
114T(point_std), /* std(point spread) */ \
115T(adjustment_dev), /* std of adjustment deviation */ \
116T(black_spot), /* radius of the black spot in center of mirrors */ \
117T(n_mirrors), /* number of mirrors */ \
118T(r_mirror), /* radius of one mirror */ \
119T(camera_width), /* camera width */ \
120T(n_pixels), /* number of pixels in the camera */ \
121T(pixel_width), /* pixel width */ \
122T(define_mirrors) /* this entry is followed by the def. of pixels */
123
124#define T(x) x // define T() as the name as it is
125
126 enum CT_ITEM_TYPE {
127 CT_ITEM_LIST
128 };
129
130#undef T
131
132#define T(x) #x // define T() as the string of x
133
134const char *const CT_ITEM_NAMES[] = {
135 CT_ITEM_LIST
136};
137
138#undef T
139
140// TYPE=0 (CT1)
141// i s rho theta x y z thetan phin xn yn zn
142//
143// i : number of the mirror
144// s : arc length [cm]
145// rho : polar rho of the position of the center of the mirror [cm]
146// theta : polar angle of the position of the center of the mirror [cm]
147// x : x coordinate of the center of the mirror [cm]
148// y : y coordinate of the center of the mirror [cm]
149// z : z coordinate of the center of the mirror [cm]
150// thetan : polar theta angle of the direction where the mirror points to
151// phin : polar phi angle of the direction where the mirror points to
152// xn : xn coordinate of the normal vector in the center (normalized)
153// yn : yn coordinate of the normal vector in the center (normalized)
154// zn : zn coordinate of the normal vector in the center (normalized)
155//
156// TYPE=1 (MAGIC)
157// i f sx sy x y z thetan phin
158//
159// i : number of the mirror
160// f : focal distance of that mirror
161// sx : curvilinear coordinate of mirror's center in X[cm]
162// sy : curvilinear coordinate of mirror's center in X[cm]
163// x : x coordinate of the center of the mirror [cm]
164// y : y coordinate of the center of the mirror [cm]
165// z : z coordinate of the center of the mirror [cm]
166// thetan : polar theta angle of the direction where the mirror points to
167// phin : polar phi angle of the direction where the mirror points to
168// xn : xn coordinate of the normal vector in the center (normalized)
169// yn : yn coordinate of the normal vector in the center (normalized)
170// zn : zn coordinate of the normal vector in the center (normalized)
171
172#define CT_I 0
173
174#define CT_S 1
175#define CT_RHO 2
176#define CT_THETA 3
177
178#define CT_FOCAL 1
179#define CT_SX 2
180#define CT_SY 3
181
182#define CT_X 4
183#define CT_Y 5
184#define CT_Z 6
185#define CT_THETAN 7
186#define CT_PHIN 8
187#define CT_XC 9
188#define CT_YC 10
189#define CT_ZC 11
190
191#define CT_NDATA 12
192
193// pre-defined filenames / values
194
195#define REFLECTIVITY_FILE "reflectivity.dat"
196#define FOCALS_FILE "focals.dat"
197#define AXISDEVIATION_FILE "axisdev.dat"
198
199// values for read-ot from STDIN
200
201#define BUFFER_LENGTH 5733
202#define SIZE_OF_BLOCK 22932
203static char EVTH[] = "EVTH";
204
205// maximum deviation from the original direction with
206// "random_pointing" option
207//
208// now is 6 degrees = 0.104719755119660 radians
209
210#define RANDOM_POINTING_MAX_SEPARATION 0.104719755119660
211
212//!@}
213
214//=-----------------------------------------------------------
215//!@subsection Prototypes of functions.
216
217//!@{
218
219//++
220// prototypes
221//--
222
223void present(void);
224void usage(void);
225void clean(void);
226void log(const char *funct, char *fmt, ...);
227void logerr(const char *funct, char *fmt, ...);
228void error(const char *funct, char *fmt, ...);
229void makeOmega(float theta, float phi);
230void makeOmegaI(float theta, float phi);
231void applyMxV(float M[3][3], float *V, float *Vp);
232void read_ct_file(void);
233void read_reflectivity(void);
234void read_axisdev(void);
235void read_focals(void);
236void rnormal(double *r, int n);
237float dist_r_P(float a, float b, float c,
238 float u, float v, float w,
239 float x, float y, float z);
240void write_mark(ofstream &os, char mark=0xff, int length=1);
241int isA( char * s1, const char * flag );
242float Curv2Lin(float s);
243float Lin2Curv(float x);
244int get_stdin_files(int ncerf, float El=0., float Eu=1000000.,
245 int flag=FALSE);
246float get_new_ct_pointing(float theta, float phi, float range,
247 float *newtheta, float *newphi);
248
249//!@}
250
251//=------------------------------------------------------------
252//!@subsection Log of this file.
253
254//!@{
255
256/*
257 * $Log: not supported by cvs2svn $
258 * Revision 1.11 1999/10/05 11:11:12 gonzalez
259 * Sep.1999
260 *
261 * Revision 1.10 1999/03/24 16:33:03 gonzalez
262 * REFLECTOR 1.1: Release
263 *
264 * Revision 1.9 1999/01/21 16:03:53 gonzalez
265 * Only small modifications
266 *
267 * Revision 1.8 1999/01/19 18:07:17 gonzalez
268 * Bugs in STDIN-STDOUT version corrected.
269 *
270 * Revision 1.7 1999/01/14 17:35:44 gonzalez
271 * Both reading from STDIN (data_from_stdin) and
272 * writing to STDOUT (data_to_STDOUT) working.
273 *
274 */
275
276//!@}
277//=EOF
Note: See TracBrowser for help on using the repository browser.