BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
MucBakelite.cxx
Go to the documentation of this file.
1//------------------------------------------------------------------------------|
2// [File ]: MucBakelite.cxx |
3// [Brief ]: MUC geometry bakelite class |
4// [Author]: Xie Yuguang, <[email protected]> |
5// [Date ]: May 22, 2005 |
6//------------------------------------------------------------------------------|
7
8#include <iostream>
9#include <cmath>
10
13
14using namespace std;
15
16// Constructor
17MucBakelite::MucBakelite( int part, int segment, int layer, int upDown, int rpcId, int id )
18 : MucEntity( part, segment, layer, upDown, rpcId, id )
19{
21}
22
23// Copy constructor
25{
26 m_Phi = other.m_Phi;
27}
28
29// Operator =
31{
32 if( this == &other)
33 return *this;
34
36
37 m_Phi = other.m_Phi;
38
39 return *this;
40}
41
42// Destructor
44
45// Initialize
47{
48 SetPhi();
49 SetTheta();
50 SetRin();
51 SetRout();
52 SetRc();
53
54 SetThin();
55 SetW();
56 SetWu();
57 SetWd();
58 SetH();
59 SetL();
60
63
67}
68
69// -------------------------- Get methods ----------------------------
70
71double MucBakelite::GetPhi() { return m_Phi; }
72
73// ---------------------------Set motheds -----------------------------
74
75// Set inclination angle of local coordinate x axis and global coordinate x axis
77{
78 if( m_Part == BRID )
79 m_Phi = B_PHI[m_Segment] * (MUC_PI/4.0);
80 else
81 m_Phi = 0.;
82}
83
85{
86 if( m_Part == BRID )
87 m_Theta = m_Segment * (MUC_PI/4.0);
88 else
89 {
90 if( m_UpDown == SL_UP )
91 m_Theta = ( MUC_PI/4.0 ) + (1 - m_RpcId) * MUC_PI / 8.0 ;
92 else
93 {
94 if( m_RpcId < 2 ) // RPC NO.1 and NO.2
95 m_Theta = ( MUC_PI/4.0 ) + MUC_PI / 8.0 ;
96 else if ( m_RpcId == 2 ) // center RPC, NO.3
97 m_Theta = ( MUC_PI/4.0 ) ;
98 else
99 m_Theta = ( MUC_PI/4.0 ) - MUC_PI / 8.0 ;
100 }
101 }
102}
103
105{
106 if( m_Part == BRID ) // Rin of bakelite
107 m_Rin = B_AS_RMIN[m_Layer] - AS_GAP/2.0 + (1-2*m_UpDown) * (STR_TH + RPC_TH)/2.0
108 + (1-2*m_ID)*(GAS_TH + BKLT_TH)/2.0 - BKLT_TH/2.0;
109 else // Rin of RPC
110 m_Rin = E_GP_RMIN[m_Layer] + E_STRPLN_DR + (1-m_UpDown)*RPC_SL_OFFSET;
111}
112
114{
115 if( m_Part == BRID ) // Rout of bakelite
116 m_Rout = B_AS_RMIN[m_Layer] - AS_GAP/2.0 + (1-2*m_UpDown) * (STR_TH + RPC_TH)/2.0
117 + (1-2*m_ID)*(GAS_TH + BKLT_TH)/2.0 + BKLT_TH/2.0;
118 else
119 {
120 m_Rout = E_AS_RMAX - E_BOX_DR - E_STRPLN_DB[(m_Layer==0)?0:1] + (m_UpDown-1)*RPC_SL_OFFSET;
121 }
122}
123
125{
126 m_Rc = (m_Rin + m_Rout)/2.0;
127}
128
130{
131 m_Thin = BKLT_TH;
132}
133
135{
136 if( m_Part == BRID)
137 {
138 if( m_Segment == B_TOP && m_RpcId < 2 ) // the first 2 RPCs in top segment
139 {
140 if( (m_Layer+1)%2 == 1 ) // odd layer
141 m_W = (B_BOX_WT[m_Layer] - 2*B_BOX_DT[m_UpDown] - 2*B_BOX_DZ[m_UpDown] - B_BOX_SLOT_WT)/2.0;
142 else // even layer
143 m_W = (B_BOX_WT[m_Layer] - 4*B_BOX_DZ[m_UpDown] - B_BOX_SLOT_WT)/2.0;
144 }
145 else // other RPCs
146 {
147 if( (m_Layer+1)%2 ==1 ) // odd layer
148 m_W = B_BOX_WT[m_Layer] - 2 * B_BOX_DT[m_UpDown];
149 else // even layer
150 m_W = B_BOX_WT[m_Layer] - 2 * B_BOX_DZ[m_UpDown];
151
152 }
153 } // end barrel
154 else
155 {
156 if( m_UpDown == SL_UP ) // up layer
157 { if( m_RpcId == 0 )
158 m_W = VALUE * m_Rc - E_GP_DX - E_STRPLN_DA - RPC_SL_OFFSET;
159 else if ( m_RpcId == 1 )
160 m_W = 2 * VALUE * m_Rc;
161 else
162 m_W = VALUE * m_Rc - E_GP_DY - E_STRPLN_DA - RPC_SL_OFFSET;
163 }
164 else // down layer
165 {
166 switch( m_RpcId )
167 {
168 case 0:
169 m_W = VALUE * m_Rc - E_GP_DX - E_STRPLN_DA;
170 break;
171 case 1:
172 case 3:
173 m_W = VALUE * ( m_Rc - m_Rin );
174 break;
175 case 2:
176 m_W = 2 * VALUE * m_Rin;
177 break;
178 case 4:
179 m_W = VALUE * m_Rc - E_GP_DY - E_STRPLN_DA;
180 break;
181 default: ;
182 }
183 }
184
185 } // else, endcap
186
187 // cut rpc chamber death edge
188 if( m_Part == BRID )
189 m_W -= RPC_DEATH_EDGE * 2.0;
190 else
191 {
192 if( m_UpDown == SL_UP )
193 {
194 if( m_RpcId == 1 ) m_W -= RPC_DEATH_EDGE * 2.0; // center rpc
195 else m_W -= ( 1 + 1.0/cos(MUC_PI/8.0) ) * RPC_DEATH_EDGE;
196 }
197 else
198 {
199 if( m_RpcId == 2 ) // center rpc
200 m_W -= RPC_DEATH_EDGE * 2.0;
201 else // DOWN 0,1,3,4 RPC
202 m_W -= RPC_DEATH_EDGE;
203 }
204 }
205}
206
208{
209 if( m_Part == BRID )
210 m_H = BKLT_TH;
211 else
212 {
213 m_H = m_Rout - m_Rin;
214
215 // cut rpc chamber death edge
216 if( m_UpDown == SL_DOWN && (m_ID == 1 || m_ID == 3) )
217 m_H -= RPC_DEATH_EDGE * (1 + 1.0/VALUE);
218 else
219 m_H -= RPC_DEATH_EDGE * 2.0;
220 }
221}
222
224{
225 if( m_Part == BRID ) // barrel
226 {
227 if( m_Segment != B_TOP ) // not top segment
228 {
229 // the first rpc of SL_DOWN is constructed as the same as the last rpc of SL_UP
230 if( (m_UpDown == SL_UP && m_RpcId == 3) || (m_UpDown == SL_DOWN && m_RpcId == 0) )
231 {
232 if( m_Layer != 1 ) // not layer NO.2
233 m_L = B_BOX_LT - 2*B_BOX_DZ[m_UpDown] - 3*B_RPC_LTN;
234 else // layer NO.2 is special
235 m_L = B_BOX_LT - 2*B_BOX_DZ[m_UpDown] - 3*B_RPC_LTS;
236 }
237 else
238 {
239 if( m_Layer != 1 ) // not layer NO.2
240 m_L = B_RPC_LTN;
241 else // layer NO.2 is special
242 m_L = B_RPC_LTS;
243 }
244 }
245 else // top segment
246 {
247 if( m_RpcId < 2 ) // RPC NO.1 and NO.2
248 {
249 m_L = B_TOPRPC_LTS[ ((m_Layer == 0)?1:(m_Layer%2)) ];
250 }
251 else if( (m_UpDown == SL_UP && m_RpcId == 4) || (m_UpDown == SL_DOWN && m_RpcId == 2) )
252 {
253 m_L = B_BOX_LT - B_TOPRPC_LTS[ ((m_Layer == 0)?1:(m_Layer%2)) ] - 2*(B_BOX_DZ[m_UpDown]+B_RPC_LTN);
254 }
255 else
256 m_L = B_RPC_LTN;
257
258 } // else, top segment
259
260 m_L -= RPC_DEATH_EDGE * 2.0; // cut rpc chamber death edge
261
262 } // if, barrel
263 else // endcap
264 {
265 m_L = BKLT_TH;
266 }
267
268}
269
271{
272 if( m_Part == BRID )
273 m_Wu = m_W;
274 else
275 {
276 if( m_UpDown == SL_UP )
277 {
278 if( m_RpcId == 0 )
279 m_Wu = VALUE * m_Rin - E_GP_DX - E_STRPLN_DA - RPC_SL_OFFSET;
280 else if( m_RpcId == 1 )
281 m_Wu = 2.0* VALUE * m_Rin;
282 else
283 m_Wu = VALUE * m_Rin - E_GP_DY - E_STRPLN_DA - RPC_SL_OFFSET;
284 }
285 else
286 {
287 switch( m_RpcId )
288 {
289 case 0:
290 m_Wu = VALUE * m_Rin - E_GP_DX - E_STRPLN_DA;
291 break;
292 case 1:
293 case 3:
294 m_Wu = 0.0;
295 break;
296 case 2:
297 m_Wu = 2.0* VALUE * m_Rin;
298 break;
299 case 4:
300 m_Wu = VALUE * m_Rin - E_GP_DY - E_STRPLN_DA;
301 break;
302 default: ;
303 }
304 }
305
306 // cut rpc chamber death edge
307 if( m_Wu > 0.0 )
308 {
309 if( m_UpDown == SL_UP )
310 {
311 if( m_RpcId == 1 ) m_Wu -= RPC_DEATH_EDGE * 2.0; // center rpc
312 else m_Wu -= ( 1 + 1.0/cos(MUC_PI/8.0) ) * RPC_DEATH_EDGE;
313 }
314 else
315 {
316 if( m_RpcId == 2 ) // center rpc
317 m_Wu -= RPC_DEATH_EDGE * 2.0;
318 else // DOWN 0,4 RPC
319 m_W -= RPC_DEATH_EDGE;
320 }
321 }
322 } // else, endcap
323}
324
326{
327 if( m_Part == BRID )
328 m_Wd = m_W;
329 else
330 {
331 if( m_UpDown == SL_UP )
332 {
333 if( m_RpcId == 0 )
334 m_Wd = VALUE * m_Rout - E_GP_DX - E_STRPLN_DA - RPC_SL_OFFSET;
335 else if( m_RpcId == 1 )
336 m_Wd = 2.0* VALUE * m_Rout;
337 else
338 m_Wd = VALUE * m_Rout - E_GP_DY - E_STRPLN_DA - RPC_SL_OFFSET;
339 }
340 else
341 {
342 switch( m_RpcId )
343 {
344 case 0:
345 m_Wd = VALUE * m_Rout - E_GP_DX - E_STRPLN_DA;
346 break;
347 case 1:
348 case 3:
349 m_Wd = VALUE * (m_Rout - m_Rin);
350 break;
351 case 2:
352 m_Wd = 2.0 * VALUE * m_Rin;
353 break;
354 case 4:
355 m_Wd = VALUE * m_Rout - E_GP_DY - E_STRPLN_DA;
356 break;
357 default: ;
358 }
359 }
360
361 // cut rpc chamber death edge
362 if( m_UpDown == SL_UP )
363 {
364 if( m_RpcId == 1 ) m_Wd -= RPC_DEATH_EDGE * 2.0; // center rpc
365 else m_Wd -= ( 1 + 1.0/cos(MUC_PI/8.0) ) * RPC_DEATH_EDGE;
366 }
367 else
368 {
369 if( m_RpcId == 2 ) // center rpc
370 m_Wd -= RPC_DEATH_EDGE * 2.0;
371 else // DOWN 0,4 RPC
372 m_Wd -= RPC_DEATH_EDGE;
373 }
374
375 } // else, endcap
376}
377
378// Set barrel rpc in BES CS
380{
381 if( m_Part != BRID ) return 0;
382
383 double x, y, z;
384 x = y = z = 0.0;
385
386 if( m_Segment != B_TOP )
387 {
388 // set x and y
389 double r;
390 r = (B_AS_RMIN[m_Layer] - AS_GAP / 2.0) + (1-2*m_UpDown)*(STR_TH + RPC_TH)/2.0;
391 x = r * cos( m_Theta );
392 y = r * sin( m_Theta );
393
394 // set z
395 if( (m_UpDown == SL_UP && m_RpcId == 3) || (m_UpDown == SL_DOWN && m_RpcId == 0) )
396 {
397 if( m_Layer != 1 ) // not layer NO.2
398 z = (2*m_UpDown - 1) * 3 * B_RPC_LTN/2.0;
399 else
400 z = (2*m_UpDown - 1) * 3 * B_RPC_LTS/2.0;
401 }
402 else if( m_UpDown == SL_UP )
403 z = B_BOX_LT/2.0 - B_BOX_DZ[m_UpDown] - (1+2*m_RpcId)*B_RPC_LTN/2.0;
404 else
405 z = -B_BOX_LT/2.0 + B_BOX_DZ[m_UpDown] + (1+2*(3-m_RpcId))*B_RPC_LTN/2.0;
406
407 } // end not top segment
408 else
409 {
410 //---------- set x--------
411 if( m_RpcId > 1 ) // NO.3, 4, 5
412 x = 0.;
413 else // NO.1 and NO.2
414 x = (1-2*m_RpcId) * ( (B_BOX_WT[m_Layer] + B_BOX_SLOT_WT)/4.0 + (B_BOX_DZ[m_UpDown] - B_BOX_DT[m_UpDown])/2.0 );
415
416 //---------- set y--------
417 y = (B_AS_RMIN[m_Layer] - AS_GAP / 2.0) + (1-2*m_UpDown)*(STR_TH + RPC_TH)/2.0;
418
419 //---------- set z--------
420 if( m_RpcId < 2 ) // rpc NO.1 and NO.2
421 z = B_BOX_LT/2.0 - B_BOX_DZ[m_UpDown] - B_TOPRPC_LTS[ ((m_Layer==0)?1:(m_Layer%2)) ];
422 else if( m_UpDown == SL_UP && m_RpcId == 4 )
423 z = -B_RPC_LTN - B_TOPRPC_LTS[ ((m_Layer==0)?1:(m_Layer%2)) ];
424 else if( m_UpDown == SL_DOWN && m_RpcId == 2 )
425 z = B_RPC_LTN - B_TOPRPC_LTS[ ((m_Layer==0)?1:(m_Layer%2)) ];
426 else if( m_UpDown == SL_UP )
427 z = B_BOX_LT/2.0 - B_BOX_DZ[m_UpDown] - B_TOPRPC_LTS[ ((m_Layer==0)?1:(m_Layer%2)) ] + (3-2*m_RpcId)*B_RPC_LTN/2.0;
428 else
429 z = -B_BOX_LT/2.0 - B_BOX_DZ[m_UpDown] + (1+2*(4-m_RpcId))*B_RPC_LTN/2.0;
430
431 } // end top segment
432
433 m_LocOrgInBes[0] = x;
434 m_LocOrgInBes[1] = y;
435 m_LocOrgInBes[2] = z;
436
437 // limit cut
438 for( int i=0; i<2; i++ ) {
439 if( fabs(m_LocOrgInBes[i]) < ERR_LIMIT ) m_LocOrgInBes[i] = 0.0;
440 }
441
442 return 0;
443}
444
446{
447 if( m_Part == BRID ) return 0;
448
449 double x, y, z;
450 x = y = z = 0.;
451
452 //------------ set x and y ---------------
453 if( m_UpDown == SL_UP )
454 {
455 if( m_RpcId == 0 )
456 {
457 x = ( VALUE*m_Rc + E_GP_DX + E_STRPLN_DA + RPC_SL_OFFSET ) / 2.0;
458 y = m_Rc;
459 }
460 else if( m_RpcId == 1 )
461 {
462 x = m_Rc * cos( MUC_PI/4.0 );
463 y = m_Rc * sin( MUC_PI/4.0 );
464 }
465 else
466 {
467 x = m_Rc;
468 y = ( VALUE*m_Rc + E_GP_DY + E_STRPLN_DA + RPC_SL_OFFSET ) / 2.0;
469 }
470 }
471 else
472 {
473 switch( m_RpcId )
474 {
475 case 0:
476 x = ( VALUE*m_Rc + E_GP_DX + E_STRPLN_DA )/2.0 + RPC_DEATH_EDGE/2.0;
477 y = m_Rc;
478 break;
479 case 1:
480 x = VALUE*m_Rc + sin(MUC_PI/4.0)*m_Wd/4.0;
481 x += RPC_DEATH_EDGE * ( 3 - 2*sqrt(2.0) )/4.0;
482
483 y = m_Rc - cos(MUC_PI/4.0)*m_Wd/4.0;
484 y += RPC_DEATH_EDGE * ( 1 + 4.0/sqrt(2.0) )/4.0;
485
486 break;
487 case 2:
488 x = m_Rc * cos( MUC_PI/4.0 );
489 y = m_Rc * sin( MUC_PI/4.0 );
490 break;
491 case 3:
492 x = m_Rc - cos(MUC_PI/4.0)*m_Wd/4.0;
493 x += RPC_DEATH_EDGE * ( 1 + 4.0/sqrt(2.0) )/4.0;
494
495 y = VALUE*m_Rc + sin(MUC_PI/4.0)*m_Wd/4.0;
496 y += RPC_DEATH_EDGE * ( 3 - 2*sqrt(2.0) )/4.0;
497
498 break;
499 case 4:
500 x = m_Rc;
501 y = ( VALUE*m_Rc + E_GP_DY + E_STRPLN_DA )/2.0 + RPC_DEATH_EDGE/2.0;
502 }
503
504 }
505
506 // sign different by segment
507 if ( m_Segment == 0 ) { ; }
508 else if( m_Segment == 1 ) { x = -x; }
509 else if( m_Segment == 2 ) { x = -x; y = -y; }
510 else { y = -y; }
511
512
513 //------------ set z ---------------------
514 for( int i=0; i<m_Layer+1; i++ ) z += E_AS_TH[i];
515
516 z += m_Layer * AS_GAP;
517 z += ( (E_AS_ZMAX - E_AS_TOTAL_TH ) + AS_GAP/2.0 );
518 z += (1-2*m_UpDown) * ( STR_TH + RPC_TH ) / 2.0;
519 z *= cos( m_Part*MUC_PI/2.0 );
520
521 m_LocOrgInBes[0] = x;
522 m_LocOrgInBes[1] = y;
523 m_LocOrgInBes[2] = z;
524
525 // limit cut
526 for( int i=0; i<2; i++ ) {
527 if( fabs(m_LocOrgInBes[i]) < ERR_LIMIT ) m_LocOrgInBes[i] = 0.;
528 }
529
530 return 0;
531}
532
533// Set local origin(RPC) in BES CS
535{
536 if( m_Part == BRID )
538 else
540}
541
542// Set bakelite origin in RPC CS
544{
545 if( m_Part == BRID )
546 {
547 m_ObjOrgInLoc[0] = 0.;
548
549 m_ObjOrgInLoc[1] = (1-2*m_ID) * (BKLT_TH + GAS_TH)/2.0;
550
551 m_ObjOrgInLoc[2] = 0.;
552 }
553 else
554 {
555 m_ObjOrgInLoc[0] = 0.;
556 m_ObjOrgInLoc[1] = 0.;
557 m_ObjOrgInLoc[2] = (1-2*m_ID) * (BKLT_TH + GAS_TH)/2.0;
558 }
559}
560
562{
564
565 // limit cut
566 for( int i=0; i<3; i++ ) {
567 if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0.;
568 }
569}
570
571/*
572void MucBakelite::SetAlignment( double dx, double dy, double dz )
573{
574
575 m_ObjOrgInLoc[0] += dx;
576 m_ObjOrgInLoc[1] += dy;
577 m_ObjOrgInLoc[2] += dz;
578}
579*/
580
581// END
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
Double_t x[10]
double GetPhi()
Definition: MucBakelite.cxx:71
virtual void SetTheta()
Definition: MucBakelite.cxx:84
virtual void SetThin()
virtual void SetRin()
virtual void SetL()
virtual void SetRout()
int SetEndcapRpcInBes()
virtual void SetWd()
virtual void SetRc()
virtual void SetObjOrgInBes()
virtual void SetW()
MucBakelite(int part, int segment, int layer, int upDown, int rpcId, int id)
Definition: MucBakelite.cxx:17
virtual void SetObjOrgInLoc()
virtual void SetPhi()
Definition: MucBakelite.cxx:76
int SetBarrelRpcInBes()
virtual void SetWu()
virtual void Init()
Definition: MucBakelite.cxx:46
MucBakelite & operator=(const MucBakelite &other)
Definition: MucBakelite.cxx:30
virtual void SetLocOrgInBes()
virtual void SetH()
int m_RpcId
Definition: MucEntity.h:92
double m_W
Definition: MucEntity.h:102
MucEntity & operator=(const MucEntity &other)
Definition: MucEntity.cxx:92
double m_Thin
Definition: MucEntity.h:101
double m_Rin
Definition: MucEntity.h:98
double m_H
Definition: MucEntity.h:103
int m_Layer
Definition: MucEntity.h:90
double m_ObjOrgInLoc[3]
Definition: MucEntity.h:119
double m_Rout
Definition: MucEntity.h:99
double m_Wd
Definition: MucEntity.h:106
int m_Segment
Definition: MucEntity.h:89
double m_Theta
Definition: MucEntity.h:95
int m_Part
Definition: MucEntity.h:88
double m_LocOrgInBes[3]
Definition: MucEntity.h:109
double m_Rc
Definition: MucEntity.h:100
double m_ObjOrgInBes[3]
Definition: MucEntity.h:118
int m_UpDown
Definition: MucEntity.h:91
void TransLocToBes(double LocCoord[], double BesCoord[], double LocOrgInBes[], double Rot_z)
Definition: MucEntity.cxx:232
int m_ID
Definition: MucEntity.h:93
double m_Wu
Definition: MucEntity.h:105
double m_L
Definition: MucEntity.h:104
double y[1000]