110 gErrorIgnoreLevel = kFatal;
115 G4SDManager* SDman = G4SDManager::GetSDMpointer();
117 besEMCSD =
new BesEmcSD(
"CalorSD",
this,besEMCGeometry);
118 SDman->AddNewDetector( besEMCSD );
128 physiEMC =
new G4PVPlacement(0,
129 G4ThreeVector(0.0 ,0.0 ,0.0),
130 logicEMC,
"physicalEMC",logicBes,
false, 0,
CHECKLV0);
131 G4cout<<
"logicEmc: === "<<logicEMC<<
" physiEmc "<<physiEMC<<G4endl;
142 phiNbCrystals = (*besEMCGeometry).BSCNbPhi;
143 thetaNbCrystals = (*besEMCGeometry).BSCNbTheta*2;
145 G4double da=0.001*deg;
150 solidBSC =
new G4Tubs(
"solidBSC",
151 (*besEMCGeometry).TaperRingRmin1,
152 (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness+(*besEMCGeometry).SPBarThickness1+2.1*mm,
153 (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz,
157 solidESC =
new G4Cons(
"solidESC",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,
158 (*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
159 (*emcEnd).WorldDz/2,0.*deg,360.*deg);
161 solidEMC =
new G4UnionSolid(
"solidEMC0",
165 G4ThreeVector(0,0,(*emcEnd).WorldZPosition));
167 G4RotationMatrix *rotateESC =
new G4RotationMatrix();
168 rotateESC->rotateY(180.*deg);
170 solidEMC =
new G4UnionSolid(
"solidEMC",
174 G4ThreeVector(0,0,-(*emcEnd).WorldZPosition));
176 logicEMC =
new G4LogicalVolume(solidEMC,
177 G4Material::GetMaterial(
"Air"),
180 physiEMC =
new G4PVPlacement(0,
188 solidBSCWorld =
new G4SubtractionSolid(
"solidBSCWorld0",
192 G4ThreeVector(0,0,(*emcEnd).WorldZPosition));
194 solidBSCWorld =
new G4SubtractionSolid(
"solidBSCWorld",
198 G4ThreeVector(0,0,-(*emcEnd).WorldZPosition));
200 logicBSCWorld =
new G4LogicalVolume(solidBSCWorld,
201 G4Material::GetMaterial(
"Air"),
204 G4RotationMatrix *rotBSC =
new G4RotationMatrix();
205 rotBSC->rotateY(180.*deg);
206 physiBSCWorld =
new G4PVPlacement(rotBSC,
214 G4RotationMatrix *rotateMatrix[200];
215 G4double oOp,ox,oy,oz;
216 G4double
delta = 0*deg;
217 G4ThreeVector axis = G4ThreeVector(0,0,0);
218 oOp=(*besEMCGeometry).BSCRmin/
sin(0.5*(*besEMCGeometry).BSCPhiDphi+90*deg)
219 *
sin((*besEMCGeometry).BSCAngleRotat);
220 G4double ll=(*besEMCGeometry).BSCCryLength;
221 G4double rr=(*besEMCGeometry).BSCRmin;
222 G4double oj=sqrt(ll*ll+rr*rr-2*ll*rr*
cos(180.*deg-(*besEMCGeometry).BSCAngleRotat));
223 G4double oij=90.*deg-(*besEMCGeometry).BSCPhiDphi/2.-(*besEMCGeometry).BSCAngleRotat;
224 G4double doj=asin(
sin(180.*deg-(*besEMCGeometry).BSCAngleRotat)/oj*ll);
225 G4double ioj=(*besEMCGeometry).BSCPhiDphi/2.+doj;
226 G4double ij=oj/
sin(oij)*
sin(ioj);
227 G4double dOp=rr/
sin(90.*deg-(*besEMCGeometry).BSCPhiDphi/2.)
228 *
sin(90.*deg+(*besEMCGeometry).BSCPhiDphi/2.-(*besEMCGeometry).BSCAngleRotat);
229 G4double cOp=rr/
sin(90.*deg+(*besEMCGeometry).BSCPhiDphi/2.)
230 *
sin(90.*deg-(*besEMCGeometry).BSCPhiDphi/2.-(*besEMCGeometry).BSCAngleRotat);
231 G4double ch=(dOp+ll)/
cos((*besEMCGeometry).BSCPhiDphi)-cOp;
232 G4double hi=(dOp+ll)*
tan((*besEMCGeometry).BSCPhiDphi)-ij;
233 G4double oh=sqrt(ch*ch+rr*rr-2*ch*rr*
cos(180*deg-(*besEMCGeometry).BSCAngleRotat));
234 G4double hoi=asin(
sin(180*deg-oij)/oh*hi);
235 G4double dok=asin(
sin(180*deg-(*besEMCGeometry).BSCAngleRotat)/oh*ch);
237 G4cout <<
"oj=" <<oj/cm<<G4endl
238 <<
"oij="<<oij/deg<<G4endl
239 <<
"doj="<<doj/deg<<G4endl
240 <<
"ioj="<<ioj/deg<<G4endl
241 <<
"ij="<<ij/cm<<G4endl
242 <<
"dOp="<<dOp/cm<<G4endl
243 <<
"cOp="<<cOp/cm<<G4endl
244 <<
"ch="<<ch/cm<<G4endl
245 <<
"hi="<<hi/cm<<G4endl
246 <<
"oh="<<oh/cm<<G4endl
247 <<
"hoi="<<hoi/deg<<G4endl
248 <<
"dok="<<dok/deg<<G4endl;
251 G4double cmo = asin(
sin(180*degree-(*besEMCGeometry).BSCAngleRotat)/(*besEMCGeometry).BSCRmax2*dOp);
252 G4double cm = (*besEMCGeometry).BSCRmax2/
sin(180*degree-(*besEMCGeometry).BSCAngleRotat)*
sin((*besEMCGeometry).BSCAngleRotat-cmo);
253 G4ThreeVector Pout(dOp+cm*
cos((*besEMCGeometry).BSCAngleRotat),-cm*
sin((*besEMCGeometry).BSCAngleRotat),(*besEMCGeometry).BSCDz);
255 G4double rTaperRingOuter1 = (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingThickness1;
256 G4double rTaperRingOuter2 = (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr;
257 G4double zTaperRing1 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz;
258 G4double zTaperRing2 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3;
260 G4RotationMatrix* rotIntersection =
new G4RotationMatrix();
261 rotIntersection->rotateZ(-(*besEMCGeometry).BSCAngleRotat-(*besEMCGeometry).BSCPhiDphi/2.-hoi);
262 G4ThreeVector
P(oOp*
cos(-90.*deg+(*besEMCGeometry).BSCAngleRotat+hoi), oOp*
sin(-90.*deg+(*besEMCGeometry).BSCAngleRotat+hoi), 0);
263 G4AffineTransform Td(rotIntersection,
P);
264 G4ThreeVector md = Td.Inverse().TransformPoint(G4ThreeVector(0,0,0));
265 G4ThreeVector vd = Td.Inverse().TransformPoint(Pout);
267 G4double zPlane0[4]={-(*besEMCGeometry).BSCDz,-zTaperRing1,zTaperRing1,(*besEMCGeometry).BSCDz};
268 G4double rInner0[4]={vd.perp(),cOp,cOp,vd.perp()};
269 G4double rOuter0[4]={(*besEMCGeometry).BSCPhiRmax,(*besEMCGeometry).BSCPhiRmax,(*besEMCGeometry).BSCPhiRmax,(*besEMCGeometry).BSCPhiRmax};
271 G4double zPlane1[4]={-zTaperRing2,-zTaperRing1,zTaperRing1,zTaperRing2};
272 G4double rInner1[4]={rTaperRingOuter2,rTaperRingOuter1,rTaperRingOuter1,rTaperRingOuter2};
273 G4double rOuter1[4]={(*besEMCGeometry).BSCRmax,(*besEMCGeometry).BSCRmax,(*besEMCGeometry).BSCRmax,(*besEMCGeometry).BSCRmax};
275 G4VSolid* solidBSCPhi1 =
new G4Polycone(
"solidBSCPhi1",0,360*deg,4,zPlane1,rInner1,rOuter1);
276 G4VSolid* solidBSCPhi0 =
new G4Polyhedra(
"solidBSCPhi0",360.*deg-(*besEMCGeometry).BSCPhiDphi,(*besEMCGeometry).BSCPhiDphi,(*besEMCGeometry).BSCNbPhi/2,4,zPlane0,rInner0,rOuter0);
277 G4IntersectionSolid* solidBSCPhi =
new G4IntersectionSolid(
"solidBSCPhi", solidBSCPhi0, solidBSCPhi1, 0, md);
279 logicBSCPhi =
new G4LogicalVolume(solidBSCPhi,
280 G4Material::GetMaterial(
"Air"),
284 for(G4int j=0;j<(*besEMCGeometry).BSCNbPhi;j++)
286 if(j<(*besEMCGeometry).BSCNbPhi/2) {
287 i=(*besEMCGeometry).BSCNbPhi/2-j-1;
289 i=(*besEMCGeometry).BSCNbPhi*3/2-j-1;
291 rotateMatrix[i] =
new G4RotationMatrix();
292 rotateMatrix[i]->rotateZ(-i*(*besEMCGeometry).BSCPhiDphi
293 -(*besEMCGeometry).BSCAngleRotat
294 -(*besEMCGeometry).BSCPhiDphi/2.
296 rotateMatrix[i]->getAngleAxis(
delta, axis);
300 ox=oOp*
cos(-90.*deg+(*besEMCGeometry).BSCAngleRotat+hoi
301 +i*(*besEMCGeometry).BSCPhiDphi);
302 oy=oOp*
sin(-90.*deg+(*besEMCGeometry).BSCAngleRotat+hoi
303 +i*(*besEMCGeometry).BSCPhiDphi);
306 ostringstream strPhi;
307 strPhi <<
"physicalBSCPhi" << j;
309 physiBSCPhi =
new G4PVPlacement(rotateMatrix[i],
310 G4ThreeVector(ox,oy,oz),
323 G4double zHalfLength[50];
324 G4double thetaAxis[50];
325 G4double phiAxis[50];
326 G4double yHalfLength1[50];
327 G4double xHalfLength2[50];
328 G4double xHalfLength1[50];
329 G4double tanAlpha1[50];
330 G4double yHalfLength2[50];
331 G4double xHalfLength4[50];
332 G4double xHalfLength3[50];
333 G4double tanAlpha2[50];
334 G4double xPosition[50];
335 G4double yPosition[50];
336 G4double zPosition[50];
337 G4double thetaPosition[50];
338 for(i=0;i<(*besEMCGeometry).BSCNbTheta;i++)
340 zHalfLength[i] = (*besEMCGeometry).zHalfLength[i];
341 thetaAxis[i] = (*besEMCGeometry).thetaAxis[i];
342 phiAxis[i] = (*besEMCGeometry).phiAxis[i];
343 yHalfLength1[i] = (*besEMCGeometry).yHalfLength1[i];
344 xHalfLength2[i] = (*besEMCGeometry).xHalfLength2[i];
345 xHalfLength1[i] = (*besEMCGeometry).xHalfLength1[i];
346 tanAlpha1[i] = (*besEMCGeometry).tanAlpha1[i];
347 yHalfLength2[i] = (*besEMCGeometry).yHalfLength2[i];
348 xHalfLength4[i] = (*besEMCGeometry).xHalfLength4[i];
349 xHalfLength3[i] = (*besEMCGeometry).xHalfLength3[i];
350 tanAlpha2[i] = (*besEMCGeometry).tanAlpha2[i];
351 xPosition[i] = (*besEMCGeometry).xPosition[i];
352 yPosition[i] = (*besEMCGeometry).yPosition[i];
353 zPosition[i] = (*besEMCGeometry).zPosition[i];
354 thetaPosition[i]= (*besEMCGeometry).thetaPosition[i];
356 G4cout <<
"The sizes of the "<<i+1<<
" crystal are:" << G4endl
357 <<
"zHalfLength ="<<zHalfLength[i]/cm<<
"(cm)," << G4endl
358 <<
"thetaAxis ="<<thetaAxis[i]/deg <<
"(deg),"<< G4endl
359 <<
"phiAxis ="<< phiAxis[i]/deg <<
"(deg),"<< G4endl
360 <<
"yHalfLength1="<<yHalfLength1[i]/cm<<
"(cm),"<< G4endl
361 <<
"xHalfLength1="<<xHalfLength1[i]/cm<<
"(cm),"<< G4endl
362 <<
"xHalfLength2="<<xHalfLength2[i]/cm<<
"(cm),"<< G4endl
363 <<
"tanAlpha1 ="<< tanAlpha1[i] << G4endl
364 <<
"yHalfLength2="<<yHalfLength2[i]/cm<<
"(cm),"<< G4endl
365 <<
"xHalfLength3="<<xHalfLength3[i]/cm<<
"(cm),"<< G4endl
366 <<
"xHalfLength4="<<xHalfLength4[i]/cm<<
"(cm),"<< G4endl
367 <<
"tanAlpha2 =" << tanAlpha2[i] <<
"." << G4endl;
371 solidBSCCrystal =
new G4Trap(
"solidCrystal",
372 100*cm, 100*deg, 100*deg,
373 100*cm, 100*cm, 100*cm, 100*deg,
374 100*cm, 100*cm, 100*cm, 100*deg);
376 logicBSCCrystal =
new G4LogicalVolume(solidBSCCrystal,
383 (*besEMCGeometry).BSCNbTheta*2,
389 solidRear =
new G4Box(
"solidRearBox",
390 (*besEMCGeometry).rearBoxLength/2,
391 (*besEMCGeometry).rearBoxLength/2,
392 (*besEMCGeometry).rearBoxDz/2);
394 logicRear =
new G4LogicalVolume(solidRear,
395 G4Material::GetMaterial(
"Air"),
399 solidOrgGlass =
new G4Box(
"solidOrganicGlass",
400 (*besEMCGeometry).orgGlassLengthX/2,
401 (*besEMCGeometry).orgGlassLengthY/2,
402 (*besEMCGeometry).orgGlassLengthZ/2);
404 logicOrgGlass =
new G4LogicalVolume(solidOrgGlass,
406 "logicalOrganicGlass");
408 physiOrgGlass =
new G4PVPlacement(0,
409 G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz-(*besEMCGeometry).orgGlassLengthZ)/2),
411 "physicalOrganicGlass",
417 solidCasingBox =
new G4Box(
"solidCasingBox",
418 (*besEMCGeometry).rearBoxLength/2,
419 (*besEMCGeometry).rearBoxLength/2,
420 (*besEMCGeometry).rearCasingThickness/2);
422 solidAirHole =
new G4Box(
"solidAirHole",
423 (*besEMCGeometry).orgGlassLengthX/2,
424 (*besEMCGeometry).orgGlassLengthY/2,
425 (*besEMCGeometry).rearBoxDz/2);
427 solidRearCasing =
new G4SubtractionSolid(
"solidRearCasing",
433 logicRearCasing =
new G4LogicalVolume(solidRearCasing,
435 "logicalRearCasing");
437 physiRearCasing =
new G4PVPlacement(0,
438 G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz-(*besEMCGeometry).rearCasingThickness)/2),
440 "physicalRearCasing",
446 solidAlBox =
new G4Box(
"solidAlBox",
447 (*besEMCGeometry).rearBoxLength/2,
448 (*besEMCGeometry).rearBoxLength/2,
449 (*besEMCGeometry).AlPlateDz/2);
451 solidAlPlate =
new G4SubtractionSolid(
"solidAlPlate",
457 logicAlPlate =
new G4LogicalVolume(solidAlPlate,
458 G4Material::GetMaterial(
"Aluminium"),
461 physiAlPlate =
new G4PVPlacement(0,
462 G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
463 -(*besEMCGeometry).rearCasingThickness
464 -(*besEMCGeometry).AlPlateDz/2)),
472 solidPD =
new G4Box(
"solidPD",
473 (*besEMCGeometry).PDLengthX,
474 (*besEMCGeometry).PDLengthY/2,
475 (*besEMCGeometry).PDLengthZ/2);
477 logicPD =
new G4LogicalVolume(solidPD,
478 G4Material::GetMaterial(
"M_Silicon"),
481 physiPD =
new G4PVPlacement(0,
482 G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
483 -(*besEMCGeometry).orgGlassLengthZ
484 -(*besEMCGeometry).PDLengthZ/2)),
492 solidPreAmpBox =
new G4Box(
"solidPreAmpBox",
493 (*besEMCGeometry).rearBoxLength/2,
494 (*besEMCGeometry).rearBoxLength/2,
495 (*besEMCGeometry).PABoxDz/2);
497 logicPreAmpBox =
new G4LogicalVolume(solidPreAmpBox,
498 G4Material::GetMaterial(
"Aluminium"),
501 physiPreAmpBox =
new G4PVPlacement(0,
502 G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
503 -(*besEMCGeometry).rearCasingThickness
504 -(*besEMCGeometry).AlPlateDz
505 -(*besEMCGeometry).PABoxDz/2)),
513 solidAirInPABox =
new G4Box(
"solidAirInPABox",
514 (*besEMCGeometry).rearBoxLength/2-(*besEMCGeometry).PABoxThickness,
515 (*besEMCGeometry).rearBoxLength/2-(*besEMCGeometry).PABoxThickness,
516 (*besEMCGeometry).PABoxDz/2-(*besEMCGeometry).PABoxThickness);
518 logicAirInPABox =
new G4LogicalVolume(solidAirInPABox,
519 G4Material::GetMaterial(
"Air"),
520 "logicalAirInPABox");
522 physiAirInPABox =
new G4PVPlacement(0,
525 "physicalAirInPABox",
531 solidHangingPlate =
new G4Box(
"solidHangingPlate",
532 (*besEMCGeometry).rearBoxLength/2,
533 (*besEMCGeometry).rearBoxLength/2,
534 (*besEMCGeometry).HangingPlateDz/2);
536 logicHangingPlate =
new G4LogicalVolume(solidHangingPlate,stainlessSteel,
"logicalHangingPlate");
538 physiHangingPlate =
new G4PVPlacement(0,
539 G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
540 -(*besEMCGeometry).rearCasingThickness
541 -(*besEMCGeometry).AlPlateDz
542 -(*besEMCGeometry).PABoxDz
543 -(*besEMCGeometry).HangingPlateDz/2)),
545 "physicalHangingPlate",
551 solidWaterPipe =
new G4Tubs(
"solidWaterPipe",
553 (*besEMCGeometry).waterPipeDr,
554 (*besEMCGeometry).BSCDz,
558 logicWaterPipe =
new G4LogicalVolume(solidWaterPipe,waterPipe,
"logicalWaterPipe");
560 physiWaterPipe =
new G4PVPlacement(0,
561 G4ThreeVector((*besEMCGeometry).cablePosX[0]-2*(*besEMCGeometry).cableDr,
562 (*besEMCGeometry).cablePosY[0]-(*besEMCGeometry).cableDr-(*besEMCGeometry).waterPipeDr,
575 G4String nameCrystalAndCasing=
"CrystalAndCasing";
578 for(i=startID;i<=thetaNbCrystals;i++)
580 ostringstream strSolidCasing;
581 strSolidCasing <<
"solidBSCCasing" << i-1;
582 ostringstream strVolumeCasing;
583 strVolumeCasing <<
"logicalBSCCasing" << i-1;
584 ostringstream strPhysiCasing;
585 strPhysiCasing <<
"physicalBSCCasing" << i-1;
587 if(i>(*besEMCGeometry).BSCNbTheta)
589 id=i-(*besEMCGeometry).BSCNbTheta-1;
590 solidBSCTheta =
new G4Trap(strSolidCasing.str(),
606 logicBSCTheta =
new G4LogicalVolume(solidBSCTheta,
608 strVolumeCasing.str());
610 rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1] =
new G4RotationMatrix();
611 rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]->rotateZ(-90*deg);
612 rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]
613 ->rotateX(-thetaPosition[
id]);
617 new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
618 G4ThreeVector(xPosition[
id],
621 strPhysiCasing.str(),
629 G4VisAttributes* rightVisAtt=
new G4VisAttributes(G4Colour(1.0,0.,0.));
630 rightVisAtt->SetVisibility(
true);
631 logicBSCTheta->SetVisAttributes(rightVisAtt);
632 logicBSCTheta->SetVisAttributes(G4VisAttributes::Invisible);
635 ostringstream strRear;
636 strRear <<
"physicalRearBox_1_" << i-1;
638 physiRear =
new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
639 G4ThreeVector((*besEMCGeometry).rearBoxPosX[
id],
640 (*besEMCGeometry).rearBoxPosY[
id],
641 (*besEMCGeometry).rearBoxPosZ[
id]),
648 ostringstream strGirder;
649 strGirder <<
"solidOpenningCutGirder_1_" << i-1;
650 solidOCGirder =
new G4Cons(strGirder.str(),
651 (*besEMCGeometry).OCGirderRmin1[
id],
652 (*besEMCGeometry).BSCPhiRmax,
653 (*besEMCGeometry).OCGirderRmin2[
id],
654 (*besEMCGeometry).BSCPhiRmax,
655 (*besEMCGeometry).OCGirderDz[
id]/2,
656 360.*deg-(*besEMCGeometry).OCGirderAngle/2,
657 (*besEMCGeometry).OCGirderAngle/2-da);
659 ostringstream strVGirder;
660 strVGirder <<
"logicalOpenningCutGirder_1_" << i-1;
661 logicOCGirder =
new G4LogicalVolume(solidOCGirder,stainlessSteel,strVGirder.str());
662 logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
664 ostringstream strPGirder;
665 strPGirder <<
"physicalOpenningCutGirder_1_" << i-1;
666 physiOCGirder =
new G4PVPlacement(0,
667 G4ThreeVector(0,0,(*besEMCGeometry).OCGirderPosZ[
id]),
674 if(
id<(*besEMCGeometry).BSCNbTheta-1)
676 G4double zLength = (*besEMCGeometry).OCGirderPosZ[
id+1]
677 -(*besEMCGeometry).OCGirderPosZ[id]
678 -(*besEMCGeometry).OCGirderDz[
id+1]/2-(*besEMCGeometry).OCGirderDz[id]/2;
679 G4double zPositionOCGirder = (*besEMCGeometry).OCGirderPosZ[
id+1]
680 -(*besEMCGeometry).OCGirderDz[
id+1]/2-zLength/2;
682 ostringstream strGirder2;
683 strGirder2 <<
"solidOpenningCutGirder_2_" << i-1;
684 solidOCGirder =
new G4Cons(strGirder2.str(),
685 (*besEMCGeometry).OCGirderRmin2[
id],
686 (*besEMCGeometry).BSCPhiRmax,
687 (*besEMCGeometry).OCGirderRmin1[
id+1],
688 (*besEMCGeometry).BSCPhiRmax,
690 360.*deg-(*besEMCGeometry).OCGirderAngle/2,
691 (*besEMCGeometry).OCGirderAngle/2-da);
693 ostringstream strVGirder2;
694 strVGirder2 <<
"logicalOpenningCutGirder_2_" << i-1;
695 logicOCGirder =
new G4LogicalVolume(solidOCGirder,stainlessSteel,strVGirder2.str());
696 logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
698 ostringstream strPGirder2;
699 strPGirder2 <<
"physicalOpenningCutGirder_2_" << i-1;
700 physiOCGirder =
new G4PVPlacement(0,
701 G4ThreeVector(0,0,zPositionOCGirder),
709 ostringstream strBSCCable;
710 strBSCCable <<
"solidBSCCable_1_" << i-1;
711 solidCable =
new G4Tubs(strBSCCable.str(),
713 (*besEMCGeometry).cableDr,
714 (*besEMCGeometry).cableLength[
id]/2,
718 ostringstream strVBSCCable;
719 strVBSCCable <<
"logicalBSCCable_1_" << i-1;
720 logicCable =
new G4LogicalVolume(solidCable,cable,strVBSCCable.str());
722 ostringstream strPBSCCable;
723 strPBSCCable <<
"physicalBSCCable_1_" << i-1;
724 physiCable =
new G4PVPlacement(0,
725 G4ThreeVector((*besEMCGeometry).cablePosX[
id],
726 (*besEMCGeometry).cablePosY[
id],
727 (*besEMCGeometry).cablePosZ[
id]),
733 logicCable->SetVisAttributes(G4VisAttributes::Invisible);
737 id=(*besEMCGeometry).BSCNbTheta-i;
738 solidBSCTheta =
new G4Trap(strSolidCasing.str(),
754 logicBSCTheta =
new G4LogicalVolume(solidBSCTheta,
756 strVolumeCasing.str());
758 rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1] =
new G4RotationMatrix();
759 rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]->rotateZ(-90*deg);
760 rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]
761 ->rotateX(-180*deg+thetaPosition[
id]);
763 new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
764 G4ThreeVector(xPosition[
id],
767 strPhysiCasing.str(),
774 G4VisAttributes* rightVisAtt=
new G4VisAttributes(G4Colour(1.0,0.,0.));
775 rightVisAtt->SetVisibility(
true);
776 logicBSCTheta->SetVisAttributes(rightVisAtt);
777 logicBSCTheta->SetVisAttributes(G4VisAttributes::Invisible);
780 ostringstream strRear;
781 strRear <<
"physicalRearBox_2_" << i-1;
783 physiRear =
new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
784 G4ThreeVector((*besEMCGeometry).rearBoxPosX[
id],
785 (*besEMCGeometry).rearBoxPosY[
id],
786 -(*besEMCGeometry).rearBoxPosZ[
id]),
793 ostringstream strGirder;
794 strGirder <<
"solidOpenningCutGirder_3_" << i-1;
795 solidOCGirder =
new G4Cons(strGirder.str(),
796 (*besEMCGeometry).OCGirderRmin2[
id],
797 (*besEMCGeometry).BSCPhiRmax,
798 (*besEMCGeometry).OCGirderRmin1[
id],
799 (*besEMCGeometry).BSCPhiRmax,
800 (*besEMCGeometry).OCGirderDz[
id]/2,
801 360.*deg-(*besEMCGeometry).OCGirderAngle/2,
802 (*besEMCGeometry).OCGirderAngle/2-da);
804 ostringstream strVGirder;
805 strVGirder <<
"logicalOpenningCutGirder_3_" << i-1;
806 logicOCGirder =
new G4LogicalVolume(solidOCGirder,stainlessSteel,strVGirder.str());
807 logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
809 ostringstream strPGirder;
810 strPGirder <<
"physicalOpenningCutGirder_3_" << i-1;
811 physiOCGirder =
new G4PVPlacement(0,
812 G4ThreeVector(0,0,-(*besEMCGeometry).OCGirderPosZ[
id]),
819 if(
id<(*besEMCGeometry).BSCNbTheta-1)
821 G4double zLength = (*besEMCGeometry).OCGirderPosZ[
id+1]-(*besEMCGeometry).OCGirderPosZ[id]
822 -(*besEMCGeometry).OCGirderDz[
id+1]/2-(*besEMCGeometry).OCGirderDz[id]/2;
823 G4double zPositionOCGirder = (*besEMCGeometry).OCGirderPosZ[
id+1]-(*besEMCGeometry).OCGirderDz[
id+1]/2-zLength/2;
825 ostringstream strGirder2;
826 strGirder2 <<
"solidOpenningCutGirder_4_" << i-1;
827 solidOCGirder =
new G4Cons(strGirder2.str(),
828 (*besEMCGeometry).OCGirderRmin1[
id+1],
829 (*besEMCGeometry).BSCPhiRmax,
830 (*besEMCGeometry).OCGirderRmin2[
id],
831 (*besEMCGeometry).BSCPhiRmax,
833 360.*deg-(*besEMCGeometry).OCGirderAngle/2,
834 (*besEMCGeometry).OCGirderAngle/2-da);
836 ostringstream strVGirder2;
837 strVGirder2 <<
"logicalOpenningCutGirder_4_" << i-1;
839 =
new G4LogicalVolume(solidOCGirder,stainlessSteel,strVGirder2.str());
840 logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
842 ostringstream strPGirder2;
843 strPGirder2 <<
"physicalOpenningCutGirder_4_" << i-1;
844 physiOCGirder =
new G4PVPlacement(0,
845 G4ThreeVector(0,0,-zPositionOCGirder),
853 ostringstream strBSCCable;
854 strBSCCable <<
"solidBSCCable_2_" << i-1;
855 solidCable =
new G4Tubs(strBSCCable.str(),
857 (*besEMCGeometry).cableDr,
858 (*besEMCGeometry).cableLength[
id]/2,
862 ostringstream strVBSCCable;
863 strVBSCCable <<
"logicalBSCCable_2_" << i-1;
864 logicCable =
new G4LogicalVolume(solidCable,cable,strVBSCCable.str());
866 ostringstream strPBSCCable;
867 strPBSCCable <<
"physicalBSCCable_2_" << i-1;
868 physiCable =
new G4PVPlacement(0,
869 G4ThreeVector((*besEMCGeometry).cablePosX[
id],
870 (*besEMCGeometry).cablePosY[
id],
871 -(*besEMCGeometry).cablePosZ[
id]),
877 logicCable->SetVisAttributes(G4VisAttributes::Invisible);
881 ostringstream strCrystal;
882 strCrystal <<
"physicalCrystal" << i-1;
883 physiBSCCrystal =
new G4PVParameterised(
890 (*besEMCGeometry).physiBSCCrystal[i]=physiBSCCrystal;
892 physiBSCCrystal->SetCopyNo(i);
893 if(
CHECKLV4) physiBSCCrystal->CheckOverlaps();
896 G4cout <<
"BesEmcConstruction*****************************"<< G4endl
897 <<
"point of crystal =" <<physiBSCCrystal << G4endl
899 <<
"point of excepted=" <<physiBSCTheta << G4endl;
916 if(logicEMC&&physiEMC&&verboseLevel>4){
917 G4cout<<
"logicEmc "<<logicEMC<<
" physiEmc "<<physiEMC<<G4endl;
918 G4cout<<
"list geo tree"<<G4endl;
920 int NdaughterofEMC = logicEMC->GetNoDaughters();
922 for(
int i = 0; i < NdaughterofEMC; i++)
924 G4LogicalVolume *daughterofEmc = logicEMC->GetDaughter(i)->GetLogicalVolume();
925 G4cout<<i<<
"/"<<NdaughterofEMC<<
" name: "<<daughterofEmc->GetName()<<
" "<<daughterofEmc<<
" shape: "<<daughterofEmc->GetSolid()->GetName()<<G4endl;
926 int NdaughterofEmc_2 = daughterofEmc->GetNoDaughters();
927 for(
int j = 0; j < NdaughterofEmc_2; j++)
929 G4LogicalVolume *daughterofEmc_2 = daughterofEmc->GetDaughter(j)->GetLogicalVolume();
930 G4cout<<
" --> "<<j<<
"/"<<NdaughterofEmc_2<<
" name: "<<daughterofEmc_2->GetName()<<
" "<<daughterofEmc_2<<
" shape: "<<daughterofEmc_2->GetSolid()->GetName()<<G4endl;
931 int NdaughterofEmc_3 = daughterofEmc_2->GetNoDaughters();
932 for(
int k = 0; k < NdaughterofEmc_3; k++)
934 G4LogicalVolume *daughterofEmc_3 = daughterofEmc_2->GetDaughter(k)->GetLogicalVolume();
935 G4cout<<
" --> "<<k<<
"/"<<NdaughterofEmc_3<<
" name: "<<daughterofEmc_3->GetName()<<
" "<<daughterofEmc_3<<
" shape: "<<daughterofEmc_3->GetSolid()->GetName()<<G4endl;
936 int NdaughterofEmc_4 = daughterofEmc_3->GetNoDaughters();
937 for(
int m = 0; m < NdaughterofEmc_4; m++)
939 G4LogicalVolume *daughterofEmc_4 = daughterofEmc_3->GetDaughter(m)->GetLogicalVolume();
940 G4cout<<
" --> "<<m<<
"/"<<NdaughterofEmc_4<<
" name: "<<daughterofEmc_4->GetName()<<
" "<<daughterofEmc_4<<
" shape: "<<daughterofEmc_4->GetSolid()->GetName()<<G4endl;
941 if(daughterofEmc_3->GetSolid()->GetName().contains(
"solidBSCCasing"))
943 G4Trap *Crystal = (G4Trap *)daughterofEmc_3->GetSolid();
944 double hz = Crystal->GetZHalfLength();
945 double hx1 = Crystal->GetXHalfLength1();
946 double hx2 = Crystal->GetXHalfLength2();
947 double hx3 = Crystal->GetXHalfLength3();
948 double hx4 = Crystal->GetXHalfLength4();
949 double hy1 = Crystal->GetYHalfLength1();
950 double hy2 = Crystal->GetYHalfLength2();
951 double tanalpha1 = Crystal->GetTanAlpha1();
952 double tanalpha2 = Crystal->GetTanAlpha2();
953 G4cout<<
" --> "<<hx1<<
" "<<hx2<<
" "<<hx3<<
" "<<hx4<<
" "<<hy1<<
" "<<hy2<<
" "<<hz<<
" "<<tanalpha1<<
" "<<tanalpha2<<G4endl;
966 if(logEMC!=logicEMC) G4cout <<
"BesEmcConstruction::ConstructEndGeometry parameter transmit error!" << G4endl;
969 G4VisAttributes* crystalVisAtt=
new G4VisAttributes(G4Colour(0.5,0,1.0));
970 crystalVisAtt->SetVisibility(
false);
971 G4VisAttributes* endPhiVisAtt=
new G4VisAttributes(G4Colour(0,1.0,0));
972 endPhiVisAtt->SetVisibility(
false);
973 const G4double zoomConst = 0.995;
974 const G4double da=0.001*deg;
978 solidEnd =
new G4Cons(
"solidEndWorld",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,
979 (*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
980 (*emcEnd).WorldDz/2,0.*deg,360.*deg);
981 logicEnd =
new G4LogicalVolume(solidEnd, G4Material::GetMaterial(
"Aluminium"),
"logicalEndWorld", 0, 0, 0);
982 physiEnd =
new G4PVPlacement(0,
983 G4ThreeVector(0,0,(*emcEnd).WorldZPosition),
990 logicEnd->SetVisAttributes(G4VisAttributes::Invisible);
994 G4RotationMatrix *rotateEnd =
new G4RotationMatrix();
995 rotateEnd->rotateY(180.*deg);
996 physiEnd =
new G4PVPlacement(rotateEnd,
997 G4ThreeVector(0,0,-(*emcEnd).WorldZPosition),
1029 solidEndPhi =
new G4Cons(
"solidEndPhi0",
1030 (*emcEnd).SectorRmin1,(*emcEnd).SectorRmax1,(*emcEnd).SectorRmin2,(*emcEnd).SectorRmax2,
1031 (*emcEnd).SectorDz/2,0.*deg,22.5*deg-da);
1032 logicEndPhi =
new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial(
"Air"),
"logicalEndPhi0", 0, 0, 0);
1033 for(G4int i=0;i<14;i++)
1037 G4RotationMatrix *rotatePhi =
new G4RotationMatrix();
1038 rotatePhi->rotateZ(-i*22.5*deg+67.5*deg);
1039 ostringstream strEndPhi;
1040 strEndPhi <<
"physicalEndPhi" << i;
1041 physiEndPhi =
new G4PVPlacement(rotatePhi,
1042 G4ThreeVector(0,0,(*emcEnd).SectorZPosition),logicEndPhi,strEndPhi.str(),logicEnd,
false,i,
CHECKLV2);
1046 logicEndPhi->SetVisAttributes(endPhiVisAtt);
1048 for(G4int i=0;i<35;i++)
1050 ostringstream strEndCasing;
1051 strEndCasing <<
"solidEndCasing_0_" << i;
1054 G4ThreeVector newfPnt[8];
1055 G4ThreeVector center(0.0, 0.0, 0.0);
1056 G4ThreeVector rotAngle(0.0, 0.0, 0.0);
1060 emcEnd->
Zoom(newfPnt,zoomConst);
1062 G4RotationMatrix *rotatePhiIrregBox =
new G4RotationMatrix();
1063 rotatePhiIrregBox->rotateX(rotAngle.x());
1064 rotatePhiIrregBox->rotateY(rotAngle.y());
1065 rotatePhiIrregBox->rotateZ(rotAngle.z());
1068 solidEndCasing =
new G4IrregBox(strEndCasing.str(),(*emcEnd).zoomPoint);
1070 ostringstream strVEndCasing;
1071 strVEndCasing <<
"logicalEndCasing_0_" << i;
1072 logicEndCasing =
new G4LogicalVolume(solidEndCasing,fCasingMaterial,strVEndCasing.str());
1074 ostringstream strPEndCasing;
1075 strPEndCasing <<
"physicalEndCasing_0_" << i;
1076 physiEndCasing =
new G4PVPlacement(rotatePhiIrregBox,center,
1077 logicEndCasing,strPEndCasing.str(),logicEndPhi,
false,i,
CHECKIrreg);
1079 ostringstream strEndCrystal;
1080 strEndCrystal <<
"solidEndCrystal_0_" << i;
1083 solidEndCrystal =
new G4IrregBox(strEndCrystal.str(),(*emcEnd).cryPoint);
1085 ostringstream strVEndCrystal;
1086 strVEndCrystal <<
"logicalEndCrystal_0_" << i;
1087 logicEndCrystal =
new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,strVEndCrystal.str());
1089 ostringstream strPEndCrystal;
1090 strPEndCrystal <<
"physicalEndCrystal_0_" << i;
1091 physiEndCrystal =
new G4PVPlacement(0,G4ThreeVector(),logicEndCrystal,strPEndCrystal.str(),logicEndCasing,
false,i,
CHECKIrreg);
1093 logicEndCasing->SetVisAttributes(G4VisAttributes::Invisible);
1094 logicEndCrystal->SetVisAttributes(crystalVisAtt);
1095 logicEndCrystal->SetSensitiveDetector(besEMCSD);
1100 G4double rmin2 = (*emcEnd).WorldRmin1+((*emcEnd).WorldRmin2-(*emcEnd).WorldRmin1)*(*emcEnd).SectorDz/(*emcEnd).WorldDz;
1101 G4double rmax2 = (*emcEnd).WorldRmax1+((*emcEnd).WorldRmax2-(*emcEnd).WorldRmax1)*(*emcEnd).SectorDz/(*emcEnd).WorldDz;
1102 solidEndPhi =
new G4Cons(
"solidEndPhi1",
1103 (*emcEnd).WorldRmin1, (*emcEnd).WorldRmax1, rmin2, rmax2,
1104 (*emcEnd).SectorDz/2,67.5*deg,22.5*deg-da);
1105 logicEndPhi =
new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial(
"Air"),
"logicalEndPhi1", 0, 0, 0);
1106 for(G4int i=0;i<2;i++)
1108 G4RotationMatrix *rotatePhi =
new G4RotationMatrix();
1109 rotatePhi->rotateZ(-i*180.*deg);
1110 ostringstream strEndPhi;
1111 strEndPhi <<
"physicalEndPhi" << i*8+6;
1112 physiEndPhi =
new G4PVPlacement(rotatePhi,G4ThreeVector(0,0,(*emcEnd).SectorZPosition),
1113 logicEndPhi,strEndPhi.str(),logicEnd,
false,i*8+6,
CHECKLV2);
1116 logicEndPhi->SetVisAttributes(endPhiVisAtt);
1118 for(G4int i=0;i<35;i++)
1120 ostringstream strEndCasing;
1121 strEndCasing <<
"solidEndCasing_1_" << i;
1124 G4ThreeVector newfPnt[8];
1125 G4ThreeVector center(0.0, 0.0, 0.0);
1126 G4ThreeVector rotAngle(0.0, 0.0, 0.0);
1130 emcEnd->
Zoom(newfPnt,zoomConst);
1132 G4RotationMatrix *rotatePhiIrregBox =
new G4RotationMatrix();
1133 rotatePhiIrregBox->rotateX(rotAngle.x());
1134 rotatePhiIrregBox->rotateY(rotAngle.y());
1135 rotatePhiIrregBox->rotateZ(rotAngle.z());
1138 solidEndCasing =
new G4IrregBox(strEndCasing.str(),(*emcEnd).zoomPoint);
1140 ostringstream strVEndCasing;
1141 strVEndCasing <<
"logicalEndCasing_1_" << i;
1142 logicEndCasing =
new G4LogicalVolume(solidEndCasing,fCasingMaterial,strVEndCasing.str());
1144 ostringstream strPEndCasing;
1145 strPEndCasing <<
"physicalEndCasing_1_" << i;
1146 physiEndCasing =
new G4PVPlacement(rotatePhiIrregBox,center,
1147 logicEndCasing,strPEndCasing.str(),logicEndPhi,
false,i,
CHECKIrreg);
1149 ostringstream strEndCrystal;
1150 strEndCrystal <<
"solidEndCrystal_1_" << i;
1153 solidEndCrystal =
new G4IrregBox(strEndCrystal.str(),(*emcEnd).cryPoint);
1155 ostringstream strVEndCrystal;
1156 strVEndCrystal <<
"logicalEndCrystal_1_" << i;
1157 logicEndCrystal =
new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,strVEndCrystal.str());
1159 ostringstream strPEndCrystal;
1160 strPEndCrystal <<
"physicalEndCrystal_1_" << i;
1161 physiEndCrystal =
new G4PVPlacement(0,G4ThreeVector(),logicEndCrystal,strPEndCrystal.str(),logicEndCasing,
false,i,
CHECKIrreg);
1163 logicEndCasing->SetVisAttributes(G4VisAttributes::Invisible);
1164 logicEndCrystal->SetVisAttributes(crystalVisAtt);
1165 logicEndCrystal->SetSensitiveDetector(besEMCSD);
1168 (*emcEnd).ReflectX();
1171 for(G4int i=0;i<35;i++)
1172 for (G4int j=0;j<8;j++)
1173 (*emcEnd).fPnt1[i][j].rotateZ(-90.*deg);
1175 solidEndPhi =
new G4Cons(
"solidEndPhi2",
1176 (*emcEnd).WorldRmin1, (*emcEnd).WorldRmax1, rmin2, rmax2,
1177 (*emcEnd).SectorDz/2,0*deg,22.5*deg-da);
1178 logicEndPhi =
new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial(
"Air"),
"logicalEndPhi2", 0, 0, 0);
1179 for(G4int i=0;i<2;i++)
1181 G4RotationMatrix *rotatePhi =
new G4RotationMatrix();
1182 rotatePhi->rotateZ(-i*180.*deg-90.*deg);
1183 ostringstream strEndPhi;
1184 strEndPhi <<
"physicalEndPhi" << i*8+7;
1185 physiEndPhi =
new G4PVPlacement(rotatePhi,G4ThreeVector(0,0,(*emcEnd).SectorZPosition),
1186 logicEndPhi,strEndPhi.str(),logicEnd,
false,i*8+7,
CHECKLV2);
1189 logicEndPhi->SetVisAttributes(endPhiVisAtt);
1191 for(G4int i=0;i<35;i++)
1193 ostringstream strEndCasing;
1194 strEndCasing <<
"solidEndCasing_2_" << i;
1197 G4ThreeVector newfPnt[8];
1198 G4ThreeVector center(0.0, 0.0, 0.0);
1199 G4ThreeVector rotAngle(0.0, 0.0, 0.0);
1203 emcEnd->
Zoom(newfPnt,zoomConst);
1205 G4RotationMatrix *rotatePhiIrregBox =
new G4RotationMatrix();
1206 rotatePhiIrregBox->rotateX(rotAngle.x());
1207 rotatePhiIrregBox->rotateY(rotAngle.y());
1208 rotatePhiIrregBox->rotateZ(rotAngle.z());
1211 solidEndCasing =
new G4IrregBox(strEndCasing.str(),(*emcEnd).zoomPoint);
1213 ostringstream strVEndCasing;
1214 strVEndCasing <<
"logicalEndCasing_2_" << i;
1215 logicEndCasing =
new G4LogicalVolume(solidEndCasing,fCasingMaterial,strVEndCasing.str());
1217 ostringstream strPEndCasing;
1218 strPEndCasing <<
"physicalEndCasing_2_" << i;
1219 physiEndCasing =
new G4PVPlacement(rotatePhiIrregBox,center,
1220 logicEndCasing,strPEndCasing.str(),logicEndPhi,
false,i,
CHECKIrreg);
1222 ostringstream strEndCrystal;
1223 strEndCrystal <<
"solidEndCrystal_2_" << i;
1226 solidEndCrystal =
new G4IrregBox(strEndCrystal.str(),(*emcEnd).cryPoint);
1228 ostringstream strVEndCrystal;
1229 strVEndCrystal <<
"logicalEndCrystal_2_" << i;
1230 logicEndCrystal =
new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,strVEndCrystal.str());
1232 ostringstream strPEndCrystal;
1233 strPEndCrystal <<
"physicalEndCrystal_2_" << i;
1234 physiEndCrystal =
new G4PVPlacement(0, G4ThreeVector(),logicEndCrystal,strPEndCrystal.str(),logicEndCasing,
false,i,
CHECKIrreg);
1236 logicEndCasing->SetVisAttributes(G4VisAttributes::Invisible);
1237 logicEndCrystal->SetVisAttributes(crystalVisAtt);
1238 logicEndCrystal->SetSensitiveDetector(besEMCSD);
1270 G4double rmax=(*besEMCGeometry).BSCRmax+2.*mm;
1271 solidSupportBar =
new G4Tubs(
"solidSupportBar0",
1272 rmax+(*besEMCGeometry).SPBarThickness1,
1273 rmax+(*besEMCGeometry).SPBarThickness+(*besEMCGeometry).SPBarThickness1,
1274 (*besEMCGeometry).BSCDz
1275 +(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz,
1279 logicSupportBar =
new G4LogicalVolume(solidSupportBar,stainlessSteel,
"logicalSupportBar0");
1281 physiSupportBar =
new G4PVPlacement(0,G4ThreeVector(),logicSupportBar,
"physicalSupportBar0",logMother,
false,0,
CHECKLV2);
1283 solidSupportBar1 =
new G4Tubs(
"solidSupportBar1",
1285 rmax+(*besEMCGeometry).SPBarThickness1,
1286 (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3,
1287 (*besEMCGeometry).BSCPhiDphi-(*besEMCGeometry).SPBarDphi/2,
1288 (*besEMCGeometry).SPBarDphi);
1290 logicSupportBar1 =
new G4LogicalVolume(solidSupportBar1,stainlessSteel,
"logicalSupportBar1");
1292 for(G4int i=0;i<(*besEMCGeometry).BSCNbPhi/2;i++)
1294 G4RotationMatrix *rotateSPBar =
new G4RotationMatrix();
1295 rotateSPBar->rotateZ((*besEMCGeometry).BSCPhiDphi-i*2*(*besEMCGeometry).BSCPhiDphi);
1296 ostringstream strSupportBar1;
1297 strSupportBar1 <<
"physicalSupportBar1_" << i;
1298 physiSupportBar1 =
new G4PVPlacement(rotateSPBar,G4ThreeVector(),
1299 logicSupportBar1,strSupportBar1.str(),logMother,
false,0,
CHECKLV2);
1303 solidEndRing =
new G4Tubs(
"solidEndRing",
1304 (*besEMCGeometry).EndRingRmin,
1305 (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr/2,
1306 (*besEMCGeometry).EndRingDz/2,
1310 solidGear =
new G4Tubs(
"solidGear",
1311 (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr/2,
1312 (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr,
1313 (*besEMCGeometry).EndRingDz/2,
1315 (*besEMCGeometry).BSCPhiDphi);
1318 solidTaperRing1 =
new G4Tubs(
"solidTaperRing1",
1319 (*besEMCGeometry).TaperRingRmin1,
1320 (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingThickness1,
1321 (*besEMCGeometry).TaperRingInnerLength/2,
1325 solidTaperRing2 =
new G4Cons(
"solidTaperRing2",
1326 (*besEMCGeometry).TaperRingRmin1,
1327 (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingThickness1,
1328 (*besEMCGeometry).TaperRingRmin2,
1329 (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr,
1330 (*besEMCGeometry).TaperRingDz/2,
1334 solidTaperRing3 =
new G4Cons(
"solidTaperRing3",
1335 (*besEMCGeometry).BSCRmax2,
1336 (*besEMCGeometry).BSCRmax2+(*besEMCGeometry).TaperRingOuterLength1,
1337 (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr,
1338 (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr+(*besEMCGeometry).TaperRingOuterLength,
1339 (*besEMCGeometry).TaperRingThickness3/2,
1343 logicEndRing =
new G4LogicalVolume(solidEndRing,stainlessSteel,
"logicalEndRing");
1344 logicGear =
new G4LogicalVolume(solidGear,stainlessSteel,
"logicalGear");
1345 logicTaperRing1 =
new G4LogicalVolume(solidTaperRing1,stainlessSteel,
"logicalTaperRing1");
1346 logicTaperRing2 =
new G4LogicalVolume(solidTaperRing2,stainlessSteel,
"logicalTaperRing2");
1347 logicTaperRing3 =
new G4LogicalVolume(solidTaperRing3,stainlessSteel,
"logicalTaperRing3");
1349 for(G4int i=0;i<2;i++)
1351 G4RotationMatrix *rotateSPRing =
new G4RotationMatrix();
1352 G4double zEndRing,z1,z2,z3;
1355 zEndRing = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz/2;
1356 z1 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3
1357 -(*besEMCGeometry).TaperRingDz-(*besEMCGeometry).TaperRingInnerLength/2;
1358 z2 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz/2;
1359 z3 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3/2;
1363 rotateSPRing->rotateY(180.*deg);
1364 zEndRing = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz/2);
1365 z1 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3
1366 -(*besEMCGeometry).TaperRingDz-(*besEMCGeometry).TaperRingInnerLength/2);
1367 z2 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz/2);
1368 z3 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3/2);
1371 ostringstream strEndRing;
1372 strEndRing <<
"physicalEndRing_" << i;
1373 physiEndRing =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,zEndRing),
1374 logicEndRing,strEndRing.str(),logMother,
false,0,
CHECKLV2);
1376 for(G4int j=0;j<(*besEMCGeometry).BSCNbPhi/2;j++)
1378 G4RotationMatrix *rotateGear =
new G4RotationMatrix();
1379 rotateGear->rotateZ((*besEMCGeometry).BSCPhiDphi/2-j*2*(*besEMCGeometry).BSCPhiDphi);
1381 ostringstream strGear;
1382 strGear <<
"physicalGear_" << i <<
"_" <<j;
1383 physiGear =
new G4PVPlacement(rotateGear,G4ThreeVector(0,0,zEndRing),
1384 logicGear,strGear.str(),logMother,
false,0,
CHECKLV2);
1387 ostringstream strTaperRing1;
1388 strTaperRing1 <<
"physicalTaperRing1_" << i;
1389 physiTaperRing1 =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z1),
1390 logicTaperRing1,strTaperRing1.str(),logMother,
false,0,
CHECKLV2);
1392 ostringstream strTaperRing2;
1393 strTaperRing2 <<
"physicalTaperRing2_" << i;
1394 physiTaperRing2 =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z2),
1395 logicTaperRing2,strTaperRing2.str(),logMother,
false,0,
CHECKLV2);
1397 ostringstream strTaperRing3;
1398 strTaperRing3 <<
"physicalTaperRing3_" << i;
1399 physiTaperRing3 =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z3),
1400 logicTaperRing3,strTaperRing3.str(),logMother,
false,0,
CHECKLV2);