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