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