BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEmcGeometry.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BESIII Object_Oreiented Simulation and Reconstruction Tool //
3//---------------------------------------------------------------------------//
4//Descpirtion: Geometry of EMC detector
5//Author: Fu Chengdong
6//Created: Oct 23, 2003
7//Comment:
8//---------------------------------------------------------------------------//
9//
10#include "G4ThreeVector.hh"
11
12#include "BesEmcGeometry.hh"
13#include "BesEmcParameter.hh"
14#include "G4ios.hh"
15#include "G4SystemOfUnits.hh"
16
18{
19 verboseLevel = 0;
20}
21
24
26{
27 // Read EMC parameters from database
29
30 TaperRingDz = emcPara.GetTaperRingDz();
31 TaperRingThickness1 = emcPara.GetTaperRingThickness1();
32 TaperRingThickness2 = emcPara.GetTaperRingThickness2();
33 TaperRingThickness3 = emcPara.GetTaperRingThickness3();
34 TaperRingTheta = emcPara.GetTaperRingTheta()*deg;
35 TaperRingInnerLength = emcPara.GetTaperRingInnerLength();
36 TaperRingOuterLength = emcPara.GetTaperRingOuterLength();
37
38 BSCRmin = emcPara.GetBSCRmin();
39 BSCDz = emcPara.GetBSCDz()-TaperRingThickness3;
40
41 BSCRmin1 = emcPara.GetBSCRmin1();
42 BSCRmax1 = emcPara.GetBSCRmax1();
43 BSCRmin2 = emcPara.GetBSCRmin2();
44 //BSCRmax2 = emcPara.GetBSCRmax2();
45 BSCDz1 = emcPara.GetBSCDz1()-TaperRingThickness3;
46
47 BSCAngleRotat = emcPara.GetBSCAngleRotat()*deg;
48 BSCNbPhi = emcPara.GetBSCNbPhi();
49 BSCNbTheta = emcPara.GetBSCNbTheta();
50
51 BSCCryLength = emcPara.GetCrystalLength();
52 BSCCryLength1 = emcPara.GetCrystalLength1();
53 BSCYFront0 = emcPara.GetBSCYFront0();
54 BSCYFront = emcPara.GetBSCYFront();
55 BSCYFront1 = emcPara.GetBSCYFront1();
56 BSCPosition0 = emcPara.GetBSCPosition0();
57 BSCPosition1 = emcPara.GetBSCPosition1();
58
59 fTyvekThickness = emcPara.GetTyvekThickness();
60 fAlThickness = emcPara.GetAlThickness();
61 fMylarThickness = emcPara.GetMylarThickness();
62
63 rearBoxLength = emcPara.GetRearBoxLength();
64 rearBoxDz = emcPara.GetRearBoxDz();
65
66 HangingPlateDz = emcPara.GetHangingPlateDz();
67 OCGirderAngle = emcPara.GetOCGirderAngle()*deg;
68
69 rearCasingThickness = emcPara.GetRearCasingThickness();
70
71 orgGlassLengthX = emcPara.GetOrgGlassLengthX();
72 orgGlassLengthY = emcPara.GetOrgGlassLengthY();
73 orgGlassLengthZ = emcPara.GetOrgGlassLengthZ();
74
75 PDLengthX = emcPara.GetPDLengthX();
76 PDLengthY = emcPara.GetPDLengthY();
77 PDLengthZ = emcPara.GetPDLengthZ();
78
79 AlPlateDz = emcPara.GetAlPlateDz();
80 PABoxDz = emcPara.GetPABoxDz();
81 PABoxThickness = emcPara.GetPABoxThickness();
82
83 cableDr = emcPara.GetCableDr();
84 waterPipeDr = emcPara.GetWaterPipeDr();
85 waterPipeThickness= emcPara.GetWaterPipeThickness();
86
87 SPBarThickness = emcPara.GetSPBarThickness();
88 SPBarThickness1 = emcPara.GetSPBarThickness1();
89 SPBarwidth = emcPara.GetSPBarwidth();
90
91 EndRingDz = emcPara.GetEndRingDz();
92 EndRingDr = emcPara.GetEndRingDr();
93 EndRingRmin = emcPara.GetEndRingRmin();
94
95 for(G4int i=0;i<BSCNbTheta*6;i++)
96 {
97 zHalfLength[i] =0;
98 thetaAxis[i] =0;
99 phiAxis [i] =0;
100 yHalfLength1[i] =0;
101 xHalfLength1[i] =0;
102 xHalfLength2[i] =0;
103 tanAlpha1[i] =0;
104 yHalfLength2[i] =0;
105 xHalfLength3[i] =0;
106 xHalfLength4[i] =0;
107 tanAlpha2[i] =0;
108 thetaPosition[i]=0;
109 xPosition[i] =0;
110 yPosition[i] =0;
111 zPosition[i] =0;
112 }
113}
114
116{
117 // Print EMC parameters
118 ;
119}
120
122{
124
125 // Compute derived parameters of the calorimeter
126 G4double theta0;
127 G4int i;
128 //for debug
129 //G4Exception("BesEmcGeometry::ComputeEMCParameters() starting.......");
130 //
131 //support frame
132 //
133 const G4double delta=1.*mm; //for opening-cut girder
134 TaperRingRmin1 = BSCRmax1-TaperRingThickness1;
135 TaperRingDr = TaperRingThickness2/cos(TaperRingTheta);
136 TaperRingRmin2 = BSCRmax1-TaperRingDr+TaperRingDz*tan(TaperRingTheta);
137 TaperRingOuterLength1 = TaperRingOuterLength+TaperRingThickness3*tan(TaperRingTheta);
138
139 BSCRmax2 = TaperRingRmin2+TaperRingDr-TaperRingThickness3*tan(TaperRingTheta);
140 BSCRmax = BSCRmin+33.8*cm;
141 BSCPhiDphi= 360.*deg/BSCNbPhi;
142 BSCPhiSphi= -BSCPhiDphi/2.;
143 BSCPhiDz = BSCDz;
144 BSCPhiRmax= BSCRmax-0.5*cm;
145 BSCPhiRmin= BSCRmin/sin(90.*deg+BSCPhiDphi/2.)
146 *sin(90.*deg+BSCPhiDphi/2.-BSCAngleRotat); //Rmin after rotate
147 SPBarDphi=2*atan(SPBarwidth/(2*BSCRmax));
148
149 //crystal No.1(from z=0 to big)
150 zHalfLength[0] = BSCCryLength/2.;
151 yHalfLength1[0]= BSCYFront0/2.;
152 xHalfLength1[0]= BSCPhiRmin*tan(BSCPhiDphi)/2.;
153 xHalfLength2[0]= xHalfLength1[0];
154
155 //there are 3 choices of rminprojected
156 G4double rminprojected=BSCRmin*cos(BSCAngleRotat);
157 rminprojected=BSCRmin;//according to hardware design
158 //rminprojected=BSCPhiRmin;
159 yHalfLength2[0]= yHalfLength1[0]
160 +(BSCYFront0-BSCPosition0)/rminprojected*BSCCryLength/2.;
161 xHalfLength3[0]= xHalfLength1[0]*(BSCPhiRmin+BSCCryLength)/BSCPhiRmin;
162 xHalfLength4[0]= xHalfLength2[0]*(BSCPhiRmin+BSCCryLength)/BSCPhiRmin;
163
164 thetaPosition[0]= 90.*deg;
165 xPosition[0] = BSCPhiRmin+BSCCryLength/2.;
166 yPosition[0] =
167 -(xHalfLength1[0]+xHalfLength3[0]+xHalfLength2[0]+xHalfLength4[0])/4.;
168 zPosition[0] = (yHalfLength1[0]+yHalfLength2[0])/2.;
169
170 theta0= 90.*deg-atan((BSCYFront0-BSCPosition0)/rminprojected);
171 if(verboseLevel>1)
172 {
173 G4cout << "------------------------------------>1"<< G4endl
174 << "The direction of crystal is:"
175 << theta0/deg <<"(deg)."<< G4endl;
176 }
177
178 rearBoxPosX[0] = xPosition[0]+BSCCryLength/2.+rearBoxDz/2.;
179 rearBoxPosY[0] = -std::min(xHalfLength3[0], xHalfLength4[0]);
180 rearBoxPosZ[0] = yHalfLength2[0];
181
182 OCGirderRmin1[0] = rearBoxPosX[0]+rearBoxDz/2.+delta;
183 OCGirderRmin2[0] = rearBoxPosX[0]+rearBoxDz/2.+delta;
184 OCGirderDz[0] = rearBoxLength;
185 OCGirderPosZ[0] = rearBoxLength/2;
186
187 cableLength[0] = BSCDz-rearBoxPosZ[0];
188 cablePosX[0] = BSCPhiRmax-cableDr-2.*mm;
189 cablePosY[0] = rearBoxPosY[0]-3*cableDr;
190 cablePosZ[0] = BSCDz-cableLength[0]/2;
191
192 //crystal No.2
193 zHalfLength[1]= BSCCryLength/2.;
194 yHalfLength1[1]= BSCYFront0/2.;
195 G4double deltaR= BSCYFront0*cos(theta0);
196 xHalfLength1[1]= xHalfLength1[0];
197 xHalfLength2[1]= xHalfLength1[1]*(BSCPhiRmin+deltaR)/BSCPhiRmin;
198 yHalfLength2[1]= yHalfLength1[1]
199 +tan(theta0-atan(rminprojected/(BSCYFront0*(1.+1./sin(theta0))-
200 BSCPosition1)))*BSCCryLength/2.;
201 deltaR=deltaR+BSCCryLength*sin(theta0);
202 xHalfLength4[1]= xHalfLength1[1]*(BSCPhiRmin+deltaR)/BSCPhiRmin;
203 deltaR=deltaR-yHalfLength2[1]*2.*cos(theta0);
204 xHalfLength3[1]= xHalfLength1[1]*(BSCPhiRmin+deltaR)/BSCPhiRmin;
205
206 thetaPosition[1]= theta0;
207 xPosition[1] = BSCPhiRmin+BSCCryLength/2.*sin(theta0)
208 + (3.*yHalfLength1[1]-yHalfLength2[1])/2.*cos(theta0);
209 yPosition[1] =
210 -(xHalfLength1[1]+xHalfLength3[1]+xHalfLength2[1]+xHalfLength4[1])/4.;
211 zPosition[1] = yHalfLength1[0]*2.
212 + (yHalfLength1[1]*2./tan(theta0)+BSCCryLength/2.)*cos(theta0)
213 + (yHalfLength1[1]+yHalfLength2[1])/2.*sin(theta0);
214
215 rearBoxPosX[1] = xPosition[1]+(BSCCryLength/2.+rearBoxDz/2.)*sin(theta0);
216 rearBoxPosY[1] = -std::min(xHalfLength3[1], xHalfLength4[1]);
217 rearBoxPosZ[1] = zPosition[1]+(BSCCryLength/2.+rearBoxDz/2.)*cos(theta0);
218
219 OCGirderRmin1[1] = rearBoxPosX[1]+rearBoxDz*sin(theta0)/2.+rearBoxLength*cos(theta0)/2+delta;
220 OCGirderRmin2[1] = rearBoxPosX[1]+rearBoxDz*sin(theta0)/2.-rearBoxLength*cos(theta0)/2+delta;
221 OCGirderDz[1] = rearBoxLength*sin(theta0);
222 OCGirderPosZ[1] = rearBoxPosZ[1]+rearBoxDz*cos(theta0)/2.;
223
224 cableLength[1] = BSCDz-rearBoxPosZ[1];
225 cablePosX[1] = cablePosX[0];
226 cablePosY[1] = cablePosY[0]+2*cableDr;
227 cablePosZ[1] = BSCDz-cableLength[1]/2;
228
229 theta0= theta0-atan((yHalfLength2[1]-yHalfLength1[1])*2./BSCCryLength);
230
231 for(i=2;i<BSCNbTheta;i++)
232 {
233 if(verboseLevel>1)
234 {
235 G4cout << "------------------------------------>"<<i<< G4endl
236 << "The direction of crystal is:"
237 << theta0/deg <<"(deg)." << G4endl;
238 }
239 G4double CryLength;
240 if(i==BSCNbTheta-1) //the rightest crystal
241 {
242 CryLength=BSCCryLength1; //24cm
243 yHalfLength1[i]=BSCYFront1/2.;
244 } else {
245 //crystal No.i+1
246 CryLength=BSCCryLength; //28cm
247 yHalfLength1[i]=BSCYFront/2.;
248 }
249 zHalfLength[i]=CryLength/2;
250
251 deltaR=yHalfLength1[i]*2.*cos(theta0);
252 xHalfLength1[i]=xHalfLength1[0];
253 xHalfLength2[i]=xHalfLength1[i]/BSCPhiRmin*(BSCPhiRmin+deltaR);
254 yHalfLength2[i]=yHalfLength1[i]
255 *(1.+CryLength/(rminprojected/sin(theta0)
256 +yHalfLength1[i]*2./tan(theta0)));
257 deltaR=deltaR+CryLength*sin(theta0);
258 xHalfLength4[i]=xHalfLength1[i]/BSCPhiRmin*(BSCPhiRmin+deltaR);
259 deltaR=deltaR-yHalfLength2[i]*2.*cos(theta0);
260 xHalfLength3[i]=xHalfLength1[i]/BSCPhiRmin*(BSCPhiRmin+deltaR);
261
262 thetaPosition[i]=theta0;
263 xPosition[i]=BSCPhiRmin+zHalfLength[i]*sin(theta0)
264 + (3.*yHalfLength1[i]-yHalfLength2[i])/2.*cos(theta0);
265 yPosition[i]=
266 -(xHalfLength1[i]+xHalfLength3[i]+xHalfLength2[i]+xHalfLength4[i])/4.;
267 zPosition[i]=BSCPosition1+rminprojected/tan(theta0)
268 +(2.*yHalfLength1[i]/tan(theta0)+zHalfLength[i])*cos(theta0)
269 +(yHalfLength1[i]+yHalfLength2[i])/2.*sin(theta0);
270
271 rearBoxPosX[i] = xPosition[i]+(CryLength/2.+rearBoxDz/2.)*sin(theta0);
272 rearBoxPosY[i] = -std::min(xHalfLength3[i], xHalfLength4[i]);
273 rearBoxPosZ[i] = zPosition[i]+(CryLength/2.+rearBoxDz/2.)*cos(theta0);
274
275 OCGirderRmin1[i] = rearBoxPosX[i]+rearBoxDz*sin(theta0)/2.+rearBoxLength*cos(theta0)/2+delta;
276 OCGirderRmin2[i] = rearBoxPosX[i]+rearBoxDz*sin(theta0)/2.-rearBoxLength*cos(theta0)/2+delta;
277 OCGirderDz[i] = rearBoxLength*sin(theta0);
278 OCGirderPosZ[i] = rearBoxPosZ[i]+rearBoxDz*cos(theta0)/2.;
279
280 G4int xCable,yCable;
281 xCable = i/4;
282 yCable = i-4*(G4int)(i/4);
283 cableLength[i] = BSCDz-(rearBoxPosZ[i]+rearBoxDz/2.*cos(theta0));
284 cablePosX[i] = cablePosX[0]-xCable*2*cableDr;
285 cablePosY[i] = cablePosY[0]+yCable*2*cableDr;
286 cablePosZ[i] = BSCDz-cableLength[i]/2;
287
288 theta0=theta0-atan(2.*yHalfLength1[i]/(rminprojected/sin(theta0)
289 +2.*yHalfLength1[i]/tan(theta0)));
290
291 }
292 thetaPosition[BSCNbTheta]=theta0;
293 if(verboseLevel>1)
294 {
295 G4cout << "------------------------------------>"<<i<< G4endl
296 << "The direction of crystal is:"
297 << theta0/deg <<"(deg)." << G4endl;
298 }
299
300 G4double oop;
301 G4double dx=0.001*mm; //zoom out of crystals to avoid overlap
302 for(i=0;i<BSCNbTheta;i++)
303 {
304 xHalfLength1[i]-=dx;
305 xHalfLength2[i]-=dx;
306 xHalfLength3[i]-=dx;
307 xHalfLength4[i]-=dx;
308 yHalfLength1[i]-=dx;
309 yHalfLength2[i]-=dx;
310
311 G4double CryLength;
312 if(i==BSCNbTheta-1) //the rightest crystal
313 {
314 CryLength=BSCCryLength1;
315 } else {
316 CryLength=BSCCryLength;
317 }
318 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
319 -yHalfLength1[i])
320 +(xHalfLength3[i]+xHalfLength4[i]-xHalfLength1[i]
321 -xHalfLength2[i])*(xHalfLength3[i]+xHalfLength4[i]
322 -xHalfLength1[i]-xHalfLength2[i])/4);
323 thetaAxis[i]=atan(oop/CryLength);
324 phiAxis[i] =180.*deg+atan((yHalfLength2[i]-yHalfLength1[i])
325 /(xHalfLength3[i]+xHalfLength4[i]
326 -xHalfLength1[i]-xHalfLength2[i])*2.);
327 tanAlpha2[i]=-(xHalfLength4[i]-xHalfLength3[i])/yHalfLength2[i]/2.;
328 tanAlpha1[i]=-(xHalfLength2[i]-xHalfLength1[i])/yHalfLength1[i]/2.;
329 //G4cout <<thetaAxis[i]<<", "
330 // <<phiAxis[i]<<", "
331 // <<tanAlpha1[i]<<", "
332 // <<tanAlpha2[i]<<G4endl;
333 }
334
335}
336
338{
339 // Compute the sizes of the naked crystals and the casing
340 // Casing size
341 // BSCNbTheta---->2*BSCNbTheta-1 : before crystal
342 // 2*BSCNbTheta-->3*BSCNbTheta-1 : a side of crystal
343 // 3*BSCNbTheta-->4*BSCNbTheta-1 : b side of crystal
344 // 4*BSCNbTheta-->5*BSCNbTheta-1 : c side of crystal
345 // 5*BSCNbTheta-->6*BSCNbTheta-1 : d side of crystal
346 // d
347 // ----------
348 // | |
349 // | |
350 // c | | a
351 // | |
352 // | |
353 // | /
354 // | /
355 // | /
356 // b
357 G4double totalThickness=fTyvekThickness+fAlThickness+fMylarThickness;//
358 G4double delta=0.,angle1=0.*deg,angle2=0.*deg;
359 G4double oop; //the distance of the centers of the two parallel plane
360
361 G4double rminprojected=BSCRmin*cos(BSCAngleRotat);
362 rminprojected=BSCRmin;//accord with hardware design
363 //rminprojected=BSCPhiRmin;
364
365 G4int i;
366 for(i=0;i<BSCNbTheta;i++)
367 {
368 G4double CryLength;
369 if(i==BSCNbTheta-1) //the rightest crystal
370 {
371 CryLength=BSCCryLength1;
372 } else {
373 CryLength=BSCCryLength;
374 }
375 zHalfLength[BSCNbTheta+i]=totalThickness/2.;
376 yHalfLength1[BSCNbTheta+i]=yHalfLength1[i];
377 yHalfLength2[BSCNbTheta+i]=yHalfLength1[i]
378 +(yHalfLength2[i]-yHalfLength1[i])*totalThickness/CryLength;
379 xHalfLength1[BSCNbTheta+i]=xHalfLength1[i];
380 xHalfLength2[BSCNbTheta+i]=xHalfLength2[i];
381 xHalfLength1[BSCNbTheta*2+i]=xHalfLength3[BSCNbTheta+i]=
382 xHalfLength1[i]*(CryLength-totalThickness)/CryLength
383 +xHalfLength3[i]*totalThickness/CryLength;
384 xHalfLength2[BSCNbTheta*4+i]=xHalfLength4[BSCNbTheta+i]=
385 xHalfLength2[i]*(CryLength-totalThickness)/CryLength
386 +xHalfLength4[i]*totalThickness/CryLength;
387
388 zHalfLength[BSCNbTheta*5+i]=zHalfLength[BSCNbTheta*4+i]=
389 zHalfLength[BSCNbTheta*3+i]=zHalfLength[BSCNbTheta*2+i]=
390 zHalfLength[i]-totalThickness/2.;
391
392 yHalfLength2[BSCNbTheta*2+i]=yHalfLength1[BSCNbTheta*2+i]=
393 totalThickness/cos(thetaPosition[i+1]-thetaPosition[i])/2.;
394 xHalfLength3[BSCNbTheta*2+i]=xHalfLength3[i];
395 xHalfLength4[BSCNbTheta*2+i]=xHalfLength3[i]
396 +(xHalfLength4[i]-xHalfLength3[i])*yHalfLength2[BSCNbTheta*2+i]
397 /yHalfLength2[i];
398 xHalfLength2[BSCNbTheta*2+i]=xHalfLength3[BSCNbTheta+i]
399 +(xHalfLength4[BSCNbTheta+i]-xHalfLength3[BSCNbTheta+i])
400 *yHalfLength1[BSCNbTheta*2+i]/yHalfLength2[BSCNbTheta*1+i];
401
402 yHalfLength2[BSCNbTheta*4+i]=yHalfLength1[BSCNbTheta*4+i]=
403 totalThickness/2.;
404 xHalfLength4[BSCNbTheta*4+i]=xHalfLength4[i];
405 xHalfLength3[BSCNbTheta*4+i]=xHalfLength4[i]
406 -(xHalfLength4[i]-xHalfLength3[i])*yHalfLength2[BSCNbTheta*4+i]
407 /yHalfLength2[i];
408 xHalfLength1[BSCNbTheta*4+i]=xHalfLength4[BSCNbTheta+i]
409 -(xHalfLength4[BSCNbTheta+i]-xHalfLength3[BSCNbTheta+i])
410 *yHalfLength1[BSCNbTheta*4+i]/yHalfLength2[BSCNbTheta*1+i];
411
412 delta=totalThickness/2.+yHalfLength1[BSCNbTheta*2+i];
413 angle1=atan(yHalfLength2[i]/(xHalfLength4[i]-xHalfLength3[i]));
414 angle2=atan(2.*(xHalfLength4[i]-xHalfLength2[i])*sin(angle1)
415 /CryLength);
416
417 yHalfLength1[BSCNbTheta*5+i]=yHalfLength1[BSCNbTheta*3+i]=
418 yHalfLength1[i]-delta;
419 yHalfLength2[BSCNbTheta*5+i]=yHalfLength2[BSCNbTheta*3+i]=
420 yHalfLength2[i]-delta;
421 xHalfLength4[BSCNbTheta*3+i]=xHalfLength3[BSCNbTheta*3+i]=
422 xHalfLength2[BSCNbTheta*3+i]=xHalfLength1[BSCNbTheta*3+i]=
423 totalThickness/cos(angle2)/sin(angle1)/2.;
424 xHalfLength4[BSCNbTheta*5+i]=xHalfLength3[BSCNbTheta*5+i]=
425 xHalfLength2[BSCNbTheta*5+i]=xHalfLength1[BSCNbTheta*5+i]=
426 totalThickness/2.;
427
428 zHalfLength[i]=zHalfLength[i]-totalThickness/2.;
429 yHalfLength1[i]=yHalfLength1[i]-delta;
430 yHalfLength2[i]=yHalfLength2[i]-delta;
431 delta=totalThickness*(1.+1./cos(angle2)/sin(angle1))/2.;
432 xHalfLength1[i]=xHalfLength1[i]-delta;
433 xHalfLength2[i]=xHalfLength2[i]-delta;
434 xHalfLength3[i]=xHalfLength3[i]-delta;
435 xHalfLength4[i]=xHalfLength4[i]-delta;
436
437 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
438 -yHalfLength1[i])
439 +(xHalfLength3[i]+xHalfLength4[i]-xHalfLength1[i]
440 -xHalfLength2[i])*(xHalfLength3[i]+xHalfLength4[i]
441 -xHalfLength1[i]-xHalfLength2[i])/4);
442 thetaAxis[i]=atan(oop/CryLength);
443 // -phi --->180+phi
444 phiAxis[i] =180.*deg+atan((yHalfLength2[i]-yHalfLength1[i])
445 /(xHalfLength3[i]+xHalfLength4[i]
446 -xHalfLength1[i]-xHalfLength2[i])*2.);
447
448 oop=sqrt((yHalfLength2[BSCNbTheta+i]-yHalfLength1[BSCNbTheta+i])
449 *(yHalfLength2[BSCNbTheta+i]-yHalfLength1[BSCNbTheta+i])
450 +(xHalfLength3[BSCNbTheta+i]+xHalfLength4[BSCNbTheta+i]
451 -xHalfLength1[BSCNbTheta+i]-xHalfLength2[BSCNbTheta+i])
452 *(xHalfLength3[BSCNbTheta+i]+xHalfLength4[BSCNbTheta+i]
453 -xHalfLength1[BSCNbTheta+i]-xHalfLength2[BSCNbTheta+i])/4);
454 thetaAxis[BSCNbTheta+i]=atan(oop/totalThickness);
455 phiAxis [BSCNbTheta+i]=
456 -atan((yHalfLength2[BSCNbTheta+i]-yHalfLength1[BSCNbTheta+i])
457 /(xHalfLength3[BSCNbTheta+i]+xHalfLength4[BSCNbTheta+i]
458 -xHalfLength1[BSCNbTheta+i]-xHalfLength2[BSCNbTheta+i])*2.);
459
460 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
461 -yHalfLength1[i])*4
462 +(xHalfLength3[BSCNbTheta*2+i]+xHalfLength4[BSCNbTheta*2+i]
463 -xHalfLength1[BSCNbTheta*2+i]-xHalfLength2[BSCNbTheta*2+i])
464 *(xHalfLength3[BSCNbTheta*2+i]+xHalfLength4[BSCNbTheta*2+i]
465 -xHalfLength1[BSCNbTheta*2+i]-xHalfLength2[BSCNbTheta*2+i])
466 /4);
467 thetaAxis[BSCNbTheta*2+i]=atan(oop/(zHalfLength[BSCNbTheta*2+i]*2));
468 phiAxis [BSCNbTheta*2+i]=
469 -atan((yHalfLength2[i]-yHalfLength1[i])
470 /(xHalfLength3[BSCNbTheta*2+i]+xHalfLength4[BSCNbTheta*2+i]
471 -xHalfLength1[BSCNbTheta*2+i]-xHalfLength2[BSCNbTheta*2+i])*4);
472
473 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
474 -yHalfLength1[i])*4
475 +(xHalfLength4[i]-xHalfLength2[i])
476 *(xHalfLength4[i]-xHalfLength2[i])*4);
477 thetaAxis[BSCNbTheta*3+i]=atan(oop/(zHalfLength[BSCNbTheta*3+i]*2));
478 phiAxis [BSCNbTheta*3+i]=-atan((yHalfLength2[i]-yHalfLength1[i])
479 /(xHalfLength4[i]-xHalfLength2[i]));
480
481 thetaAxis[BSCNbTheta*4+i]=
482 atan((xHalfLength4[BSCNbTheta*4+i]+xHalfLength3[BSCNbTheta*4+i]
483 -xHalfLength2[BSCNbTheta*4+i]-xHalfLength1[BSCNbTheta*4+i])/2.
484 /(zHalfLength[BSCNbTheta*4+i]*2));
485 phiAxis [BSCNbTheta*4+i]=0;
486
487 thetaAxis[BSCNbTheta*5+i]=atan((xHalfLength3[BSCNbTheta*5+i]
488 -xHalfLength1[BSCNbTheta*5+i])
489 /(zHalfLength[BSCNbTheta*5+i]*2));
490 phiAxis [BSCNbTheta*5+i]=-90.*deg;
491
492 tanAlpha2[BSCNbTheta+i]=tanAlpha1[BSCNbTheta+i]=tanAlpha1[i]=
493 -(xHalfLength2[i]-xHalfLength1[i])/yHalfLength1[i]/2.;
494 tanAlpha1[BSCNbTheta*2+i]=(xHalfLength2[BSCNbTheta*2+i]
495 -xHalfLength1[BSCNbTheta*2+i])
496 /yHalfLength1[BSCNbTheta*2+i]/2.;
497 tanAlpha1[BSCNbTheta*3+i]=tanAlpha1[i]*2.;
498 tanAlpha1[BSCNbTheta*4+i]=(xHalfLength2[BSCNbTheta*4+i]
499 -xHalfLength1[BSCNbTheta*4+i])
500 /yHalfLength1[BSCNbTheta*4+i]/2.;
501 tanAlpha1[BSCNbTheta*5+i]=(xHalfLength2[BSCNbTheta*5+i]
502 -xHalfLength1[BSCNbTheta*5+i])
503 /yHalfLength1[BSCNbTheta*5+i]/2.;
504
505 tanAlpha2[i]=-(xHalfLength4[i]-xHalfLength3[i])/yHalfLength2[i]/2.;
506 //tanAlpha2[BSCNbTheta+i]=(xHalfLength4[BSCNbTheta+i]-xHalfLength3[BSCNbTheta+i])/yHalfLength2[BSCNbTheta+i]/2.;
507 tanAlpha2[BSCNbTheta*2+i]=(xHalfLength4[BSCNbTheta*2+i]
508 -xHalfLength3[BSCNbTheta*2+i])
509 /yHalfLength2[BSCNbTheta*2+i]/2.;
510 tanAlpha2[BSCNbTheta*3+i]=tanAlpha2[i]*2.;
511 tanAlpha2[BSCNbTheta*4+i]=(xHalfLength4[BSCNbTheta*4+i]
512 -xHalfLength3[BSCNbTheta*4+i])
513 /yHalfLength2[BSCNbTheta*4+i]/2.;
514 tanAlpha2[BSCNbTheta*5+i]=(xHalfLength4[BSCNbTheta*5+i]
515 -xHalfLength3[BSCNbTheta*5+i])
516 /yHalfLength2[BSCNbTheta*5+i]/2.;
517
518 zPosition[BSCNbTheta*5+i]=zPosition[BSCNbTheta*3+i]=zPosition[i]=
519 zPosition[i]+totalThickness/2.*cos(thetaPosition[i])
520 -yHalfLength1[BSCNbTheta*2+i]*sin(thetaPosition[i]);
521 zPosition[i]=totalThickness/2.;//for the newest method
522 xPosition[BSCNbTheta*5+i]=xPosition[BSCNbTheta*3+i]=xPosition[i]=
523 xPosition[i]+totalThickness/2.*sin(thetaPosition[i])
524 +totalThickness*(1./cos(thetaPosition[i+1]-thetaPosition[i])-1)/2.
525 *cos(thetaPosition[i]);
526 xPosition[i]=totalThickness*(1.-1./cos(angle2)/sin(angle1))/2.;
527 //for the newest method
528 yPosition[i]=yPosition[i]
529 +totalThickness*(1.-1./cos(angle2)/sin(angle1))/2.;
530 yPosition[i]=yHalfLength1[BSCNbTheta*2+i]-totalThickness/2.;//for the newest method
531 yPosition[BSCNbTheta*3+i]=yPosition[i]*2.+xHalfLength1[BSCNbTheta*3+i];
532 yPosition[BSCNbTheta*5+i]=xHalfLength1[BSCNbTheta*5+i];
533
534 xPosition[BSCNbTheta+i]=BSCPhiRmin
535 +zHalfLength[BSCNbTheta+i]*sin(thetaPosition[i])
536 +(3.*yHalfLength1[BSCNbTheta+i]-yHalfLength2[BSCNbTheta+i])/2.
537 *cos(thetaPosition[i]);
538 yPosition[BSCNbTheta+i]=(xHalfLength1[BSCNbTheta+i]
539 +xHalfLength3[BSCNbTheta+i]
540 +xHalfLength2[BSCNbTheta+i]
541 +xHalfLength4[BSCNbTheta+i])/4.;
542 zPosition[BSCNbTheta+i]=BSCPosition1+rminprojected/tan(thetaPosition[i])
543 +(2.*yHalfLength1[BSCNbTheta+i]/tan(thetaPosition[i])
544 +zHalfLength[BSCNbTheta+i])*cos(thetaPosition[i])
545 +(yHalfLength1[BSCNbTheta+i]+yHalfLength2[BSCNbTheta+i])/2.
546 *sin(thetaPosition[i]);
547
548 xPosition[BSCNbTheta*2+i]=xPosition[i]
549 +((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*2+i])
550 *cos(thetaPosition[i]);
551 zPosition[BSCNbTheta*2+i]=zPosition[i]
552 -((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*2+i])
553 *sin(thetaPosition[i]);
554 yPosition[BSCNbTheta*2+i]=(xHalfLength1[BSCNbTheta*2+i]
555 +xHalfLength3[BSCNbTheta*2+i]
556 +xHalfLength2[BSCNbTheta*2+i]
557 +xHalfLength4[BSCNbTheta*2+i])/4.;
558
559 xPosition[BSCNbTheta*4+i]=xPosition[i]
560 -((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*4+i])
561 *cos(thetaPosition[i]);
562 zPosition[BSCNbTheta*4+i]=zPosition[i]
563 -((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*4+i])
564 *sin(thetaPosition[i]);
565 yPosition[BSCNbTheta*4+i]=(xHalfLength1[BSCNbTheta*4+i]
566 +xHalfLength3[BSCNbTheta*4+i]
567 +xHalfLength2[BSCNbTheta*4+i]
568 +xHalfLength4[BSCNbTheta*4+i])/4.;
569
570 }
571
572 if(verboseLevel>1)
573 for(i=0;i<BSCNbTheta*6;i++)
574 {
575 G4cout << "The sizes of the " << i+1 << " crystal are:" << G4endl
576 << "zHalfLength =" << zHalfLength[i]/cm << "(cm)," << G4endl
577 << "thetaAxis =" << thetaAxis[i]/deg << "(deg),"<< G4endl
578 << "phiAxis =" << phiAxis[i]/deg << "(deg),"<< G4endl
579 << "yHalfLength1=" << yHalfLength1[i]/cm << "(cm)," << G4endl
580 << "xHalfLength1=" << xHalfLength1[i]/cm << "(cm)," << G4endl
581 << "xHalfLength2=" << xHalfLength2[i]/cm << "(cm)," << G4endl
582 << "tanAlpha1 =" << tanAlpha1[i] << G4endl
583 << "yHalfLength2=" << yHalfLength2[i]/cm << "(cm)," << G4endl
584 << "xHalfLength3=" << xHalfLength3[i]/cm << "(cm)," << G4endl
585 << "xHalfLength4=" << xHalfLength4[i]/cm << "(cm)," << G4endl
586 << "tanAlpha2 =" << tanAlpha2[i] << "." << G4endl
587 << "The position of the " << i+1 << " crystal is:" << G4endl
588 << "(" << xPosition[i]/cm << ","
589 << yPosition[i]/cm << ","
590 << zPosition[i]/cm << ")cm" << G4endl;
591 }
592
593}
594
596{
597 // change Gap thickness and recompute the calorimeter parameters
598 fTyvekThickness = val('X');
599 fAlThickness = val('Y');
600 fMylarThickness = val('Z');
601}
602
603G4double BesEmcGeometry::GetXPosition(G4int NbCrystal)
604{
605 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
606 {
607 return xPosition[NbCrystal];
608 }
609 else
610 {
611 return 0.;
612 }
613}
614
615G4double BesEmcGeometry::GetYPosition(G4int NbCrystal)
616{
617 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
618 {
619 return yPosition[NbCrystal];
620 }
621 else
622 {
623 return 0.;
624 }
625}
626
627G4double BesEmcGeometry::GetZPosition(G4int NbCrystal)
628{
629 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
630 {
631 return zPosition[NbCrystal];
632 }
633 else
634 {
635 return 0.;
636 }
637}
638
639G4double BesEmcGeometry::GetThetaPosition(G4int NbCrystal)
640{
641 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
642 {
643 return thetaPosition[NbCrystal];
644 }
645 else
646 {
647 return 0.;
648 }
649}
650
651G4double BesEmcGeometry::GetZHalfLength(G4int NbCrystal)
652{
653 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
654 {
655 return zHalfLength[NbCrystal];
656 }
657 else
658 {
659 return 0.;
660 }
661}
662
663G4double BesEmcGeometry::GetThetaAxis(G4int NbCrystal)
664{
665 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
666 {
667 return thetaAxis[NbCrystal];
668 }
669 else
670 {
671 return 0.;
672 }
673}
674
675G4double BesEmcGeometry::GetPhiAxis(G4int NbCrystal)
676{
677 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
678 {
679 return phiAxis[NbCrystal];
680 }
681 else
682 {
683 return 0.;
684 }
685}
686
687G4double BesEmcGeometry::GetYHalfLength1(G4int NbCrystal)
688{
689 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
690 {
691 return yHalfLength1[NbCrystal];
692 }
693 else
694 {
695 return 0.;
696 }
697}
698
699G4double BesEmcGeometry::GetXHalfLength1(G4int NbCrystal)
700{
701 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
702 {
703 return xHalfLength1[NbCrystal];
704 }
705 else
706 {
707 return 0.;
708 }
709}
710
711G4double BesEmcGeometry::GetXHalfLength2(G4int NbCrystal)
712{
713 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
714 {
715 return xHalfLength2[NbCrystal];
716 }
717 else
718 {
719 return 0.;
720 }
721}
722
723G4double BesEmcGeometry::GetTanAlpha1(G4int NbCrystal)
724{
725 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
726 {
727 return tanAlpha1[NbCrystal];
728 }
729 else
730 {
731 return 0.;
732 }
733}
734
735G4double BesEmcGeometry::GetYHalfLength2(G4int NbCrystal)
736{
737 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
738 {
739 return yHalfLength2[NbCrystal];
740 }
741 else
742 {
743 return 0.;
744 }
745}
746
747G4double BesEmcGeometry::GetXHalfLength3(G4int NbCrystal)
748{
749 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
750 {
751 return xHalfLength3[NbCrystal];
752 }
753 else
754 {
755 return 0.;
756 }
757}
758
759G4double BesEmcGeometry::GetXHalfLength4(G4int NbCrystal)
760{
761 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
762 {
763 return xHalfLength4[NbCrystal];
764 }
765 else
766 {
767 return 0.;
768 }
769}
770
771G4double BesEmcGeometry::GetTanAlpha2(G4int NbCrystal)
772{
773 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
774 {
775 return tanAlpha2[NbCrystal];
776 }
777 else
778 {
779 return 0.;
780 }
781}
782
783G4VPhysicalVolume* BesEmcGeometry::GetPhysiBSCCrystal(G4int NbCrystal)
784{
785 if(NbCrystal>=0&&NbCrystal<BSCNbTheta*6)
786 {
787 return physiBSCCrystal[NbCrystal];
788 }
789 else
790 {
791 return NULL;
792 }
793}
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
const double delta
#define NULL
void ComputeEMCParameters()
G4double GetThetaPosition(G4int NbCrystal)
G4double GetYPosition(G4int NbCrystal)
G4double GetZHalfLength(G4int NbCrystal)
G4double GetXHalfLength2(G4int NbCrystal)
G4double GetTanAlpha2(G4int NbCrystal)
G4double GetTanAlpha1(G4int NbCrystal)
G4double GetYHalfLength1(G4int NbCrystal)
G4double GetThetaAxis(G4int NbCrystal)
G4double GetXHalfLength4(G4int NbCrystal)
G4double GetYHalfLength2(G4int NbCrystal)
G4VPhysicalVolume * GetPhysiBSCCrystal(G4int NbCrystal)
G4double GetXPosition(G4int NbCrystal)
G4double GetZPosition(G4int NbCrystal)
void SetCasingThickness(G4ThreeVector)
G4double GetXHalfLength1(G4int NbCrystal)
G4double GetPhiAxis(G4int NbCrystal)
G4double GetXHalfLength3(G4int NbCrystal)
G4double GetOrgGlassLengthY()
G4double GetBSCYFront0()
G4double GetBSCPosition1()
G4double GetEndRingDr()
G4double GetCrystalLength()
G4double GetBSCRmax1()
G4double GetRearCasingThickness()
G4double GetOrgGlassLengthZ()
G4double GetOCGirderAngle()
G4double GetBSCRmin2()
G4double GetPDLengthX()
G4double GetSPBarThickness()
G4double GetBSCYFront1()
G4double GetBSCPosition0()
G4double GetTaperRingInnerLength()
G4double GetTaperRingThickness1()
static BesEmcParameter & GetInstance()
G4double GetBSCYFront()
G4double GetTyvekThickness()
G4double GetOrgGlassLengthX()
G4double GetTaperRingDz()
G4double GetRearBoxDz()
G4double GetSPBarwidth()
G4double GetTaperRingThickness3()
G4double GetBSCRmin1()
G4double GetMylarThickness()
G4double GetBSCRmin()
G4double GetWaterPipeThickness()
G4double GetPDLengthY()
G4double GetPDLengthZ()
G4double GetAlPlateDz()
G4double GetWaterPipeDr()
G4double GetTaperRingTheta()
G4double GetHangingPlateDz()
G4double GetRearBoxLength()
G4double GetEndRingRmin()
G4double GetCrystalLength1()
G4double GetEndRingDz()
G4double GetSPBarThickness1()
G4double GetTaperRingThickness2()
G4double GetTaperRingOuterLength()
G4double GetAlThickness()
G4double GetPABoxThickness()
G4double GetBSCAngleRotat()