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