4 #include "G4SystemOfUnits.hh"
5 #include "G4ThreeVector.hh"
6 #include "G4RotationMatrix.hh"
7 #include "G4Transform3D.hh"
9 #include "G4Material.hh"
10 #include "G4NistManager.hh"
15 #include "G4Sphere.hh"
17 #include "G4UnionSolid.hh"
18 #include "G4SubtractionSolid.hh"
20 #include "G4LogicalVolume.hh"
21 #include "G4PVPlacement.hh"
22 #include "G4PVReplica.hh"
24 #include "G4LogicalSkinSurface.hh"
26 #include "G4VisAttributes.hh"
28 #include "G4SDManager.hh"
46 G4cout <<
"**** Construct egg-shaped HyperK Detector ****" << G4endl;
57 G4LogicalVolume* eggShapedHyperKLV
58 =
new G4LogicalVolume(
new G4Box(
"EggShapedHyperKBox",
64 eggShapedHyperKLV->SetVisAttributes(G4VisAttributes::Invisible);
66 new G4LogicalSkinSurface(
"WaterBSSurface",eggShapedHyperKLV,
OpWaterBSSurface);
74 G4LogicalVolume* blackSheetZLV
75 =
new G4LogicalVolume(
new G4Box(
"blackSheetZ",
87 new G4PVPlacement(0,G4ThreeVector(0,0, z),blackSheetZLV,
89 new G4PVPlacement(0,G4ThreeVector(0,0,-z),blackSheetZLV,
104 G4RotationMatrix rotm = G4RotationMatrix();
105 rotm.rotateZ(180.*degree);
107 G4VSolid* waterTank_union
108 =
new G4UnionSolid(
"Union",waterTank_top,waterTank_bot,
113 =
new G4LogicalVolume(waterTank_union,
FindMaterial(
"G4_WATER"),
"Tank");
114 waterTankLV->SetVisAttributes(G4VisAttributes::Invisible);
119 G4RotationMatrix* g4rot;
120 G4LogicalVolume* pmtCellLV;
133 g4rot =
new G4RotationMatrix();
134 g4rot->rotateY(90.*deg);
140 new G4PVPlacement(g4rot,
141 G4ThreeVector(r,0.,0.),
155 new G4PVPlacement(g4rot,
156 G4ThreeVector(r,0.,0.),
166 g4rot =
new G4RotationMatrix();
167 g4rot->rotateY(-90.*deg);
172 G4double angle = -phi + dphi;
179 G4double x = r * std::cos(angle);
180 G4double y = r * std::sin(angle);
185 new G4PVPlacement(g4rot, G4ThreeVector(x,y,z),
193 x = r * std::cos(angle);
194 y = r * std::sin(angle);
199 new G4PVPlacement(g4rot, G4ThreeVector(x,y,z),
219 x = r * std::cos(angle);
220 y = r * std::sin(angle);
225 new G4PVPlacement(g4rot, G4ThreeVector(x,y,z),
233 x = r * std::cos(angle);
234 y = r * std::sin(angle);
239 new G4PVPlacement(g4rot, G4ThreeVector(x,y,z),
249 g4rot =
new G4RotationMatrix();
250 g4rot->rotateY(180.*deg);
263 g4rot =
new G4RotationMatrix();
264 g4rot->rotateX(-90.*deg);
266 new G4PVPlacement(g4rot, G4ThreeVector(0.,0.,0.),
275 new G4PVPlacement(g4rot, G4ThreeVector(0.,0.,0.),
284 g4rot =
new G4RotationMatrix();
285 g4rot->rotateX(90.*deg);
287 new G4PVPlacement(g4rot, G4ThreeVector(0.,0.,0.),
296 new G4PVPlacement(g4rot, G4ThreeVector(0.,0.,0.),
305 return eggShapedHyperKLV;
309 G4double waterTank_OffSet)
312 G4double cosPhi = std::sqrt(1.-sinPhi*sinPhi);
314 G4double sinPhiHalf = std::sqrt((1.-cosPhi)/2.);
315 G4double cosPhiHalf = std::sqrt((1.+cosPhi)/2.);
317 G4double phi = std::asin(sinPhi);
319 G4Trap* waterTank_trap
320 =
new G4Trap(
"TankTrap",
323 waterTank_Radius-waterTank_OffSet,
324 waterTank_Radius*cosPhi-waterTank_OffSet,
327 waterTank_Radius-waterTank_OffSet,
328 waterTank_Radius*cosPhi-waterTank_OffSet,
331 const G4double epsilon = 1*mm;
332 G4VSolid* waterTank_slice
333 =
new G4SubtractionSolid(
"TankSlice",
334 new G4Tubs(
"WaterTubs",
338 new G4Box(
"WaterBox",
339 waterTank_Radius*cosPhiHalf,
340 waterTank_Radius*sinPhiHalf,
343 G4RotationMatrix rotm = G4RotationMatrix();
344 rotm.rotateZ(phi/2.);
346 G4VSolid* waterTank_union1
347 =
new G4UnionSolid(
"Union1",waterTank_trap,waterTank_slice,
348 G4Transform3D(rotm,G4ThreeVector(-waterTank_OffSet,
352 rotm = G4RotationMatrix();
353 rotm.rotateZ(phi/2.);
354 rotm.rotateY(180.*degree);
356 G4VSolid* waterTank_union2
357 =
new G4UnionSolid(
"Union2",waterTank_union1,waterTank_slice,
358 G4Transform3D(rotm,G4ThreeVector(waterTank_OffSet,
361 return waterTank_union2;
373 G4bool inner =
false;
376 G4double sinPhi = height/radius;
378 G4double phi = std::asin(sinPhi);
379 G4int nphi = (G4int)(radius*phi/pitchR);
395 phi = nphi * pitchR/radius;
397 G4double dphi = pitchR/radius;
400 G4int nz = (G4int)(length/pitchZ);
401 length = nz * pitchZ;
403 G4LogicalVolume* pmtAnnulusLV
404 =
new G4LogicalVolume(
new G4Tubs(
"PMTAnnulus",
405 radius-2.*expose,radius,
410 pmtAnnulusLV->SetVisAttributes(G4VisAttributes::Invisible);
412 G4LogicalVolume* blackSheetALV = NULL;
415 new G4LogicalVolume(
new G4Tubs(
"blackSheetA",
425 G4LogicalVolume* pmtRingLV
426 =
new G4LogicalVolume(
new G4Tubs(
"PMTRing",
427 radius-2.*expose,radius,
432 pmtRingLV->SetVisAttributes(G4VisAttributes::Invisible);
434 G4LogicalVolume* pmtCellLV
435 =
new G4LogicalVolume(
new G4Tubs(
"PMTCell",
436 radius-2.*expose,radius,
441 pmtCellLV->SetVisAttributes(G4VisAttributes::Invisible);
467 G4VPhysicalVolume* pmtRingPV
468 =
new G4PVReplica(
"PMTRing",
475 new G4PVReplica(
"PMTCell",
483 G4RotationMatrix* rotm =
new G4RotationMatrix();
484 rotm->rotateZ(-phi/2.);
485 if(!top)rotm->rotateZ(180.*degree);
496 rotm =
new G4RotationMatrix();
497 rotm->rotateZ(phi/2.);
498 if(!top)rotm->rotateZ(180.*degree);
499 rotm->rotateY(180.*degree);
513 G4LogicalVolume* pmtCellLV
514 =
new G4LogicalVolume(
new G4Box(
"PMTCell",
520 pmtCellLV->SetVisAttributes(G4VisAttributes::Invisible);
522 G4RotationMatrix* rotm =
new G4RotationMatrix();
523 rotm->rotateY(180.*degree);
527 G4ThreeVector xv = G4ThreeVector(x,0.,0.);
535 G4ThreeVector yv = G4ThreeVector(0.,y,0.);
540 G4ThreeVector dv = ov + xv + yv;
545 yv = G4ThreeVector(0.,y,0.);
556 yv = G4ThreeVector(0.,y,0.);
561 G4ThreeVector dv = ov + xv + yv;
566 yv = G4ThreeVector(0.,y,0.);
574 G4LogicalVolume* pmtSlabLV
575 =
new G4LogicalVolume(
new G4Box(
"PMTSlab",
581 pmtSlabLV->SetVisAttributes(G4VisAttributes::Invisible);
583 new G4PVReplica(
"PMTCell",
594 new G4PVPlacement(0, G4ThreeVector(xpos,ypos, zpos),
596 new G4PVPlacement(rotm,G4ThreeVector(xpos,ypos,-zpos),
600 new G4PVPlacement(0, G4ThreeVector(xpos,ypos, zpos),
602 new G4PVPlacement(rotm,G4ThreeVector(xpos,ypos,-zpos),
608 xv = G4ThreeVector(x,0.,0.);
621 G4bool inner =
false;
624 G4int nx = (G4int)(2.*width/pitch);
629 G4double xlength = nx * pitch;
631 G4double zlength = nz * pitch;
633 G4LogicalVolume* pmtSlabLV
634 =
new G4LogicalVolume(
new G4Box(
"PMTSlab",
640 pmtSlabLV->SetVisAttributes(G4VisAttributes::Invisible);
642 G4LogicalVolume* blackSheetYLV = NULL;
645 new G4LogicalVolume(
new G4Box(
"blackSheetY",
655 G4LogicalVolume* pmtSliceLV
656 =
new G4LogicalVolume(
new G4Box(
"PMTSlice",
662 pmtSliceLV->SetVisAttributes(G4VisAttributes::Invisible);
664 G4LogicalVolume* pmtCellLV
665 =
new G4LogicalVolume(
new G4Box(
"PMTCell",
671 pmtCellLV->SetVisAttributes(G4VisAttributes::Invisible);
673 G4VPhysicalVolume* pmtSlicePV
674 =
new G4PVReplica(
"PMTSlice",
681 new G4PVReplica(
"PMTCell",
688 G4double xpos = 0.0*mm;
690 G4double zpos = 0.0*mm;
693 new G4PVPlacement(0,G4ThreeVector(xpos,ypos,zpos),
696 if (inner)
new G4PVPlacement(0,G4ThreeVector(xpos,ypos,zpos),
700 G4RotationMatrix* rotm =
new G4RotationMatrix();
701 rotm->rotateZ(180.*degree);
702 new G4PVPlacement(rotm,G4ThreeVector(xpos,ypos,zpos),
705 if (inner)
new G4PVPlacement(0,G4ThreeVector(xpos,ypos,zpos),
720 if (name ==
"G4_POLYETHYLENE")
return FindMaterial(
"Blacksheet");
721 G4Material* material = G4Material::GetMaterial(name,
true);
G4LogicalVolume * ConstructPMT(G4String, G4String, G4String detectorElement="tank")
G4String WCODCollectionName
G4VSolid * ConstructHalf(G4double, G4double)
G4LogicalVolume * ConstructEndWallPMT()
G4double waterTank_Height
G4double outerPMT_TopRpitch
G4double waterTank_LowerB
G4Material * FindMaterial(G4String)
G4LogicalVolume * waterTankLV
G4LogicalVolume * ConstructEggShapedHyperK()
G4String WCIDCollectionName
G4LogicalVolume * ConstructRadialPMT(G4bool, G4double, G4double, G4double, G4double, G4double, G4double)
G4double waterTank_Length
G4double waterTank_UpperA
G4OpticalSurface * OpWaterBSSurface
G4double blackSheetThickness
G4LogicalVolume * ConstructCeilingPMT(G4bool, G4double, G4double, G4double, G4double)
G4double outerPMT_BotRpitch