Rev 25 | Rev 70 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 25 | Rev 54 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | 13 | ||
14 | 14 | ||
15 | 15 | ||
16 | #define MARGIN 1.0e-6 |
16 | #define MARGIN 1.0e-6 |
17 | #define DEGREE 180.0/3.14159265358979312 |
17 | #define DEGREE 180.0/3.14159265358979312 |
- | 18 | #define MAX_REFLECTIONS 19 |
|
- | 19 | ||
18 | 20 | ||
19 | using namespace TMath; |
21 | using namespace TMath; |
20 | 22 | ||
21 | const double c_reflectivity = 0.96; |
23 | const double c_reflectivity = 0.96; |
22 | const int REFRACTION = 1; |
24 | const int REFRACTION = 1; |
23 | const int REFLECTION = 2; |
25 | const int REFLECTION = 2; |
24 | const int TOTAL = 3; |
26 | const int TOTAL = 3; |
- | 27 | const int ABSORBED = -2; |
|
25 | const TVector3 CENTER(-2.0, 0.0, 0.0); |
28 | const TVector3 CENTER(-2.0, 0.0, 0.0); |
26 | const int nch = 50; // number of "channels" used as number of bins in histograms |
29 | const int nch = 50; // number of "channels" used as number of bins in histograms |
27 | 30 | ||
28 | enum Fate {missed=0, |
31 | enum Fate {missed=0, hitExit=1, refracted=-1, enter=2, noreflection=-2, backreflected=-3, rays=3, absorbed=4}; |
29 | 32 | ||
30 | int dbg = 0; |
33 | int dbg = 0; |
31 | 34 | ||
32 | //================================================================================= |
35 | //================================================================================= |
33 | // zarek (premica) |
36 | // zarek (premica) |
Line 127... | Line 130... | ||
127 | //#define SURF_TOTAL 1 |
130 | //#define SURF_TOTAL 1 |
128 | #define SURF_IMPER 4 |
131 | #define SURF_IMPER 4 |
129 | //#define SURF_DIFUS 5 |
132 | //#define SURF_DIFUS 5 |
130 | 133 | ||
131 | class CSurface : public CPlane4 |
134 | class CSurface : public CPlane4 |
132 | { |
135 | { |
133 | 136 | ||
134 | public: |
137 | public: |
135 | CSurface(int type0 = 0); |
138 | CSurface(int type0 = 0); |
136 | CSurface(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4, |
139 | CSurface(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4, |
137 | double n10, double n20, double reflectivity); |
140 | double n10, double n20, double reflectivity); |
138 | CSurface(int type0, TVector3 *vr, double n10, double n20, double reflectivity); |
141 | CSurface(int type0, TVector3 *vr, double n10, double n20, double reflectivity); |
139 | 142 | ||
140 | void SetV(TVector3 *vr){CPlane4::Set(vr);}; |
143 | void SetV(TVector3 *vr){CPlane4::Set(vr);}; |
141 | void SetType(int type0){type = type0;}; |
144 | void SetType(int type0){type = type0;}; |
142 | void SetIndex(double n10, double n20); |
145 | void SetIndex(double n10, double n20); |
143 | void SetReflection(double reflectivity){reflection = reflectivity;}; |
146 | void SetReflection(double reflectivity){reflection = reflectivity;}; |
144 | void SetFresnel(int f = 1) {fresnel = f;}; |
147 | void SetFresnel(int f = 1) {fresnel = f;}; |
Line 161... | Line 164... | ||
161 | TRandom rand; // za racunanje verjetnosti odboja od zrcala |
164 | TRandom rand; // za racunanje verjetnosti odboja od zrcala |
162 | double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2 |
165 | double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2 |
163 | 166 | ||
164 | int fresnel; // ali naj uposteva Fresnelove enacbe |
167 | int fresnel; // ali naj uposteva Fresnelove enacbe |
165 | }; |
168 | }; |
166 | //================================================================================= |
169 | //================================================================================= |
167 | 170 | ||
168 | 171 | ||
169 | //================================================================================= |
172 | //================================================================================= |
170 | // +------- n1 |
173 | // +------- n1 |
171 | // | ------- |
174 | // | ------- |
172 | // | n2 ----+ |
175 | // | n2 ----+ |
Line 177... | Line 180... | ||
177 | // | ------R |
180 | // | ------R |
178 | // +------- |
181 | // +------- |
179 | // <-------- d -------> |
182 | // <-------- d -------> |
180 | // |
183 | // |
181 | 184 | ||
182 | #define VODNIK_MAX_ODB 19 |
- | |
183 | 185 | ||
- | 186 | ||
184 | int RCol(int col, int solid); |
187 | int RCol(int col, int solid); |
185 | 188 | ||
186 | 189 | ||
187 | class DetectorParameters |
190 | class DetectorParameters |
188 | { |
191 | { |
189 | public: |
192 | public: |
190 | DetectorParameters(double a, double b, double d, double active, double n1, double n2, double n3, TVector3 gap): |
193 | DetectorParameters(double a, double b, double d, double active, double n1, double n2, double n3, TVector3 gap): |
191 | _a(a), |
194 | _a(a), |
192 | _b(b), |
195 | _b(b), |
193 | _d(d), |
196 | _d(d), |
194 | _active(active), |
197 | _active(active), |
Line 199... | Line 202... | ||
199 | _plateWidth(1), |
202 | _plateWidth(1), |
200 | _fresnel(1), |
203 | _fresnel(1), |
201 | _glassOn(0), |
204 | _glassOn(0), |
202 | _glassD(0), |
205 | _glassD(0), |
203 | _guideOn(1), |
206 | _guideOn(1), |
204 | _plateOn(1) |
207 | _plateOn(1), |
- | 208 | offsetY(2.5), |
|
- | 209 | offsetZ(2.5) |
|
205 | {}; |
210 | {}; |
206 | DetectorParameters(double a, double b, double d): |
211 | DetectorParameters(double a, double b, double d): |
207 | _a(a), |
212 | _a(a), |
208 | _b(b), |
213 | _b(b), |
209 | _d(d), |
214 | _d(d), |
Line 215... | Line 220... | ||
215 | _plateWidth(1), |
220 | _plateWidth(1), |
216 | _fresnel(1), |
221 | _fresnel(1), |
217 | _glassOn(0), |
222 | _glassOn(0), |
218 | _glassD(0), |
223 | _glassD(0), |
219 | _guideOn(1), |
224 | _guideOn(1), |
220 | _plateOn(1) |
225 | _plateOn(1), |
- | 226 | offsetY(2.5), |
|
- | 227 | offsetZ(2.5) |
|
221 | {}; |
228 | {}; |
222 | ~DetectorParameters() {}; |
229 | ~DetectorParameters() {}; |
223 | 230 | ||
224 | void setGuide(double a, double b, double d, double n1, double n2, double n3) { |
231 | void setGuide(double a, double b, double d, double n1, double n2, double n3) { |
225 | _a = a; |
232 | _a = a; |
Line 253... | Line 260... | ||
253 | int getFresnel() { return _fresnel; }; |
260 | int getFresnel() { return _fresnel; }; |
254 | int getGlassOn() { return _glassOn; }; |
261 | int getGlassOn() { return _glassOn; }; |
255 | double getGlassD() { return _glassD; }; |
262 | double getGlassD() { return _glassD; }; |
256 | int getGuideOn() { return _guideOn; }; |
263 | int getGuideOn() { return _guideOn; }; |
257 | int getPlateOn() { return _plateOn; }; |
264 | int getPlateOn() { return _plateOn; }; |
- | 265 | double getOffsetY() { return offsetY; }; |
|
- | 266 | double getOffsetZ() { return offsetZ; }; |
|
258 | 267 | ||
259 | private: |
268 | private: |
260 | double _a; |
269 | double _a; |
261 | double _b; |
270 | double _b; |
262 | double _d; |
271 | double _d; |
Line 264... | Line 273... | ||
264 | double _n1; |
273 | double _n1; |
265 | double _n2; |
274 | double _n2; |
266 | double _n3; |
275 | double _n3; |
267 | TVector3 _gap; |
276 | TVector3 _gap; |
268 | double _plateWidth; |
277 | double _plateWidth; |
- | 278 | double offsetY; |
|
- | 279 | double offsetZ; |
|
269 | 280 | ||
270 | int _fresnel; |
281 | int _fresnel; |
271 | int _glassOn; |
282 | int _glassOn; |
272 | double _glassD; |
283 | double _glassD; |
273 | int _guideOn; |
284 | int _guideOn; |
Line 278... | Line 289... | ||
278 | class Guide |
289 | class Guide |
279 | { |
290 | { |
280 | public: |
291 | public: |
281 | Guide(TVector3 center0, DetectorParameters& parameters); |
292 | Guide(TVector3 center0, DetectorParameters& parameters); |
282 | ~Guide() { |
293 | ~Guide() { |
283 |
|
294 | for (int jk=0; jk<6; jk++) delete s_side[jk]; |
284 | delete hfate; |
295 | delete hfate; |
285 | delete hnodb_all; |
296 | delete hnodb_all; |
286 | delete hnodb_exit; |
297 | delete hnodb_exit; |
287 | delete hin; |
298 | delete hin; |
288 | delete hout; |
299 | delete hout; |
289 | } |
300 | } |
290 | 301 | ||
291 | Fate PropagateRay(CRay in, CRay *out, int *n_points, TVector3 *points); |
302 | Fate PropagateRay(CRay in, CRay *out, int *n_points, TVector3 *points); |
292 | 303 | ||
293 | double getD() { return _d; } |
304 | double getD() { return _d; } |
Line 300... | Line 311... | ||
300 | TH2F* GetHIn() const {return hin;}; |
311 | TH2F* GetHIn() const {return hin;}; |
301 | TH2F* GetHOut() const {return hout;}; |
312 | TH2F* GetHOut() const {return hout;}; |
302 | int GetExitHits() {return (int)hfate->GetBinContent(5);}; |
313 | int GetExitHits() {return (int)hfate->GetBinContent(5);}; |
303 | int GetEnteranceHits() {return (int)hfate->GetBinContent(6);}; |
314 | int GetEnteranceHits() {return (int)hfate->GetBinContent(6);}; |
304 | void GetVFate(int *out); |
315 | void GetVFate(int *out); |
305 | int GetMAXODB() const {return |
316 | int GetMAXODB() const {return MAX_REFLECTIONS;}; |
306 | 317 | ||
307 | void Draw(int color = 1, int width = 1); |
318 | void Draw(int color = 1, int width = 1); |
308 | void DrawSkel(int color = 1, int width = 1); |
319 | void DrawSkel(int color = 1, int width = 1); |
309 | 320 | ||
310 | private: |
321 | private: |
311 | Fate fate; |
322 | Fate fate; |
312 | double _d; // parameters |
323 | double _d; // parameters |
313 | double n1, n2, n3; // refractive index: n1 above entry surface, n2 inside, n3 after exit |
324 | double n1, n2, n3; // refractive index: n1 above entry surface, n2 inside, n3 after exit |
314 | double _r; |
325 | double _r; |
315 | double absorption; |
326 | double absorption; |
Line 347... | Line 358... | ||
347 | 358 | ||
348 | class Plate |
359 | class Plate |
349 | { |
360 | { |
350 | public: |
361 | public: |
351 | Plate(DetectorParameters& parameters); |
362 | Plate(DetectorParameters& parameters); |
- | 363 | ~Plate() { |
|
352 |
|
364 | for (int jk=0; jk<6; jk++) delete sides[jk]; // the same, needs solution |
353 | }; |
365 | }; |
354 | 366 | ||
355 | void draw(int color, int width); |
367 | void draw(int color, int width); |
356 | void drawSkel(int color, int width); |
368 | void drawSkel(int color, int width); |
357 |
|
369 | Fate propagateRay(CRay, CRay*, int*, TVector3*); |
358 | 370 | ||
359 | private: |
371 | private: |
360 | TVector3 plate_edge[8]; |
372 | TVector3 plate_edge[8]; |
361 | CSurface *sides[6]; |
373 | CSurface *sides[6]; |
362 | }; |
374 | }; |
Line 476... | Line 488... | ||
476 | 488 | ||
477 | double _plateWidth; |
489 | double _plateWidth; |
478 | int _plateOn; |
490 | int _plateOn; |
479 | 491 | ||
480 | TH2F *histoPlate; |
492 | TH2F *histoPlate; |
- | 493 | ||
- | 494 | double offsetY; |
|
- | 495 | double offsetZ; |
|
481 | }; |
496 | }; |
482 | 497 | ||
483 | 498 | ||
484 | 499 | ||
485 | //================================================================================= |
500 | //================================================================================= |