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