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 #include <boost/format.hpp>
54 class G4VPVParameterisation;
62 , m_ParamsContainer(parameters)
63 , m_IsSupportActive(0)
65 , m_LayerBeginEndIteratorPair(layer_b_e)
69 int layer = layeriter->second;
77 fill_n(&
m_PosZ[0][0],
sizeof(
m_PosZ) /
sizeof(
double), NAN);
91 G4LogicalVolume *logvol = volume->GetLogicalVolume();
108 cout <<
"PHG4InttDetector::Construct called for layers " << endl;
111 cout <<
"layer " << layeriter->second << endl;
128 array<array<double, 2>, 8> hdi_z_arr;
132 int inttlayer = layeriter->second;
139 const int nladders_layer = params1->
get_int_param(
"nladder");
145 const int nstrips_phi_sensor = params->
get_int_param(
"nstrips_phi_sensor");
161 cout <<
"Constructing Intt layer: " << endl;
162 cout <<
" layer " << inttlayer <<
" laddertype " << laddertype <<
" nladders_layer " << nladders_layer
163 <<
" sensor_radius " <<
m_SensorRadius[inttlayer] <<
" offsetphi " << offsetphi <<
" rad "
164 <<
" offsetphi " << offsetphi *
rad / deg <<
" deg "
169 for (
int itype = 0; itype < 2; ++itype)
171 if (!(itype >= 0 && itype <= 1))
173 assert(!
"Error: check ladder type.");
176 int nstrips_z_sensor;
181 nstrips_z_sensor = params->
get_int_param(
"nstrips_z_sensor_0");
185 nstrips_z_sensor = params->
get_int_param(
"nstrips_z_sensor_1");
188 cout <<
"invalid itype " << itype << endl;
198 const double siactive_x = strip_x;
199 const double siactive_y = strip_y * nstrips_phi_sensor;
200 const double siactive_z = strip_z * nstrips_z_sensor;
201 G4VSolid *siactive_box =
new G4Box((boost::format(
"siactive_box_%d_%d") % inttlayer % itype).str(), siactive_x / 2, siactive_y / 2., siactive_z / 2.);
202 G4LogicalVolume *siactive_volume =
new G4LogicalVolume(siactive_box,
GetDetectorMaterial(
"G4_Si"),
203 boost::str(boost::format(
"siactive_volume_%d_%d") % inttlayer % itype).c_str(), 0, 0, 0);
212 const double sifull_x = siactive_x;
213 const double sifull_y = siactive_y + 2.0 * params->
get_double_param(
"sensor_edge_phi") *
cm;
214 const double sifull_z = siactive_z + 2.0 * params->
get_double_param(
"sensor_edge_z") *
cm;
215 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);
218 G4VSolid *siinactive_box =
new G4SubtractionSolid((boost::format(
"siinactive_box_%d_%d") % inttlayer % itype).str(),
219 sifull_box, siactive_box, 0, G4ThreeVector(0, 0, 0));
220 G4LogicalVolume *siinactive_volume =
new G4LogicalVolume(siinactive_box,
GetDetectorMaterial(
"G4_Si"),
221 (boost::format(
"siinactive_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
230 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);
232 G4LogicalVolume *si_glue_volume =
new G4LogicalVolume(si_glue_box,
GetDetectorMaterial(
"SilverEpoxyGlue_INTT"),
233 (boost::format(
"si_glue_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
244 hdi_z_arr[inttlayer][itype] = hdi_z;
245 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);
246 G4LogicalVolume *hdi_kapton_volume =
new G4LogicalVolume(hdi_kapton_box,
GetDetectorMaterial(
"G4_KAPTON"),
247 (boost::format(
"hdi_kapton_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
253 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);
254 G4LogicalVolume *hdi_copper_volume =
new G4LogicalVolume(hdi_copper_box,
GetDetectorMaterial(
"G4_Cu"),
255 (boost::format(
"hdi_copper_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
264 const double hdiext_z = (itype == 0) ? 0.000001 : halfladder_inside_z - hdi_z_arr[inttlayer][0] - hdi_z;
265 G4VSolid *hdiext_kapton_box =
new G4Box((boost::format(
"hdiext_kapton_box_%d_%s") % inttlayer % itype).str(),
266 hdi_kapton_x / 2., hdi_y / 2., hdiext_z / 2.0);
267 G4LogicalVolume *hdiext_kapton_volume =
new G4LogicalVolume(hdiext_kapton_box,
GetDetectorMaterial(
"G4_KAPTON"),
268 (boost::format(
"hdiext_kapton_%d_%s") % inttlayer % itype).str(), 0, 0, 0);
273 G4VSolid *hdiext_copper_box =
new G4Box((boost::format(
"hdiext_copper_box_%d_%s") % inttlayer % itype).str(),
274 hdi_copper_x / 2., hdi_y / 2., hdiext_z / 2.0);
275 G4LogicalVolume *hdiext_copper_volume =
new G4LogicalVolume(hdiext_copper_box,
GetDetectorMaterial(
"G4_Cu"),
276 (boost::format(
"hdiext_copper_%d_%s") % inttlayer % itype).str(), 0, 0, 0);
285 G4VSolid *fphx_box =
new G4Box((boost::format(
"fphx_box_%d_%d") % inttlayer % itype).str(), fphx_x / 2., fphx_y / 2., fphx_z / 2.);
287 (boost::format(
"fphx_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
298 G4VSolid *fphxcontainer_box =
new G4Box((boost::format(
"fphxcontainer_box_%d_%d") % inttlayer % itype).str(),
299 fphx_x / 2., fphx_y / 2., hdi_z / 2.);
301 (boost::format(
"fphxcontainer_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
306 const double fphx_offsetx = 0.;
307 const double fphx_offsety = 0.;
309 double offsetz, cell_length_z;
314 ncopy = nstrips_z_sensor / 128.0;
318 ncopy = nstrips_z_sensor;
322 cout <<
PHWHERE <<
"invalid laddertype " << laddertype << endl;
329 cell_length_z = strip_z * nstrips_z_sensor / ncopy;
330 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;
332 G4VPVParameterisation *fphxparam =
new PHG4InttFPHXParameterisation(fphx_offsetx, +fphx_offsety, offsetz, 2. * cell_length_z / 2., ncopy);
333 new G4PVParameterised((boost::format(
"fphxcontainer_%d_%d") % inttlayer % itype).str(),
334 fphx_volume, fphxcontainer_volume, kZAxis, ncopy, fphxparam,
OverlapCheck());
337 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.);
339 G4LogicalVolume *fphx_glue_volume =
new G4LogicalVolume(fphx_glue_box,
GetDetectorMaterial(
"SilverEpoxyGlue_INTT"),
340 (boost::format(
"fphx_glue_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
349 G4VSolid *fphx_gluecontainer_box =
new G4Box((boost::format(
"fphx_gluecontainer_box_%d_%d") % inttlayer % itype).str(),
350 fphx_glue_x / 2., fphx_y / 2., hdi_z / 2.);
352 (boost::format(
"fphx_gluecontainer_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
355 G4VPVParameterisation *fphx_glueparam =
new PHG4InttFPHXParameterisation(fphx_offsetx, +fphx_offsety, offsetz, 2. * cell_length_z / 2., ncopy);
357 new G4PVParameterised((boost::format(
"glue_fphxcontainer_%d_%d") % inttlayer % itype).str(),
358 fphx_glue_volume, fphx_gluecontainer_volume, kZAxis, ncopy, fphx_glueparam,
OverlapCheck());
363 G4LogicalVolume *stave_volume = NULL;
364 G4LogicalVolume *staveext_volume = NULL;
371 const double stave_thickness = params->
get_double_param(
"stave_straight_cooler_x") *
cm;
372 const double Rcmin = 0.30 *
cm;
373 const double Rcmax = Rcmin + stave_thickness;
374 double Rcavge = (Rcmax + Rcmin) / 2.0;
375 double dphi_c = 23.19859051 *
M_PI / 180.;
376 const double stave_z = hdi_z;;
380 const double phic_begin[4] = {
M_PI - dphi_c, -dphi_c, 0.0,
M_PI};
381 const double dphic[4] = {dphi_c, dphi_c, dphi_c, dphi_c};
383 G4Tubs *stave_curve_cons[4];
384 G4Tubs *stave_curve_ext_cons[4];
385 G4LogicalVolume *stave_curve_volume[4];
386 G4LogicalVolume *stave_curve_ext_volume[4];
388 for (
int i = 0; i < 4; i++)
390 stave_curve_cons[i] =
new G4Tubs((boost::format(
"stave_curve_cons_%d_%d_%d") % inttlayer % itype % i).str(),
391 Rcmin, Rcmax, stave_z / 2., phic_begin[i], dphic[i]);
392 stave_curve_volume[i] =
new G4LogicalVolume(stave_curve_cons[i],
GetDetectorMaterial(
"CFRP_INTT"),
393 (boost::format(
"stave_curve_volume_%d_%d_%d") % inttlayer % itype % i).str(), 0, 0, 0);
398 stave_curve_ext_cons[i] =
new G4Tubs((boost::format(
"stave_curve_ext_cons_%d_%d_%d") % inttlayer % itype % i).str(),
399 Rcmin, Rcmax, hdiext_z / 2., phic_begin[i], dphic[i]);
400 stave_curve_ext_volume[i] =
new G4LogicalVolume(stave_curve_ext_cons[i],
GetDetectorMaterial(
"CFRP_INTT"),
401 (boost::format(
"stave_curve_ext_volume_%d_%d_%d") % inttlayer % itype % i).str(), 0, 0, 0);
411 double curve_length_y = Rcavge * sin(dphi_c);
414 double stave_straight_outer_y = params->
get_double_param(
"stave_straight_outer_y") *
cm;
415 double stave_straight_cooler_y = params->
get_double_param(
"stave_straight_cooler_y") *
cm;
416 double rohacell_straight_y = params->
get_double_param(
"stave_straight_rohacell_y") *
cm;
419 G4VSolid *stave_straight_outer_box =
new G4Box((boost::format(
"stave_straight_outer_box_%d_%d") % inttlayer % itype).str(),
420 stave_thickness / 2., stave_straight_outer_y / 2., stave_z / 2.);
421 G4LogicalVolume *stave_straight_outer_volume =
new G4LogicalVolume(stave_straight_outer_box,
GetDetectorMaterial(
"CFRP_INTT"),
422 (boost::format(
"stave_straight_outer_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
427 G4VSolid *stave_straight_outer_ext_box =
new G4Box((boost::format(
"stave_straight_outer_ext_box_%d_%s") % inttlayer % itype).str(),
428 stave_thickness / 2., stave_straight_outer_y / 2., hdiext_z / 2.);
429 G4LogicalVolume *stave_straight_outer_ext_volume =
new G4LogicalVolume(stave_straight_outer_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
430 (boost::format(
"stave_straight_outer_ext_volume_%d_%s") % inttlayer % itype).str(), 0, 0, 0);
437 G4VSolid *stave_straight_cooler_box =
new G4Box((boost::format(
"stave_straight_cooler_box_%d_%d") % inttlayer % itype).str(),
438 stave_thickness / 2., stave_straight_cooler_y / 2., stave_z / 2.);
439 G4LogicalVolume *stave_straight_cooler_volume =
new G4LogicalVolume(stave_straight_cooler_box,
GetDetectorMaterial(
"CFRP_INTT"),
440 (boost::format(
"stave_straight_cooler_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
445 G4VSolid *stave_straight_cooler_ext_box =
new G4Box((boost::format(
"stave_straight_cooler_ext_box_%d_%d") % inttlayer % itype).str(),
446 stave_thickness / 2., stave_straight_cooler_y / 2., hdiext_z / 2.);
447 G4LogicalVolume *stave_straight_cooler_ext_volume =
new G4LogicalVolume(stave_straight_cooler_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
448 (boost::format(
"stave_straight_cooler_ext_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
456 G4VSolid *stave_slant_cooler_box =
new G4Box((boost::format(
"stave_slant_cooler_box_%d_%d") % inttlayer % itype).str(),
457 stave_thickness / 2., stave_slant_cooler_y / 2., stave_z / 2.);
458 G4LogicalVolume *stave_slant_cooler_volume =
new G4LogicalVolume(stave_slant_cooler_box,
GetDetectorMaterial(
"CFRP_INTT"),
459 (boost::format(
"stave_slant_cooler_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
464 G4VSolid *stave_slant_cooler_ext_box =
new G4Box((boost::format(
"stave_lant_cooler_ext_box_%d_%d") % inttlayer % itype).str(),
465 stave_thickness / 2., stave_slant_cooler_y / 2., hdiext_z / 2.);
466 G4LogicalVolume *stave_slant_cooler_ext_volume =
new G4LogicalVolume(stave_slant_cooler_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
467 (boost::format(
"stave_slant_cooler_ext_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
475 G4VSolid *stave_bottom_cooler_box
476 =
new G4Box((boost::format(
"stave_bottom_cooler_box_%d_%d") % inttlayer % itype).str(),
477 stave_thickness / 2., hdi_y / 2., stave_z / 2.);
479 G4LogicalVolume *stave_bottom_cooler_volume
481 (boost::format(
"stave_bottom_cooler_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
487 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.);
488 G4LogicalVolume *stave_bottom_cooler_ext_volume =
new G4LogicalVolume(stave_bottom_cooler_ext_box,
GetDetectorMaterial(
"CFRP_INTT"),
489 (boost::format(
"stave_bottom_cooler_ext_volume_%d_%s") % inttlayer % itype).str(), 0, 0, 0);
505 const double Rpmin = 0.10 *
cm;
506 const double Rpmax = 0.15 *
cm;
507 G4VSolid *stave_glue_box =
new G4Box((boost::format(
"stave_glue_box_%d_%d") % inttlayer % itype).str(), 3. / 2, 3. / 2., stave_z / 2.);
508 G4LogicalVolume *stave_glue_volume =
new G4LogicalVolume(stave_glue_box,
GetDetectorMaterial(
"Epoxy"),
509 (boost::format(
"stave_glue_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
510 G4VSolid *staveext_glue_box =
new G4Box((boost::format(
"staveext_glue_box_%d_%d") % inttlayer % itype).str(), 3. / 2., 3. / 2., hdiext_z / 2.);
511 G4LogicalVolume *staveext_glue_volume =
new G4LogicalVolume(staveext_glue_box,
GetDetectorMaterial(
"Epoxy"),
512 (boost::format(
"staveext_glue_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
517 G4VSolid *stave_pipe_cons =
new G4Tubs((boost::format(
"stave_pipe_cons_%d_%d") % inttlayer % itype).str(),
518 Rpmin, Rpmax, stave_z / 2., -
M_PI, 2.0 *
M_PI);
519 G4LogicalVolume *stave_pipe_volume =
new G4LogicalVolume(stave_pipe_cons,
GetDetectorMaterial(
"CFRP_INTT"),
520 (boost::format(
"stave_pipe_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
522 G4VSolid *staveext_pipe_cons =
new G4Tubs((boost::format(
"staveext_pipe_cons_%d_%d") % inttlayer % itype).str(),
523 Rpmin, Rpmax, hdiext_z / 2., -
M_PI, 2.0 *
M_PI);
524 G4LogicalVolume *staveext_pipe_volume =
new G4LogicalVolume(staveext_pipe_cons,
GetDetectorMaterial(
"CFRP_INTT"),
525 (boost::format(
"staveext_pipe_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
530 G4VSolid *stave_water_cons =
new G4Tubs((boost::format(
"stave_water_cons_%d_%d") % inttlayer % itype).str(),
531 0., Rpmin, stave_z / 2., -
M_PI, 2.0 *
M_PI);
532 G4LogicalVolume *stave_water_volume =
new G4LogicalVolume(stave_water_cons,
GetDetectorMaterial(
"G4_WATER"),
533 (boost::format(
"stave_water_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
535 G4VSolid *staveext_water_cons =
new G4Tubs((boost::format(
"staveext_water_cons_%d_%d") % inttlayer % itype).str(),
536 0., Rpmin, hdiext_z / 2., -
M_PI, 2.0 *
M_PI);
537 G4LogicalVolume *staveext_water_volume =
new G4LogicalVolume(staveext_water_cons,
GetDetectorMaterial(
"G4_WATER"),
538 (boost::format(
"staveext_water_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
545 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.);
546 G4LogicalVolume *rohacell_straight_volume =
new G4LogicalVolume(rohacell_straight_cons,
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
547 (boost::format(
"rohacell_straight_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
549 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.);
550 G4LogicalVolume *rohacellext_straight_volume =
new G4LogicalVolume(rohacellext_straight_cons,
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
551 (boost::format(
"rohacellext_straight_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
554 const double rh_phic_begin[2] = {-dphi_c, 0.0};
555 const double rh_dphic[2] = {dphi_c, dphi_c};
556 G4Tubs *rohacell_curve_cons[2];
557 G4LogicalVolume *rohacell_curve_volume[2];
558 G4Tubs *rohacellext_curve_cons[2];
559 G4LogicalVolume *rohacellext_curve_volume[2];
560 for (
int i = 0; i < 2; i++)
562 rohacell_curve_cons[i] =
new G4Tubs((boost::format(
"rohacell_curve_cons_%d_%d_%d") % inttlayer % itype % i).str(),
563 0., Rcmin, stave_z / 2., rh_phic_begin[i], rh_dphic[i]);
564 rohacell_curve_volume[i] =
new G4LogicalVolume(rohacell_curve_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
565 (boost::format(
"rohacell_curve_volume_%d_%d_%d") % inttlayer % itype % i).str(), 0, 0, 0);
566 rohacellext_curve_cons[i] =
new G4Tubs((boost::format(
"rohacellext_curve_cons_%d_%d_%d") % inttlayer % itype % i).str(),
567 0., Rcmin, hdiext_z / 2., rh_phic_begin[i], rh_dphic[i]);
568 rohacellext_curve_volume[i] =
new G4LogicalVolume(rohacellext_curve_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
569 (boost::format(
"rohacellext_curve_volume_%d_%d_%d") % inttlayer % itype % i).str(), 0, 0, 0);
573 G4GenericTrap *rohacell_trap_cons[2];
574 G4LogicalVolume *rohacell_trap_volume[2];
575 G4GenericTrap *rohacellext_trap_cons[2];
576 G4LogicalVolume *rohacellext_trap_volume[2];
577 for (
int i = 0; i < 2; i++)
579 double shift = 1.e-5;
580 std::vector<G4TwoVector> rohatrap(8);
583 rohatrap[0] = G4TwoVector(0. *
cm, 0. *
cm);
584 rohatrap[1] = G4TwoVector(Rcmin *
cos(dphi_c) - shift, -Rcmin * sin(dphi_c));
585 rohatrap[2] = G4TwoVector(Rcmin * (1. -
cos(dphi_c)) - shift, -stave_slant_cooler_y *
cos(dphi_c) - Rcmin * sin(dphi_c));
586 rohatrap[3] = G4TwoVector(0. *
cm, -stave_slant_cooler_y *
cos(dphi_c) - Rcmin * sin(dphi_c));
590 rohatrap[0] = G4TwoVector(0. *
cm, +stave_slant_cooler_y *
cos(dphi_c) + Rcmin * sin(dphi_c));
591 rohatrap[1] = G4TwoVector(Rcmax * (1. -
cos(dphi_c)) - shift, +stave_slant_cooler_y *
cos(dphi_c) + Rcmin * sin(dphi_c));
592 rohatrap[2] = G4TwoVector(Rcmin *
cos(dphi_c) - shift, +Rcmin * sin(dphi_c));
593 rohatrap[3] = G4TwoVector(0. *
cm, 0. *
cm);
595 rohatrap[4] = rohatrap[0];
596 rohatrap[5] = rohatrap[1];
597 rohatrap[6] = rohatrap[2];
598 rohatrap[7] = rohatrap[3];
600 rohacell_trap_cons[i] =
new G4GenericTrap((boost::format(
"rohacell_trap_cons_%d_%d_%d") % inttlayer % itype % i).str(), stave_z / 2., rohatrap);
601 rohacell_trap_volume[i] =
new G4LogicalVolume(rohacell_trap_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
602 (boost::format(
"rohacell_trap_volume_%d_%d_%d") % inttlayer % itype % i).str(), 0, 0, 0);
604 rohacellext_trap_cons[i] =
new G4GenericTrap((boost::format(
"rohacellext_trap_cons_%d_%d_%d") % inttlayer % itype % i).str(), hdiext_z / 2., rohatrap);
605 rohacellext_trap_volume[i] =
new G4LogicalVolume(rohacellext_trap_cons[i],
GetDetectorMaterial(
"ROHACELL_FOAM_51"),
606 (boost::format(
"rohacellext_trap_volume_%d_%d_%d") % inttlayer % itype % i).str(), 0, 0, 0);
611 for (
int i = 0; i < 2; i++)
621 double cooler_gap_x = 0.3 *
cm;
622 double cooler_wall = stave_thickness;
623 double cooler_x = cooler_gap_x + 2.0 * cooler_wall;
629 G4RotationMatrix *stv_rot_pos =
new G4RotationMatrix();
630 stv_rot_pos->rotateZ(-15. *
M_PI / 180.);
631 G4ThreeVector stvTranspos(stave_x / 2., stave_y / 2., 0.);
633 G4RotationMatrix *stv_rot_neg =
new G4RotationMatrix();
634 stv_rot_neg->rotateZ(+15. *
M_PI / 180.);
635 G4ThreeVector stvTransneg(stave_x / 2., -stave_y / 2., 0.);
637 G4VSolid *stave_basebox =
new G4Box((boost::format(
"stave_basebox_%d_%d") % inttlayer % itype).str(), stave_x / 2., stave_y / 2., stave_z / 2.);
638 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.);
640 G4VSolid *stave_box1 =
new G4SubtractionSolid((boost::format(
"stave_box1_%d_%d") % inttlayer % itype).str(), stave_basebox, stave_subtbox, stv_rot_pos, stvTranspos);
642 G4VSolid *stave_box =
new G4SubtractionSolid((boost::format(
"stave_box_%d_%d") % inttlayer % itype).str(), stave_box1, stave_subtbox, stv_rot_neg, stvTransneg);
645 (boost::format(
"stave_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
647 G4VSolid *staveext_basebox =
new G4Box((boost::format(
"staveext_basebox_%d_%d") % inttlayer % itype).str(), stave_x / 2., stave_y / 2., hdiext_z / 2.);
648 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.);
650 G4VSolid *staveext_box1 =
new G4SubtractionSolid((boost::format(
"staveext_box1_%d_%d") % inttlayer % itype).str(), staveext_basebox, staveext_subtbox, stv_rot_pos, stvTranspos);
652 G4VSolid *staveext_box =
new G4SubtractionSolid((boost::format(
"staveext_box_%d_%d") % inttlayer % itype).str(), staveext_box1, staveext_subtbox, stv_rot_neg, stvTransneg);
655 (boost::format(
"staveext_volume_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
670 double x_off_str[3] =
672 Rcavge - stave_x / 2.,
673 (Rcmax - Rcmin) / 2. - stave_x / 2.,
674 (Rcmax - Rcmin) / 2. - stave_x / 2.};
675 double y_off_str[3] =
678 +stave_straight_cooler_y / 2. + 2. * curve_length_y + stave_straight_outer_y / 2.,
679 -stave_straight_cooler_y / 2. - 2. * curve_length_y - stave_straight_outer_y / 2.};
681 for (
int i = 0; i < 3; i++)
685 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_cooler_volume,
686 (boost::format(
"stave_straight_cooler_%d_%d_%d") % i % inttlayer % itype).str(), stave_volume,
false, 0,
OverlapCheck());
687 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_cooler_ext_volume,
688 (boost::format(
"stave_straight_cooler_ext_%d_%d_%d") % i % inttlayer % itype).str(), staveext_volume,
false, 0,
OverlapCheck());
692 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_outer_volume,
693 (boost::format(
"stave_straight_outer_%d_%d_%d") % i % inttlayer % itype).str(), stave_volume,
false, 0,
OverlapCheck());
694 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_outer_ext_volume,
695 (boost::format(
"stave_straight_outer_ext_%d_%d_%d") % i % inttlayer % itype).str(), staveext_volume,
false, 0,
OverlapCheck());
704 double x_off_cooler[4] =
706 Rcavge - cooler_gap_x / 2.,
707 -Rcavge + cooler_gap_x / 2.,
708 -Rcavge + cooler_gap_x / 2.,
709 Rcavge - cooler_gap_x / 2.};
710 double y_off_cooler[4] =
712 -stave_straight_cooler_y / 2. - 2. * curve_length_y,
713 -stave_straight_cooler_y / 2.,
714 +stave_straight_cooler_y / 2.,
715 +stave_straight_cooler_y / 2. + 2. * curve_length_y};
717 for (
int i = 0; i < 4; i++)
719 new G4PVPlacement(0, G4ThreeVector(x_off_cooler[i], y_off_cooler[i], 0.0), stave_curve_volume[i],
720 (boost::format(
"stave_curve_%d_%d_%d") % inttlayer % itype % i).str(), stave_volume,
false, 0,
OverlapCheck());
721 new G4PVPlacement(0, G4ThreeVector(x_off_cooler[i], y_off_cooler[i], 0.0), stave_curve_ext_volume[i],
722 (boost::format(
"stave_curve_ext_%d_%d_%s") % inttlayer % itype % i).str(), staveext_volume,
false, 0,
OverlapCheck());
729 double x_off_str[6] =
731 (Rcmax + Rcmin) / 2. - stave_x / 2. + stave_thickness,
732 (Rcmax + Rcmax) / 4. - stave_x / 2. + stave_thickness,
733 (Rcmax + Rcmax) / 4. - stave_x / 2. + stave_thickness,
734 (Rcmax - Rcmin) / 2. - stave_x / 2. + stave_thickness,
735 (Rcmax - Rcmin) / 2. - stave_x / 2. + stave_thickness,
736 (Rcmax - Rcmin) / 2. - stave_x / 2.
738 double y_off_str[6] =
741 -stave_straight_cooler_y / 2. - 1. * curve_length_y -
cos(dphi_c) * stave_slant_cooler_y / 2.,
742 +stave_straight_cooler_y / 2. + 1. * curve_length_y +
cos(dphi_c) * stave_slant_cooler_y / 2.,
743 -stave_straight_cooler_y / 2. - 2. * curve_length_y -
cos(dphi_c) * stave_slant_cooler_y - stave_straight_outer_y / 2.,
744 +stave_straight_cooler_y / 2. + 2. * curve_length_y +
cos(dphi_c) * stave_slant_cooler_y + stave_straight_outer_y / 2.,
749 for (
int i = 0; i < 6; i++)
753 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_cooler_volume,
754 (boost::format(
"stave_straight_cooler_%d_%d_%d") % inttlayer % itype % i).str(), stave_volume,
false, 0,
OverlapCheck());
755 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_cooler_ext_volume,
756 (boost::format(
"stave_straight_cooler_ext_%d_%d_%s") % inttlayer % itype % i).str(), staveext_volume,
false, 0,
OverlapCheck());
758 else if (i == 1 || i == 2)
760 G4RotationMatrix rotation;
762 rotation.rotateZ(-1. * dphi_c);
764 rotation.rotateZ(dphi_c);
765 new G4PVPlacement(G4Transform3D(rotation, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0)), stave_slant_cooler_volume,
766 (boost::format(
"stave_slant_cooler_%d_%d_%d") % inttlayer % itype % i).str(), stave_volume,
false, 0,
OverlapCheck());
767 new G4PVPlacement(G4Transform3D(rotation, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0)), stave_slant_cooler_ext_volume,
768 (boost::format(
"stave_slant_cooler_ext_%d_%d_%d") % inttlayer % itype % i).str(), staveext_volume,
false, 0,
OverlapCheck());
770 else if( i == 3 || i == 4 )
772 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_outer_volume,
773 (boost::format(
"stave_straight_outer_%d_%d_%d") % inttlayer % itype % i).str(), stave_volume,
false, 0,
OverlapCheck());
774 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_straight_outer_ext_volume,
775 (boost::format(
"stave_straight_outer_ext_%d_%d_%s") % inttlayer % itype % i).str(), staveext_volume,
false, 0,
OverlapCheck());
779 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_bottom_cooler_volume,
780 (boost::format(
"stave_bottom_cooler_%d_%d_%d") % inttlayer % itype % i).str(), stave_volume,
false, 0,
OverlapCheck());
781 new G4PVPlacement(0, G4ThreeVector(x_off_str[i], y_off_str[i], 0.0), stave_bottom_cooler_ext_volume,
782 (boost::format(
"stave_bottom_cooler_ext_%d_%d_%s") % inttlayer % itype % i).str(), staveext_volume,
false, 0,
OverlapCheck());
790 double x_off_curve[4] =
793 +Rcavge - cooler_gap_x / 2. + stave_thickness / 2.,
794 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.,
795 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.,
796 +Rcavge - cooler_gap_x / 2. + stave_thickness / 2.};
797 double y_off_curve[4] =
800 -stave_straight_cooler_y / 2. - 2. * curve_length_y -
cos(dphi_c) * stave_slant_cooler_y,
801 -stave_straight_cooler_y / 2.,
802 +stave_straight_cooler_y / 2.,
803 +stave_straight_cooler_y / 2. + 2. * curve_length_y +
cos(dphi_c) * stave_slant_cooler_y};
805 for (
int i = 0; i < 4; i++)
807 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());
808 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());
813 double x_off_roha_str[2] =
816 -cooler_wall / 2. + stave_thickness / 2.,
817 -cooler_wall / 2. + stave_thickness / 2.};
818 double y_off_roha_str[2] =
821 -3. / 2. - rohacell_straight_y / 2.,
822 +3. / 2. + rohacell_straight_y / 2.};
824 for (
int i = 0; i < 2; i++)
826 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());
827 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());
831 double x_off_roha_curve[2] =
834 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.,
835 -Rcavge + cooler_gap_x / 2. + stave_thickness / 2.};
836 double y_off_roha_curve[2] =
839 -3. / 2. - rohacell_straight_y,
840 +3. / 2. + rohacell_straight_y};
842 for (
int i = 0; i < 2; i++)
844 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());
845 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());
849 double x_off_roha_trap[2] =
852 -Rcmin - cooler_wall / 2. + cooler_gap_x / 2. + stave_thickness / 2.,
853 -Rcmin - cooler_wall / 2. + cooler_gap_x / 2. + stave_thickness / 2.};
854 double y_off_roha_trap[2] =
857 -3. / 2. - rohacell_straight_y,
858 +3. / 2. + rohacell_straight_y};
860 for (
int i = 0; i < 2; i++)
862 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());
863 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());
867 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());
868 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());
869 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());
870 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());
873 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());
874 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());
878 cout <<
PHWHERE <<
"invalid laddertype " << laddertype << endl;
890 const double ladder_x = stave_x + hdi_kapton_x + hdi_copper_x + fphx_glue_x + fphx_x;
891 double ladder_y = hdi_y;
894 G4RotationMatrix *lad_box_rotpos =
new G4RotationMatrix();
895 lad_box_rotpos->rotateZ(-15. *
M_PI / 180.);
896 G4ThreeVector ladTranspos(ladder_x / 2., ladder_y / 2., 0.);
898 G4RotationMatrix *lad_box_rotneg =
new G4RotationMatrix();
899 lad_box_rotneg->rotateZ(+15. *
M_PI / 180.);
900 G4ThreeVector ladTransneg(ladder_x / 2., -ladder_y / 2., 0.);
902 G4VSolid *ladder_basebox =
new G4Box((boost::format(
"ladder_basebox_%d_%d") % inttlayer % itype).str(), ladder_x / 2., ladder_y / 2., hdi_z / 2.);
903 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.);
905 G4VSolid *ladder_box1 =
new G4SubtractionSolid((boost::format(
"ladder_box1_%d_%d") % inttlayer % itype).str(), ladder_basebox, ladder_subtbox, lad_box_rotpos, ladTranspos);
907 G4VSolid *ladder_box =
new G4SubtractionSolid((boost::format(
"ladder_box_%d_%d") % inttlayer % itype).str(), ladder_box1, ladder_subtbox, lad_box_rotneg, ladTransneg);
909 G4LogicalVolume *ladder_volume =
new G4LogicalVolume(ladder_box,
GetDetectorMaterial(rc->
get_StringFlag(
"WorldMaterial")), (boost::format(
"ladder_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
911 G4VSolid *ladderext_basebox =
new G4Box((boost::format(
"ladderext_basebox_%d_%d") % inttlayer % itype).str(), ladder_x / 2., ladder_y / 2., hdiext_z / 2.);
912 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.);
914 G4VSolid *ladderext_box1 =
new G4SubtractionSolid((boost::format(
"ladderext_box1_%d_%d") % inttlayer % itype).str(), ladderext_basebox, ladderext_subtbox, lad_box_rotpos, ladTranspos);
916 G4VSolid *ladderext_box =
new G4SubtractionSolid((boost::format(
"ladderext_box_%d_%d") % inttlayer % itype).str(), ladderext_box1, ladderext_subtbox, lad_box_rotneg, ladTransneg);
918 G4LogicalVolume *ladderext_volume =
new G4LogicalVolume(ladderext_box,
GetDetectorMaterial(rc->
get_StringFlag(
"WorldMaterial")), (boost::format(
"ladderext_%d_%d") % inttlayer % itype).str(), 0, 0, 0);
920 delete lad_box_rotpos;
921 delete lad_box_rotneg;
933 double TVstave_y = 0.0;
934 const double TVstave_x = ladder_x / 2. - stave_x / 2.;
935 new G4PVPlacement(0, G4ThreeVector(TVstave_x, TVstave_y, 0.0), stave_volume, (boost::format(
"stave_%d_%d") % inttlayer % itype).str(),
937 new G4PVPlacement(0, G4ThreeVector(TVstave_x, TVstave_y, 0.0), staveext_volume, (boost::format(
"staveext_%d_%s") % inttlayer % itype).str(),
941 const double TVhdi_kapton_x = TVstave_x - stave_x / 2. - hdi_kapton_x / 2.;
942 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());
943 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());
946 const double TVhdi_copper_x = TVhdi_kapton_x - hdi_kapton_x / 2. - hdi_copper_x / 2.;
947 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());
948 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());
951 const double TVsi_glue_x = TVhdi_copper_x - hdi_copper_x / 2. - si_glue_x / 2.;
952 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());
958 TVSi_y = +sensor_offset_y;
960 const double TVSi_x = TVsi_glue_x - si_glue_x / 2. - siactive_x / 2.;
961 new G4PVPlacement(0, G4ThreeVector(TVSi_x, TVSi_y, 0.0), siinactive_volume,
962 (boost::format(
"siinactive_%d_%d") % inttlayer % itype).str(), ladder_volume,
false, 0,
OverlapCheck());
963 new G4PVPlacement(0, G4ThreeVector(TVSi_x, TVSi_y, 0.0), siactive_volume,
964 (boost::format(
"siactive_%d_%d") % inttlayer % itype).str(), ladder_volume,
false, 0,
OverlapCheck());
967 const double TVfphx_glue_x = TVhdi_copper_x - hdi_copper_x / 2. - fphx_glue_x / 2.;
968 double TVfphx_glue_y = sifull_y / 2. + gap_sensor_fphx + fphx_y / 2.;
970 TVfphx_glue_y -= sensor_offset_y;
975 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());
977 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());
980 const double TVfphx_x = TVfphx_glue_x - fphx_glue_x / 2. - fphx_x / 2.;
981 double TVfphx_y = sifull_y / 2. + gap_sensor_fphx + fphx_y / 2.;
983 TVfphx_y -= sensor_offset_y;
988 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());
990 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());
1001 double sensor_offset_x_ladder = 0.0 - TVSi_x;
1003 const double dphi = 2 *
M_PI / nladders_layer;
1005 m_PosZ[inttlayer][itype] = (itype == 0) ? hdi_z / 2. : hdi_z_arr[inttlayer][0] + hdi_z / 2.;
1013 for (
int icopy = 0; icopy < nladders_layer; icopy++)
1016 const double phi = offsetphi + dphi * icopy;
1021 radius += sensor_offset_x_ladder;
1028 p = atan(sensor_offset_y / radius);
1034 const double posx = radius *
cos(phi - p);
1035 const double posy = radius * sin(phi - p);
1036 const double fRotate = p + (phi -
p) + offsetrot;
1037 G4RotationMatrix ladderrotation;
1038 ladderrotation.rotateZ(fRotate);
1041 auto pointer_negz =
new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, -
m_PosZ[inttlayer][itype])), ladder_volume,
1042 (boost::format(
"ladder_%d_%d_%d_negz") % inttlayer % itype % icopy).str(), trackerenvelope,
false, 0,
OverlapCheck());
1043 auto pointer_posz =
new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, +
m_PosZ[inttlayer][itype])), ladder_volume,
1044 (boost::format(
"ladder_%d_%d_%d_posz") % inttlayer % itype % icopy).str(), trackerenvelope,
false, 0,
OverlapCheck());
1047 m_ActiveVolumeTuple.insert(make_pair(pointer_negz, make_tuple(inttlayer, itype, icopy, -1)));
1048 m_ActiveVolumeTuple.insert(make_pair(pointer_posz, make_tuple(inttlayer, itype, icopy, 1)));
1057 const double posz_ext = (hdi_z_arr[inttlayer][0] + hdi_z) + hdiext_z / 2.;
1059 new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, -posz_ext)), ladderext_volume,
1060 (boost::format(
"ladderext_%d_%d_%d_negz") % inttlayer % itype % icopy).str(), trackerenvelope,
false, 0,
OverlapCheck());
1061 new G4PVPlacement(G4Transform3D(ladderrotation, G4ThreeVector(posx, posy, +posz_ext)), ladderext_volume,
1062 (boost::format(
"ladderext_%d_%d_%d_posz") % inttlayer % itype % icopy).str(), trackerenvelope,
false, 0,
OverlapCheck());
1066 cout <<
" Ladder copy " << icopy <<
" radius " << radius <<
" phi " << phi <<
" itype " << itype <<
" posz " <<
m_PosZ[inttlayer][itype]
1067 <<
" fRotate " << fRotate <<
" posx " << posx <<
" posy " << posy
1088 G4Tubs *rail_tube =
new G4Tubs((boost::format(
"si_support_rail")).str(),
1093 G4LogicalVolume *rail_volume =
new G4LogicalVolume(rail_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1094 "rail_volume", 0, 0, 0);
1104 for (
int i = 0; i < 4; i++)
1106 double phi = rail_phi_start + i * rail_dphi;
1109 const double posx = rail_radius *
cos(phi);
1110 const double posy = rail_radius * sin(phi);
1112 new G4PVPlacement(0, G4ThreeVector(posx, posy, 0.0), rail_volume,
1113 (boost::format(
"si_support_rail_%d") % i).str(), trackerenvelope,
false, 0,
OverlapCheck());
1141 G4Tubs *outer_skin_tube =
new G4Tubs(
"si_outer_skin",
1146 G4LogicalVolume *outer_skin_volume =
new G4LogicalVolume(outer_skin_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1147 "outer_skin_volume", 0, 0, 0);
1166 new G4PVPlacement(0, G4ThreeVector(0, 0.0, 0), outer_skin_volume,
1167 "si_support_outer_skin_cfcin", trackerenvelope,
false, 0,
OverlapCheck());
1170 G4Tubs *inner_skin_tube =
new G4Tubs(
"si_inner_skin",
1175 G4LogicalVolume *inner_skin_volume =
new G4LogicalVolume(inner_skin_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1176 "inner_skin_volume", 0, 0, 0);
1183 new G4PVPlacement(0, G4ThreeVector(0, 0.0), inner_skin_volume,
1184 "si_support_inner_skin", trackerenvelope,
false, 0,
OverlapCheck());
1187 G4Tubs *service_barrel_outer_tube =
new G4Tubs(
"si_service_barrel_outer",
1192 G4LogicalVolume *service_barrel_outer_volume =
new G4LogicalVolume(service_barrel_outer_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1193 "service_barrel_outer_volume", 0, 0, 0);
1200 new G4PVPlacement(0, G4ThreeVector(0, 0.0), service_barrel_outer_volume,
1201 "si_support_service_barrel_outer", trackerenvelope,
false, 0,
OverlapCheck());
1204 G4Tubs *support_tube_tube =
new G4Tubs(
"si_support_tube",
1209 G4LogicalVolume *support_tube_volume =
new G4LogicalVolume(support_tube_tube,
GetDetectorMaterial(
"CFRP_INTT"),
1210 "support_tube_volume", 0, 0, 0);
1217 new G4PVPlacement(0, G4ThreeVector(0, 0.0), support_tube_volume,
1218 "si_support_support_tube", trackerenvelope,
false, 0,
OverlapCheck());
1227 G4Tubs *endcap_CP_ring =
new G4Tubs(
"endcap_CP_ring",
1233 G4LogicalVolume *endcap_CP_ring_volume =
new G4LogicalVolume(endcap_CP_ring,
GetDetectorMaterial(
"CF30_PEEK70"),
1234 "endcap_CP_ring_volume", 0, 0, 0);
1239 G4Tubs *endcap_AlPEEK_Alring_1 =
new G4Tubs(
"endcap_AlPEEK_Alring_1",
1245 G4LogicalVolume *endcap_AlPEEK_Alring_1_volume =
new G4LogicalVolume(endcap_AlPEEK_Alring_1,
GetDetectorMaterial(
"G4_Al"),
1246 "endcap_AlPEEK_Alring_1_volume", 0, 0, 0);
1250 G4Tubs *endcap_AlPEEK_Cring_1 =
new G4Tubs(
"endcap_AlPEEK_Cring_1",
1256 G4LogicalVolume *endcap_AlPEEK_Cring_1_volume =
new G4LogicalVolume(endcap_AlPEEK_Cring_1,
GetDetectorMaterial(
"CF30_PEEK70"),
1257 "endcap_AlPEEK_Cring_1_volume", 0, 0, 0);
1261 G4Tubs *endcap_AlPEEK_Alring_2 =
new G4Tubs(
"endcap_AlPEEK_Alring_2",
1267 G4LogicalVolume *endcap_AlPEEK_Alring_2_volume =
new G4LogicalVolume(endcap_AlPEEK_Alring_2,
GetDetectorMaterial(
"G4_Al"),
1268 "endcap_AlPEEK_Alring_2_volume", 0, 0, 0);
1272 G4Tubs *endcap_AlPEEK_Cring_2 =
new G4Tubs(
"endcap_AlPEEK_Cring_2",
1278 G4LogicalVolume *endcap_AlPEEK_Cring_2_volume =
new G4LogicalVolume(endcap_AlPEEK_Cring_2,
GetDetectorMaterial(
"CF30_PEEK70"),
1279 "endcap_AlPEEK_Cring_2_volume", 0, 0, 0);
1283 G4Tubs *endcap_AlPEEK_Alring_3 =
new G4Tubs(
"endcap_AlPEEK_Alring_3",
1289 G4LogicalVolume *endcap_AlPEEK_Alring_3_volume =
new G4LogicalVolume(endcap_AlPEEK_Alring_3,
GetDetectorMaterial(
"G4_Al"),
1290 "endcap_AlPEEK_Alring_3_volume", 0, 0, 0);
1296 double endcap_outer_edge_z = 0.0;
1300 G4Tubs *endcap_Al_ring =
new G4Tubs(
"endcap_Al_ring",
1306 G4LogicalVolume *endcap_Al_ring_volume =
new G4LogicalVolume(endcap_Al_ring,
GetDetectorMaterial(
"Al6061T6"),
1307 "endcap_Al_ring_volume", 0, 0, 0);
1310 G4Tubs *endcap_SS_ring =
new G4Tubs(
"endcap_SS_ring",
1316 G4LogicalVolume *endcap_SS_ring_volume =
new G4LogicalVolume(endcap_SS_ring,
GetDetectorMaterial(
"SS316"),
1317 "endcap_SS_ring_volume", 0, 0, 0);
1320 G4Tubs *endcap_WG_ring =
new G4Tubs(
"endcap_WG_ring",
1326 G4LogicalVolume *endcap_WG_ring_volume =
new G4LogicalVolume(endcap_WG_ring,
GetDetectorMaterial(
"WaterGlycol_INTT"),
1327 "endcap_WG_ring_volume", 0, 0, 0);
1330 for (
int i = 0; i < 2; i++)
1332 endcap_ring_z = (i == 0) ? endcap_ring_z : -1.0 * endcap_ring_z;
1334 double width_WGring_z = supportparams->
get_double_param(
"endcap_WGring_length") *
cm;
1335 double width_SSring_z = supportparams->
get_double_param(
"endcap_SSring_length") *
cm;
1336 double width_Alring_z = supportparams->
get_double_param(
"endcap_Alring_length") *
cm;
1338 for (
int j = 0; j < 2; j++)
1340 width_WGring_z = (j == 0) ? width_WGring_z : -1.0 * width_WGring_z;
1341 width_SSring_z = (j == 0) ? width_SSring_z : -1.0 * width_SSring_z;
1342 width_Alring_z = (j == 0) ? width_Alring_z : -1.0 * width_Alring_z;
1344 double cent_WGring_z = endcap_ring_z + width_WGring_z / 2.;
1345 double cent_SSring_z = endcap_ring_z + width_WGring_z + width_SSring_z / 2.;
1346 double cent_Alring_z = endcap_ring_z + width_WGring_z + width_SSring_z + width_Alring_z / 2.;
1347 endcap_outer_edge_z = fabs(endcap_ring_z) + fabs(width_WGring_z + width_SSring_z + width_Alring_z / 2.);
1349 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_WGring_z),
1350 endcap_WG_ring_volume,
1351 (boost::format(
"endcap_WG_ring_pv_%d_%d") % i % j).str(),
1354 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_SSring_z),
1355 endcap_SS_ring_volume,
1356 (boost::format(
"endcap_SS_ring_pv_%d_%d") % i % j).str(),
1359 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_Alring_z),
1360 endcap_Al_ring_volume,
1361 (boost::format(
"endcap_Al_ring_pv_%d_%d") % i % j).str(),
1366 else if (supportparams->
get_int_param(
"endcap_ring_type") == 1)
1370 for (
int i = 0; i < 2; i++)
1372 endcap_ring_z = (i == 0) ? endcap_ring_z : -1.0 * endcap_ring_z;
1373 endcap_outer_edge_z = fabs(endcap_ring_z);
1375 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1376 endcap_CP_ring_volume,
1377 (boost::format(
"endcap_CP_ring_pv_%d") % i).str(),
1382 else if (supportparams->
get_int_param(
"endcap_ring_type") == 2 )
1389 double sifull_width = si_0_width + si_1_width;
1391 double hdiext_width = params->
get_double_param(
"halfladder_inside_z") *
cm - sifull_width;
1392 double hdifull_width = hdi_width + hdiext_width;
1393 double endcap_ring_z = hdifull_width + supportparams->
get_double_param(
"endcap_AlPEEK_Cring_length") / 2.0 *
cm;
1395 for (
int i = 0; i < 2; i++)
1397 endcap_ring_z = (i == 0) ? endcap_ring_z : -1.0 * endcap_ring_z;
1398 endcap_outer_edge_z = fabs(endcap_ring_z) + supportparams->
get_double_param(
"endcap_AlPEEK_Alring_length") *
cm / 2.0;
1400 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1401 endcap_AlPEEK_Alring_1_volume,
1402 (boost::format(
"endcap_AlPEEK_Alring_1_pv_%d") % i).str(),
1405 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1406 endcap_AlPEEK_Cring_1_volume,
1407 (boost::format(
"endcap_AlPEEK_Cring_1_pv_%d") % i).str(),
1410 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1411 endcap_AlPEEK_Alring_2_volume,
1412 (boost::format(
"endcap_AlPEEK_Alring_2_pv_%d") % i).str(),
1415 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1416 endcap_AlPEEK_Cring_2_volume,
1417 (boost::format(
"endcap_AlPEEK_Cring_2_pv_%d") % i).str(),
1420 new G4PVPlacement(0, G4ThreeVector(0, 0, endcap_ring_z),
1421 endcap_AlPEEK_Alring_3_volume,
1422 (boost::format(
"endcap_AlPEEK_Alring_3_pv_%d") % i).str(),
1431 double bus_extender_radius_innermost = supportparams->
get_double_param(
"bus_extender_radius") *
cm;
1432 double bus_extender_length = supportparams->
get_double_param(
"bus_extender_length") *
cm;
1433 double bus_extender_copper_x = supportparams->
get_double_param(
"bus_extender_copper_x") *
cm;
1434 double bus_extender_kapton_x = supportparams->
get_double_param(
"bus_extender_kapton_x") *
cm;
1438 G4Tubs *bus_extender_copper_inner =
new G4Tubs(
"bus_extender_coppe_innerr",
1439 inner_radius, inner_radius + bus_extender_copper_x,
1440 bus_extender_length / 2.0, -
M_PI, 2.0 *
M_PI);
1442 G4LogicalVolume *bus_extender_copper_inner_volume =
new G4LogicalVolume(bus_extender_copper_inner,
GetDetectorMaterial(
"G4_Cu"),
1443 "bus_extender_copper_inner_volume", 0, 0, 0);
1447 inner_radius += bus_extender_copper_x;
1448 G4Tubs *bus_extender_kapton_inner =
new G4Tubs(
"bus_extender_kapton_inner",
1449 inner_radius, inner_radius + bus_extender_kapton_x,
1450 bus_extender_length / 2.0, -
M_PI, 2.0 *
M_PI);
1452 G4LogicalVolume *bus_extender_kapton_inner_volume =
new G4LogicalVolume(bus_extender_kapton_inner,
GetDetectorMaterial(
"G4_KAPTON"),
1453 "bus_extender_kapton_inner_volume", 0, 0, 0);
1457 inner_radius += bus_extender_kapton_x;
1458 G4Tubs *bus_extender_copper_outer =
new G4Tubs(
"bus_extender_copper_outer",
1459 inner_radius, inner_radius + bus_extender_copper_x,
1460 bus_extender_length / 2.0, -
M_PI, 2.0 *
M_PI);
1462 G4LogicalVolume *bus_extender_copper_outer_volume =
new G4LogicalVolume(bus_extender_copper_outer,
GetDetectorMaterial(
"G4_Cu"),
1463 "bus_extender_copper_outer_volume", 0, 0, 0);
1467 inner_radius += bus_extender_copper_x;
1468 G4Tubs *bus_extender_kapton_outer =
new G4Tubs(
"bus_extender_kapton_outer",
1469 inner_radius, inner_radius + bus_extender_kapton_x,
1470 bus_extender_length / 2.0, -
M_PI, 2.0 *
M_PI);
1472 G4LogicalVolume *bus_extender_kapton_outer_volume =
new G4LogicalVolume(bus_extender_kapton_outer,
GetDetectorMaterial(
"G4_KAPTON"),
1473 "bus_extender_kapton_outer_volume", 0, 0, 0);
1476 double bus_extender_z = endcap_outer_edge_z;
1477 for (
int i = 0; i < 2; i++)
1480 double cent_bus_extender_z = bus_extender_z + bus_extender_length / 2.0;
1481 cent_bus_extender_z *= (i == 0) ? 1.0 : -1.0;
1482 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z ),
1483 bus_extender_copper_inner_volume,
1484 (boost::format(
"bus_extender_copper_inner_layer_pv_%d") % i ).str(),
1488 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z ),
1489 bus_extender_kapton_inner_volume,
1490 (boost::format(
"bus_extender_kapton_inner_layer_pv_%d") % i ).str(),
1494 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z ),
1495 bus_extender_copper_outer_volume,
1496 (boost::format(
"bus_extender_copper_outer_layer_pv_%d") % i ).str(),
1500 new G4PVPlacement(0, G4ThreeVector(0, 0, cent_bus_extender_z ),
1501 bus_extender_kapton_outer_volume,
1502 (boost::format(
"bus_extender_kapton_outer_layer_pv_%d") % i ).str(),
1516 if (iter->second > 0)
1538 const int sphxlayer = layeriter->first;
1539 const int inttlayer = layeriter->second;
1540 int ilayer = inttlayer;
1570 map<G4VPhysicalVolume *, std::tuple<int, int, int, int>>::const_iterator
1576 cout <<
PHWHERE <<
" Volume " << physvol->GetName() <<
" not in active volume tuple" << endl;
1582 map<G4LogicalVolume *, std::tuple<int, int>>::const_iterator
1588 cout <<
PHWHERE <<
" Volume " << logvol->GetName() <<
" not in passive volume tuple" << endl;