Subversion Repositories f9daq

Rev

Rev 71 | Rev 73 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 72
Line 35... Line 35...
35
//=================================================================================
35
//=================================================================================
36
// zarek (premica)
36
// zarek (premica)
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
          n(TVector3(1,0,0)),
42
    n(TVector3(1,0,0)),
43
          p(TVector3(0,1,0)),
43
    //p(TVector3(0,1,0)),
-
 
44
    p(TVector3(0,0,1)),
44
          color(1)
45
    color(kBlack)
45
        {};
46
  {};
46
        CRay(TVector3 r0, TVector3 n0) :
47
  CRay(TVector3 r0, TVector3 n0) :
47
          r(r0),
48
    r(r0),
48
          n(n0.Unit()),
49
    n(n0.Unit()),
49
          p(TVector3(0,1,0)),
50
    //p(TVector3(0,1,0)),
-
 
51
    p(TVector3(0,0,1)),
50
          color(1)
52
    color(kBlack)
51
        {};
53
  {};
52
        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) :
53
    r(TVector3(x0,y0,z0)),
55
    r(TVector3(x0,y0,z0)),
54
    n(TVector3(l0,m0,n0).Unit()),
56
    n(TVector3(l0,m0,n0).Unit()),
55
    p(TVector3(0,1,0)),
57
    //p(TVector3(0,1,0)),
-
 
58
    p(TVector3(0,0,1)),
56
    color(1)
59
    color(kBlack)
57
  {};
60
  {};
58
 
61
 
59
        void Set(TVector3 r0, TVector3 n0);
62
  void Set(TVector3 r0, TVector3 n0);
60
        //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);
61
        void SetColor(int c){color = c;};
64
  void SetColor(int c){color = c;};
62
        void SetPolarization(TVector3 p0) {p = p0.Unit();};
65
  void SetPolarization(TVector3 p0) {p = p0.Unit();};
63
       
66
 
64
        //inline CRay & operator = (const CRay &);
67
  //inline CRay & operator = (const CRay &);
-
 
68
 
-
 
69
  TVector3 GetR() const {return r;};
-
 
70
  TVector3 GetN() const {return n;};
-
 
71
  TVector3 GetP() const {return p;};
-
 
72
 
-
 
73
  void Print();
-
 
74
  void Draw();
-
 
75
  void Draw(double x_from, double x_to);
-
 
76
  void DrawS(double x_from, double t);
65
 
77
 
66
        TVector3 GetR() const {return r;};
-
 
67
        TVector3 GetN() const {return n;};
-
 
68
        TVector3 GetP() const {return p;};
-
 
69
       
-
 
70
        void Print();
-
 
71
        void Draw();
-
 
72
        void Draw(double x_from, double x_to);
-
 
73
        void DrawS(double x_from, double t);
-
 
74
       
-
 
75
private:
78
private:
76
        TVector3 r;
79
  TVector3 r;
77
        TVector3 n;
80
  TVector3 n;
78
        TVector3 p; //r = point on line, n = normal, p = polarization
81
  TVector3 p; //r = point on line, n = normal, p = polarization
79
        int color;
82
  int color;
80
};
83
};
81
//=================================================================================
84
//=================================================================================
82
 
85
 
83
 
86
 
84
//=================================================================================
87
//=================================================================================
85
// ravnina, definirana in omejena s 4 tockami na njej (stirikotni poligon)
88
// ravnina, definirana in omejena s 4 tockami na njej (stirikotni poligon)
86
// zanasam se na taksno definicijo: (normala kaze noter)
89
// zanasam se na taksno definicijo: (normala kaze noter)
87
// r1----->r2
90
// r1----->r2
88
// ^        |
91
// ^        |
89
// |        |
92
// |        |
90
// |        |
93
// |        |
91
// |        �
94
// |
92
// r0<-----r3
95
// r0<-----r3
93
class CPlane4
96
class CPlane4
94
{
97
{
95
 
98
 
96
public:
99
public:
97
        CPlane4();
100
  CPlane4();
98
        CPlane4(TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4);
101
  CPlane4(TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4);
99
        CPlane4(TVector3 *vr);
102
  CPlane4(TVector3 *vr);
100
        void Set(TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4);
103
  void Set(TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4);
101
        void Set(TVector3 *vr) {Set(vr[0], vr[1], vr[2], vr[3]);};
104
  void Set(TVector3 *vr) {Set(vr[0], vr[1], vr[2], vr[3]);};
102
        void FlipN(){n = -n;};
105
  void FlipN(){n = -n;};
103
 
106
 
104
        int GetIntersection(TVector3 *vec, CRay ray);
107
  int GetIntersection(TVector3 *vec, CRay ray);
105
        int IsInTri(TVector3 vec, TVector3 e1, TVector3 e2, double);
108
  int IsInTri(TVector3 vec, TVector3 e1, TVector3 e2, double);
106
        int IsVectorIn(TVector3 vec);
109
  int IsVectorIn(TVector3 vec);
107
        int TestIntersection(CRay in); // ray in & ??? plane
110
  int TestIntersection(CRay in); // ray in & ??? plane
108
        int TestIntersection(TVector3 *vec, CRay in); // plane defined with normal vec and ray in
111
  int TestIntersection(TVector3 *vec, CRay in); // plane defined with normal vec and ray in
109
       
112
 
110
        TVector3 GetN() {return n;};
113
  TVector3 GetN() {return n;};
-
 
114
 
-
 
115
  void Print();
-
 
116
  void Draw(int color = 1, int width = 1);
-
 
117
 
-
 
118
private:
-
 
119
  TVector3 r[4], n;
-
 
120
  double A, B, C, D;
-
 
121
  TVector3 edge[4]; // vektorji stranic
-
 
122
  double angle_r[4]; // koti ob posameznem vogalu
-
 
123
};
-
 
124
//=================================================================================
-
 
125
// ravnina - krog
-
 
126
class CPlaneR
-
 
127
{
-
 
128
 
-
 
129
public:
-
 
130
  CPlaneR(TVector3 c, TVector3 n0, double R0)
-
 
131
  {center = c; n = n0; _r = R0;};
-
 
132
 
-
 
133
  void Set(TVector3 c, TVector3 n0, double R0)
-
 
134
  {center = c; n = n0; _r = R0;};
-
 
135
 
-
 
136
  int TestIntersection(TVector3 *vec, CRay in);
-
 
137
 
-
 
138
  void Draw(int color = 1, int NN = 32);
111
 
139
 
112
        void Print();
-
 
113
        void Draw(int color = 1, int width = 1);
-
 
114
       
-
 
115
        private:
140
private:
116
        TVector3 r[4], n;
141
  TVector3 n, center;
117
        double A, B, C, D;
142
  double _r;
118
        TVector3 edge[4]; // vektorji stranic
-
 
119
        double angle_r[4]; // koti ob posameznem vogalu
-
 
120
};
143
};
121
//=================================================================================
144
//=================================================================================
122
 
-
 
123
 
145
 
124
//=================================================================================
146
//=================================================================================
125
// ravna opticna povrsina: refractor, zrcalo ali povrsina s totalnim odbojem
147
// ravna opticna povrsina: refractor, zrcalo ali povrsina s totalnim odbojem
126
#define SURF_DUMMY 0
148
#define SURF_DUMMY 0
127
#define SURF_REFRA 1
149
#define SURF_REFRA 1
Line 130... Line 152...
130
//#define SURF_TOTAL 1
152
//#define SURF_TOTAL 1
131
#define SURF_IMPER 4
153
#define SURF_IMPER 4
132
//#define SURF_DIFUS 5
154
//#define SURF_DIFUS 5
133
 
155
 
134
class CSurface : public CPlane4
156
class CSurface : public CPlane4
135
{
157
{
136
 
158
 
137
public:
159
public:
138
        CSurface(int type0 = 0);
160
  CSurface(int type0 = 0);
139
        CSurface(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4,
161
  CSurface(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4,
140
                         double n10, double n20, double reflectivity);
162
      double n10, double n20, double reflectivity);
141
        CSurface(int type0, TVector3 *vr,  double n10, double n20, double reflectivity);
163
  CSurface(int type0, TVector3 *vr,  double n10, double n20, double reflectivity);
142
 
164
 
143
        void SetV(TVector3 *vr){CPlane4::Set(vr);};
165
  void SetV(TVector3 *vr){CPlane4::Set(vr);};
144
        void SetType(int type0){type = type0;};
166
  void SetType(int type0){type = type0;};
145
        void SetIndex(double n10, double n20);
167
  void SetIndex(double n10, double n20);
146
        void SetReflection(double reflectivity){reflection = reflectivity;};
168
  void SetReflection(double reflectivity){reflection = reflectivity;};
147
        void SetFresnel(int f = 1) {fresnel = f;};
169
  void SetFresnel(int f = 1) {fresnel = f;};
148
 
170
 
149
        void Set(int type0, TVector3 *vr, double n10, double n20, double reflectivity)
171
  void Set(int type0, TVector3 *vr, double n10, double n20, double reflectivity)
150
                {type = type0; CPlane4::Set(vr); SetIndex(n10, n20); reflection = reflectivity;};
172
  {type = type0; CPlane4::Set(vr); SetIndex(n10, n20); reflection = reflectivity;};
151
        void Set(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4, double n10, double n20, double reflectivity)
173
  void Set(int type0, TVector3 r1, TVector3 r2, TVector3 r3, TVector3 r4, double n10, double n20, double reflectivity)
152
                {type = type0; CPlane4::Set(r1, r2, r3, r4); SetIndex(n10, n20); reflection = reflectivity;};
174
  {type = type0; CPlane4::Set(r1, r2, r3, r4); SetIndex(n10, n20); reflection = reflectivity;};
153
 
175
 
154
        int PropagateRay(CRay in, CRay *out, TVector3 *intersection);
176
  int PropagateRay(CRay in, CRay *out, TVector3 *intersection);
155
       
177
 
156
        double N1_N2(int sign) { return ((sign > 0) ? n1/n2 : n2/n1);};
178
  double N1_N2(int sign) { return ((sign > 0) ? n1/n2 : n2/n1);};
-
 
179
 
-
 
180
  void Print(){printf("Type = %d\n", type); CPlane4::Print();};
-
 
181
 
-
 
182
private:
-
 
183
  int type; //0 = dummy; 1 = refractor; 2 = reflector; 3 = total reflection
-
 
184
  double n1, n2, n1_n2; //index of refraction, n1 @ +normal, n2 @ -normal
-
 
185
  double reflection; // odbojnost stranic
-
 
186
  TRandom rand; // za racunanje verjetnosti odboja od zrcala
-
 
187
  double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2
157
 
188
 
158
        void Print(){printf("Type = %d\n", type); CPlane4::Print();};
-
 
159
       
-
 
160
        private:
-
 
161
        int type; //0 = dummy; 1 = refractor; 2 = reflector; 3 = total reflection
-
 
162
        double n1, n2, n1_n2; //index of refraction, n1 @ +normal, n2 @ -normal
-
 
163
        double reflection; // odbojnost stranic
-
 
164
        TRandom rand; // za racunanje verjetnosti odboja od zrcala
-
 
165
        double cosTtotal; //cosinus mejnega kota totalnega odboja za dana n1 in n2
-
 
166
       
-
 
167
        int fresnel; // ali naj uposteva Fresnelove enacbe
189
  int fresnel; // ali naj uposteva Fresnelove enacbe
168
};
190
};
169
//=================================================================================
191
//=================================================================================
-
 
192
 
170
 
193
 
171
               
-
 
172
//=================================================================================
194
//=================================================================================
173
//    +-------   n1                
195
//    +-------   n1                
174
//    |       -------              
196
//    |       -------              
175
//    |          n2  ----+         
197
//    |          n2  ----+         
176
//    |                  |         
198
//    |                  |         
177
//   0| M*SiPM           | SiPM    
199
//   0| M*SiPM           | SiPM    
178
//    |                  |         
200
//    |                  |         
179
//    |              ----+         
201
//    |              ----+         
180
//    |       ------R              
202
//    |       ------R              
181
//    +-------                     
203
//    +-------                     
182
//    <-------- d ------->         
204
//    <-------- d ------->         
183
//                                 
205
//                                 
184
 
206
 
185
 
207
 
186
 
208
 
187
int RCol(int col, int solid);
209
int RCol(int col, int solid);
188
 
210
 
189
 
211
 
190
class DetectorParameters
212
class DetectorParameters
191
{
213
{
192
public:
214
public:
193
  DetectorParameters(double a, double b, double d, double active, double n1, double n2, double n3, TVector3 gap):
215
  DetectorParameters(double a, double b, double d, double active, double n1, double n2, double n3, TVector3 gap, bool coupling):
194
  _a(a),
216
    _a(a),
195
  _b(b),
217
    _b(b),
196
  _d(d),
218
    _d(d),
197
  _active(active),
219
    _active(active),
198
  _n1(n1),
220
    _n1(n1),
199
  _n2(n2),
221
    _n2(n2),
200
  _n3(n3),
222
    _n3(n3),
201
  _gap(gap),
223
    _gap(gap),
202
  _fresnel(1),
224
    _fresnel(1),
203
  _guideOn(1),
225
    _guideOn(1),
204
  offsetY(b/2.0),
226
    offsetY(b/2.0),
205
  offsetZ(b/2.0),
227
    offsetZ(b/2.0),
206
    _plateOn(1),
228
    _plateOn(1),
207
  _plateWidth(1),
229
    _plateWidth(1),
208
  _glassOn(0),
230
    _glassOn(0),
209
  _glassD(0)
231
    _glassD(0),
-
 
232
    _coupling(coupling)
210
  {};
233
  {};
211
  DetectorParameters(double a, double b, double d):
234
  DetectorParameters(double a, double b, double d):
212
  _a(a),
235
    _a(a),
213
  _b(b),
236
    _b(b),
214
  _d(d),
237
    _d(d),
215
  _active(a),
238
    _active(a),
216
  _n1(1.0),
239
    _n1(1.0),
217
  _n2(1.53),
240
    _n2(1.53),
218
  _n3(1.46),
241
    _n3(1.46),
219
  _gap(TVector3(0,0,0)),
242
    _gap(TVector3(0,0,0)),
220
  _fresnel(1),
243
    _fresnel(1),
221
  _guideOn(1),
244
    _guideOn(1),
222
  offsetY(b/2.0),
245
    offsetY(b/2.0),
223
  offsetZ(b/2.0),
246
    offsetZ(b/2.0),
224
  _plateOn(1),
247
    _plateOn(1),
225
  _plateWidth(1),
248
    _plateWidth(1),
226
  _glassOn(0),
249
    _glassOn(0),
227
  _glassD(0)
250
    _glassD(0),
-
 
251
    _coupling(false)
228
  {};
252
  {};
229
  ~DetectorParameters() {};
253
  ~DetectorParameters() {};
230
 
254
 
231
  void setGuide(double a, double b, double d) {
255
  void setGuide(double a, double b, double d) {
232
    _a = a;
256
    _a = a;
233
    _b = b;
257
    _b = b;
234
    //_M = b/a;
258
    //_M = b/a;
235
    _d = d;
259
    _d = d;
236
    };
260
  };
237
  void setGap(double x, double y, double z) { _gap = TVector3(x,y,z); };
261
  void setGap(double x, double y, double z) { _gap = TVector3(x,y,z); };
238
  void setFresnel(int fresnel) { _fresnel = fresnel; };
262
  void setFresnel(int fresnel) { _fresnel = fresnel; };
239
  void setGlass(int glassOn, double glassD) { _glassOn = glassOn; _glassD = glassD; };
263
  void setGlass(int glassOn, double glassD) { _glassOn = glassOn; _glassD = glassD; };
240
  void setGuideOn(int guideOn) { _guideOn = guideOn; };
264
  void setGuideOn(int guideOn) { _guideOn = guideOn; };
241
  void setPlate(int plateOn, double plateWidth) { _plateOn = plateOn; _plateWidth = plateWidth; };
265
  void setPlate(int plateOn, double plateWidth) { _plateOn = plateOn; _plateWidth = plateWidth; };
242
  void setIndices(double n1, double n2, double n3) { _n1 = n1; _n2 = n2; _n3 = n3; };
266
  void setIndices(double n1, double n2, double n3) { _n1 = n1; _n2 = n2; _n3 = n3; };
-
 
267
  void setCoupling(bool coupling) { _coupling = coupling; };
243
 
268
 
244
  double getLightYield() { return ( Power(_b,2)/Power(_active,2)); };
269
  double getLightYield() { return ( Power(_b,2)/Power(_active,2)); };
245
  double getM() { return (_b/_a); };
270
  double getM() { return (_b/_a); };
246
  double getA() {return _a;};
271
  double getA() {return _a;};
247
  double getB() {return _b;};
272
  double getB() {return _b;};
Line 257... Line 282...
257
  double getGlassD() { return _glassD; };
282
  double getGlassD() { return _glassD; };
258
  int getGuideOn() { return _guideOn; };
283
  int getGuideOn() { return _guideOn; };
259
  int getPlateOn() { return _plateOn; };
284
  int getPlateOn() { return _plateOn; };
260
  double getOffsetY() { return offsetY; };
285
  double getOffsetY() { return offsetY; };
261
  double getOffsetZ() { return offsetZ; };
286
  double getOffsetZ() { return offsetZ; };
-
 
287
  // bad coupling in the case the small amount of grease was applied
-
 
288
  bool badCoupling() { return _coupling; };
262
 
289
 
263
private:
290
private:
264
  double _a;
291
  double _a;
265
  double _b;
292
  double _b;
266
  double _d;
293
  double _d;
267
  double _active;
294
  double _active;
268
  double _n1;
295
  double _n1;
269
  double _n2;
296
  double _n2;
270
  double _n3;
297
  double _n3;
271
  TVector3 _gap;
298
  TVector3 _gap;
272
 
299
 
273
  int _fresnel;
300
  int _fresnel;
274
 
301
 
275
  int _guideOn;
302
  int _guideOn;
276
  double offsetY;
303
  double offsetY;
277
  double offsetZ;
304
  double offsetZ;
278
 
305
 
279
  int _plateOn;
306
  int _plateOn;
280
  double _plateWidth;
307
  double _plateWidth;
281
 
308
 
282
  int _glassOn;
309
  int _glassOn;
283
  double _glassD;
310
  double _glassD;
-
 
311
  bool _coupling;
284
 
312
 
285
};
313
};
286
 
314
 
287
class Guide
315
class Guide
288
{
316
{
289
public:
317
public:
290
        Guide(TVector3 center0, DetectorParameters& parameters);
318
  Guide(TVector3 center0, DetectorParameters& parameters);
291
        ~Guide() {
319
  ~Guide() {
292
          for (int jk=0; jk<6; jk++) delete s_side[jk];
320
    for (int jk=0; jk<6; jk++) delete s_side[jk];
-
 
321
    delete grease;
-
 
322
    delete noCoupling;
293
          delete hfate;
323
    delete hfate;
294
          delete hnodb_all;
324
    delete hnodb_all;
295
          delete hnodb_exit;
325
    delete hnodb_exit;
296
          delete hin;
326
    delete hin;
297
          delete hout;
327
    delete hout;
298
        }
328
  }
299
       
329
 
300
        Fate PropagateRay(CRay in, CRay *out, int *n_points, TVector3 *points);
330
  Fate PropagateRay(CRay in, CRay *out, int *n_points, TVector3 *points);
301
       
331
 
302
        double getD() { return _d; }
332
  double getD() { return _d; }
303
        double getN1() { return n1; };
333
  double getN1() { return _n1; };
304
        double getN2() { return n2; };
334
  double getN2() { return _n2; };
305
        double getN3() { return n3; };
335
  double getN3() { return _n3; };
306
        TH1F* GetHFate() const {return hfate;};
336
  TH1F* GetHFate() const {return hfate;};
307
        TH1F* GetHNOdb_all() const {return hnodb_all;};
337
  TH1F* GetHNOdb_all() const {return hnodb_all;};
308
        TH1F* GetHNOdb_exit() const {return hnodb_exit;};
338
  TH1F* GetHNOdb_exit() const {return hnodb_exit;};
309
        TH2F* GetHIn() const {return hin;};
339
  TH2F* GetHIn() const {return hin;};
310
        TH2F* GetHOut() const {return hout;};
340
  TH2F* GetHOut() const {return hout;};
311
        int GetExitHits() {return (int)hfate->GetBinContent(5);};
341
  int GetExitHits() {return (int)hfate->GetBinContent(5);};
312
        int GetEnteranceHits() {return (int)hfate->GetBinContent(6);};
342
  int GetEnteranceHits() {return (int)hfate->GetBinContent(6);};
313
        void GetVFate(int *out);
343
  void GetVFate(int *out);
314
        int GetMAXODB() const {return MAX_REFLECTIONS;};
344
  int GetMAXODB() const {return MAX_REFLECTIONS;};
315
       
345
 
316
        void Draw(int color = 1, int width = 1);
346
  void Draw(int color = 1, int width = 1);
317
        void DrawSkel(int color = 1, int width = 1);
347
  void DrawSkel(int color = 1, int width = 1);
318
       
348
 
319
private:
349
private:
320
  Fate fate;
350
  Fate fate;
321
        double _d; // parameters
351
  double _d; // parameters
322
        double n1, n2, n3; // refractive index: n1 above entry surface, n2 inside, n3 after exit
352
  double _n1, _n2, _n3; // refractive index: n1 above entry surface, n2 inside, n3 after exit
323
        double _r;
353
  double _r;
324
        double absorption;
354
  double _absorption;
325
        double A;
355
  double _A;
-
 
356
  bool _badCoupling;
326
        TRandom rand; // for material absorption
357
  TRandom rand; // for material absorption
327
        CSurface *s_side[6];
358
  CSurface *s_side[6];
-
 
359
  CPlaneR* grease;
-
 
360
  CSurface* noCoupling;
328
        TVector3 center, vodnik_edge[8];
361
  TVector3 center, vodnik_edge[8];
329
       
362
 
330
        TH1F *hfate, *hnodb_all, *hnodb_exit;
363
  TH1F *hfate, *hnodb_all, *hnodb_exit;
331
        TH2F *hin, *hout;
364
  TH2F *hin, *hout;
332
};
365
};
333
//=================================================================================
366
//=================================================================================
334
 
367
 
335
//=============================================================================================================================== <<<<<<<<
368
//=============================================================================================================================== <<<<<<<<
336
// ravnina - krog
-
 
337
class CPlaneR
-
 
338
{
-
 
339
 
369
 
340
        public:
-
 
341
                CPlaneR(TVector3 c, TVector3 n0, double R0)
-
 
342
                {center = c; n = n0; _r = R0;};
-
 
343
       
-
 
344
                void Set(TVector3 c, TVector3 n0, double R0)
-
 
345
                {center = c; n = n0; _r = R0;};
-
 
346
       
-
 
347
                int TestIntersection(TVector3 *vec, CRay in);
-
 
348
       
-
 
349
                void Draw(int color = 1, int NN = 32);
-
 
350
               
-
 
351
        private:
-
 
352
                TVector3 n, center;
-
 
353
                double _r;
-
 
354
};
-
 
355
//=================================================================================
-
 
356
 
370
 
357
class Plate
371
class Plate
358
{
372
{
359
public:
373
public:
360
  Plate(DetectorParameters& parameters);
374
  Plate(DetectorParameters& parameters);
361
  ~Plate() {
375
  ~Plate() {
362
    for (int jk=0; jk<6; jk++) delete sides[jk]; // the same, needs solution
376
    for (int jk=0; jk<6; jk++) delete sides[jk]; // the same, needs solution
363
  };
377
  };
364
 
378
 
365
  void draw(int color, int width);
379
  void draw(int color, int width);
366
  void drawSkel(int color, int width);
380
  void drawSkel(int color, int width);
367
  Fate propagateRay(CRay, CRay*, int*, TVector3*);
381
  Fate propagateRay(CRay, CRay*, int*, TVector3*);
368
 
382
 
369
private:
383
private:
370
        TVector3 plate_edge[8];
384
  TVector3 plate_edge[8];
371
        CSurface *sides[6];
385
  CSurface *sides[6];
372
};
386
};
373
 
387
 
374
// ================================================================================
388
// ================================================================================
375
 
389
 
376
class CDetector
390
class CDetector
377
{
391
{
378
public:
392
public:
379
        CDetector(TVector3 center0, DetectorParameters& parameters);
393
  CDetector(TVector3 center0, DetectorParameters& parameters);
380
        ~CDetector() {
394
  ~CDetector() {
381
          delete glass;
395
    delete glass;
382
          delete glass_circle;
396
    delete glass_circle;
383
          delete hglass;
397
    delete hglass;
384
    delete active;
398
    delete active;
385
          delete hactive;
399
    delete hactive;
386
          delete hlaser;
400
    delete hlaser;
387
          delete detector;
401
    delete detector;
388
          delete hdetector;
402
    delete hdetector;
389
          delete guide;
403
    delete guide;
390
          delete plate;
404
    delete plate;
391
          delete histoPlate;
405
    delete histoPlate;
392
          //delete window;
406
    //delete window;
393
          //delete window_circle;
407
    //delete window_circle;
394
          //delete hwindow;
408
    //delete hwindow;
395
        }
409
  }
396
 
410
 
397
        //void SetLGType(int in = SURF_REFRA, int side = SURF_REFRA, int out = SURF_REFRA)
411
  //void SetLGType(int in = SURF_REFRA, int side = SURF_REFRA, int out = SURF_REFRA)
398
        //      {type_in = in; type_side = side; type_out = out;};
412
  //    {type_in = in; type_side = side; type_out = out;};
399
 
413
 
400
/*      void SetLG(double SiPM0, double M0, double d0, double n10, double n20, double n30, double R0)
414
  /*    void SetLG(double SiPM0, double M0, double d0, double n10, double n20, double n30, double R0)
401
        { SiPM=SiPM0;
415
        { SiPM=SiPM0;
402
                M=M0;
416
                M=M0;
403
                d=d0;
417
                d=d0;
404
                n1=n10;
418
                n1=n10;
405
                n2=n20;
419
                n2=n20;
406
                n3=n30;
420
                n3=n30;
407
                R=R0;
421
                R=R0;
408
                }; */
422
                }; */
409
        //void SetR(double R0) {R = R0;};
423
  //void SetR(double R0) {R = R0;};
410
        //void SetGlass(int glass_on0, double glass_d0)
424
  //void SetGlass(int glass_on0, double glass_d0)
411
                //{glass_on = glass_on0; glass_d = glass_d0;};
425
  //{glass_on = glass_on0; glass_d = glass_d0;};
412
        //void SetGap(double x_gap0, double y_gap0, double z_gap0)
426
  //void SetGap(double x_gap0, double y_gap0, double z_gap0)
413
                //{x_gap = x_gap0; y_gap = y_gap0; z_gap = z_gap0;};    
427
  //{x_gap = x_gap0; y_gap = y_gap0; z_gap = z_gap0;};
414
        void SetRCol(int in, int lg, int out, int gla)
428
  void SetRCol(int in, int lg, int out, int gla)
415
                {col_in = in; col_lg = lg; col_out = out; col_rgla = gla;};
429
  {col_in = in; col_lg = lg; col_out = out; col_rgla = gla;};
416
        void SetDCol(int LG0, int glass0, int active0)
430
  void SetDCol(int LG0, int glass0, int active0)
417
                {col_LG = LG0; col_glass = glass0; col_active = active0;};
431
  {col_LG = LG0; col_glass = glass0; col_active = active0;};
418
        //void SetFresnel(int b)
432
  //void SetFresnel(int b)
419
                //{fresnel = b;};
433
  //{fresnel = b;};
420
        //void SetAbsorption(int b, double A0)
434
  //void SetAbsorption(int b, double A0)
421
                //{absorption = b; A = A0;};
435
  //{absorption = b; A = A0;};
422
        //void SetWindow(double wR, double d0) {window_R = wR; window_d = d0;}; 
436
  //void SetWindow(double wR, double d0) {window_R = wR; window_d = d0;};
423
        //void SetGuideOn(int b)
437
  //void SetGuideOn(int b)
424
                //{guide_on = b;};
438
  //{guide_on = b;};
425
 
-
 
426
        //void Init();
-
 
427
 
-
 
428
        int Propagate(CRay, CRay*, int);
-
 
429
 
-
 
430
        Guide* GetLG() const {return guide;};
-
 
431
        //TH2F* GetHWindow() const {return hwindow;};
-
 
432
        TH2F* GetHGlass() const {return hglass;};
-
 
433
        TH2F* GetHActive() const {return hactive;};
-
 
434
        TH2F* GetHLaser() const {return hlaser;};
-
 
435
        TH2F* GetHDetector() const {return hdetector;};
-
 
436
        TH2F* GetHPlate() const {return histoPlate;};
-
 
437
       
-
 
438
        //double GetSiPM() const {return SiPM;};
-
 
439
        //double GetM() const {return M;};
-
 
440
        //double GetD() const {return d;};
-
 
441
        //double GetR() const {return R;};
-
 
442
        //TVector3 GetVGap() const {return (TVector3(x_gap, y_gap, z_gap));};
-
 
443
        //int IsGlass() {return glass_on;};
-
 
444
        //double getGlassWidth() {return glass_d;};
-
 
445
        //double GetWindowR() {return window_R;};
-
 
446
        //double GetWindowD() {return window_d;};
-
 
447
 
439
 
448
        void Draw(int width = 2);
-
 
449
       
-
 
450
        private:
-
 
451
        Fate fate;
-
 
452
        TVector3 center;
440
  //void Init();
453
 
441
 
454
        //int type_in, type_side, type_out;
442
  int Propagate(CRay, CRay*, int);
455
        //double SiPM, M, d, n1, n2, n3, R;
-
 
456
        //double detectorActive; 
-
 
457
       
-
 
458
 
443
 
-
 
444
  Guide* GetLG() const {return guide;};
-
 
445
  //TH2F* GetHWindow() const {return hwindow;};
-
 
446
  TH2F* GetHGlass() const {return hglass;};
-
 
447
  TH2F* GetHActive() const {return hactive;};
-
 
448
  TH2F* GetHLaser() const {return hlaser;};
-
 
449
  TH2F* GetHDetector() const {return hdetector;};
-
 
450
  TH2F* GetHPlate() const {return histoPlate;};
-
 
451
 
-
 
452
  //double GetSiPM() const {return SiPM;};
-
 
453
  //double GetM() const {return M;};
-
 
454
  //double GetD() const {return d;};
-
 
455
  //double GetR() const {return R;};
-
 
456
  //TVector3 GetVGap() const {return (TVector3(x_gap, y_gap, z_gap));};
-
 
457
  //int IsGlass() {return glass_on;};
-
 
458
  //double getGlassWidth() {return glass_d;};
-
 
459
  //double GetWindowR() {return window_R;};
-
 
460
  //double GetWindowD() {return window_d;};
-
 
461
 
-
 
462
  void Draw(int width = 2);
-
 
463
 
-
 
464
private:
-
 
465
  Fate fate;
-
 
466
  TVector3 center;
-
 
467
 
-
 
468
  //int type_in, type_side, type_out;
-
 
469
  //double SiPM, M, d, n1, n2, n3, R;
-
 
470
  //double detectorActive;
-
 
471
 
-
 
472
 
459
        int glass_on;
473
  int glass_on;
460
        double glass_d;
474
  double glass_d;
461
        CSurface *glass;
475
  CSurface *glass;
462
        CPlaneR *glass_circle;
476
  CPlaneR *glass_circle;
463
        TH2F *hglass;
477
  TH2F *hglass;
464
 
478
 
465
        //double x_gap, y_gap, z_gap;
479
  //double x_gap, y_gap, z_gap;
466
        CPlane4 *active;
480
  CPlane4* active;
-
 
481
  CPlaneR* grease;
467
        TH2F *hactive, *hlaser;
482
  TH2F *hactive, *hlaser;
468
 
483
 
469
        CPlane4 *detector;
484
  CPlane4 *detector;
470
        TH2F *hdetector;
485
  TH2F *hdetector;
471
       
486
 
472
        int col_in, col_lg, col_out, col_rgla;
487
  int col_in, col_lg, col_out, col_rgla;
473
        int col_LG, col_glass, col_active;
488
  int col_LG, col_glass, col_active;
474
       
489
 
475
        //int fresnel, absorption;
490
  //int fresnel, absorption;
476
        //double A;
491
  //double A;
477
       
492
 
478
        int guide_on;
493
  int guide_on;
479
       
494
 
480
        //double window_R, window_d;
495
  //double window_R, window_d;
481
        //CSurface *window;
496
  //CSurface *window;
482
        //CPlaneR *window_circle;
497
  //CPlaneR *window_circle;
483
        //TH2F *hwindow;
498
  //TH2F *hwindow;
484
       
499
 
485
        Guide *guide;
500
  Guide *guide;
486
        Plate *plate;
501
  Plate *plate;
487
       
502
 
488
        double _plateWidth;
503
  double _plateWidth;
489
        int _plateOn;
504
  int _plateOn;
490
       
505
 
491
        TH2F *histoPlate;
506
  TH2F *histoPlate;
492
       
507
 
493
        double offsetY;
508
  double offsetY;
494
        double offsetZ;
509
  double offsetZ;
495
};
510
};
496
 
511
 
497
 
512
 
498
 
513
 
499
//=================================================================================
514
//=================================================================================