6 #include <phparameter/PHParameters.h>
18 #include <Geant4/G4Box.hh>
19 #include <Geant4/G4LogicalVolume.hh>
20 #include <Geant4/G4PVPlacement.hh>
21 #include <Geant4/G4PhysicalConstants.hh>
22 #include <Geant4/G4RotationMatrix.hh>
23 #include <Geant4/G4String.hh>
24 #include <Geant4/G4SubtractionSolid.hh>
25 #include <Geant4/G4SystemOfUnits.hh>
26 #include <Geant4/G4ThreeVector.hh>
27 #include <Geant4/G4Transform3D.hh>
28 #include <Geant4/G4Tubs.hh>
29 #include <Geant4/G4Types.hh>
30 #include <Geant4/G4VPhysicalVolume.hh>
45 , m_Params(parameters)
47 , m_Angle(M_PI_4 * radian)
49 , m_HPlate(400.0 *
mm)
50 , m_WPlate(100.0 *
mm)
51 , m_TAbsorber(5.0 *
mm)
52 , m_HAbsorber(150.0 *
mm)
53 , m_WAbsorber(100.0 *
mm)
55 , m_HFiber(400.0 *
mm)
56 , m_WFiber(100.0 *
mm)
57 , m_GFiber(0.0001 *
mm)
65 , m_PlaceHole(122.56 *
mm)
71 , m_ActiveFlag(m_Params->get_int_param(
"active"))
72 , m_AbsorberActiveFlag(m_Params->get_int_param(
"absorberactive"))
73 , m_SupportActiveFlag(m_Params->get_int_param(
"supportactive"))
75 , m_SuperDetector(
"NONE")
83 G4LogicalVolume* mylogvol = volume->GetLogicalVolume();
118 std::cout <<
"PHG4ZDCDetector: Begin Construction" << std::endl;
121 if (
m_Layer != PHG4ZDCDefs::NORTH &&
124 std::cout <<
"use either PHG4ZDCDefs::NORTH or PHG4ZDCDefs::SOUTH for ZDC Subsystem" << std::endl;
139 G4double RTT = 1. / sin(
m_Angle);
140 G4double First_Pos = -RTT * Det_Length / 2;
141 G4double Room = 3.5 *
mm;
144 G4VSolid* ExitWindow_nocut_solid =
new G4Tubs(G4String(
"ExitWindow_nocut_solid"),
147 G4VSolid* Hole_solid =
new G4Tubs(G4String(
"Hole_solid"),
149 G4VSolid* ExitWindow_1cut_solid =
new G4SubtractionSolid(
"ExitWindow_1cut_solid", ExitWindow_nocut_solid, Hole_solid,
nullptr, G4ThreeVector(
m_PlaceHole, 0, 0));
151 G4VSolid* ExitWindow_2cut_solid =
new G4SubtractionSolid(
"ExitWindow_2cut_solid", ExitWindow_1cut_solid, Hole_solid,
nullptr, G4ThreeVector(-
m_PlaceHole, 0, 0));
153 G4LogicalVolume* ExitWindow_log =
new G4LogicalVolume(ExitWindow_2cut_solid,
GetDetectorMaterial(
"G4_STAINLESS-STEEL"), G4String(
"ExitWindow_log"),
nullptr,
nullptr,
nullptr);
157 G4RotationMatrix Window_rotm;
162 if (
m_Layer == PHG4ZDCDefs::NORTH)
165 ExitWindow_log,
"Window_North", logicWorld,
false, PHG4ZDCDefs::NORTH,
OverlapCheck());
168 else if (
m_Layer == PHG4ZDCDefs::SOUTH)
171 ExitWindow_log,
"Window_South", logicWorld,
false, PHG4ZDCDefs::SOUTH,
OverlapCheck());
178 G4double Mother_Z = Mother_2Z / 2. + Room;
179 G4VSolid* ZDC_envelope_solid =
new G4Box(G4String(
"ZDC_envelope_solid"),
184 G4LogicalVolume* ZDC_envelope_log =
new G4LogicalVolume(ZDC_envelope_solid, WorldMaterial, G4String(
"ZDC_envelope_log"),
nullptr,
nullptr,
nullptr);
190 G4RotationMatrix ZDC_rotm;
196 G4VSolid* fiber_plate_solid =
new G4Box(G4String(
"fiber_plate_solid"),
201 G4LogicalVolume* fiber_plate_log =
new G4LogicalVolume(fiber_plate_solid, WorldMaterial, G4String(
"fiber_plate_log"),
nullptr,
nullptr,
nullptr);
204 G4VSolid* fb_plate_solid =
new G4Box(G4String(
"fb_plate_solid"),
209 G4LogicalVolume* fb_plate_log =
new G4LogicalVolume(fb_plate_solid, Fe, G4String(
"fb_plate_log"),
nullptr,
nullptr,
nullptr);
214 G4VSolid* absorber_solid =
new G4Box(G4String(
"absorber_solid"),
219 G4LogicalVolume* absorber_log =
new G4LogicalVolume(absorber_solid, W, G4String(
"absorber_log"),
nullptr,
nullptr,
nullptr);
225 G4VSolid* SMD_solid =
new G4Box(G4String(
"SMD_solid"),
230 G4LogicalVolume* SMD_log =
new G4LogicalVolume(SMD_solid, WorldMaterial, G4String(
"SMD_log"),
nullptr,
nullptr,
nullptr);
233 G4double scintx = 15 *
mm;
234 G4double scinty = 20 *
mm;
235 G4VSolid* Scint_solid =
new G4Box(G4String(
"Scint_solid"),
240 G4LogicalVolume* Scint_log =
new G4LogicalVolume(Scint_solid, Scint, G4String(
"Scint_log"),
nullptr,
nullptr,
nullptr);
245 double scint_XPos = -
m_WSMD / 2.;
246 double scint_Xstep = scintx / 2.;
247 double scint_Ystep = scinty / 2.;
251 for (
int i = 0;
i < Nx;
i++)
253 scint_XPos += scint_Xstep;
254 double scint_YPos = -
m_HSMD / 2.;
255 for (
int j = 0;
j < Ny;
j++)
257 int copyno = Nx *
j +
i;
258 scint_YPos += scint_Ystep;
259 G4RotationMatrix SMDRotation;
260 new G4PVPlacement(G4Transform3D(SMDRotation, G4ThreeVector(scint_XPos, scint_YPos, 0.0)),
266 scint_YPos += scint_Ystep;
268 scint_XPos += scint_Xstep;
272 G4VSolid* single_fiber_solid =
new G4Tubs(G4String(
"single_fiber_solid"),
275 G4LogicalVolume* single_fiber_log =
new G4LogicalVolume(single_fiber_solid, PMMA, G4String(
"single_fiber_log"),
nullptr,
nullptr,
nullptr);
280 G4RotationMatrix* FiberRotation =
new G4RotationMatrix();
281 FiberRotation->rotateX(90. *
deg);
284 G4double fiber_XPos = -
m_WFiber / 2.;
285 G4double fiber_step =
m_DFiber / 2.;
288 for (
int i = 0;
i < Nfiber;
i++)
290 fiber_XPos += fiber_step;
293 new G4PVPlacement(FiberRotation, G4ThreeVector(fiber_XPos, 0.0, 0.0),
295 G4String(
"single_fiber_scint"),
298 fiber_XPos += fiber_step;
302 G4RotationMatrix* PlateRotation =
new G4RotationMatrix();
304 PlateRotation->rotateX(-
m_Angle);
307 G4double Plate_Step =
m_TPlate * RTT;
309 G4double Gap_Step = TGap * RTT;
310 G4double SMD_Step = m_TSMD * RTT;
311 G4double ZPos = First_Pos - Plate_Step / 2.;
322 int copyno_plate = 0;
328 ZPos += (SMD_Step / 2.);
329 new G4PVPlacement(PlateRotation, G4ThreeVector(0.0, SMD_YPos, SMD_ZPos + ZPos),
334 ZPos += (SMD_Step / 2.);
337 ZPos += (Plate_Step / 2.);
338 new G4PVPlacement(PlateRotation, G4ThreeVector(0.0, Plate_YPos, Plate_ZPos + ZPos),
340 G4String(
"front_plate"),
343 ZPos += (Plate_Step / 2.);
348 ZPos += (Absorber_Step / 2.);
349 new G4PVPlacement(PlateRotation, G4ThreeVector(0.0, 0.0, ZPos),
351 G4String(
"single_absorber"),
354 ZPos += (Absorber_Step / 2.);
357 ZPos += (Gap_Step / 2.);
358 int copyno = 27 *
i +
j;
360 new G4PVPlacement(PlateRotation, G4ThreeVector(0.0, Gap_YPos, Gap_ZPos + ZPos),
365 ZPos += (Gap_Step / 2.);
368 ZPos += (Plate_Step / 2.);
369 new G4PVPlacement(PlateRotation, G4ThreeVector(0.0, Plate_YPos, Plate_ZPos + ZPos),
371 G4String(
"back_plate"),
375 ZPos += (Plate_Step / 2.);
380 if (
m_Layer == PHG4ZDCDefs::NORTH)
383 ZDC_envelope_log,
"ZDC_Envelope_North", logicWorld,
false, PHG4ZDCDefs::NORTH,
OverlapCheck());
385 else if (
m_Layer == PHG4ZDCDefs::SOUTH)
387 ZDC_rotm.rotateY(180 *
deg);
389 ZDC_envelope_log,
"ZDC_Envelope_South", logicWorld,
false, PHG4ZDCDefs::SOUTH,
OverlapCheck());