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