CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
MucStripCal.cxx
Go to the documentation of this file.
1//------------------------------------------------------------------------------|
2// [File ]: MucStripCal.cxx |
3// [Brief ]: Class MucStripCal for MUC calibration |
4// [Author]: Xie Yuguang, <[email protected]> |
5// [Date ]: Apil 6, 2005 |
6//------------------------------------------------------------------------------|
7
8#include<iostream>
9#include<fstream>
10#include<cmath>
11
12using namespace std;
13
16
17// Constructor
18MucStripCal::MucStripCal( int part, int segment, int layer, int id ) : MucEntityCal( part, segment, layer, id )
19{
21
22 // m_MucPadChain = NULL;
23}
24
25// Copy constructor
27{
28 m_Type = other.m_Type;
29 m_CenterLine = other.m_CenterLine;
30 m_Head = other.m_Head;
31 m_Tail = other.m_Tail;
32 m_Phi = other.m_Phi;
33
34// m_MucPadChain = other.m_MucPadChain;
35}
36
37// Operator =
39{
40 if( this == &other) return *this;
41
43
44 m_Type = other.m_Type;
45 m_CenterLine = other.m_CenterLine;
46 m_Head = other.m_Head;
47 m_Tail = other.m_Tail;
48 m_Phi = other.m_Phi;
49
50 // m_MucPadChain = other.m_MucPadChain;
51
52 return *this;
53}
54
55// Destructor
57{
58 // delete m_MucPadChain;
59 ;
60}
61
62// Initialize
64{
65 SetType();
66 SetW();
67 SetWu();
68 SetWd();
69 SetCenterLine(); // use strip width
70 SetHead();
71 SetTail();
72 SetPhi();
73
74 SetThin();
75 SetH();
76 SetL();
77 SetArea();
79}
80
81// ---------------------------------Get methods ------------------------
82
83int MucStripCal::GetType() { return m_Type; }
84double MucStripCal::GetCenterLine() { return m_CenterLine; }
85double MucStripCal::GetHead() { return m_Head; }
86double MucStripCal::GetTail() { return m_Tail; }
87double MucStripCal::GetPhi() { return m_Phi; }
88int MucStripCal::GetPadNumber() { return m_PadNumber; }
89
90/*
91MucPadChain* MucStripCal::GetPadChain( )
92{
93 if( m_MucPadChain != NULL )
94 return m_MucPadChain;
95 else
96 return ( m_MucPadChain = new MucPadChain( m_Part, m_Segment, m_Layer, m_PadNumber ) );
97}
98*/
99
100//-----------------------------------Set methods-------------------------
101// Set strip type(readout direction)
103{
104 if( m_Part == BRID ) {
105 if( (m_Layer+1)%2 == 1 ) m_Type = ZSTR;
106 else m_Type = PHISTR;
107 }
108 else {
109 if( (m_Layer+1)%2 == 1 ) m_Type = XSTR;
110 else m_Type = YSTR;
111 }
112}
113
114// Set x or y of endcap strip certerline in BES coordinate system
116{
117 // Base on strips width and structure correlations
118 // Endcap only
119
120 int segFlag = 0;
121
122 if( (m_Layer+1)%2 == 1 ) // 1,3,5,7
123 {
124 if( m_Segment < 2 ) segFlag = 1;
125 else segFlag = -1;
126
127 if( m_ID != E_STR_NUM-1 ) // NO.1~62
128 m_CenterLine = segFlag * ( E_XSTR_OFFSET + m_ID*E_STR_DST );
129 else // NO.63 end strip
130 m_CenterLine = segFlag * ( E_XSTR_OFFSET + (E_STR_NUM-2)*E_STR_DST + (E_STR_DST + m_W + STR_GAP)/2);
131 }
132 else // 2,4,6,8
133 {
134 if( m_Segment%3 == 0 ) segFlag = 1;
135 else segFlag = -1;
136
137 if(m_ID != E_STR_NUM-1) // NO.1~62
138 m_CenterLine = segFlag * ( E_YSTR_OFFSET + m_ID*E_STR_DST );
139 else // NO.63 end strip
140 m_CenterLine = segFlag * ( E_YSTR_OFFSET + (E_STR_NUM-2)*E_STR_DST + (E_STR_DST + m_W + STR_GAP)/2);
141 }
142}
143
144// Set x and y of the head of endcap strip in BES coordinate system
146{
147 int segFlag = 0;
148
149 // base on strips width and correlations
150 if( m_ID+1 < TURN_STR_ID[m_Layer][0] )
151 m_Head = FIRST_TURN_HEAD[m_Layer][0];
152
153 if( m_ID+1 == TURN_STR_ID[m_Layer][0] )
154 m_Head = FIRST_TURN_HEAD[m_Layer][1];
155
156 if( (m_ID+1 > TURN_STR_ID[m_Layer][0]) && (m_ID+1 <= TURN_STR_ID[m_Layer][1]) )
157 m_Head = FIRST_TURN_HEAD[m_Layer][1] - ( m_ID + 1 - TURN_STR_ID[m_Layer][0] )*E_STR_DST;
158
159 if( m_ID+1 > TURN_STR_ID[m_Layer][1] )
160 m_Head = SECOND_TURN_HEAD[m_Layer%2];
161
162 if( (m_Layer+1)%2 == 1 ) // 1,3,5,7
163 {
164 if( m_Segment%3 ==0 ) segFlag = 1;
165 else segFlag = -1;
166 }
167 else // 2,4,6,8
168 {
169 if( m_Segment < 2 ) segFlag = 1;
170 else segFlag = -1;
171 }
172
173 m_Head *= segFlag;
174}
175
176// Set x and y of the tail of endcap strip in BES coordinate system
178{
179 int segFlag = 0;
180
181 if( (m_Layer+1)%2 == 1 ) // 1,3,5,7
182 {
183 if( m_Segment%3 ==0 ) segFlag = 1;
184 else segFlag = -1;
185
186 if( m_ID+1 < TURN_POINT_NUM )
187 m_Tail = ODD_TURN_POINT_TAIL[(m_Layer==0)?0:1][0];
188 if( m_ID+1 == TURN_POINT_NUM )
189 m_Tail = ODD_TURN_POINT_TAIL[(m_Layer==0)?0:1][1];
190 if( m_ID+1 > TURN_POINT_NUM )
191 m_Tail = ODD_TURN_POINT_TAIL[(m_Layer==0)?0:1][1]-( m_ID + 1 - TURN_POINT_NUM )* E_STR_DST;
192 if( m_ID == E_STR_NUM - 1 )
193 m_Tail = ODD_TURN_POINT_TAIL[(m_Layer==0)?0:1][1]-( m_ID -TURN_POINT_NUM )*E_STR_DST - ( E_STR_DST + m_W + STR_GAP )/2;
194 }
195 else // 2,4,6,8
196 {
197 if( m_Segment < 2 ) segFlag = 1;
198 else segFlag = -1;
199
200 if( m_ID+1 < TURN_POINT_NUM )
201 m_Tail = EVEN_TURN_POINT_TAIL[0];
202 if( m_ID+1 == TURN_POINT_NUM )
203 m_Tail = EVEN_TURN_POINT_TAIL[1];
204 if( m_ID+1 > TURN_POINT_NUM )
205 m_Tail = EVEN_TURN_POINT_TAIL[1] - ( m_ID + 1 - TURN_POINT_NUM ) * E_STR_DST;
206 if( m_ID == E_STR_NUM - 1 )
207 m_Tail = EVEN_TURN_POINT_TAIL[1]-(m_ID - TURN_POINT_NUM)*E_STR_DST - ( E_STR_DST + m_W + STR_GAP )/2;
208 }
209
210 m_Tail *= segFlag;
211}
212
213// Set inclination angle of local coordinate x axis and global coordinate x axis
215{
216 if ( m_Part == BRID ) // barrel
217 m_Phi = B_PHI[m_Segment] * (PI/4.0);
218 else // endcap , all phi is zer
219 m_Phi = 0.;
220}
221
222// set strip thickness
224{
225 m_Thin = STR_TH;
226}
227
228// Set strip width
230{
231 if( m_Part == BRID )
232 {
233 // Set maximum strip
234 int maxStrip;
235 if( (m_Layer+1)%2 == 1 )
236 maxStrip = B_ZSTR_NUM; // odd layer
237 else if( m_Segment != B_TOP )
238 maxStrip = B_PHISTR_NUM; // even layer not top segment
239 else
240 maxStrip = B_TOPSTR_NUM; // even layer top segment
241
242
243 if( (m_Layer+1)%2 == 1 ) // odd layer, z
244 {
245 if( m_ID > 0 && m_ID < (maxStrip-1)) // not marginal strip
246 m_W = B_STR_DST[m_Layer] - STR_GAP;
247 else // marginal strip
248 m_W = (B_BOX_WT[m_Layer] - 2*B_BOX_DT[SL_DOWN] - (maxStrip-2)*B_STR_DST[m_Layer] - STR_GAP)/2;
249 }
250 else // even layer, phi
251 {
252 if( m_ID >0 && m_ID < (maxStrip-1) ) // not marginal strip
253 m_W = B_STR_DST[m_Layer] - STR_GAP;
254 else // marginal strip
255 m_W = B_BOX_LT/2 - B_BOX_DZ[SL_DOWN] - B_STR_DST[m_Layer]*(B_PHISTR_NUM-2)/2;
256
257 if( (maxStrip == B_TOPSTR_NUM) && (m_ID == (B_PHISTR_NUM - 1)) ) // special marginal strip
258 m_W = B_BOX_LT/2 - B_BOX_DZ[SL_DOWN] - B_STR_DST[m_Layer]*(B_PHISTR_NUM-2)/2;
259 }
260 }
261 else
262 {
263 // Strip0~62: 33;
264 // Strip63: L0: 34; L2/4/6: 43; L1/3/5/7: 53
265 if(m_ID != E_STR_NUM-1) m_W = E_STR_WT; // NO.1~62
266 else // NO.63, end strip
267 {
268 if((m_Layer+1)%2!=0) // 0,2,4,6
269 {
270 if(m_Layer==0) m_W = 34;
271 else m_W = 43;
272 }
273 else m_W = 53; // 1,3,5,7
274 }
275 }
276}
277
278// Set strip Wu, no use
280{
281 m_Wu = m_W;
282}
283
284// Set strip Wd, no use
286{
287 m_Wd = m_W;
288}
289
290// Set strip height
292{
293 m_H = STR_TH;
294}
295
296// Set strip length
298{
299 if( m_Part==BRID ) // barrel
300 {
301 int ZCUT_HEAD_NUM = B_ZSTR_NUM/2 - B_ZSTR_CUT_NUM[m_Layer] - 1;
302 int ZCUT_TAIL_NUM = B_ZSTR_NUM/2 + B_ZSTR_CUT_NUM[m_Layer];
303
304 if( m_Segment != B_TOP ) // not top segment
305 {
306 if( (m_Layer+1)%2 == 1) // odd layer, Z
307 m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN];
308 else // even layer, phi
309 m_L = B_BOX_WT[m_Layer] - 2*B_BOX_DZ[SL_DOWN];
310 }
311 else // top segment
312 {
313 if((m_Layer+1)%2 == 1) // odd layer, z
314 {
315 if( m_ID > ZCUT_HEAD_NUM && m_ID < ZCUT_TAIL_NUM ) // be cut
316 {
317 if( m_Layer == 0 )
318 m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN] - B_ZSTR_CUT[1];
319 else
320 m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN] - B_ZSTR_CUT[0];
321 }
322 else // no cut
323 m_L = B_BOX_LT - 2*B_BOX_DZ[SL_DOWN];
324 }
325 else // even layer, phi
326 {
327 if( m_ID < B_PHISTR_CUT_NUM ) // no cut
328 m_L = B_BOX_WT[m_Layer] - 2*B_BOX_DZ[SL_DOWN];
329 else // be cut
330 m_L = (B_BOX_WT[m_Layer] - 2*B_BOX_DZ[SL_DOWN] - B_PHISTR_CUT)/2;
331 }
332 }
333 }
334 else // endcap
335 {
336 m_L = fabs( m_Head - m_Tail );
337 }
338}
339
340// Set area(cm^2)
342{
343 m_Area = m_W*m_L/100;
344}
345
346// Set Pad number of strip
348{
349 int n = 0;
350 double fn = 0;
351
352 if(m_W == 0) {
353 cout<<"Error, strip width = 0!"<<endl;
354 m_PadNumber = 0;
355 }
356 else
357 {
358 fn = (m_L/m_W);
359 n = (int)fn;
360
361 if( (fn - n) > 0.3 )
362 m_PadNumber = n + 1;
363 else
364 m_PadNumber = n;
365 }
366}
367
368// END
369
const Int_t n
const double SECOND_TURN_HEAD[2]
Definition MucStripCal.h:21
const double EVEN_TURN_POINT_TAIL[2]
Definition MucStripCal.h:24
const double ODD_TURN_POINT_TAIL[2][2]
Definition MucStripCal.h:23
const int TURN_STR_ID[8][2]
Definition MucStripCal.h:18
const double FIRST_TURN_HEAD[8][2]
Definition MucStripCal.h:19
const int TURN_POINT_NUM
Definition MucStripCal.h:22
const double PI
Definition PipiJpsi.cxx:55
MucEntityCal & operator=(const MucEntityCal &other)
void SetPadNumber()
virtual void SetArea()
virtual void SetH()
double GetTail()
virtual void SetThin()
virtual void Init()
double GetPhi()
double GetCenterLine()
virtual void SetWu()
MucStripCal(int part, int segment, int layer, int id)
int GetPadNumber()
double GetHead()
virtual void SetW()
virtual void SetWd()
void SetCenterLine()
MucStripCal & operator=(const MucStripCal &other)
virtual ~MucStripCal()
virtual void SetL()