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