#include <ExtBesEmcEndGeometry.h>
Public Member Functions | |
G4ThreeVector | ComputeDimAndPos (const G4int, const G4int, const G4int) |
G4ThreeVector | ComputeDimAndPos (const G4int, const G4int, const G4int) |
void | ComputeParameters () |
void | ComputeParameters () |
void | Exchange (G4int cry1, G4int cry2) |
void | Exchange (G4int cry1, G4int cry2) |
ExtBesEmcEndGeometry () | |
ExtBesEmcEndGeometry () | |
G4int | GetCryNumInOneLayer (G4int num) |
G4int | GetCryNumInOneLayer (G4int num) |
void | ModifyForCasing (G4ThreeVector pos[8], G4int CryNb) |
void | ModifyForCasing (G4ThreeVector pos[8], G4int CryNb) |
void | ReadParameters () |
void | ReadParameters () |
void | ReflectX () |
void | ReflectX () |
~ExtBesEmcEndGeometry () | |
~ExtBesEmcEndGeometry () | |
Private Attributes | |
G4int | cryNumInOneLayer [6] |
G4ThreeVector | cryPoint [8] |
G4double | CrystalLength |
G4double | fAlThickness |
G4double | fMylarThickness |
G4ThreeVector | fPnt [35][8] |
G4ThreeVector | fPnt1 [35][8] |
G4double | fTyvekThickness |
G4double | param [35][24] |
G4double | penta [5][6] |
G4int | pentaInOneSector [5] |
G4double | totalThickness |
G4double | WorldDz |
G4double | WorldRmax1 |
G4double | WorldRmax2 |
G4double | WorldRmin1 |
G4double | WorldRmin2 |
G4double | WorldZPosition |
Friends | |
class | ExtBesEmcConstruction |
|
00016 {;}
|
|
00019 {;}
|
|
|
|
|
|
|
|
00309 { 00310 //ComputeParameters(); 00311 G4int sector=-1, cryNb=-1; 00312 G4int leftFlag=0; 00313 G4int downFlag=0; 00314 G4int pentaFlag=0; 00315 G4int flag=0; 00316 G4double A1=0,a1=0,B1=0,b1=0,C1=0,c1=0,D1=0,d1=0,E1=0,e1=0; //dimension of pentagonal crystal 00317 G4int m_numPhi=0; 00318 G4ThreeVector position=0; 00319 G4int cryInOneSector = cryNumInOneLayer[numTheta]/16; //number of crystal in one layer in one sector 00320 G4ThreeVector pos[8]; 00321 00322 if(partId==2) //west end 00323 { 00324 if(numPhi>=0&&numPhi<8*cryInOneSector) 00325 m_numPhi=8*cryInOneSector-1-numPhi; 00326 else if(numPhi>=8*cryInOneSector&&numPhi<16*cryInOneSector) 00327 m_numPhi=16*cryInOneSector-1-numPhi; 00328 } 00329 else //east end 00330 m_numPhi=numPhi; 00331 00332 if(numPhi>=4*cryInOneSector&&numPhi<5*cryInOneSector) //crystal in 4th sector 00333 { 00334 leftFlag = 1; 00335 m_numPhi=8*cryInOneSector-1-numPhi; 00336 } 00337 else if(numPhi>=11*cryInOneSector&&numPhi<12*cryInOneSector) //crystal in 11th sector 00338 { 00339 leftFlag = 1; 00340 downFlag = 1; 00341 m_numPhi=numPhi-8*cryInOneSector; 00342 } 00343 if(numPhi>=12*cryInOneSector&&numPhi<13*cryInOneSector) //crystal in 12th sector 00344 { 00345 downFlag = 1; 00346 m_numPhi=16*cryInOneSector-1-numPhi; 00347 } 00348 00349 //translate numTheta and numPhi to sector and cryNb 00350 G4int cryNbOffset = 0; 00351 for(G4int i=0;i<numTheta;i++) 00352 cryNbOffset += cryNumInOneLayer[i]/16; 00353 if(cryInOneSector) 00354 sector = m_numPhi/cryInOneSector; 00355 cryNb = m_numPhi-cryInOneSector*sector+cryNbOffset; 00356 sector += 3; 00357 if(sector>15&§or<=18) 00358 sector -= 16; 00359 00360 //sector beside the gap 00361 if(sector==6) 00362 for(G4int i=0;i<8;i++) 00363 pos[i]=fPnt1[cryNb][i]; 00364 else 00365 for(G4int i=0;i<8;i++) 00366 { 00367 pos[i]=fPnt[cryNb][i]; 00368 pos[i].rotateZ(-67.5*deg+sector*22.5*deg); 00369 } 00370 00371 //crystal dimension 00372 ModifyForCasing(pos,cryNb); 00373 G4double A = (cryPoint[0]-cryPoint[3]).r(); 00374 G4double a = (cryPoint[4]-cryPoint[7]).r(); 00375 G4double B = (cryPoint[1]-cryPoint[2]).r(); 00376 G4double b = (cryPoint[5]-cryPoint[6]).r(); 00377 G4double C = (cryPoint[0]-cryPoint[1]).r(); 00378 G4double c = (cryPoint[4]-cryPoint[5]).r(); 00379 G4double D = (cryPoint[2]-cryPoint[3]).r(); 00380 G4double d = (cryPoint[6]-cryPoint[7]).r(); 00381 00382 //reflect the axis according to the flag 00383 for(G4int i=0;i<8;i++) 00384 { 00385 pos[i].setZ(pos[i].getZ()+WorldZPosition); //give the absolute z coordinate 00386 if(leftFlag==1) 00387 pos[i].setX(-pos[i].getX()); 00388 if(downFlag==1) 00389 pos[i].setY(-pos[i].getY()); 00390 if(partId==2) 00391 { 00392 pos[i].setX(-pos[i].getX()); 00393 pos[i].setZ(-pos[i].getZ()); 00394 } 00395 } 00396 00397 //compute the position 00398 for(G4int j=4;j<8;j++) 00399 position += pos[j]; 00400 position /= 4; 00401 00402 //compute pentagonal crystal 00403 for(G4int i=0;i<5;i++) 00404 { 00405 if(cryNb==pentaInOneSector[i]) 00406 { 00407 pentaFlag = 1; 00408 G4ThreeVector penta[8]; 00409 00410 //sector beside the gap 00411 if(sector==6) 00412 for(G4int j=0;j<8;j++) 00413 penta[j]=fPnt1[30+i][j]; 00414 else 00415 for(G4int j=0;j<8;j++) 00416 { 00417 penta[j]=fPnt[30+i][j]; 00418 penta[j].rotateZ(-67.5*deg+sector*22.5*deg); 00419 } 00420 00421 //crystal dimension 00422 ModifyForCasing(penta,30+i); 00423 A1 = (cryPoint[1]-cryPoint[2]).r(); 00424 a1 = (cryPoint[5]-cryPoint[6]).r(); 00425 B1 = (cryPoint[1]-cryPoint[0]).r(); 00426 b1 = (cryPoint[5]-cryPoint[4]).r(); 00427 C1 = (cryPoint[0]-cryPoint[3]).r()+A; 00428 c1 = (cryPoint[4]-cryPoint[7]).r()+a; 00429 D1 = D; 00430 d1 = d; 00431 E1 = B; 00432 e1 = b; 00433 00434 //reflect the axis according to the flag 00435 for(G4int j=0;j<8;j++) 00436 { 00437 penta[j].setZ(penta[j].getZ()+WorldZPosition); //give the absolute z coordinate 00438 if(leftFlag==1) 00439 penta[j].setX(-penta[j].getX()); 00440 if(downFlag==1) 00441 penta[j].setY(-penta[j].getY()); 00442 if(partId==2) 00443 { 00444 penta[j].setX(-penta[j].getX()); 00445 penta[j].setZ(-penta[j].getZ()); 00446 } 00447 } 00448 00449 //compute the position 00450 for(G4int j=4;j<8;j++) 00451 { 00452 if(j!=0&&j!=4) 00453 position += pos[j]; 00454 if(j==0||j==1||j==4||j==5) 00455 position += penta[j]; 00456 } 00457 position /= 10; 00458 00459 flag = leftFlag+downFlag; 00460 if(flag==1) 00461 { 00462 G4double temp1 = B1; B1 = D1; D1 = temp1; 00463 temp1 = A1; A1 = E1; E1 = temp1; 00464 temp1 = b1; b1 = d1; d1 = temp1; 00465 temp1 = a1; a1 = e1; e1 = temp1; 00466 } 00467 00468 break; 00469 } 00470 } 00471 00472 flag = leftFlag+downFlag+partId/2; 00473 if(flag==1||flag==3) 00474 { 00475 G4double temp = C; C = D; D = temp; 00476 temp = c; c = d; d = temp; 00477 } 00478 00479 /*G4cout<<"##########################################################################"<<G4endl; 00480 G4cout<<"###sector="<<sector<<",cryNb="<<cryNb<<",left flag="<<leftFlag<<",down flag="<<downFlag<<G4endl; 00481 G4cout<<"partId="<<partId<<"\t"<<"theta number="<<numTheta<<"\t"<<"phi number="<<numPhi<<G4endl; 00482 G4cout<<"crystal point:"<<G4endl; 00483 for(G4int i=0;i<8;i++) 00484 G4cout<<pos[i]<<G4endl; 00485 G4cout<<"crystal position:"<<"\t"<<position<<"\t"<<"phi="<<position.phi()/deg<<G4endl; 00486 G4cout<<"crystal dimension:"<<G4endl; 00487 if(pentaFlag==1) 00488 G4cout<<"A="<<A1<<",a="<<a1<<",B="<<B1<<",b="<<b1<<",C="<<C1<<",c="<<c1<<",D="<<D1<<",d="<<d1<<",E="<<E1<<",e="<<e1<<G4endl; 00489 else 00490 G4cout<<"A="<<A<<",a="<<a<<",B="<<B<<",b="<<b<<",C="<<C<<",c="<<c<<",D="<<D<<",d="<<d<<G4endl; 00491 G4cout<<"##########################################################################"<<G4endl; 00492 */ 00493 return position; 00494 }
|
|
|
|
00065 { 00066 00068 // emc endcap crystal // 00070 // 1 // 00071 // 0 __ -- // 00072 // -- \ // 00073 // | \ \ // 00074 // | \ __ - 2 // 00075 // | \ -- | // 00076 // | | 3 | // 00077 // | | | // 00078 // | | | // 00079 // | | | // 00080 // | | 5 | // 00081 // 4 \ | | // 00082 // \ | __ - 6 // 00083 // \| -- // 00084 // 7 // 00086 00087 ReadParameters(); 00088 00089 G4int pentaNb=0; 00090 for(G4int i=0;i<30;i++) 00091 { 00092 for (G4int j=0;j<8;j++) 00093 { 00094 //use 24 parameters to construct 8 point of one crystal 00095 G4ThreeVector* pPnt = new G4ThreeVector(param[i][j],param[i][j+8],param[i][j+16]-WorldZPosition); 00096 fPnt[i][j] = *pPnt; 00097 } 00098 00099 if(i==5||i==6||i==14||i==15||i==16) 00100 { 00101 for(G4int j=0;j<8;j++) 00102 fPnt[30+pentaNb][j] = fPnt[i][j]; 00103 00104 //compute the 5th point of the pentagonal crystal 00105 G4double y0,y1,y4,y5; 00106 G4ThreeVector v0,v1,v4,v5; 00107 y0 = penta[pentaNb][0]; 00108 y1 = penta[pentaNb][1]; 00109 y4 = penta[pentaNb][2]; 00110 y5 = penta[pentaNb][3]; 00111 v0 = (y0-fPnt[i][3].getY())*(fPnt[i][0]-fPnt[i][3])/(fPnt[i][0].getY()-fPnt[i][3].getY()) 00112 +fPnt[i][3]; 00113 v1 = (y1-fPnt[i][2].getY())*(fPnt[i][1]-fPnt[i][2])/(fPnt[i][1].getY()-fPnt[i][2].getY()) 00114 +fPnt[i][2]; 00115 v4 = (y4-fPnt[i][7].getY())*(fPnt[i][4]-fPnt[i][7])/(fPnt[i][4].getY()-fPnt[i][7].getY()) 00116 +fPnt[i][7]; 00117 v5 = (y5-fPnt[i][6].getY())*(fPnt[i][5]-fPnt[i][6])/(fPnt[i][5].getY()-fPnt[i][6].getY()) 00118 +fPnt[i][6]; 00119 00120 G4double x1,x5; 00121 x1 = penta[pentaNb][4]; 00122 x5 = penta[pentaNb][5]; 00123 v1 = (x1-v0.getX())*(v1-v0)/(v1.getX()-v0.getX())+v0; //v1', the fifth point 00124 v5 = (x5-v4.getX())*(v5-v4)/(v5.getX()-v4.getX())+v4; //v5' 00125 00126 fPnt[i][0] = v0; 00127 fPnt[i][1] = v1; 00128 fPnt[i][4] = v4; 00129 fPnt[i][5] = v5; 00130 00131 fPnt[30+pentaNb][2] = v1; 00132 fPnt[30+pentaNb][3] = v0; 00133 fPnt[30+pentaNb][6] = v5; 00134 fPnt[30+pentaNb][7] = v4; 00135 00136 pentaNb++; 00137 } 00138 } 00139 00140 //reflect point in one sector according to new design 00141 G4ThreeVector temp[35][8]; 00142 for(G4int i=0;i<35;i++) 00143 { 00144 for (G4int j=0;j<8;j++) 00145 { 00146 temp[i][j]=fPnt[i][j]; 00147 fPnt[i][j].rotateZ(157.5*deg); 00148 fPnt[i][j].setX(-fPnt[i][j].getX()); 00149 } 00150 00151 // point 0<-->3, 1<-->2, 4<-->7, 5<-->6 00152 for (G4int j=0;j<8;j++) 00153 { 00154 if(j<2) 00155 { 00156 G4ThreeVector v=fPnt[i][j]; 00157 fPnt[i][j]=fPnt[i][3-j]; 00158 fPnt[i][3-j]=v; 00159 } 00160 else if(j>=4&&j<6) 00161 { 00162 G4ThreeVector v=fPnt[i][j]; 00163 fPnt[i][j]=fPnt[i][11-j]; 00164 fPnt[i][11-j]=v; 00165 } 00166 } 00167 } 00168 00169 //exchange sequence in the same layer 00170 Exchange(0,3); Exchange(1,2); Exchange(4,7); Exchange(5,31); Exchange(6,30); 00171 Exchange(8,12); Exchange(9,11); Exchange(13,17); Exchange(14,34); Exchange(15,33); Exchange(16,32); 00172 Exchange(18,23); Exchange(19,22); Exchange(20,21); Exchange(24,29); Exchange(25,28); Exchange(26,27); 00173 00174 /*for(G4int i=0;i<35;i++) 00175 { 00176 G4cout<<"crystal number: "<<i<<G4endl; 00177 for(G4int j=0;j<8;j++) 00178 G4cout<<fPnt[i][j]<<G4endl; 00179 }*/ 00180 00181 00182 //compute the 6 crystal beside the 20mm gap 00183 for(G4int i=0;i<35;i++) 00184 { 00185 for (G4int j=0;j<8;j++) 00186 { 00187 G4ThreeVector pPnt1 = temp[i][j]; 00188 fPnt1[i][j] = pPnt1.rotateZ(67.5*deg); 00189 } 00190 if((i==3)||(i==7)||(i==12)||(i==17)||(i==23)||(i==29)) 00191 { 00192 fPnt1[i][0].setX(10); 00193 fPnt1[i][1].setX(10); 00194 fPnt1[i][4].setX(10); 00195 fPnt1[i][5].setX(10); 00196 00197 G4double y0 = fPnt1[i][0].getY()+10*(fPnt1[i][3].getY()-fPnt1[i][0].getY())/fPnt1[i][3].getX(); 00198 G4double y1 = fPnt1[i][1].getY()+10*(fPnt1[i][2].getY()-fPnt1[i][1].getY())/fPnt1[i][2].getX(); 00199 G4double y4 = fPnt1[i][4].getY()+10*(fPnt1[i][7].getY()-fPnt1[i][4].getY())/fPnt1[i][7].getX(); 00200 G4double y5 = fPnt1[i][5].getY()+10*(fPnt1[i][6].getY()-fPnt1[i][5].getY())/fPnt1[i][6].getX(); 00201 00202 G4double z0 = fPnt1[i][0].getZ()+10*(fPnt1[i][3].getZ()-fPnt1[i][0].getZ())/fPnt1[i][3].getX(); 00203 G4double z1 = fPnt1[i][1].getZ()+10*(fPnt1[i][2].getZ()-fPnt1[i][1].getZ())/fPnt1[i][2].getX(); 00204 G4double z4 = fPnt1[i][4].getZ()+10*(fPnt1[i][7].getZ()-fPnt1[i][4].getZ())/fPnt1[i][7].getX(); 00205 G4double z5 = fPnt1[i][5].getZ()+10*(fPnt1[i][6].getZ()-fPnt1[i][5].getZ())/fPnt1[i][6].getX(); 00206 00207 fPnt1[i][0].setY(y0); 00208 fPnt1[i][1].setY(y1); 00209 fPnt1[i][4].setY(y4); 00210 fPnt1[i][5].setY(y5); 00211 00212 fPnt1[i][0].setZ(z0); 00213 fPnt1[i][1].setZ(z1); 00214 fPnt1[i][4].setZ(z4); 00215 fPnt1[i][5].setZ(z5); 00216 } 00217 } 00218 }
|
|
|
|
00221 { 00222 G4ThreeVector v; 00223 for(G4int i=0;i<8;i++) 00224 { 00225 v = fPnt[cry1][i]; 00226 fPnt[cry1][i] = fPnt[cry2][i]; 00227 fPnt[cry2][i] = v; 00228 } 00229 }
|
|
00024 { return cryNumInOneLayer[num]; }
|
|
00024 { return cryNumInOneLayer[num]; }
|
|
|
|
00258 { 00259 G4ThreeVector center1=0; //the center of large surface 00260 G4ThreeVector center2=0; //the center of small surface 00261 00262 if(CryNb==5||CryNb==6||CryNb==14||CryNb==15||CryNb==16) 00263 { 00264 center1 = (pos[0]+pos[1])/2; 00265 center2 = (pos[4]+pos[5])/2; 00266 } 00267 else if(CryNb>=30&&CryNb<35) 00268 { 00269 center1 = (pos[2]+pos[3])/2; 00270 center2 = (pos[6]+pos[7])/2; 00271 } 00272 else 00273 { 00274 center1 = (pos[0]+pos[1]+pos[2]+pos[3])/4; 00275 center2 = (pos[4]+pos[5]+pos[6]+pos[7])/4; 00276 } 00277 00278 G4double r1=(pos[1]-center1).r(); 00279 G4double r2=(pos[2]-center1).r(); 00280 G4double r12=(pos[1]-pos[2]).r(); 00281 G4double theta=acos((r2*r2+r12*r12-r1*r1)/(2*r2*r12)); 00282 G4double h=r2*sin(theta); //distance from the center to the vertical side 00283 G4double t1=totalThickness/h; 00284 00285 r1=(pos[5]-center2).r(); 00286 r2=(pos[6]-center2).r(); 00287 r12=(pos[5]-pos[6]).r(); 00288 theta=acos((r2*r2+r12*r12-r1*r1)/(2*r2*r12)); 00289 h=r2*sin(theta); 00290 G4double t2=totalThickness/h; 00291 00292 for(G4int i=0;i<8;i++) 00293 { 00294 if(i<4) 00295 { 00296 cryPoint[i] = (1-t1)*pos[i]+t1*center1; 00297 } 00298 else 00299 { 00300 G4ThreeVector temp = (1-t2)*pos[i]+t2*center2; 00301 cryPoint[i] = (1-totalThickness/CrystalLength)*temp+(totalThickness/CrystalLength)*pos[i-4]; 00302 } 00303 //G4cout<<"casing="<<pos[i]<<"\t"<<"crystal="<<cryPoint[i]<<G4endl; 00304 } 00305 }
|
|
|
|
00022 { 00023 ExtBesEmcParameter emcPara; 00024 emcPara.ReadData(); 00025 00026 WorldRmin1 = emcPara.GetWorldRmin1(); 00027 WorldRmax1 = emcPara.GetWorldRmax1(); 00028 WorldRmin2 = emcPara.GetWorldRmin2(); 00029 WorldRmax2 = emcPara.GetWorldRmax2(); 00030 WorldDz = emcPara.GetWorldDz(); 00031 WorldZPosition = emcPara.GetWorldZPosition(); 00032 CrystalLength = emcPara.GetCrystalLength(); 00033 00034 for(G4int i=0;i<6;i++) 00035 cryNumInOneLayer[i] = emcPara.GetCryInOneLayer(i); 00036 for(G4int i=0;i<5;i++) 00037 pentaInOneSector[i] = emcPara.GetPentaInOneSector(i); 00038 00039 fTyvekThickness = emcPara.GetTyvekThickness(); 00040 fAlThickness = emcPara.GetAlThickness(); 00041 fMylarThickness = emcPara.GetMylarThickness(); 00042 totalThickness=fTyvekThickness+fAlThickness+fMylarThickness; 00043 00044 // G4String ParaPath = ReadBoostRoot::GetBoostRoot(); 00045 G4String ParaPath = getenv("SIMUTILROOT"); 00046 if(!ParaPath){ 00047 G4Exception("BOOST environment not set!"); 00048 } 00049 ParaPath += "/dat/EmcEndGeometry.dat"; 00050 00051 ifstream fin; 00052 fin.open(ParaPath); 00053 assert(fin); 00054 for(G4int i=0;i<30;i++) 00055 for (G4int j=0;j<24;j++) 00056 fin>>param[i][j]; 00057 for(G4int i=0;i<5;i++) 00058 for (G4int j=0;j<6;j++) 00059 fin>>penta[i][j]; 00060 fin.close(); 00061 }
|
|
|
|
00234 { 00235 for(G4int i=0;i<35;i++) 00236 { 00237 for(G4int j=0;j<8;j++) 00238 { 00239 fPnt1[i][j].setX(-fPnt1[i][j].getX()); 00240 } 00241 00242 //change the sequence of eight points according to the requirment of IrregBox 00243 // point 0<-->1, 2<-->3, 4<-->5, 6<-->7 00244 for(G4int j=0;j<8;j++) 00245 { 00246 if((j%2)==0) 00247 { 00248 G4ThreeVector v2=fPnt1[i][j]; 00249 fPnt1[i][j]=fPnt1[i][j+1]; 00250 fPnt1[i][j+1]=v2; 00251 } 00252 } 00253 } 00254 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|