Rev 72 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 72 | Rev 73 | ||
|---|---|---|---|
| Line 37... | Line 37... | ||
| 37 | class CRay |
37 | class CRay |
| 38 | { |
38 | { |
| 39 | public: |
39 | public: |
| 40 | CRay() : |
40 | CRay() : |
| 41 | r(TVector3(0,0,0)), |
41 | r(TVector3(0,0,0)), |
| 42 |
|
42 | k(TVector3(1,0,0)), |
| 43 | //p(TVector3(0,1,0)), |
43 | //p(TVector3(0,1,0)), |
| 44 | p(TVector3(0,0,1)), |
44 | p(TVector3(0,0,1)), |
| 45 | color(kBlack) |
45 | color(kBlack) |
| 46 | {}; |
46 | {}; |
| 47 | CRay(TVector3 r0, TVector3 |
47 | CRay(TVector3 r0, TVector3 k0) : |
| 48 | r(r0), |
48 | r(r0), |
| 49 |
|
49 | k(k0.Unit()), |
| 50 | //p(TVector3(0,1,0)), |
50 | //p(TVector3(0,1,0)), |
| 51 | p(TVector3(0,0,1)), |
51 | p(TVector3(0,0,1)), |
| 52 | color(kBlack) |
52 | color(kBlack) |
| 53 | {}; |
53 | {}; |
| 54 | CRay(double x0, double y0, double z0, double l0, double m0, double n0) : |
54 | CRay(double x0, double y0, double z0, double l0, double m0, double n0) : |
| 55 | r(TVector3(x0,y0,z0)), |
55 | r(TVector3(x0,y0,z0)), |
| 56 |
|
56 | k(TVector3(l0,m0,n0).Unit()), |
| 57 | //p(TVector3(0,1,0)), |
57 | //p(TVector3(0,1,0)), |
| 58 | p(TVector3(0,0,1)), |
58 | p(TVector3(0,0,1)), |
| 59 | color(kBlack) |
59 | color(kBlack) |
| 60 | {}; |
60 | {}; |
| 61 | 61 | ||
| 62 | void Set(TVector3 r0, TVector3 |
62 | void Set(TVector3 r0, TVector3 k0); |
| 63 | //void Set(double x0, double y0, double z0, double l0, double m0, double n0); |
63 | //void Set(double x0, double y0, double z0, double l0, double m0, double n0); |
| 64 | void SetColor(int c){color = c;}; |
64 | void SetColor(int c){color = c;}; |
| 65 | void |
65 | void setPolarization(TVector3 p0) { |
| - | 66 | p = p0.Unit(); |
|
| - | 67 | if (p.Dot(k)>1e-3) printf("*** ERROR in CRay: E has component || with k\n"); |
|
| - | 68 | }; |
|
| 66 | 69 | ||
| 67 | //inline CRay & operator = (const CRay &); |
70 | //inline CRay & operator = (const CRay &); |
| 68 | 71 | ||
| 69 | TVector3 GetR() const {return r;}; |
72 | TVector3 GetR() const {return r;}; |
| 70 | TVector3 |
73 | TVector3 GetK() const {return k;}; |
| 71 | TVector3 GetP() const {return p;}; |
74 | TVector3 GetP() const {return p;}; |
| 72 | 75 | ||
| 73 | void Print(); |
76 | void Print(); |
| 74 | void Draw(); |
77 | void Draw(); |
| 75 | void Draw(double x_from, double x_to); |
78 | void Draw(double x_from, double x_to); |
| 76 | void DrawS(double x_from, double t); |
79 | void DrawS(double x_from, double t); |
| 77 | 80 | ||
| - | 81 | //r = position, k = unit wave vector, p = polarization |
|
| 78 | private: |
82 | private: |
| 79 | TVector3 r; |
83 | TVector3 r; |
| 80 | TVector3 |
84 | TVector3 k; |
| 81 | TVector3 p; |
85 | TVector3 p; |
| 82 | int color; |
86 | int color; |
| 83 | }; |
87 | }; |
| 84 | //================================================================================= |
- | |
| 85 | 88 | ||
| 86 | 89 | ||
| 87 | //================================================================================= |
90 | //================================================================================= |
| 88 | // ravnina, definirana in omejena s 4 tockami na njej (stirikotni poligon) |
91 | // ravnina, definirana in omejena s 4 tockami na njej (stirikotni poligon) |
| 89 | // zanasam se na taksno definicijo: (normala kaze noter) |
92 | // zanasam se na taksno definicijo: (normala kaze noter) |
| Line 118... | Line 121... | ||
| 118 | private: |
121 | private: |
| 119 | TVector3 r[4], n; |
122 | TVector3 r[4], n; |
| 120 | double A, B, C, D; |
123 | double A, B, C, D; |
| 121 | TVector3 edge[4]; // vektorji stranic |
124 | TVector3 edge[4]; // vektorji stranic |
| 122 | double angle_r[4]; // koti ob posameznem vogalu |
125 | double angle_r[4]; // koti ob posameznem vogalu |
| 123 | }; |
126 | }; |
| 124 | //================================================================================= |
127 | //================================================================================= |
| 125 | // ravnina - krog |
128 | // ravnina - krog |
| 126 | class CPlaneR |
129 | class CPlaneR |
| 127 | { |
130 | { |
| 128 | 131 | ||
| Line 132... | Line 135... | ||
| 132 | 135 | ||
| 133 | void Set(TVector3 c, TVector3 n0, double R0) |
136 | void Set(TVector3 c, TVector3 n0, double R0) |
| 134 | {center = c; n = n0; _r = R0;}; |
137 | {center = c; n = n0; _r = R0;}; |
| 135 | 138 | ||
| 136 | int TestIntersection(TVector3 *vec, CRay in); |
139 | int TestIntersection(TVector3 *vec, CRay in); |
| 137 | 140 | ||
| 138 | void Draw(int color = 1, int NN = 32); |
141 | void Draw(int color = 1, int NN = 32); |
| 139 | 142 | ||
| 140 | private: |
143 | private: |
| 141 | TVector3 n, center; |
144 | TVector3 n, center; |
| 142 | double _r; |
145 | double _r; |
| 143 | }; |
146 | }; |
| 144 | //================================================================================= |
- | |
| 145 | 147 | ||
| 146 | //================================================================================= |
148 | //================================================================================= |
| 147 | // ravna opticna povrsina: refractor, zrcalo ali povrsina s totalnim odbojem |
149 | // ravna opticna povrsina: refractor, zrcalo ali povrsina s totalnim odbojem |
| 148 | #define SURF_DUMMY 0 |
150 | #define SURF_DUMMY 0 |
| 149 | #define SURF_REFRA 1 |
151 | #define SURF_REFRA 1 |
| 150 | #define SURF_REFLE 2 |
152 | #define SURF_REFLE 2 |
| Line 174... | Line 176... | ||
| 174 | {type = type0; CPlane4::Set(r1, r2, r3, r4); SetIndex(n10, n20); reflection = reflectivity;}; |
176 | {type = type0; CPlane4::Set(r1, r2, r3, r4); SetIndex(n10, n20); reflection = reflectivity;}; |
| 175 | 177 | ||
| 176 | int PropagateRay(CRay in, CRay *out, TVector3 *intersection); |
178 | int PropagateRay(CRay in, CRay *out, TVector3 *intersection); |
| 177 | 179 | ||
| 178 | double N1_N2(int sign) { return ((sign > 0) ? n1/n2 : n2/n1);}; |
180 | double N1_N2(int sign) { return ((sign > 0) ? n1/n2 : n2/n1);}; |
| 179 | 181 | ||
| 180 | void Print(){printf("Type = %d\n", type); CPlane4::Print();}; |
182 | void Print(){printf("Type = %d\n", type); CPlane4::Print();}; |
| 181 | 183 | ||
| 182 | private: |
184 | private: |
| 183 | int type; //0 = dummy; 1 = refractor; 2 = reflector; 3 = total reflection |
185 | int type; //0 = dummy; 1 = refractor; 2 = reflector; 3 = total reflection |
| 184 | double n1, n2, n1_n2; //index of refraction, n1 @ +normal, n2 @ -normal |
186 | double n1, n2, n1_n2; //index of refraction, n1 @ +normal, n2 @ -normal |
| 185 | double reflection; // odbojnost stranic |
187 | double reflection; // odbojnost stranic |
| 186 | TRandom rand; // za racunanje verjetnosti odboja od zrcala |
188 | TRandom rand; // za racunanje verjetnosti odboja od zrcala |
| 187 | double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2 |
189 | double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2 |
| 188 | 190 | ||
| 189 | int fresnel; // ali naj uposteva Fresnelove enacbe |
191 | int fresnel; // ali naj uposteva Fresnelove enacbe |
| 190 | }; |
192 | }; |
| 191 | //================================================================================= |
- | |
| 192 | 193 | ||
| 193 | 194 | ||
| 194 | //================================================================================= |
195 | //================================================================================= |
| 195 | // +------- n1 |
196 | // +------- n1 |
| 196 | // | ------- |
197 | // | ------- |
| Line 284... | Line 285... | ||
| 284 | int getPlateOn() { return _plateOn; }; |
285 | int getPlateOn() { return _plateOn; }; |
| 285 | double getOffsetY() { return offsetY; }; |
286 | double getOffsetY() { return offsetY; }; |
| 286 | double getOffsetZ() { return offsetZ; }; |
287 | double getOffsetZ() { return offsetZ; }; |
| 287 | // bad coupling in the case the small amount of grease was applied |
288 | // bad coupling in the case the small amount of grease was applied |
| 288 | bool badCoupling() { return _coupling; }; |
289 | bool badCoupling() { return _coupling; }; |
| 289 | 290 | ||
| 290 | private: |
291 | private: |
| 291 | double _a; |
292 | double _a; |
| 292 | double _b; |
293 | double _b; |
| 293 | double _d; |
294 | double _d; |
| 294 | double _active; |
295 | double _active; |
| 295 | double _n1; |
296 | double _n1; |
| Line 340... | Line 341... | ||
| 340 | TH2F* GetHOut() const {return hout;}; |
341 | TH2F* GetHOut() const {return hout;}; |
| 341 | int GetExitHits() {return (int)hfate->GetBinContent(5);}; |
342 | int GetExitHits() {return (int)hfate->GetBinContent(5);}; |
| 342 | int GetEnteranceHits() {return (int)hfate->GetBinContent(6);}; |
343 | int GetEnteranceHits() {return (int)hfate->GetBinContent(6);}; |
| 343 | void GetVFate(int *out); |
344 | void GetVFate(int *out); |
| 344 | int GetMAXODB() const {return MAX_REFLECTIONS;}; |
345 | int GetMAXODB() const {return MAX_REFLECTIONS;}; |
| 345 | 346 | ||
| 346 | void Draw(int color = 1, int width = 1); |
347 | void Draw(int color = 1, int width = 1); |
| 347 | void DrawSkel(int color = 1, int width = 1); |
348 | void DrawSkel(int color = 1, int width = 1); |
| 348 | 349 | ||
| 349 | private: |
350 | private: |
| 350 | Fate fate; |
351 | Fate fate; |
| 351 | double _d; // parameters |
352 | double _d; // parameters |
| 352 | double _n1, _n2, _n3; // refractive index: n1 above entry surface, n2 inside, n3 after exit |
353 | double _n1, _n2, _n3; // refractive index: n1 above entry surface, n2 inside, n3 after exit |
| 353 | double _r; |
354 | double _r; |
| Line 361... | Line 362... | ||
| 361 | TVector3 center, vodnik_edge[8]; |
362 | TVector3 center, vodnik_edge[8]; |
| 362 | 363 | ||
| 363 | TH1F *hfate, *hnodb_all, *hnodb_exit; |
364 | TH1F *hfate, *hnodb_all, *hnodb_exit; |
| 364 | TH2F *hin, *hout; |
365 | TH2F *hin, *hout; |
| 365 | }; |
366 | }; |
| 366 | //================================================================================= |
- | |
| 367 | 367 | ||
| 368 | //=============================================================================================================================== <<<<<<<< |
- | |
| 369 | 368 | ||
| 370 | 369 | ||
| 371 | class Plate |
370 | class Plate |
| 372 | { |
371 | { |
| 373 | public: |
372 | public: |
| Line 383... | Line 382... | ||
| 383 | private: |
382 | private: |
| 384 | TVector3 plate_edge[8]; |
383 | TVector3 plate_edge[8]; |
| 385 | CSurface *sides[6]; |
384 | CSurface *sides[6]; |
| 386 | }; |
385 | }; |
| 387 | 386 | ||
| 388 | // ================================================================================ |
- | |
| 389 | 387 | ||
| 390 | class CDetector |
388 | class CDetector |
| 391 | { |
389 | { |
| 392 | public: |
390 | public: |
| 393 | CDetector(TVector3 center0, DetectorParameters& parameters); |
391 | CDetector(TVector3 center0, DetectorParameters& parameters); |
| Line 509... | Line 507... | ||
| 509 | double offsetZ; |
507 | double offsetZ; |
| 510 | }; |
508 | }; |
| 511 | 509 | ||
| 512 | 510 | ||
| 513 | 511 | ||
| 514 | //================================================================================= |
- | |
| 515 | #endif |
512 | #endif |