5 #include <phparameter/PHParameters.h>
13 #include <Geant4/G4LogicalVolume.hh>
14 #include <Geant4/G4Material.hh>
15 #include <Geant4/G4NistManager.hh>
16 #include <Geant4/G4PVPlacement.hh>
17 #include <Geant4/G4Polyhedra.hh>
18 #include <Geant4/G4RotationMatrix.hh>
19 #include <Geant4/G4String.hh>
20 #include <Geant4/G4SystemOfUnits.hh>
21 #include <Geant4/G4ThreeVector.hh>
22 #include <Geant4/G4Tubs.hh>
23 #include <Geant4/G4Types.hh>
24 #include <Geant4/G4VPhysicalVolume.hh>
35 , m_ActiveFlag(m_Params->get_int_param(
"active"))
36 , m_SupportActiveFlag(m_Params->get_int_param(
"supportactive"))
44 G4LogicalVolume *mylogvol = volume->GetLogicalVolume();
75 G4double z_bbcd[] = {-6.15 *
cm, 6.15 *
cm};
76 G4double len_bbcd = z_bbcd[1] - z_bbcd[0];
77 G4double rin_bbcd[] = {0 *
cm, 0 *
cm};
78 G4double rout_bbcd[] = {1.4 *
cm, 1.4 *
cm};
79 G4Polyhedra *bbcd =
new G4Polyhedra(
"bbcd", 0., 2 *
M_PI, 6, 2, z_bbcd, rin_bbcd, rout_bbcd);
80 G4LogicalVolume *bbcd_lv =
new G4LogicalVolume(bbcd, WorldMaterial, G4String(
"Bbc_tube"));
87 const G4double z_bbca[] = {-0.5 *
cm, -0.201 *
cm, -0.2 *
cm, 0.5 *
cm};
88 const G4double rInner_bbca[] = {0.2 *
cm, 0.2 *
cm, 0.2 *
cm, 0.2 *
cm};
89 const G4double rOuter_bbca[] = {1.4 *
cm, 1.4 *
cm, 1.375 *
cm, 1.375 *
cm};
90 G4Polyhedra *bbca =
new G4Polyhedra(
"bbca", 0., 2 *
M_PI, 6, 4, z_bbca, rInner_bbca, rOuter_bbca);
94 G4LogicalVolume *bbca_lv =
new G4LogicalVolume(bbca, Aluminum, G4String(
"Bbc_attach_plate"));
98 G4double xpos = 0. *
cm;
99 G4double ypos = 0. *
cm;
100 G4double len_bbca = z_bbca[3] - z_bbca[0];
101 G4double zpos = z_bbcd[0] + len_bbca * 0.5;
103 G4VPhysicalVolume *bbca_phys =
new G4PVPlacement(
nullptr, G4ThreeVector(xpos, ypos, zpos), bbca_lv,
"BBCA", bbcd_lv,
false, 0);
106 std::cout <<
"placement of BBCA failed" << std::endl;
112 const G4double z_bbcq[] = {-1.5 *
cm, 1.5 *
cm};
113 const G4double rInner_bbcq[] = {0., 0.};
114 const G4double rOuter_bbcq[] = {1.27 *
cm, 1.27 *
cm};
115 G4Polyhedra *bbcq =
new G4Polyhedra(
"bbcq", 0., 2 *
M_PI, 6, 2, z_bbcq, rInner_bbcq, rOuter_bbcq);
117 G4LogicalVolume *bbcq_lv =
new G4LogicalVolume(bbcq, Quartz, G4String(
"Bbc_quartz"));
122 G4double len_bbcq = z_bbcq[1] - z_bbcq[0];
123 zpos += len_bbca * 0.5 + len_bbcq * 0.5;
125 G4VPhysicalVolume *bbcq_phys =
new G4PVPlacement(
nullptr, G4ThreeVector(xpos, ypos, zpos), bbcq_lv,
"BBCQ", bbcd_lv,
false, 0);
128 std::cout <<
"placement of BBCQ failed" << std::endl;
132 const G4double len_bbcp = 4.4 *
cm;
133 const G4double rInner_bbcp = 1.09 *
cm;
134 const G4double rOuter_bbcp = 1.29 *
cm;
135 G4Tubs *bbcp =
new G4Tubs(
"bbcp", rInner_bbcp, rOuter_bbcp, len_bbcp * 0.5, 0 * deg, 360 * deg);
137 G4LogicalVolume *bbcp_lv =
new G4LogicalVolume(bbcp, Quartz, G4String(
"Bbc_PMT"));
142 zpos += len_bbcq * 0.5 + len_bbcp * 0.5;
144 G4VPhysicalVolume *bbcp_phys =
new G4PVPlacement(
nullptr, G4ThreeVector(xpos, ypos, zpos), bbcp_lv,
"BBCP", bbcd_lv,
false, 0);
147 std::cout <<
"placement of BBCP failed" << std::endl;
151 const G4double len_bbcr = 3.9 *
cm;
152 const G4double rInner_bbcr = 0.0 *
cm;
153 const G4double rOuter_bbcr = 1.2 *
cm;
154 G4Tubs *bbcr =
new G4Tubs(
"bbcr", rInner_bbcr, rOuter_bbcr, len_bbcr * 0.5, 0 * deg, 360 * deg);
159 G4Material *G10 =
new G4Material(
"BBC_G10", density = 1.700 *
g /
cm3, ncomponents = 4);
160 G4NistManager *manager = G4NistManager::Instance();
161 G10->AddElement(G4NistManager::Instance()->FindOrBuildElement(
"Si"), natoms = 1);
162 G10->AddElement(G4NistManager::Instance()->FindOrBuildElement(
"O"), natoms = 2);
163 G10->AddElement(G4NistManager::Instance()->FindOrBuildElement(
"C"), natoms = 3);
164 G10->AddElement(G4NistManager::Instance()->FindOrBuildElement(
"H"), natoms = 3);
166 G4LogicalVolume *bbcr_lv =
new G4LogicalVolume(bbcr, G10,
"Bbc_Breeder_Module");
171 zpos += len_bbcp * 0.5 + len_bbcr * 0.5;
173 G4PVPlacement *plcmt =
new G4PVPlacement(
nullptr, G4ThreeVector(xpos, ypos, zpos), bbcr_lv,
"BBCR", bbcd_lv,
false, 0);
176 std::cout <<
"placement of BBCR failed" << std::endl;
180 const G4double z_bbch[] = {-5.65 *
cm, 5.65 *
cm};
181 const G4double rInner_bbch[] = {1.375 *
cm, 1.375 *
cm};
182 const G4double rOuter_bbch[] = {1.4 *
cm, 1.4 *
cm};
183 G4Polyhedra *bbch =
new G4Polyhedra(
"bbch", 0., 2 *
M_PI, 6, 2, z_bbch, rInner_bbch, rOuter_bbch);
185 G4Material *MuMetal = manager->FindOrBuildMaterial(
"G4_STAINLESS-STEEL");
187 G4LogicalVolume *bbch_lv =
new G4LogicalVolume(bbch, MuMetal, G4String(
"Bbc_Shield"));
191 G4double len_bbch = z_bbch[1] - z_bbch[0];
192 zpos = z_bbcd[0] + 0.3 *
cm + len_bbch * 0.5;
194 G4VPhysicalVolume *bbch_phys =
new G4PVPlacement(
nullptr, G4ThreeVector(xpos, ypos, zpos), bbch_lv,
"BBCH", bbcd_lv,
false, 0);
197 std::cout <<
"placement of BBCH failed" << std::endl;
204 float TubeLoc[64][2] = {
254 { -2.45951, -12.78 },
257 { -4.91902, -11.36 },
274 const float tube_zpos =
m_bbcz + len_bbcd / 2.0 - len_bbca;
277 G4RotationMatrix *arm_rot[2];
278 for (
int iarm = 0; iarm < 2; iarm++)
280 arm_rot[iarm] =
new G4RotationMatrix;
287 arm_rot[iarm]->rotateY(180 * deg);
296 for (
int itube = 0; itube < NPMT; itube++)
299 float tube_xpos = xside * TubeLoc[itube][0] *
cm;
300 float tube_ypos = TubeLoc[itube][1] *
cm;
301 new G4PVPlacement(arm_rot[iarm], G4ThreeVector( tube_xpos, tube_ypos, zside*tube_zpos ),
302 bbcd_lv,
"BBCD", logicWorld,
false, iarm * NPMT + itube,
OverlapCheck());
309 G4Tubs *bbc_outer_shell =
new G4Tubs(
"bbc_outer_shell", 14.9 *
cm, 15 *
cm, 11.5 *
cm, 0, 2 *
M_PI);
310 G4LogicalVolume *bbc_outer_shell_lv =
new G4LogicalVolume(bbc_outer_shell, Aluminum, G4String(
"Bbc_Outer_Shell"));
313 G4Tubs *bbc_inner_shell =
new G4Tubs(
"bbc_inner_shell", 5.0 *
cm, 5.5 *
cm, 11.5 *
cm, 0, 2 *
M_PI);
314 G4LogicalVolume *bbc_inner_shell_lv =
new G4LogicalVolume(bbc_inner_shell, Aluminum, G4String(
"Bbc_Inner_Shell"));
317 G4VPhysicalVolume *outer_shell_vol[2] = {0};
318 G4VPhysicalVolume *inner_shell_vol[2] = {0};
321 outer_shell_vol[0] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (-250 + 1.0 - 11.5) *
cm),
322 bbc_outer_shell_lv,
"BBC_OUTER_SHELL", logicWorld,
false, 0,
OverlapCheck());
323 inner_shell_vol[0] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (-250 + 1.0 - 11.5) *
cm),
324 bbc_inner_shell_lv,
"BBC_INNER_SHELL", logicWorld,
false, 0,
OverlapCheck());
327 outer_shell_vol[1] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (250 - 1.0 + 11.5) *
cm),
328 bbc_outer_shell_lv,
"BBC_OUTER_SHELL", logicWorld,
false, 1,
OverlapCheck());
329 inner_shell_vol[1] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (250 - 1.0 + 11.5) *
cm),
330 bbc_inner_shell_lv,
"BBC_INNER_SHELL", logicWorld,
false, 0,
OverlapCheck());
332 if (!outer_shell_vol[0] || !outer_shell_vol[1] || !inner_shell_vol[0] || !inner_shell_vol[1])
334 std::cout <<
"problem placing BBC Sheels" << std::endl;
338 G4Tubs *bbc_plate =
new G4Tubs(
"bbc_fplate", 5 *
cm, 15 *
cm, 0.5 *
cm, 0, 2 *
M_PI);
339 G4LogicalVolume *bbc_plate_lv =
new G4LogicalVolume(bbc_plate, Aluminum, G4String(
"Bbc_Cover_Plates"));
342 G4VPhysicalVolume *fplate_vol[2] = {0};
343 G4VPhysicalVolume *bplate_vol[2] = {0};
346 fplate_vol[0] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (-250 + 1.0 + 0.5) *
cm),
347 bbc_plate_lv,
"BBC_FPLATE", logicWorld,
false, 0,
OverlapCheck());
348 bplate_vol[0] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (-250 + 1.0 + 0.5 - 24.0) *
cm),
349 bbc_plate_lv,
"BBC_BPLATE", logicWorld,
false, 0,
OverlapCheck());
352 fplate_vol[1] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (250 - 1.0 - 0.5) *
cm),
353 bbc_plate_lv,
"BBC_FPLATE", logicWorld,
false, 1,
OverlapCheck());
354 bplate_vol[1] =
new G4PVPlacement(
nullptr, G4ThreeVector(0, 0, (250 - 1.0 - 0.5 + 24.0) *
cm),
355 bbc_plate_lv,
"BBC_BPLATE", logicWorld,
false, 0,
OverlapCheck());
358 G4Material* Cu = manager->FindOrBuildMaterial(
"G4_Cu");
359 const G4double len_cable = 120*
cm;
360 const G4double r_CableConductor = 0.09525*
cm;
361 G4Tubs *bbc_cablecond =
new G4Tubs(
"bbc_cablecond",0.,r_CableConductor,len_cable*0.5,0*deg,360*deg);
363 G4LogicalVolume *bbc_cablecond_lv =
new G4LogicalVolume(bbc_cablecond, Cu, G4String(
"Bbc_CableCond"));
365 const G4double rIn_CableShield = 0.302876*
cm;
366 const G4double rOut_CableShield = 0.3175*
cm;
367 G4Tubs *bbc_cableshield =
new G4Tubs(
"bbc_cableshield",rIn_CableShield,rOut_CableShield,len_cable*0.5,0*deg,360*deg);
369 G4LogicalVolume *bbc_cableshield_lv =
new G4LogicalVolume(bbc_cableshield, Cu, G4String(
"Bbc_CableShield"));
371 ypos = len_cable/2 + 5*
cm;
374 G4RotationMatrix *rot_cable =
new G4RotationMatrix();
375 rot_cable->rotateX( 90*deg );
379 for (
int iarm=0; iarm<2; iarm++)
387 for (
int iring=1; iring<5; iring++)
389 float ring_radius = iring*0.67*
cm;
390 int ncables = 2*
M_PI*ring_radius/(0.635*
cm);
391 double dphi = 2*
M_PI/ncables;
396 for (
int ic=0; ic<ncables; ic++)
398 xpos =
cos(dphi*ic)*ring_radius;
399 zpos = sin(dphi*ic)*ring_radius + zsign*(
m_bbcz + 30*
cm);
401 new G4PVPlacement(rot_cable, G4ThreeVector(xpos, ypos, zpos), bbc_cablecond_lv,
"BBC_Cable_Cond", logicWorld,
false, icable,
OverlapCheck());
403 new G4PVPlacement(rot_cable, G4ThreeVector(xpos, ypos, zpos), bbc_cableshield_lv,
"BBC_Cable_Shield", logicWorld,
false, icable++,
OverlapCheck());
409 if ( !fplate_vol[0] || !fplate_vol[1] || !bplate_vol[0] || !bplate_vol[1] )
411 std::cout <<
"problem placing BBC Sheets" << std::endl;
421 std::cout <<
"INSIDE BBC" << std::endl;
428 std::cout <<
"Bbc Detector:" << std::endl;
429 if (what ==
"ALL" || what ==
"VOLUME")
431 std::cout <<
"Version 0.1" << std::endl;