BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
MucBox.cxx
Go to the documentation of this file.
1//------------------------------------------------------------------------------|
2// [File ]: MucBox.cxx |
3// [Brief ]: MUC geometry box creating class |
4// [Author]: Xie Yuguang, <[email protected]> |
5// [Date ]: May 22, 2005 |
6//------------------------------------------------------------------------------|
7
8#include <iostream>
9#include <cmath>
10
11#include "MucGeoCreateAlg/MucGeoConst.h"
12#include "MucGeoCreateAlg/MucBox.h"
13
14using namespace std;
15
16// Constructor
17MucBox::MucBox( int part, int segment, int layer, int id ) : MucEntity( part, segment, layer, id )
18{
20
21 m_MucStripPlane = NULL;
22 m_MucRpc = NULL;
23 m_MucBoxCover = NULL;
24}
25
26// Copy constructor
27MucBox::MucBox( const MucBox &other ) : MucEntity( other )
28{
29 m_MucStripPlane = other.m_MucStripPlane;
30 m_MucRpc = other.m_MucRpc;
31 m_MucBoxCover = other.m_MucBoxCover;
32}
33
34// Operator =
36{
37 if( this == &other)
38 return *this;
39
41
42 m_MucRpc = other.m_MucRpc;
43 m_MucBoxCover = other.m_MucBoxCover;
44 m_MucStripPlane = other.m_MucStripPlane;
45
46 return *this;
47}
48
49// Destructor
51{
52 delete m_MucStripPlane;
53 delete m_MucRpc;
54 delete m_MucBoxCover;
55}
56
57// Initialize
59{
60 SetTheta();
61 SetRin();
62 SetRout();
63 SetRc();
64
65 SetThin();
66 SetW();
67 SetWu();
68 SetWd();
69 SetH();
70 SetL();
71 SetArea();
72
77}
78
79//----------------------------- Get methods --------------------------
80
82{
83 if( m_MucStripPlane != NULL )
84 return m_MucStripPlane;
85 else
86 return ( m_MucStripPlane = new MucStripPlane( m_Part, m_Segment, m_Layer, ((m_Part==BRID)?0:-1) ) );
87}
88
89MucRpc* MucBox::GetRpc( int upDown, int id )
90{
91 if( m_MucRpc != NULL )
92 delete m_MucRpc;
93
94 return ( m_MucRpc = new MucRpc( m_Part, m_Segment, m_Layer, upDown, id ) );
95}
96
97MucBoxCover* MucBox::GetBoxCover( int upDown, int id )
98{
99 if( m_MucBoxCover != NULL )
100 delete m_MucBoxCover;
101
102 return ( m_MucBoxCover = new MucBoxCover( m_Part, m_Segment, m_Layer, upDown, id ) );
103}
104
105
106//------------------------------- Set motheds -------------------------
108{
109 if( m_Part == BRID )
110 m_Theta = m_Segment * ( MUC_PI/4.0 );
111 else
112 {
113 if( m_ID == -1 )
114 m_Theta = ( 2*m_Segment + 1 ) * ( MUC_PI/4.0 );
115 else
116 m_Theta = ( MUC_PI/4.0 ) + ( m_ID - 1) * MUC_PI / 8.0 ;
117 }
118}
119
121{
122 if( m_Part == BRID )
123 m_Rin = B_AS_RMIN[m_Layer] - ( AS_GAP + BOX_TH ) / 2.0;
124 else
125 {
126 if( m_ID == -1 )
127 m_Rin = 0.;
128 else
129 m_Rin = E_GP_RMIN[m_Layer];
130 }
131}
132
134{
135 if( m_Part == BRID )
136 m_Rout = B_AS_RMIN[m_Layer] -( AS_GAP - BOX_TH ) / 2.0;
137 else
138 m_Rout = E_AS_RMAX - E_BOX_DR;
139}
140
142{
143 if( m_Part == BRID )
144 m_Rc = B_AS_RMIN[m_Layer] - AS_GAP/2.0;
145 else
146 {
147 if( m_ID == -1 )
148 m_Rc = sqrt(2.0) * ( E_AS_RMAX - E_BOX_DR ) / 2.0;
149 else
150 m_Rc = (m_Rin + m_Rout)/2.0;
151 }
152}
153
155{
156 m_Thin = BOX_TH;
157}
158
160{
161 if( m_Part == BRID)
162 {
163 if( m_Segment != B_TOP )
164 m_W = B_BOX_WT[m_Layer];
165 else // top segment
166 {
167 if( m_ID == -1 || m_ID == 2 )
168 m_W = B_BOX_WT[m_Layer];
169 else
170 m_W = ( B_BOX_WT[m_Layer] - B_BOX_SLOT_WT )/2.0;
171 }
172 }
173 else
174 {
175 if( m_ID == -1 ) // virtual encap gap
176 m_W = E_AS_RMAX - E_BOX_DR - E_GP_DX;
177 else
178 m_W = 0.;
179 }
180}
181
183{
184 if( m_Part == BRID )
185 m_H = BOX_TH;
186 else
187 {
188 if( m_ID == -1 ) // virtual encap gap
189 m_H = E_AS_RMAX - E_BOX_DR - E_GP_DY;
190 else if( m_ID == 1 )
191 { // for panel logical operation "AND" valid;
192 m_H = E_AS_RMAX - E_BOX_DR - E_GP_RMIN[m_Layer] + OVERLAP_WIDTH;
193 }
194 else
195 m_H = E_AS_RMAX - E_BOX_DR - E_GP_RMIN[m_Layer];
196 }
197}
198
200{
201 if( m_Part == BRID )
202 {
203 if( m_Segment != B_TOP || m_ID == -1 )
204 m_L = B_BOX_LT;
205 else // top segment
206 {
207 if( m_ID == 2 )
208 m_L = B_BOX_LT - B_TOPRPC_LTS[(m_Layer==0)?1:(m_Layer%2)];
209 else
210 m_L = B_TOPRPC_LTS[(m_Layer==0)?1:(m_Layer%2)];
211 }
212 }
213 else
214 m_L = BOX_TH;
215}
216
218{
219 if( m_Part == BRID )
220 m_Wu = m_W;
221 else
222 {
223 if( m_ID == -1 ) // virtual box
224 m_Wu = m_W;
225 else if( m_ID == 1 ) // center fraction
226 {
227 m_Wu = 2 * VALUE * m_Rin ;
228 m_Wu -= 2*VALUE*(2.0/2); // for panel operation "AND" valid
229 m_Wu += OVERLAP_WIDTH;
230 }
231 else if( m_ID == 0 )
232 m_Wu = VALUE * m_Rin - E_GP_DY;
233 else
234 m_Wu = VALUE * m_Rin - E_GP_DX;
235
236 if( m_ID != -1 ) m_Wu+=OVERLAP_WIDTH; // avoid panels overlap
237 }
238}
239
241{
242 if( m_Part == BRID )
243 m_Wd = m_W;
244 else
245 {
246 if( m_ID == -1 ) // virtual box
247 m_Wd = m_W;
248 else if( m_ID == 1 ) // center fraction
249 {
250 m_Wd = 2 * VALUE * m_Rout;
251 m_Wd += 2*VALUE*(2.0/2); // for panel operation "AND" valid
252 m_Wd += OVERLAP_WIDTH;
253 }
254 else if( m_ID == 0 )
255 m_Wd = VALUE * m_Rout - E_GP_DY;
256 else
257 m_Wd = VALUE * m_Rout - E_GP_DX;
258
259 if( m_ID != -1 ) m_Wd+=OVERLAP_WIDTH; // avoid panels overlap
260
261 }
262}
263
265{
266 if( m_Part == BRID )
267 m_Area = m_W * m_L;
268 else
269 m_Area = m_W * m_L;
270}
271
272
273// local is gap
275{
276 double x, y, z;
277 x = y = z = 0.;
278
279 if( m_Part == BRID )
280 {
281 x = m_Rc*cos( m_Theta );
282 y = m_Rc*sin( m_Theta );
283 z = 0.;
284
285 } // barrel
286 else
287 {
288 //------------ set x and y ---------------
289 // segment 0 as reference
290 if( m_ID == -1 ) // for box, local is gap
291 {
292 x = (E_AS_RMAX + E_GP_DX) / 2.0;
293 y = (E_AS_RMAX + E_GP_DY) / 2.0;
294 }
295 else // for box panel, local is box
296 {
297 x = (E_AS_RMAX - E_BOX_DR + E_GP_DX) / 2.0;
298 y = (E_AS_RMAX - E_BOX_DR + E_GP_DY) / 2.0;
299 }
300
301 // x, y signs of coordinate different by segment
302 if ( m_Segment == 0 ) { ; }
303 else if ( m_Segment == 1 ) { x = -x; }
304 else if ( m_Segment == 2 ) { x = -x; y = -y; }
305 else { y = -y; }
306
307 //------------- set z --------------------
308 for( int i=0; i<m_Layer+1; i++ ) z += E_AS_TH[i];
309
310 z += m_Layer * AS_GAP;
311 z += (E_AS_ZMAX - E_AS_TOTAL_TH) + AS_GAP/2.0;
312 z *= cos( m_Part*MUC_PI/2.0 );
313
314 }// endcap
315
316 m_LocOrgInBes[0] = x;
317 m_LocOrgInBes[1] = y;
318 m_LocOrgInBes[2] = z;
319
320 // limit cut
321 for(int i=0;i<3;i++) {
322 if( fabs(m_LocOrgInBes[i]) < ERR_LIMIT ) m_LocOrgInBes[i] = 0;
323 }
324}
325
327{
328 m_ObjRotToMot[0] = 0.;
329 m_ObjRotToMot[1] = 0.;
330
331 if( m_Part == BRID )
332 {
333 // for barrel segment 5, 6 and 7, the box is uppended in the gap
334 if( m_Segment == 5 || m_Segment == 6 || m_Segment == 7 )
335 m_ObjRotToMot[2] = MUC_PI;
336 else
337 m_ObjRotToMot[2] = 0.;
338 }
339 else
340 {
341 m_ObjRotToMot[2] = 0.;
342 }
343}
344
346{
347 double x, y, z;
348 x = y = z = 0.;
349
350 if( m_Part == BRID )
351 {
352 if( m_Segment != B_TOP || m_ID == -1 )
353 for( int i=0; i<3; i++ ) m_ObjOrgInBes[i] = m_LocOrgInBes[i];
354 else // top segment
355 {
356 // set x
357 if( m_ID == 2 ) x = 0.;
358 else x = (1-2*m_ID) * ( B_BOX_WT[m_Layer] + B_BOX_SLOT_WT )/4.0;
359
360
361 // set z
362 if( m_ID == 2 ) z = -B_TOPRPC_LTS[(m_Layer==0)?1:(m_Layer%2)] / 2.0;
363 else z = ( B_BOX_LT - B_TOPRPC_LTS[(m_Layer==0)?1:(m_Layer%2)] )/2.0;
364
365 m_ObjOrgInBes[0] = x;
366 m_ObjOrgInBes[2] = z;
367
368 // set y
370
371 // limit cut
372 for( int i=0; i<3; i++ ) {
373 if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0;
374
375 }
376 }
377 }
378 else // endcap
379 {
380 //------------- set x, y --------------------------
381 // segment 0 as reference
382 if( m_ID == -1 )
383 {
384 x = (E_AS_RMAX - E_BOX_DR + E_GP_DX) / 2.0;
385 y = (E_AS_RMAX - E_BOX_DR + E_GP_DY) / 2.0;
386 }
387 else if( m_ID == 0 )
388 {
389 x = m_Rc;
390 y = ( m_Rc * tan( m_Theta ) + E_GP_DY ) / 2.0;
391 }
392 else if ( m_ID ==1 )
393 {
394 x = m_Rc * cos( m_Theta );
395 y = m_Rc * sin( m_Theta );
396 }
397 else // m_ID == 2
398 {
399 x = ( m_Rc / tan( m_Theta ) + E_GP_DX ) / 2.0;
400 y = m_Rc;
401 }
402
403 // x, y signs of coordinate different by segment
404 if ( m_Segment == 0 ) { ; }
405 else if ( m_Segment == 1 ) { x = -x; }
406 else if ( m_Segment == 2 ) { x = -x; y = -y; }
407 else { y = -y; }
408
409 m_ObjOrgInBes[0] = x;
410 m_ObjOrgInBes[1] = y;
411
412 // limit cut
413 for( int i=0; i<2; i++ ) {
414 if( fabs(m_ObjOrgInBes[i]) < ERR_LIMIT ) m_ObjOrgInBes[i] = 0;
415 }
416
417 //---------- set z ---------------------
419
420 } // else, panels
421}
422
424{
425 if( m_Part == BRID )
426 {
427 if( m_Segment != B_TOP )
428 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = 0.;
429 else
430 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = m_ObjOrgInBes[i] - m_LocOrgInBes[i];
431 }
432 else
433 for(int i=0; i<3; i++) m_ObjOrgInLoc[i] = m_ObjOrgInBes[i] - m_LocOrgInBes[i];
434}
435
436void MucBox::SetAlignment( double dx, double dy, double dz )
437{
438
439 if( m_Part == BRID || m_ID == -1 )
440 {
441 m_ObjOrgInLoc[0] += dx;
442 m_ObjOrgInLoc[1] += dy;
443 m_ObjOrgInLoc[2] += dz;
444 }
445}
446
447// END
Double_t x[10]
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
~MucBox()
Definition: MucBox.cxx:50
virtual void SetAlignment(double dx, double dy, double dz)
Definition: MucBox.cxx:436
MucBox(int part, int segment, int layer, int id)
Definition: MucBox.cxx:17
virtual void SetObjOrgInLoc()
Definition: MucBox.cxx:423
virtual void SetRc()
Definition: MucBox.cxx:141
virtual void SetRout()
Definition: MucBox.cxx:133
virtual void SetObjOrgInBes()
Definition: MucBox.cxx:345
MucRpc * GetRpc(int upDown, int id)
Definition: MucBox.cxx:89
MucBoxCover * GetBoxCover(int upDown, int id)
Definition: MucBox.cxx:97
virtual void SetArea()
Definition: MucBox.cxx:264
virtual void SetRin()
Definition: MucBox.cxx:120
virtual void SetLocOrgInBes()
Definition: MucBox.cxx:274
virtual void SetH()
Definition: MucBox.cxx:182
virtual void SetTheta()
Definition: MucBox.cxx:107
virtual void SetL()
Definition: MucBox.cxx:199
virtual void SetObjRotToMot()
Definition: MucBox.cxx:326
MucStripPlane * GetStripPlane()
Definition: MucBox.cxx:81
virtual void SetThin()
Definition: MucBox.cxx:154
virtual void SetWu()
Definition: MucBox.cxx:217
MucBox & operator=(const MucBox &other)
Definition: MucBox.cxx:35
virtual void SetW()
Definition: MucBox.cxx:159
virtual void Init()
Definition: MucBox.cxx:58
virtual void SetWd()
Definition: MucBox.cxx:240
MucEntity & operator=(const MucEntity &other)
Definition: MucEntity.cxx:92