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