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