12 #include <Geant4/G4Box.hh>
13 #include <Geant4/G4Colour.hh>
14 #include <Geant4/G4LogicalVolume.hh>
15 #include <Geant4/G4Material.hh>
16 #include <Geant4/G4NistManager.hh>
17 #include <Geant4/G4PVPlacement.hh>
18 #include <Geant4/G4RotationMatrix.hh>
19 #include <Geant4/G4RunManager.hh>
20 #include <Geant4/G4String.hh>
21 #include <Geant4/G4SystemOfUnits.hh>
22 #include <Geant4/G4ThreeVector.hh>
23 #include <Geant4/G4Transform3D.hh>
24 #include <Geant4/G4Trap.hh>
25 #include <Geant4/G4Types.hh>
26 #include <Geant4/G4UnionSolid.hh>
27 #include <Geant4/G4VisAttributes.hh>
28 #include <Geant4/G4ios.hh>
44 , nHcal2Layers(nHcal1Layers)
45 , hcal2ScintSizeX(2.54 * 26.1 *
cm)
47 hcal2ScintSizeY(0.85 *
cm)
49 hcal2ScintSizeZ(2.54 * 29.53 *
cm)
51 hcal1ScintSizeX(2.54 * 12.43 *
cm)
53 hcal1ScintSizeY(0.85 *
cm)
55 hcal1ScintSizeZ(2.54 * 17.1 *
cm)
58 , hcal2TiltAngle(0.14)
63 hcal1RadiusIn(1855 *
mm)
64 , hcal2RadiusIn(hcal1RadiusIn + hcal1ScintSizeX)
67 hcalBoxSizeX(1.1 * (hcal2ScintSizeX + hcal1ScintSizeX))
68 , hcalBoxSizeY(2.54 * 40.0 *
cm)
70 hcalBoxSizeZ(1.1 * hcal2ScintSizeZ)
71 , hcalBoxRotationAngle_z(0.0 *
rad)
73 hcalBoxRotationAngle_y(0.0 *
rad)
75 hcal2Abs_dxa(2.54 * 27.1 *
cm)
77 hcal2Abs_dxb(hcal2Abs_dxa)
78 , hcal2Abs_dya(2.54 * 1.099 *
cm)
79 , hcal2Abs_dyb(2.54 * 1.776 *
cm)
80 , hcal2Abs_dz(hcal2ScintSizeZ)
81 , hcal1Abs_dxa(hcal1ScintSizeX)
83 hcal1Abs_dxb(hcal1ScintSizeX)
84 , hcal1Abs_dya(2.54 * 0.787 *
cm)
85 , hcal1Abs_dyb(2.54 * 1.115 *
cm)
86 , hcal1Abs_dz(hcal1ScintSizeZ)
87 , hcalJunctionSizeX(2.54 * 1.0 *
cm)
88 , hcalJunctionSizeY(hcal2ScintSizeY)
89 , hcalJunctionSizeZ(hcal2Abs_dz)
92 , logicHcalBox(nullptr)
93 , solidHcalBox(nullptr)
94 , physiHcalBox(nullptr)
95 , logicHcal2ScintLayer(nullptr)
96 , logicHcal1ScintLayer(nullptr)
97 , logicHcal2AbsLayer(nullptr)
98 , logicHcal1AbsLayer(nullptr)
130 G4NistManager* nist = G4NistManager::Instance();
132 world_mat = nist->FindOrBuildMaterial(
"G4_AIR");
134 steel = nist->FindOrBuildMaterial(
"G4_Fe");
135 scint_mat = nist->FindOrBuildMaterial(
"G4_POLYSTYRENE");
137 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
146 G4bool checkOverlaps =
true;
159 G4RotationMatrix rotBox = G4RotationMatrix();
164 G4Transform3D boxTransform = G4Transform3D(rotBox, boxVector);
175 G4VisAttributes* hcalBoxVisAtt =
new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
176 hcalBoxVisAtt->SetVisibility(
true);
184 G4Box* hcal2ScintLayer =
new G4Box(
"hcal2ScintLayer",
188 new G4LogicalVolume(hcal2ScintLayer,
193 G4VisAttributes* scintVisAtt =
new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
194 scintVisAtt->SetVisibility(
true);
199 G4double outer1UpDz = 649.8 *
mm;
200 G4double outer1UpDy1 = 2 * 0.35 *
cm;
201 G4double outer1UpDx2 = 179.3 *
mm;
202 G4double outer1UpDx4 = 113.2 *
mm;
204 G4Trap* outer1USheetSolid =
new G4Trap(
"outer1USheet",
205 outer1UpDy1, outer1UpDz,
206 outer1UpDx2, outer1UpDx4);
208 G4LogicalVolume* logicOuter1USheet =
new G4LogicalVolume(outer1USheetSolid,
213 G4VisAttributes* scintSheetVisAtt =
new G4VisAttributes(G4Colour(0.5, 0.5, 0.0));
214 scintSheetVisAtt->SetVisibility(
true);
215 scintSheetVisAtt->SetForceSolid(
true);
217 logicOuter1USheet->SetVisAttributes(scintSheetVisAtt);
221 G4ThreeVector threeVecOuter1U_1 = G4ThreeVector(0 *
cm, 0 *
cm, -0.252 * (outer1UpDx2 + outer1UpDx4));
222 G4RotationMatrix rot1U_1 = G4RotationMatrix();
223 rot1U_1.rotateZ(90 *
deg);
224 rot1U_1.rotateX(-90 *
deg);
226 G4Transform3D transformOuter1U_1 = G4Transform3D(rot1U_1, threeVecOuter1U_1);
228 new G4PVPlacement(transformOuter1U_1,
238 G4ThreeVector threeVecOuter1U_2 = G4ThreeVector(0 *
cm, 0 *
cm, 0.252 * (outer1UpDx2 + outer1UpDx4));
239 G4RotationMatrix rot1U_2 = G4RotationMatrix();
240 rot1U_2.rotateZ(90 *
deg);
241 rot1U_2.rotateX(90 *
deg);
243 G4Transform3D transformOuter1U_2 = G4Transform3D(rot1U_2, threeVecOuter1U_2);
245 new G4PVPlacement(transformOuter1U_2,
254 G4double outer2UpDz = 0.5 * 649.8 *
mm;
255 G4double outer2UpTheta = 8.8 * M_PI / 180.;
256 G4double outer2UpPhi = 0.0 * M_PI / 180.;
257 G4double outer2UpDy1 = 0.35 *
cm;
258 G4double outer2UpDy2 = 0.35 *
cm;
259 G4double outer2UpDx1 = 0.5 * 179.3 *
mm, outer2UpDx2 = 0.5 * 179.3 *
mm;
260 G4double outer2UpDx3 = 0.5 * 113.2 *
mm, outer2UpDx4 = 0.5 * 113.2 *
mm;
261 G4double outer2UpAlp1 = 0. * M_PI / 180., outer2UpAlp2 = 0. * M_PI / 180;
263 G4Trap* outer2USheetSolid =
new G4Trap(
"outer2USheet",
276 G4LogicalVolume* logicOuter2USheet =
new G4LogicalVolume(outer2USheetSolid,
280 logicOuter2USheet->SetVisAttributes(scintSheetVisAtt);
284 G4ThreeVector threeVecOuter2U_1 = G4ThreeVector(0 *
cm, 0 *
cm, -0.755 * (outer1UpDx2 + outer1UpDx4));
285 G4RotationMatrix rot2U_1 = G4RotationMatrix();
286 rot2U_1.rotateY(-90 *
deg);
288 G4Transform3D transformOuter2U_1 = G4Transform3D(rot2U_1, threeVecOuter2U_1);
290 new G4PVPlacement(transformOuter2U_1,
300 G4ThreeVector threeVecOuter2U_2 = G4ThreeVector(0 *
cm, 0 *
cm, 0.755 * (outer1UpDx2 + outer1UpDx4));
301 G4RotationMatrix rot2U_2 = G4RotationMatrix();
302 rot2U_2.rotateY(-90 *
deg);
303 rot2U_2.rotateX(180 *
deg);
305 G4Transform3D transformOuter2U_2 = G4Transform3D(rot2U_2, threeVecOuter2U_2);
307 new G4PVPlacement(transformOuter2U_2,
315 G4Trap* hcal2AbsLayer =
316 new G4Trap(
"hcal2AbsLayer",
321 G4Box* hcalJunction =
new G4Box(
"HcalJunction",
326 G4RotationMatrix rotJunction = G4RotationMatrix();
327 rotJunction.rotateZ(90 *
deg);
328 rotJunction.rotateX(0 *
deg);
329 G4Transform3D transformJunction = G4Transform3D(rotJunction, threeVecJunction);
332 G4UnionSolid* hcal2AbsLayerJunct =
new G4UnionSolid(
"hcal2AbsLayerJunct", hcal2AbsLayer, hcalJunction, transformJunction);
339 G4VisAttributes* hcal2AbsVisAtt =
new G4VisAttributes(G4Colour(0.5, 0.5, 1.0));
340 hcal2AbsVisAtt->SetVisibility(
true);
353 G4double xPadding = 0.0;
354 G4double yPadding = 0.0;
355 G4double tiltPadding = 0.0;
363 G4double xposShift = rAbsLayerCenter * (cos(theta) - 1.0);
364 G4double yposShift = rAbsLayerCenter * sin(theta);
365 xPadding = 0.013 * RmidAbsLayerX * LayerNum;
366 G4ThreeVector absTrans = G4ThreeVector(RmidAbsLayerX + xposShift - xPadding, yposShift, 0);
367 G4RotationMatrix rotAbsLayer = G4RotationMatrix();
368 rotAbsLayer.rotateY(90 *
deg);
369 rotAbsLayer.rotateX(90 *
deg);
370 rotAbsLayer.rotateY(-90 *
deg);
371 tiltPadding = LayerNum * 0.005 *
rad;
372 rotAbsLayer.rotateZ((iLayer +
nHcal2Layers / 2) * 0.02 *
rad + tiltPadding);
374 G4Transform3D transformAbs = G4Transform3D(rotAbsLayer, absTrans);
376 new G4PVPlacement(transformAbs,
387 G4cout <<
"M_PI: " << M_PI <<
" theta: " << theta <<
" TileAngle: " << theta2 << G4endl;
388 xposShift = rScintLayerCenter * (cos(theta) - 1.0);
389 yposShift = rScintLayerCenter * sin(theta);
390 G4ThreeVector myTrans = G4ThreeVector(RmidScintLayerX + xposShift - xPadding, yposShift + 0.3 *
cm, 0);
391 G4RotationMatrix rotm = G4RotationMatrix();
392 rotm.rotateZ((iLayer +
nHcal2Layers / 2 + 1) * 0.020 *
rad + tiltPadding);
393 G4Transform3D
transform = G4Transform3D(rotm, myTrans);
395 G4cout <<
" iLayer " << iLayer << G4endl;
397 new G4PVPlacement(transform,
411 G4Box* hcal1ScintLayer =
new G4Box(
"hcal1ScintLayer",
415 new G4LogicalVolume(hcal1ScintLayer,
424 G4double inner1UpDz = 316.8 *
mm;
425 G4double inner1UpDy1 = 2 * 0.35 *
cm;
426 G4double inner1UpDx2 = 108.6 *
mm;
427 G4double inner1UpDx4 = 77.4 *
mm;
429 G4Trap* inner1USheetSolid =
new G4Trap(
"inner1USheet",
430 inner1UpDy1, inner1UpDz,
431 inner1UpDx2, inner1UpDx4);
433 G4LogicalVolume* logicInner1USheet =
new G4LogicalVolume(inner1USheetSolid,
436 logicInner1USheet->SetVisAttributes(scintSheetVisAtt);
440 G4ThreeVector threeVecInner1U_1_inner = G4ThreeVector(0 *
cm, 0 *
cm, -0.252 * (inner1UpDx2 + inner1UpDx4));
442 G4Transform3D transformInner1U_1 = G4Transform3D(rot1U_1, threeVecInner1U_1_inner);
444 new G4PVPlacement(transformInner1U_1,
454 G4ThreeVector threeVecInner1U_2_inner = G4ThreeVector(0 *
cm, 0 *
cm, 0.252 * (inner1UpDx2 + inner1UpDx4));
459 G4Transform3D transformInner1U_2 = G4Transform3D(rot1U_2, threeVecInner1U_2_inner);
461 new G4PVPlacement(transformInner1U_2,
471 G4double inner2UpDz = 0.5 * 316.8 *
mm;
472 G4double inner2UpTheta = 8.8 * M_PI / 180.;
473 G4double inner2UpPhi = 0.0 * M_PI / 180.;
474 G4double inner2UpDy1 = 0.35 *
cm;
475 G4double inner2UpDy2 = 0.35 *
cm;
476 G4double inner2UpDx1 = 0.5 * 108.6 *
mm, inner2UpDx2 = 0.5 * 108.6 *
mm;
477 G4double inner2UpDx3 = 0.5 * 77.4 *
mm, inner2UpDx4 = 0.5 * 77.4 *
mm;
478 G4double inner2UpAlp1 = 0. * M_PI / 180., inner2UpAlp2 = 0. * M_PI / 180;
480 G4Trap* inner2USheetSolid =
new G4Trap(
"inner2USheet",
493 G4LogicalVolume* logicInner2USheet =
new G4LogicalVolume(inner2USheetSolid,
497 logicInner2USheet->SetVisAttributes(scintSheetVisAtt);
501 G4ThreeVector threeVecInner2U_1_inner = G4ThreeVector(0 *
cm, 0 *
cm, -0.755 * (inner1UpDx2 + inner1UpDx4));
505 G4Transform3D transformInner2U_1 = G4Transform3D(rot2U_1, threeVecInner2U_1_inner);
507 new G4PVPlacement(transformInner2U_1,
518 G4ThreeVector threeVecInner2U_2_inner = G4ThreeVector(0 *
cm, 0 *
cm, 0.755 * (inner1UpDx2 + inner1UpDx4));
523 G4Transform3D transformInner2U_2 = G4Transform3D(rot2U_2, threeVecInner2U_2_inner);
525 new G4PVPlacement(transformInner2U_2,
542 G4Trap* hcal1AbsLayer =
543 new G4Trap(
"hcal1AbsLayer",
562 yPadding = -2.54 * 0.8 *
cm;
569 G4double xposShift = rAbsLayerCenter * (cos(theta) - 1.0);
570 G4double yposShift = rAbsLayerCenter * sin(theta);
571 xPadding = 0.005 * RmidAbsLayerX * LayerNum - 2.54 * 1.9 *
cm;
572 G4ThreeVector absTrans = G4ThreeVector(-RmidAbsLayerX * cos(theta) + xposShift - xPadding, yposShift + yPadding, 0);
573 G4RotationMatrix rotAbsLayer = G4RotationMatrix();
574 rotAbsLayer.rotateY(90 *
deg);
575 rotAbsLayer.rotateX(90 *
deg);
576 rotAbsLayer.rotateY(-90 *
deg);
577 tiltPadding = LayerNum * 0.005 *
rad;
578 rotAbsLayer.rotateZ((theta - theta2) *
rad + tiltPadding);
581 G4Transform3D transformAbs = G4Transform3D(rotAbsLayer, absTrans);
583 new G4PVPlacement(transformAbs,
599 xposShift = rAbsLayerCenter * (cos(theta) - 1.0);
600 yposShift = rAbsLayerCenter * sin(theta);
601 G4ThreeVector myTrans = G4ThreeVector(-RmidAbsLayerX * cos(theta) + xposShift - xPadding, yposShift + yPadding, 0);
603 G4RotationMatrix rotm = G4RotationMatrix();
604 rotm.rotateZ((theta - theta2 + 0.01) *
rad + tiltPadding);
606 G4Transform3D
transform = G4Transform3D(rotm, myTrans);
608 G4cout <<
" iLayer " << iLayer << G4endl;
610 new G4PVPlacement(transform,
638 G4RunManager::GetRunManager()->PhysicsHasBeenModified();
650 G4int ncr = fabs(ncross);
660 alpha = (360. /
nHcal2Layers * M_PI / 180.) * (ncr - 1) / 2.0;
667 G4double sinbSide = sin(alpha) * bSide / (sqrt(bSide * bSide + cSide * cSide - 2 * bSide * cSide * cos(alpha)));
668 G4double beta = asin(sinbSide);
677 sinbSide = sin(alpha) * bSide / (sqrt(bSide * bSide + cSide * cSide - 2.0 * bSide * cSide * cos(alpha)));
678 beta = asin(sinbSide);
682 G4cout <<
" alpha : " << alpha << G4endl;
683 G4cout <<
" SetTitlViaNCross(" << ncross <<
") setting the outer hcal slat tilt angle to : " <<
hcal2TiltAngle <<
" radian" << G4endl;
684 G4cout <<
" SetTitlViaNCross(" << ncross <<
") setting the inner hcal slat tilt angle to : " <<
hcal1TiltAngle <<
" radian" << G4endl;
693 G4cout <<
"In SetOuterHcalDPhi: " <<
hcal2DPhi <<
" is set!!! " << G4endl;
699 G4cout <<
"In SetOuterPlateTiltAngle: " <<
hcal2TiltAngle <<
" is set!!! " << G4endl;
705 G4cout <<
"In SetInnerHcalDPhi: " <<
hcal1DPhi <<
" is set!!! " << G4endl;
711 G4cout <<
"In SetInnerPlateTiltAngle: " <<
hcal1TiltAngle <<
" is set!!! " << G4endl;