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