11 #include <phparameter/PHParameters.h>
12 #include <phparameter/PHParametersContainer.h>
29 #include <Geant4/G4Box.hh>
30 #include <Geant4/G4GenericTrap.hh>
31 #include <Geant4/G4LogicalVolume.hh>
32 #include <Geant4/G4PVParameterised.hh>
33 #include <Geant4/G4PVPlacement.hh>
34 #include <Geant4/G4RotationMatrix.hh>
35 #include <Geant4/G4String.hh>
36 #include <Geant4/G4SubtractionSolid.hh>
37 #include <Geant4/G4SystemOfUnits.hh>
38 #include <Geant4/G4ThreeVector.hh>
39 #include <Geant4/G4Transform3D.hh>
40 #include <Geant4/G4Tubs.hh>
41 #include <Geant4/G4TwoVector.hh>
42 #include <Geant4/G4VPhysicalVolume.hh>
43 #include <Geant4/geomdefs.hh>
45 #pragma GCC diagnostic push
46 #pragma GCC diagnostic ignored "-Wshadow"
47 #include <boost/format.hpp>
48 #pragma GCC diagnostic pop
57 class G4VPVParameterisation;
63 , m_ParamsContainer(parameters)
64 , m_LayerBeginEndIteratorPair(layer_b_e)
68 int layer = layeriter->second;
76 std::fill_n(&
m_PosZ[0][0],
sizeof(
m_PosZ) /
sizeof(
double), NAN);
90 G4LogicalVolume *logvol = volume->GetLogicalVolume();
107 std::cout <<
"PHG4InttDetector::Construct called for layers " << std::endl;
110 std::cout <<
"layer " << layeriter->second << std::endl;
127 std::array<std::array<double, 2>, 8> hdi_z_arr;
131 int inttlayer = layeriter->second;
138 const int nladders_layer = params1->
get_int_param(
"nladder");
144 const int nstrips_phi_sensor = params->
get_int_param(
"nstrips_phi_sensor");
160 std::cout <<
"Constructing Intt layer: " << std::endl;
161 std::cout <<
" layer " << inttlayer <<
" laddertype " << laddertype <<
" nladders_layer " << nladders_layer
162 <<
" sensor_radius " <<
m_SensorRadius[inttlayer] <<
" offsetphi " << offsetphi <<
" rad "
163 <<
" offsetphi " << offsetphi *
rad /
deg <<
" deg "
168 for (
int itype = 0; itype < 2; ++itype)
171 int nstrips_z_sensor;
176 nstrips_z_sensor = params->
get_int_param(
"nstrips_z_sensor_0");
180 nstrips_z_sensor = params->
get_int_param(
"nstrips_z_sensor_1");
183 std::cout <<
"invalid itype " << itype << std::endl;
193 const double siactive_x = strip_x;
194 const double siactive_y = strip_y * nstrips_phi_sensor;
195 const double siactive_z = strip_z * nstrips_z_sensor;
196 G4VSolid *siactive_box =
new G4Box((
boost::format(
"siactive_box_%d_%d") % inttlayer % itype).
str(), siactive_x / 2, siactive_y / 2., siactive_z / 2.);
197 G4LogicalVolume *siactive_volume =
new G4LogicalVolume(siactive_box,
GetDetectorMaterial(
"G4_Si"),
207 const double sifull_x = siactive_x;
208 const double sifull_y = siactive_y + 2.0 * params->
get_double_param(
"sensor_edge_phi") *
cm;
209 const double sifull_z = siactive_z + 2.0 * params->
get_double_param(
"sensor_edge_z") *
cm;
210 G4VSolid *sifull_box =
new G4Box((
boost::format(
"sifull_box_%d_%d") % inttlayer % itype).
str(), sifull_x / 2., sifull_y / 2.0, sifull_z / 2.0);
213 G4VSolid *siinactive_box =
new G4SubtractionSolid((
boost::format(
"siinactive_box_%d_%d") % inttlayer % itype).
str(),
214 sifull_box, siactive_box, 0, G4ThreeVector(0, 0, 0));
215 G4LogicalVolume *siinactive_volume =
new G4LogicalVolume(siinactive_box,
GetDetectorMaterial(
"G4_Si"),
216 (
boost::format(
"siinactive_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
225 G4VSolid *si_glue_box =
new G4Box((
boost::format(
"si_glue_box_%d_%d") % inttlayer % itype).
str(), si_glue_x / 2., sifull_y / 2.0, sifull_z / 2.0);
227 G4LogicalVolume *si_glue_volume =
new G4LogicalVolume(si_glue_box,
GetDetectorMaterial(
"SilverEpoxyGlue_INTT"),
228 (
boost::format(
"si_glue_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
239 hdi_z_arr[inttlayer][itype] = hdi_z;
240 G4VSolid *hdi_kapton_box =
new G4Box((
boost::format(
"hdi_kapton_box_%d_%d") % inttlayer % itype).
str(), hdi_kapton_x / 2., hdi_y / 2., hdi_z / 2.0);
241 G4LogicalVolume *hdi_kapton_volume =
new G4LogicalVolume(hdi_kapton_box,
GetDetectorMaterial(
"G4_KAPTON"),
248 G4VSolid *hdi_copper_box =
new G4Box((
boost::format(
"hdi_copper_box_%d_%d") % inttlayer % itype).
str(), hdi_copper_x / 2., hdi_y / 2., hdi_z / 2.0);
249 G4LogicalVolume *hdi_copper_volume =
new G4LogicalVolume(hdi_copper_box,
GetDetectorMaterial(
"G4_Cu"),
259 const double hdiext_z = (itype == 0) ? 0.000001 : halfladder_inside_z - hdi_z_arr[inttlayer][0] - hdi_z;
260 G4VSolid *hdiext_kapton_box =
new G4Box((
boost::format(
"hdiext_kapton_box_%d_%s") % inttlayer % itype).
str(),
261 hdi_kapton_x / 2., hdi_y / 2., hdiext_z / 2.0);
262 G4LogicalVolume *hdiext_kapton_volume =
new G4LogicalVolume(hdiext_kapton_box,
GetDetectorMaterial(
"G4_KAPTON"),
268 G4VSolid *hdiext_copper_box =
new G4Box((
boost::format(
"hdiext_copper_box_%d_%s") % inttlayer % itype).
str(),
269 hdi_copper_x / 2., hdi_y / 2., hdiext_z / 2.0);
270 G4LogicalVolume *hdiext_copper_volume =
new G4LogicalVolume(hdiext_copper_box,
GetDetectorMaterial(
"G4_Cu"),
280 G4VSolid *fphx_box =
new G4Box((
boost::format(
"fphx_box_%d_%d") % inttlayer % itype).
str(), fphx_x / 2., fphx_y / 2., fphx_z / 2.);
293 G4VSolid *fphxcontainer_box =
new G4Box((
boost::format(
"fphxcontainer_box_%d_%d") % inttlayer % itype).
str(),
294 fphx_x / 2., fphx_y / 2., hdi_z / 2.);
296 (
boost::format(
"fphxcontainer_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
301 const double fphx_offsetx = 0.;
302 const double fphx_offsety = 0.;
304 double offsetz, cell_length_z;
309 ncopy = nstrips_z_sensor / 128.0;
313 ncopy = nstrips_z_sensor;
317 std::cout <<
PHWHERE <<
"invalid laddertype " << laddertype << std::endl;
324 cell_length_z = strip_z * nstrips_z_sensor / ncopy;
325 offsetz = (ncopy % 2 == 0) ? -2. * cell_length_z / 2. *
double(ncopy / 2) + cell_length_z / 2. + fphx_offset_z : -2. * cell_length_z / 2. *
double(ncopy / 2) + fphx_offset_z;
327 G4VPVParameterisation *fphxparam =
new PHG4InttFPHXParameterisation(fphx_offsetx, +fphx_offsety, offsetz, 2. * cell_length_z / 2., ncopy);
328 new G4PVParameterised((
boost::format(
"fphxcontainer_%d_%d") % inttlayer % itype).
str(),
329 fphx_volume, fphxcontainer_volume, kZAxis, ncopy, fphxparam,
OverlapCheck());
332 G4VSolid *fphx_glue_box =
new G4Box((
boost::format(
"fphx_glue_box_%d_%d") % inttlayer % itype).
str(), fphx_glue_x / 2., fphx_y / 2., fphx_z / 2.);
334 G4LogicalVolume *fphx_glue_volume =
new G4LogicalVolume(fphx_glue_box,
GetDetectorMaterial(
"SilverEpoxyGlue_INTT"),
335 (
boost::format(
"fphx_glue_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
344 G4VSolid *fphx_gluecontainer_box =
new G4Box((
boost::format(
"fphx_gluecontainer_box_%d_%d") % inttlayer % itype).
str(),
345 fphx_glue_x / 2., fphx_y / 2., hdi_z / 2.);
347 (
boost::format(
"fphx_gluecontainer_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
350 G4VPVParameterisation *fphx_glueparam =
new PHG4InttFPHXParameterisation(fphx_offsetx, +fphx_offsety, offsetz, 2. * cell_length_z / 2., ncopy);
352 new G4PVParameterised((
boost::format(
"glue_fphxcontainer_%d_%d") % inttlayer % itype).
str(),
353 fphx_glue_volume, fphx_gluecontainer_volume, kZAxis, ncopy, fphx_glueparam,
OverlapCheck());
358 G4LogicalVolume *stave_volume = NULL;
359 G4LogicalVolume *staveext_volume = NULL;
366 const double stave_thickness = params->
get_double_param(
"stave_straight_cooler_x") *
cm;
367 const double Rcmin = 0.30 *
cm;
368 const double Rcmax = Rcmin + stave_thickness;
369 double Rcavge = (Rcmax + Rcmin) / 2.0;
370 double dphi_c = 23.19859051 * M_PI / 180.;
371 const double stave_z = hdi_z;
375 const double phic_begin[4] = {M_PI - dphi_c, -dphi_c, 0.0, M_PI};
376 const double dphic[4] = {dphi_c, dphi_c, dphi_c, dphi_c};
378 G4Tubs *stave_curve_cons[4];
379 G4Tubs *stave_curve_ext_cons[4];
380 G4LogicalVolume *stave_curve_volume[4];
381 G4LogicalVolume *stave_curve_ext_volume[4];
383 for (
int i = 0;
i < 4;
i++)
385 stave_curve_cons[
i] =
new G4Tubs((
boost::format(
"stave_curve_cons_%d_%d_%d") % inttlayer % itype %
i).
str(),
386 Rcmin, Rcmax, stave_z / 2., phic_begin[i], dphic[i]);
387 stave_curve_volume[
i] =
new G4LogicalVolume(stave_curve_cons[i],
GetDetectorMaterial(
"CFRP_INTT"),
388 (
boost::format(
"stave_curve_volume_%d_%d_%d") % inttlayer % itype % i).
str(), 0, 0, 0);
393 stave_curve_ext_cons[
i] =
new G4Tubs((
boost::format(
"stave_curve_ext_cons_%d_%d_%d") % inttlayer % itype % i).
str(),
394 Rcmin, Rcmax, hdiext_z / 2., phic_begin[i], dphic[i]);
395 stave_curve_ext_volume[
i] =
new G4LogicalVolume(stave_curve_ext_cons[i],
GetDetectorMaterial(
"CFRP_INTT"),
396 (
boost::format(
"stave_curve_ext_volume_%d_%d_%d") % inttlayer % itype % i).
str(), 0, 0, 0);
406 double curve_length_y = Rcavge * sin(dphi_c);
409 double stave_straight_outer_y = params->
get_double_param(
"stave_straight_outer_y") *
cm;
410 double stave_straight_cooler_y = params->
get_double_param(
"stave_straight_cooler_y") *
cm;
411 double rohacell_straight_y = params->
get_double_param(
"stave_straight_rohacell_y") *
cm;
414 G4VSolid *stave_straight_outer_box =
new G4Box((
boost::format(
"stave_straight_outer_box_%d_%d") % inttlayer % itype).
str(),
415 stave_thickness / 2., stave_straight_outer_y / 2., stave_z / 2.);
416 G4LogicalVolume *stave_straight_outer_volume =
new G4LogicalVolume(stave_straight_outer_box,
GetDetectorMaterial(
"CFRP_INTT"),
417 (
boost::format(
"stave_straight_outer_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
422 G4VSolid *stave_straight_outer_ext_box =
new G4Box((
boost::format(
"stave_straight_outer_ext_box_%d_%s") % inttlayer % itype).
str(),
423 stave_thickness / 2., stave_straight_outer_y / 2., hdiext_z / 2.);
424 G4LogicalVolume *stave_straight_outer_ext_volume =
new G4LogicalVolume(stave_straight_outer_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
425 (
boost::format(
"stave_straight_outer_ext_volume_%d_%s") % inttlayer % itype).
str(), 0, 0, 0);
432 G4VSolid *stave_straight_cooler_box =
new G4Box((
boost::format(
"stave_straight_cooler_box_%d_%d") % inttlayer % itype).
str(),
433 stave_thickness / 2., stave_straight_cooler_y / 2., stave_z / 2.);
434 G4LogicalVolume *stave_straight_cooler_volume =
new G4LogicalVolume(stave_straight_cooler_box,
GetDetectorMaterial(
"CFRP_INTT"),
435 (
boost::format(
"stave_straight_cooler_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
440 G4VSolid *stave_straight_cooler_ext_box =
new G4Box((
boost::format(
"stave_straight_cooler_ext_box_%d_%d") % inttlayer % itype).
str(),
441 stave_thickness / 2., stave_straight_cooler_y / 2., hdiext_z / 2.);
442 G4LogicalVolume *stave_straight_cooler_ext_volume =
new G4LogicalVolume(stave_straight_cooler_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
443 (
boost::format(
"stave_straight_cooler_ext_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
451 G4VSolid *stave_slant_cooler_box =
new G4Box((
boost::format(
"stave_slant_cooler_box_%d_%d") % inttlayer % itype).
str(),
452 stave_thickness / 2., stave_slant_cooler_y / 2., stave_z / 2.);
453 G4LogicalVolume *stave_slant_cooler_volume =
new G4LogicalVolume(stave_slant_cooler_box,
GetDetectorMaterial(
"CFRP_INTT"),
454 (
boost::format(
"stave_slant_cooler_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
459 G4VSolid *stave_slant_cooler_ext_box =
new G4Box((
boost::format(
"stave_lant_cooler_ext_box_%d_%d") % inttlayer % itype).
str(),
460 stave_thickness / 2., stave_slant_cooler_y / 2., hdiext_z / 2.);
461 G4LogicalVolume *stave_slant_cooler_ext_volume =
new G4LogicalVolume(stave_slant_cooler_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
462 (
boost::format(
"stave_slant_cooler_ext_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
469 G4VSolid *stave_bottom_cooler_box =
new G4Box((
boost::format(
"stave_bottom_cooler_box_%d_%d") % inttlayer % itype).
str(),
470 stave_thickness / 2., hdi_y / 2., stave_z / 2.);
472 G4LogicalVolume *stave_bottom_cooler_volume =
new G4LogicalVolume(stave_bottom_cooler_box,
GetDetectorMaterial(
"CFRP_INTT"),
473 (
boost::format(
"stave_bottom_cooler_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
479 G4VSolid *stave_bottom_cooler_ext_box =
new G4Box((
boost::format(
"stave_bottom_cooler_ext_box_%d_%s") % inttlayer % itype).
str(), stave_thickness / 2., hdi_y / 2., hdiext_z / 2.);
480 G4LogicalVolume *stave_bottom_cooler_ext_volume =
new G4LogicalVolume(stave_bottom_cooler_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
481 (
boost::format(
"stave_bottom_cooler_ext_volume_%d_%s") % inttlayer % itype).
str(), 0, 0, 0);
497 const double Rpmin = 0.10 *
cm;
498 const double Rpmax = 0.15 *
cm;
499 G4VSolid *stave_glue_box =
new G4Box((
boost::format(
"stave_glue_box_%d_%d") % inttlayer % itype).
str(), 3. / 2, 3. / 2., stave_z / 2.);
500 G4LogicalVolume *stave_glue_volume =
new G4LogicalVolume(stave_glue_box,
GetDetectorMaterial(
"Epoxy"),
501 (
boost::format(
"stave_glue_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
502 G4VSolid *staveext_glue_box =
new G4Box((
boost::format(
"staveext_glue_box_%d_%d") % inttlayer % itype).
str(), 3. / 2., 3. / 2., hdiext_z / 2.);
503 G4LogicalVolume *staveext_glue_volume =
new G4LogicalVolume(staveext_glue_box,
GetDetectorMaterial(
"Epoxy"),
504 (
boost::format(
"staveext_glue_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
509 G4VSolid *stave_pipe_cons =
new G4Tubs((
boost::format(
"stave_pipe_cons_%d_%d") % inttlayer % itype).
str(),
510 Rpmin, Rpmax, stave_z / 2., 0, 2.0 * M_PI);
511 G4LogicalVolume *stave_pipe_volume =
new G4LogicalVolume(stave_pipe_cons,
GetDetectorMaterial(
"CFRP_INTT"),
512 (
boost::format(
"stave_pipe_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
514 G4VSolid *staveext_pipe_cons =
new G4Tubs((
boost::format(
"staveext_pipe_cons_%d_%d") % inttlayer % itype).
str(),
515 Rpmin, Rpmax, hdiext_z / 2., 0, 2.0 * M_PI);
516 G4LogicalVolume *staveext_pipe_volume =
new G4LogicalVolume(staveext_pipe_cons,
GetDetectorMaterial(
"CFRP_INTT"),
517 (
boost::format(
"staveext_pipe_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
522 G4VSolid *stave_water_cons =
new G4Tubs((
boost::format(
"stave_water_cons_%d_%d") % inttlayer % itype).
str(),
523 0., Rpmin, stave_z / 2., 0, 2.0 * M_PI);
524 G4LogicalVolume *stave_water_volume =
new G4LogicalVolume(stave_water_cons,
GetDetectorMaterial(
"G4_WATER"),
525 (
boost::format(
"stave_water_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
527 G4VSolid *staveext_water_cons =
new G4Tubs((
boost::format(
"staveext_water_cons_%d_%d") % inttlayer % itype).
str(),
528 0., Rpmin, hdiext_z / 2., 0, 2.0 * M_PI);
529 G4LogicalVolume *staveext_water_volume =
new G4LogicalVolume(staveext_water_cons,
GetDetectorMaterial(
"G4_WATER"),
530 (
boost::format(
"staveext_water_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
537 G4VSolid *rohacell_straight_cons =
new G4Box((
boost::format(
"rohacell_straight_cons_%d_%d") % inttlayer % itype).
str(), 3. / 2, rohacell_straight_y / 2., stave_z / 2.);
538 G4LogicalVolume *rohacell_straight_volume =
new G4LogicalVolume(rohacell_straight_cons,
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
539 (
boost::format(
"rohacell_straight_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
541 G4VSolid *rohacellext_straight_cons =
new G4Box((
boost::format(
"rohacellext_straight_cons_%d_%d") % inttlayer % itype).
str(), 3. / 2, rohacell_straight_y / 2., hdiext_z / 2.);
542 G4LogicalVolume *rohacellext_straight_volume =
new G4LogicalVolume(rohacellext_straight_cons,
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
543 (
boost::format(
"rohacellext_straight_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
546 const double rh_phic_begin[2] = {-dphi_c, 0.0};
547 const double rh_dphic[2] = {dphi_c, dphi_c};
548 G4Tubs *rohacell_curve_cons[2];
549 G4LogicalVolume *rohacell_curve_volume[2];
550 G4Tubs *rohacellext_curve_cons[2];
551 G4LogicalVolume *rohacellext_curve_volume[2];
552 for (
int i = 0;
i < 2;
i++)
554 rohacell_curve_cons[
i] =
new G4Tubs((
boost::format(
"rohacell_curve_cons_%d_%d_%d") % inttlayer % itype %
i).
str(),
555 0., Rcmin, stave_z / 2., rh_phic_begin[i], rh_dphic[i]);
556 rohacell_curve_volume[
i] =
new G4LogicalVolume(rohacell_curve_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
557 (
boost::format(
"rohacell_curve_volume_%d_%d_%d") % inttlayer % itype % i).
str(), 0, 0, 0);
558 rohacellext_curve_cons[
i] =
new G4Tubs((
boost::format(
"rohacellext_curve_cons_%d_%d_%d") % inttlayer % itype % i).
str(),
559 0., Rcmin, hdiext_z / 2., rh_phic_begin[i], rh_dphic[i]);
560 rohacellext_curve_volume[
i] =
new G4LogicalVolume(rohacellext_curve_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
561 (
boost::format(
"rohacellext_curve_volume_%d_%d_%d") % inttlayer % itype % i).
str(), 0, 0, 0);
565 G4GenericTrap *rohacell_trap_cons[2];
566 G4LogicalVolume *rohacell_trap_volume[2];
567 G4GenericTrap *rohacellext_trap_cons[2];
568 G4LogicalVolume *rohacellext_trap_volume[2];
569 for (
int i = 0;
i < 2;
i++)
571 double shift = 1.e-5;
572 std::vector<G4TwoVector> rohatrap(8);
575 rohatrap[0] = G4TwoVector(0. *
cm, 0. *
cm);
576 rohatrap[1] = G4TwoVector(Rcmin * cos(dphi_c) - shift, -Rcmin * sin(dphi_c));
577 rohatrap[2] = G4TwoVector(Rcmin * (1. - cos(dphi_c)) - shift, -stave_slant_cooler_y * cos(dphi_c) - Rcmin * sin(dphi_c));
578 rohatrap[3] = G4TwoVector(0. *
cm, -stave_slant_cooler_y * cos(dphi_c) - Rcmin * sin(dphi_c));
582 rohatrap[0] = G4TwoVector(0. *
cm, +stave_slant_cooler_y * cos(dphi_c) + Rcmin * sin(dphi_c));
583 rohatrap[1] = G4TwoVector(Rcmax * (1. - cos(dphi_c)) - shift, +stave_slant_cooler_y * cos(dphi_c) + Rcmin * sin(dphi_c));
584 rohatrap[2] = G4TwoVector(Rcmin * cos(dphi_c) - shift, +Rcmin * sin(dphi_c));
585 rohatrap[3] = G4TwoVector(0. *
cm, 0. *
cm);
587 rohatrap[4] = rohatrap[0];
588 rohatrap[5] = rohatrap[1];
589 rohatrap[6] = rohatrap[2];
590 rohatrap[7] = rohatrap[3];
592 rohacell_trap_cons[
i] =
new G4GenericTrap((
boost::format(
"rohacell_trap_cons_%d_%d_%d") % inttlayer % itype %
i).
str(), stave_z / 2., rohatrap);
593 rohacell_trap_volume[
i] =
new G4LogicalVolume(rohacell_trap_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
594 (
boost::format(
"rohacell_trap_volume_%d_%d_%d") % inttlayer % itype % i).
str(), 0, 0, 0);
596 rohacellext_trap_cons[
i] =
new G4GenericTrap((
boost::format(
"rohacellext_trap_cons_%d_%d_%d") % inttlayer % itype % i).
str(), hdiext_z / 2., rohatrap);
597 rohacellext_trap_volume[
i] =
new G4LogicalVolume(rohacellext_trap_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
598 (
boost::format(
"rohacellext_trap_volume_%d_%d_%d") % inttlayer % itype % i).
str(), 0, 0, 0);
603 for (
int i = 0;
i < 2;
i++)
613 double cooler_gap_x = 0.3 *
cm;
614 double cooler_wall = stave_thickness;
615 double cooler_x = cooler_gap_x + 2.0 * cooler_wall;
621 G4RotationMatrix *stv_rot_pos =
new G4RotationMatrix();
622 stv_rot_pos->rotateZ(-15. * M_PI / 180.);
623 G4ThreeVector stvTranspos(stave_x / 2., stave_y / 2., 0.);
625 G4RotationMatrix *stv_rot_neg =
new G4RotationMatrix();
626 stv_rot_neg->rotateZ(+15. * M_PI / 180.);
627 G4ThreeVector stvTransneg(stave_x / 2., -stave_y / 2., 0.);
629 G4VSolid *stave_basebox =
new G4Box((
boost::format(
"stave_basebox_%d_%d") % inttlayer % itype).
str(), stave_x / 2., stave_y / 2., stave_z / 2.);
630 G4VSolid *stave_subtbox =
new G4Box((
boost::format(
"stave_subtbox_%d_%d") % inttlayer % itype).
str(), stave_x / 1.5, stave_y / 1.5, stave_z / 1.);
632 G4VSolid *stave_box1 =
new G4SubtractionSolid((
boost::format(
"stave_box1_%d_%d") % inttlayer % itype).
str(), stave_basebox, stave_subtbox, stv_rot_pos, stvTranspos);
634 G4VSolid *stave_box =
new G4SubtractionSolid((
boost::format(
"stave_box_%d_%d") % inttlayer % itype).
str(), stave_box1, stave_subtbox, stv_rot_neg, stvTransneg);
639 G4VSolid *staveext_basebox =
new G4Box((
boost::format(
"staveext_basebox_%d_%d") % inttlayer % itype).
str(), stave_x / 2., stave_y / 2., hdiext_z / 2.);
640 G4VSolid *staveext_subtbox =
new G4Box((
boost::format(
"staveext_subtbox_%d_%d") % inttlayer % itype).
str(), stave_x / 1.5, stave_y / 1.5, hdiext_z / 1.);
642 G4VSolid *staveext_box1 =
new G4SubtractionSolid((
boost::format(
"staveext_box1_%d_%d") % inttlayer % itype).
str(), staveext_basebox, staveext_subtbox, stv_rot_pos, stvTranspos);
644 G4VSolid *staveext_box =
new G4SubtractionSolid((
boost::format(
"staveext_box_%d_%d") % inttlayer % itype).
str(), staveext_box1, staveext_subtbox, stv_rot_neg, stvTransneg);
647 (
boost::format(
"staveext_volume_%d_%d") % inttlayer % itype).
str(), 0, 0, 0);
662 double x_off_str[3] =
664 Rcavge - stave_x / 2.,
665 (Rcmax - Rcmin) / 2. - stave_x / 2.,
666 (Rcmax - Rcmin) / 2. - stave_x / 2.};
667 double y_off_str[3] =
670 +stave_straight_cooler_y / 2. + 2. * curve_length_y + stave_straight_outer_y / 2.,
671 -stave_straight_cooler_y / 2. - 2. * curve_length_y - stave_straight_outer_y / 2.};
673 for (
int i = 0;
i < 3;
i++)
677 new G4PVPlacement(0, G4ThreeVector(x_off_str[
i], y_off_str[i], 0.0), stave_straight_cooler_volume,
679 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_cooler_ext_volume,
684 new G4PVPlacement(0, G4ThreeVector(x_off_str[
i], y_off_str[i], 0.0), stave_straight_outer_volume,
686 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_outer_ext_volume,
696 double x_off_cooler[4] =
698 Rcavge - cooler_gap_x / 2.,
699 -Rcavge + cooler_gap_x / 2.,
700 -Rcavge + cooler_gap_x / 2.,
701 Rcavge - cooler_gap_x / 2.};
702 double y_off_cooler[4] =
704 -stave_straight_cooler_y / 2. - 2. * curve_length_y,
705 -stave_straight_cooler_y / 2.,
706 +stave_straight_cooler_y / 2.,
707 +stave_straight_cooler_y / 2. + 2. * curve_length_y};
709 for (
int i = 0;
i < 4;
i++)
711 new G4PVPlacement(0, G4ThreeVector(x_off_cooler[
i], y_off_cooler[i], 0.0), stave_curve_volume[i],
713 new G4PVPlacement(0, G4ThreeVector(x_off_cooler[i], y_off_cooler[i], 0.0), stave_curve_ext_volume[i],
721 double x_off_str[6] =
723 (Rcmax + Rcmin) / 2. - stave_x / 2. + stave_thickness,
724 (Rcmax + Rcmax) / 4. - stave_x / 2. + stave_thickness,
725 (Rcmax + Rcmax) / 4. - stave_x / 2. + stave_thickness,
726 (Rcmax - Rcmin) / 2. - stave_x / 2. + stave_thickness,
727 (Rcmax - Rcmin) / 2. - stave_x / 2. + stave_thickness,
728 (Rcmax - Rcmin) / 2. - stave_x / 2.
730 double y_off_str[6] =
733 -stave_straight_cooler_y / 2. - 1. * curve_length_y - cos(dphi_c) * stave_slant_cooler_y / 2.,
734 +stave_straight_cooler_y / 2. + 1. * curve_length_y + cos(dphi_c) * stave_slant_cooler_y / 2.,
735 -stave_straight_cooler_y / 2. - 2. * curve_length_y - cos(dphi_c) * stave_slant_cooler_y - stave_straight_outer_y / 2.,
736 +stave_straight_cooler_y / 2. + 2. * curve_length_y + cos(dphi_c) * stave_slant_cooler_y + stave_straight_outer_y / 2.,
741 for (
int i = 0;
i < 6;
i++)
745 new G4PVPlacement(0, G4ThreeVector(x_off_str[
i], y_off_str[i], 0.0), stave_straight_cooler_volume,
747 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_cooler_ext_volume,
750 else if (
i == 1 ||
i == 2)
752 G4RotationMatrix rotation;
754 rotation.rotateZ(-1. * dphi_c);
756 rotation.rotateZ(dphi_c);
757 new G4PVPlacement(G4Transform3D(rotation, G4ThreeVector(x_off_str[
i], y_off_str[i], 0.0)), stave_slant_cooler_volume,
759 new G4PVPlacement(G4Transform3D(rotation, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0)), stave_slant_cooler_ext_volume,
762 else if (
i == 3 ||
i == 4)
764 new G4PVPlacement(0, G4ThreeVector(x_off_str[
i], y_off_str[i], 0.0), stave_straight_outer_volume,
766 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_outer_ext_volume,
771 new G4PVPlacement(0, G4ThreeVector(x_off_str[
i], y_off_str[i], 0.0), stave_bottom_cooler_volume,
773 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_bottom_cooler_ext_volume,
781 double x_off_curve[4] =
784 +Rcavge - cooler_gap_x / 2. + stave_thickness / 2.,
785 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.,
786 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.,
787 +Rcavge - cooler_gap_x / 2. + stave_thickness / 2.};
788 double y_off_curve[4] =
791 -stave_straight_cooler_y / 2. - 2. * curve_length_y - cos(dphi_c) * stave_slant_cooler_y,
792 -stave_straight_cooler_y / 2.,
793 +stave_straight_cooler_y / 2.,
794 +stave_straight_cooler_y / 2. + 2. * curve_length_y + cos(dphi_c) * stave_slant_cooler_y};
796 for (
int i = 0;
i < 4;
i++)
798 new G4PVPlacement(0, G4ThreeVector(x_off_curve[
i], y_off_curve[i], 0.0), stave_curve_volume[i], (
boost::format(
"stave_curve_%d_%d_%d") % inttlayer % itype % i).
str(), stave_volume,
false, 0,
OverlapCheck());
799 new G4PVPlacement(0, G4ThreeVector(x_off_curve[i], y_off_curve[i], 0.0), stave_curve_ext_volume[i], (
boost::format(
"stave_curve_ext_%d_%d_%s") % inttlayer % itype % i).
str(), staveext_volume,
false, 0,
OverlapCheck());
804 double x_off_roha_str[2] =
807 -cooler_wall / 2. + stave_thickness / 2.,
808 -cooler_wall / 2. + stave_thickness / 2.};
809 double y_off_roha_str[2] =
812 -3. / 2. - rohacell_straight_y / 2.,
813 +3. / 2. + rohacell_straight_y / 2.};
815 for (
int i = 0;
i < 2;
i++)
817 new G4PVPlacement(0, G4ThreeVector(x_off_roha_str[
i], y_off_roha_str[i], 0.0), rohacell_straight_volume, (
boost::format(
"rohacell_straight_%d_%d_%d") % inttlayer % itype % i).
str(), stave_volume,
false, 0,
OverlapCheck());
818 new G4PVPlacement(0, G4ThreeVector(x_off_roha_str[i], y_off_roha_str[i], 0.0), rohacellext_straight_volume, (
boost::format(
"rohacell_straight_ext_%d_%d_%d") % inttlayer % itype % i).
str(), staveext_volume,
false, 0,
OverlapCheck());
822 double x_off_roha_curve[2] =
825 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.,
826 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.};
827 double y_off_roha_curve[2] =
830 -3. / 2. - rohacell_straight_y,
831 +3. / 2. + rohacell_straight_y};
833 for (
int i = 0;
i < 2;
i++)
835 new G4PVPlacement(0, G4ThreeVector(x_off_roha_curve[
i], y_off_roha_curve[i], 0.0), rohacell_curve_volume[i], (
boost::format(
"rohacell_curve_%d_%d_%d") % inttlayer % itype % i).
str(), stave_volume,
false, 0,
OverlapCheck());
836 new G4PVPlacement(0, G4ThreeVector(x_off_roha_curve[i], y_off_roha_curve[i], 0.0), rohacellext_curve_volume[i], (
boost::format(
"rohacell_curve_ext_%d_%d_%d") % inttlayer % itype % i).
str(), staveext_volume,
false, 0,
OverlapCheck());
840 double x_off_roha_trap[2] =
843 -Rcmin - cooler_wall / 2. + cooler_gap_x / 2. + stave_thickness / 2.,
844 -Rcmin - cooler_wall / 2. + cooler_gap_x / 2. + stave_thickness / 2.};
845 double y_off_roha_trap[2] =
848 -3. / 2. - rohacell_straight_y,
849 +3. / 2. + rohacell_straight_y};
851 for (
int i = 0;
i < 2;
i++)
853 new G4PVPlacement(0, G4ThreeVector(x_off_roha_trap[
i], y_off_roha_trap[i], 0.0), rohacell_trap_volume[i], (
boost::format(
"rohacell_trap_%d_%d_%d") % inttlayer % itype % i).
str(), stave_volume,
false, 0,
OverlapCheck());
854 new G4PVPlacement(0, G4ThreeVector(x_off_roha_trap[i], y_off_roha_trap[i], 0.0), rohacellext_trap_volume[i], (
boost::format(
"rohacell_trap_ext_%d_%d_%d") % inttlayer % itype % i).
str(), staveext_volume,
false, 0,
OverlapCheck());
858 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), stave_pipe_volume, (
boost::format(
"stave_pipe_%d_%d") % inttlayer % itype).
str(), stave_glue_volume,
false, 0,
OverlapCheck());
859 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), staveext_pipe_volume, (
boost::format(
"stave_pipe_ext_%d_%d") % inttlayer % itype).
str(), staveext_glue_volume,
false, 0,
OverlapCheck());
860 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), stave_water_volume, (
boost::format(
"stave_water_%d_%d") % inttlayer % itype).
str(), stave_glue_volume,
false, 0,
OverlapCheck());
861 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), staveext_water_volume, (
boost::format(
"stave_water_ext_%d_%d") % inttlayer % itype).
str(), staveext_glue_volume,
false, 0,
OverlapCheck());
864 new G4PVPlacement(0, G4ThreeVector(-cooler_wall / 2. + stave_thickness / 2., 0.0, 0.0), stave_glue_volume, (
boost::format(
"stave_glue_%d_%d") % inttlayer % itype).
str(), stave_volume,
false, 0,
OverlapCheck());
865 new G4PVPlacement(0, G4ThreeVector(-cooler_wall / 2. + stave_thickness / 2., 0.0, 0.0), staveext_glue_volume, (
boost::format(
"stave_glue_ext_%d_%d") % inttlayer % itype).
str(), staveext_volume,
false, 0,
OverlapCheck());
869 std::cout <<
PHWHERE <<
"invalid laddertype " << laddertype << std::endl;
880 const double ladder_x = stave_x + hdi_kapton_x + hdi_copper_x + fphx_glue_x + fphx_x;
881 double ladder_y = hdi_y;
884 G4RotationMatrix *lad_box_rotpos =
new G4RotationMatrix();
885 lad_box_rotpos->rotateZ(-15. * M_PI / 180.);
886 G4ThreeVector ladTranspos(ladder_x / 2., ladder_y / 2., 0.);
888 G4RotationMatrix *lad_box_rotneg =
new G4RotationMatrix();
889 lad_box_rotneg->rotateZ(+15. * M_PI / 180.);
890 G4ThreeVector ladTransneg(ladder_x / 2., -ladder_y / 2., 0.);
892 G4VSolid *ladder_basebox =
new G4Box((
boost::format(
"ladder_basebox_%d_%d") % inttlayer % itype).
str(), ladder_x / 2., ladder_y / 2., hdi_z / 2.);
893 G4VSolid *ladder_subtbox =
new G4Box((
boost::format(
"ladder_subtbox_%d_%d") % inttlayer % itype).
str(), stave_x / 1.5, ladder_y / 1.5, hdi_z / 1.);
895 G4VSolid *ladder_box1 =
new G4SubtractionSolid((
boost::format(
"ladder_box1_%d_%d") % inttlayer % itype).
str(), ladder_basebox, ladder_subtbox, lad_box_rotpos, ladTranspos);
897 G4VSolid *ladder_box =
new G4SubtractionSolid((
boost::format(
"ladder_box_%d_%d") % inttlayer % itype).
str(), ladder_box1, ladder_subtbox, lad_box_rotneg, ladTransneg);
901 G4VSolid *ladderext_basebox =
new G4Box((
boost::format(
"ladderext_basebox_%d_%d") % inttlayer % itype).
str(), ladder_x / 2., ladder_y / 2., hdiext_z / 2.);
902 G4VSolid *ladderext_subtbox =
new G4Box((
boost::format(
"ladderext_subtbox_%d_%d") % inttlayer % itype).
str(), stave_x / 1.5, ladder_y / 1.5, hdiext_z / 1.);
904 G4VSolid *ladderext_box1 =
new G4SubtractionSolid((
boost::format(
"ladderext_box1_%d_%d") % inttlayer % itype).
str(), ladderext_basebox, ladderext_subtbox, lad_box_rotpos, ladTranspos);
906 G4VSolid *ladderext_box =
new G4SubtractionSolid((
boost::format(
"ladderext_box_%d_%d") % inttlayer % itype).
str(), ladderext_box1, ladderext_subtbox, lad_box_rotneg, ladTransneg);
910 delete lad_box_rotpos;
911 delete lad_box_rotneg;
923 double TVstave_y = 0.0;
924 const double TVstave_x = ladder_x / 2. - stave_x / 2.;
925 new G4PVPlacement(0, G4ThreeVector(TVstave_x, TVstave_y, 0.0), stave_volume, (
boost::format(
"stave_%d_%d") % inttlayer % itype).
str(),
927 new G4PVPlacement(0, G4ThreeVector(TVstave_x, TVstave_y, 0.0), staveext_volume, (
boost::format(
"staveext_%d_%s") % inttlayer % itype).
str(),
931 const double TVhdi_kapton_x = TVstave_x - stave_x / 2. - hdi_kapton_x / 2.;
932 new G4PVPlacement(0, G4ThreeVector(TVhdi_kapton_x, TVstave_y, 0.0), hdi_kapton_volume, (
boost::format(
"hdikapton_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
933 new G4PVPlacement(0, G4ThreeVector(TVhdi_kapton_x, TVstave_y, 0.0), hdiext_kapton_volume, (
boost::format(
"hdiextkapton_%d_%s") % inttlayer % itype).
str(), ladderext_volume,
false, 0,
OverlapCheck());
936 const double TVhdi_copper_x = TVhdi_kapton_x - hdi_kapton_x / 2. - hdi_copper_x / 2.;
937 new G4PVPlacement(0, G4ThreeVector(TVhdi_copper_x, TVstave_y, 0.0), hdi_copper_volume, (
boost::format(
"hdicopper_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
938 new G4PVPlacement(0, G4ThreeVector(TVhdi_copper_x, TVstave_y, 0.0), hdiext_copper_volume, (
boost::format(
"hdiextcopper_%d_%s") % inttlayer % itype).
str(), ladderext_volume,
false, 0,
OverlapCheck());
941 const double TVsi_glue_x = TVhdi_copper_x - hdi_copper_x / 2. - si_glue_x / 2.;
942 new G4PVPlacement(0, G4ThreeVector(TVsi_glue_x, TVstave_y, 0.0), si_glue_volume, (
boost::format(
"si_glue_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
948 TVSi_y = +sensor_offset_y;
950 const double TVSi_x = TVsi_glue_x - si_glue_x / 2. - siactive_x / 2.;
951 new G4PVPlacement(0, G4ThreeVector(TVSi_x, TVSi_y, 0.0), siinactive_volume,
953 new G4PVPlacement(0, G4ThreeVector(TVSi_x, TVSi_y, 0.0), siactive_volume,
957 const double TVfphx_glue_x = TVhdi_copper_x - hdi_copper_x / 2. - fphx_glue_x / 2.;
958 double TVfphx_glue_y = sifull_y / 2. + gap_sensor_fphx + fphx_y / 2.;
960 TVfphx_glue_y -= sensor_offset_y;
965 new G4PVPlacement(0, G4ThreeVector(TVfphx_glue_x, +TVfphx_glue_y, 0.0), fphx_gluecontainer_volume, (
boost::format(
"fphx_gluecontainerp_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
967 new G4PVPlacement(0, G4ThreeVector(TVfphx_glue_x, -TVfphx_glue_y, 0.0), fphx_gluecontainer_volume, (
boost::format(
"fphx_gluecontainerm_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
970 const double TVfphx_x = TVfphx_glue_x - fphx_glue_x / 2. - fphx_x / 2.;
971 double TVfphx_y = sifull_y / 2. + gap_sensor_fphx + fphx_y / 2.;
973 TVfphx_y -= sensor_offset_y;
978 new G4PVPlacement(0, G4ThreeVector(TVfphx_x, +TVfphx_y, 0.0), fphxcontainer_volume, (
boost::format(
"fphxcontainerp_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
980 new G4PVPlacement(0, G4ThreeVector(TVfphx_x, -TVfphx_y, 0.0), fphxcontainer_volume, (
boost::format(
"fphxcontainerm_%d_%d") % inttlayer % itype).
str(), ladder_volume,
false, 0,
OverlapCheck());
991 double sensor_offset_x_ladder = 0.0 - TVSi_x;
993 const double dphi = 2 * M_PI / nladders_layer;
995 m_PosZ[inttlayer][itype] = (itype == 0) ? hdi_z / 2. : hdi_z_arr[inttlayer][0] + hdi_z / 2.;
1003 for (
int icopy = 0; icopy < nladders_layer; icopy++)
1006 const double phi = offsetphi + dphi * icopy;
1011 radius += sensor_offset_x_ladder;
1018 p = atan(sensor_offset_y / radius);
1024 const double posx = radius * cos(phi - p);
1025 const double posy = radius * sin(phi - p);
1026 const double fRotate = p + (phi -
p) + offsetrot;
1027 G4RotationMatrix ladderrotation;
1028 ladderrotation.rotateZ(fRotate);
1031 auto pointer_negz =
new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, -
m_PosZ[inttlayer][itype])), ladder_volume,
1033 auto pointer_posz =
new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, +
m_PosZ[inttlayer][itype])), ladder_volume,
1047 const double posz_ext = (hdi_z_arr[inttlayer][0] + hdi_z) + hdiext_z / 2.;
1049 new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, -posz_ext)), ladderext_volume,
1051 new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, +posz_ext)), ladderext_volume,
1056 std::cout <<
" Ladder copy " << icopy <<
" radius " << radius <<
" phi " << phi <<
" itype " << itype <<
" posz " <<
m_PosZ[inttlayer][itype]
1057 <<
" fRotate " << fRotate <<
" posx " << posx <<
" posy " << posy
1083 G4LogicalVolume *rail_volume =
new G4LogicalVolume(rail_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1084 "rail_volume", 0, 0, 0);
1094 for (
int i = 0;
i < 4;
i++)
1096 double phi = rail_phi_start +
i * rail_dphi;
1099 const double posx = rail_radius * cos(phi);
1100 const double posy = rail_radius * sin(phi);
1102 new G4PVPlacement(0, G4ThreeVector(posx, posy, 0.0), rail_volume,
1131 G4Tubs *outer_skin_tube =
new G4Tubs(
"si_outer_skin",
1136 G4LogicalVolume *outer_skin_volume =
new G4LogicalVolume(outer_skin_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1137 "outer_skin_volume", 0, 0, 0);
1156 new G4PVPlacement(0, G4ThreeVector(0, 0.0, 0), outer_skin_volume,
1157 "si_support_outer_skin_cfcin", trackerenvelope,
false, 0,
OverlapCheck());
1160 G4Tubs *inner_skin_tube =
new G4Tubs(
"si_inner_skin",
1165 G4LogicalVolume *inner_skin_volume =
new G4LogicalVolume(inner_skin_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1166 "inner_skin_volume", 0, 0, 0);
1173 new G4PVPlacement(0, G4ThreeVector(0, 0.0), inner_skin_volume,
1174 "si_support_inner_skin", trackerenvelope,
false, 0,
OverlapCheck());
1177 G4Tubs *service_barrel_outer_tube =
new G4Tubs(
"si_service_barrel_outer",
1182 G4LogicalVolume *service_barrel_outer_volume =
new G4LogicalVolume(service_barrel_outer_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1183 "service_barrel_outer_volume", 0, 0, 0);
1190 new G4PVPlacement(0, G4ThreeVector(0, 0.0), service_barrel_outer_volume,
1191 "si_support_service_barrel_outer", trackerenvelope,
false, 0,
OverlapCheck());
1194 G4Tubs *support_tube_tube =
new G4Tubs(
"si_support_tube",
1199 G4LogicalVolume *support_tube_volume =
new G4LogicalVolume(support_tube_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1200 "support_tube_volume", 0, 0, 0);
1207 new G4PVPlacement(0, G4ThreeVector(0, 0.0), support_tube_volume,
1208 "si_support_support_tube", trackerenvelope,
false, 0,
OverlapCheck());
1217 G4Tubs *endcap_CP_ring =
new G4Tubs(
"endcap_CP_ring",
1223 G4LogicalVolume *endcap_CP_ring_volume =
new G4LogicalVolume(endcap_CP_ring,
GetDetectorMaterial(
"CF30_PEEK70"),
1224 "endcap_CP_ring_volume", 0, 0, 0);
1229 G4Tubs *endcap_AlPEEK_Alring_1 =
new G4Tubs(
"endcap_AlPEEK_Alring_1",
1235 G4LogicalVolume *endcap_AlPEEK_Alring_1_volume =
new G4LogicalVolume(endcap_AlPEEK_Alring_1,
GetDetectorMaterial(
"G4_Al"),
1236 "endcap_AlPEEK_Alring_1_volume", 0, 0, 0);
1240 G4Tubs *endcap_AlPEEK_Cring_1 =
new G4Tubs(
"endcap_AlPEEK_Cring_1",
1246 G4LogicalVolume *endcap_AlPEEK_Cring_1_volume =
new G4LogicalVolume(endcap_AlPEEK_Cring_1,
GetDetectorMaterial(
"CF30_PEEK70"),
1247 "endcap_AlPEEK_Cring_1_volume", 0, 0, 0);
1251 G4Tubs *endcap_AlPEEK_Alring_2 =
new G4Tubs(
"endcap_AlPEEK_Alring_2",
1257 G4LogicalVolume *endcap_AlPEEK_Alring_2_volume =
new G4LogicalVolume(endcap_AlPEEK_Alring_2,
GetDetectorMaterial(
"G4_Al"),
1258 "endcap_AlPEEK_Alring_2_volume", 0, 0, 0);
1262 G4Tubs *endcap_AlPEEK_Cring_2 =
new G4Tubs(
"endcap_AlPEEK_Cring_2",
1268 G4LogicalVolume *endcap_AlPEEK_Cring_2_volume =
new G4LogicalVolume(endcap_AlPEEK_Cring_2,
GetDetectorMaterial(
"CF30_PEEK70"),
1269 "endcap_AlPEEK_Cring_2_volume", 0, 0, 0);
1273 G4Tubs *endcap_AlPEEK_Alring_3 =
new G4Tubs(
"endcap_AlPEEK_Alring_3",
1279 G4LogicalVolume *endcap_AlPEEK_Alring_3_volume =
new G4LogicalVolume(endcap_AlPEEK_Alring_3,
GetDetectorMaterial(
"G4_Al"),
1280 "endcap_AlPEEK_Alring_3_volume", 0, 0, 0);
1285 double endcap_outer_edge_z = 0.0;
1289 G4Tubs *endcap_Al_ring =
new G4Tubs(
"endcap_Al_ring",
1295 G4LogicalVolume *endcap_Al_ring_volume =
new G4LogicalVolume(endcap_Al_ring,
GetDetectorMaterial(
"Al6061T6"),
1296 "endcap_Al_ring_volume", 0, 0, 0);
1299 G4Tubs *endcap_SS_ring =
new G4Tubs(
"endcap_SS_ring",
1305 G4LogicalVolume *endcap_SS_ring_volume =
new G4LogicalVolume(endcap_SS_ring,
GetDetectorMaterial(
"SS316"),
1306 "endcap_SS_ring_volume", 0, 0, 0);
1309 G4Tubs *endcap_WG_ring =
new G4Tubs(
"endcap_WG_ring",
1315 G4LogicalVolume *endcap_WG_ring_volume =
new G4LogicalVolume(endcap_WG_ring,
GetDetectorMaterial(
"WaterGlycol_INTT"),
1316 "endcap_WG_ring_volume", 0, 0, 0);
1319 for (
int i = 0;
i < 2;
i++)
1321 endcap_ring_z = (
i == 0) ? endcap_ring_z : -1.0 * endcap_ring_z;
1323 double width_WGring_z = supportparams->
get_double_param(
"endcap_WGring_length") *
cm;
1324 double width_SSring_z = supportparams->
get_double_param(
"endcap_SSring_length") *
cm;
1325 double width_Alring_z = supportparams->
get_double_param(
"endcap_Alring_length") *
cm;
1327 for (
int j = 0;
j < 2;
j++)
1329 width_WGring_z = (
j == 0) ? width_WGring_z : -1.0 * width_WGring_z;
1330 width_SSring_z = (
j == 0) ? width_SSring_z : -1.0 * width_SSring_z;
1331 width_Alring_z = (
j == 0) ? width_Alring_z : -1.0 * width_Alring_z;
1333 double cent_WGring_z = endcap_ring_z + width_WGring_z / 2.;
1334 double cent_SSring_z = endcap_ring_z + width_WGring_z + width_SSring_z / 2.;
1335 double cent_Alring_z = endcap_ring_z + width_WGring_z + width_SSring_z + width_Alring_z / 2.;
1336 endcap_outer_edge_z = fabs(endcap_ring_z) + fabs(width_WGring_z + width_SSring_z + width_Alring_z / 2.);
1338 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_WGring_z),
1339 endcap_WG_ring_volume,
1343 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_SSring_z),
1344 endcap_SS_ring_volume,
1348 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_Alring_z),
1349 endcap_Al_ring_volume,
1355 else if (supportparams->
get_int_param(
"endcap_ring_type") == 1)
1359 for (
int i = 0;
i < 2;
i++)
1361 endcap_ring_z = (
i == 0) ? endcap_ring_z : -1.0 * endcap_ring_z;
1362 endcap_outer_edge_z = fabs(endcap_ring_z);
1364 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1365 endcap_CP_ring_volume,
1371 else if (supportparams->
get_int_param(
"endcap_ring_type") == 2)
1375 double sifull_width = si_0_width + si_1_width;
1377 double hdiext_width = params->
get_double_param(
"halfladder_inside_z") *
cm - sifull_width;
1378 double hdifull_width = hdi_width + hdiext_width;
1379 double endcap_ring_z = hdifull_width + supportparams->
get_double_param(
"endcap_AlPEEK_Cring_length") / 2.0 *
cm;
1381 for (
int i = 0;
i < 2;
i++)
1383 endcap_ring_z = (
i == 0) ? endcap_ring_z : -1.0 * endcap_ring_z;
1384 endcap_outer_edge_z = fabs(endcap_ring_z) + supportparams->
get_double_param(
"endcap_AlPEEK_Alring_length") *
cm / 2.0;
1386 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1387 endcap_AlPEEK_Alring_1_volume,
1391 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1392 endcap_AlPEEK_Cring_1_volume,
1396 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1397 endcap_AlPEEK_Alring_2_volume,
1401 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1402 endcap_AlPEEK_Cring_2_volume,
1406 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1407 endcap_AlPEEK_Alring_3_volume,
1415 double bus_extender_radius_innermost = supportparams->
get_double_param(
"bus_extender_radius") *
cm;
1416 double bus_extender_length = supportparams->
get_double_param(
"bus_extender_length") *
cm;
1417 double bus_extender_copper_x = supportparams->
get_double_param(
"bus_extender_copper_x") *
cm;
1418 double bus_extender_kapton_x = supportparams->
get_double_param(
"bus_extender_kapton_x") *
cm;
1422 G4Tubs *bus_extender_copper_inner =
new G4Tubs(
"bus_extender_coppe_innerr",
1423 inner_radius, inner_radius + bus_extender_copper_x,
1424 bus_extender_length / 2.0, 0, 2.0 * M_PI);
1426 G4LogicalVolume *bus_extender_copper_inner_volume =
new G4LogicalVolume(bus_extender_copper_inner,
GetDetectorMaterial(
"G4_Cu"),
1427 "bus_extender_copper_inner_volume", 0, 0, 0);
1431 inner_radius += bus_extender_copper_x;
1432 G4Tubs *bus_extender_kapton_inner =
new G4Tubs(
"bus_extender_kapton_inner",
1433 inner_radius, inner_radius + bus_extender_kapton_x,
1434 bus_extender_length / 2.0, 0, 2.0 * M_PI);
1436 G4LogicalVolume *bus_extender_kapton_inner_volume =
new G4LogicalVolume(bus_extender_kapton_inner,
GetDetectorMaterial(
"G4_KAPTON"),
1437 "bus_extender_kapton_inner_volume", 0, 0, 0);
1441 inner_radius += bus_extender_kapton_x;
1442 G4Tubs *bus_extender_copper_outer =
new G4Tubs(
"bus_extender_copper_outer",
1443 inner_radius, inner_radius + bus_extender_copper_x,
1444 bus_extender_length / 2.0, 0, 2.0 * M_PI);
1446 G4LogicalVolume *bus_extender_copper_outer_volume =
new G4LogicalVolume(bus_extender_copper_outer,
GetDetectorMaterial(
"G4_Cu"),
1447 "bus_extender_copper_outer_volume", 0, 0, 0);
1451 inner_radius += bus_extender_copper_x;
1452 G4Tubs *bus_extender_kapton_outer =
new G4Tubs(
"bus_extender_kapton_outer",
1453 inner_radius, inner_radius + bus_extender_kapton_x,
1454 bus_extender_length / 2.0, 0, 2.0 * M_PI);
1456 G4LogicalVolume *bus_extender_kapton_outer_volume =
new G4LogicalVolume(bus_extender_kapton_outer,
GetDetectorMaterial(
"G4_KAPTON"),
1457 "bus_extender_kapton_outer_volume", 0, 0, 0);
1460 double bus_extender_z = endcap_outer_edge_z;
1461 for (
int i = 0;
i < 2;
i++)
1464 double cent_bus_extender_z = bus_extender_z + bus_extender_length / 2.0;
1465 cent_bus_extender_z *= (
i == 0) ? 1.0 : -1.0;
1466 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z),
1467 bus_extender_copper_inner_volume,
1472 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z),
1473 bus_extender_kapton_inner_volume,
1478 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z),
1479 bus_extender_copper_outer_volume,
1484 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z),
1485 bus_extender_kapton_outer_volume,
1500 if (iter->second > 0)
1522 const int sphxlayer = layeriter->first;
1523 const int inttlayer = layeriter->second;
1524 int ilayer = inttlayer;
1554 std::map<G4VPhysicalVolume *, std::tuple<int, int, int, int>>::const_iterator
1560 std::cout <<
PHWHERE <<
" Volume " << physvol->GetName() <<
" not in active volume tuple" << std::endl;
1566 std::map<G4LogicalVolume *, std::tuple<int, int>>::const_iterator
1572 std::cout <<
PHWHERE <<
" Volume " << logvol->GetName() <<
" not in passive volume tuple" << std::endl;