Belle II Software  release-06-02-00
forward.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <ecl/geometry/GeoECLCreator.h>
9 #include "ecl/geometry/BelleLathe.h"
10 #include "ecl/geometry/BelleCrystal.h"
11 #include "G4LogicalVolume.hh"
12 #include "G4PVPlacement.hh"
13 #include <G4VisAttributes.hh>
14 #include <G4Tubs.hh>
15 #include <G4Box.hh>
16 #include <G4AssemblyVolume.hh>
17 #include <G4SubtractionSolid.hh>
18 #include <G4Region.hh>
19 #include <G4UnionSolid.hh>
20 #include <G4TwoVector.hh>
21 #include <G4PVReplica.hh>
22 #include "G4ReflectionFactory.hh"
23 #include <G4Trap.hh>
24 
25 #include <iostream>
26 #include "CLHEP/Matrix/Vector.h"
27 #include "G4Vector3D.hh"
28 #include "G4Point3D.hh"
29 #include "ecl/geometry/shapes.h"
30 #include <geometry/Materials.h>
31 
32 using namespace std;
33 using namespace Belle2;
34 using namespace Belle2::geometry;
35 
36 void Belle2::ECL::GeoECLCreator::forward(G4LogicalVolume& _top)
37 {
38  G4LogicalVolume* top = &_top;
39 
40  const bool sec = 0;
41  const double phi0 = 0;
42  const double dphi = sec ? M_PI / 16 : 2 * M_PI;
43 
44  const bool b_inner_support_ring = 1;
45  const bool b_outer_support_ring = 1;
46  const bool b_support_wall = 1;
47  const bool b_ribs = 1;
48  const bool b_septum_wall = 1;
49  const bool b_crystals = 1;
50  const bool b_preamplifier = 1;
51  const bool b_support_leg = 1;
52  const bool b_support_structure_13 = 1;
53  const bool b_support_structure_15 = 1;
54  bool b_connectors = 1;
55  bool b_boards = 1;
56  const bool b_cover = 1;
57 
58  b_connectors &= b_support_structure_15;
59  b_boards &= b_support_structure_15;
60 
61  int overlap = m_overlap;
62 
63  // vector<cplacement_t> bp = load_placements("/ecl/data/crystal_placement_forward.dat");
64  vector<cplacement_t> bp = load_placements(m_sap, ECLParts::forward);
65  vector<cplacement_t>::iterator fp = find_if(bp.begin(), bp.end(), [](const cplacement_t& p) {
66  const int ECL_forward_part = 1000;
67  return p.nshape == ECL_forward_part;
68  });
69  // global transformation before placing the whole forward part in the top logical volume
70  G4Transform3D gTrans = (fp == bp.end()) ? G4Translate3D(0, 0, 1960) : get_transform(*fp);
71  // since the calorimeter supporting structures attach to the yoke at
72  // the same place we need to modify supporting legs by milling
73  // necessary thickness of steel when moving forward part outward in
74  // z-direction
75  double milled_thickness = gTrans.dz() - 1960; // [mm]
76  if (fp != bp.end()) bp.erase(fp); // now not needed
77 
78  const double th0 = 13.12, th1 = 32.98;
79  const double ZT = 437, ZI = 434, RI = 431, RIp = 532.2, RC = 1200.4, RT = 1415;
80  if (b_inner_support_ring) {
81  zr_t vc1[] = {{ZI - 487, 410}, {ZT - (RIp - 410 - 20 / cosd(th0)) / tand(th0), 410}, {ZT, RIp - 20 / cosd(th0)}, {ZT, RIp}, {3., RI}, {3., 418}, {ZI - 487, 418}};
82  std::vector<zr_t> contour1(vc1, vc1 + sizeof(vc1) / sizeof(zr_t));
83  G4VSolid* part1solid = new BelleLathe("fwd_part1solid", phi0, dphi, contour1);
84  G4LogicalVolume* part1logical = new G4LogicalVolume(part1solid, Materials::get("SUS304"), "part1logical", 0, 0, 0);
85  part1logical->SetVisAttributes(att("iron"));
86  new G4PVPlacement(gTrans, part1logical, "part1physical", top, false, 0, overlap);
87  }
88 
89  if (b_support_wall) {
90  // solving equation to get L : 3+L*cosd(th1)+1.6*cosd(th1+90) = 434 + 3 - 107.24
91  double L = (ZT - 107.24 - 3 - 1.6 * cosd(th1 + 90)) / cosd(th1);
92  double R0 = 418, R1 = RC;
93  zr_t vc23[] = {{0, R0}, {3, R0}, {3, R1}, {3 + L * cosd(th1), R1 + L * sind(th1)},
94  {3 + L * cosd(th1) + 1.6 * cosd(th1 + 90), R1 + L * sind(th1) + 1.6 * sind(th1 + 90)}, {3 + 1.6 * cosd(th1 + 90), R1 + 1.6 * sind(th1 + 90)}, {0, R1}
95  };
96  std::vector<zr_t> contour23(vc23, vc23 + sizeof(vc23) / sizeof(zr_t));
97  G4VSolid* part23solid = new BelleLathe("fwd_part23solid", phi0, dphi, contour23);
98  G4LogicalVolume* part23logical = new G4LogicalVolume(part23solid, Materials::get("A5052"), "part23logical", 0, 0, 0);
99  part23logical->SetVisAttributes(att("alum"));
100  new G4PVPlacement(gTrans, part23logical, "part23physical", top, false, 0, overlap);
101  }
102 
103  if (b_outer_support_ring) {
104  zr_t vc4[] = {{3 + (RT - 20 - RC) / tand(th1), RT - 20}, {ZT, RT - 20}, {ZT, RT}, {3 + (RT - RC) / tand(th1), RT}};
105  std::vector<zr_t> contour4(vc4, vc4 + sizeof(vc4) / sizeof(zr_t));
106  G4VSolid* part4solid = new BelleLathe("fwd_part4solid", phi0, dphi, contour4);
107  G4LogicalVolume* part4logical = new G4LogicalVolume(part4solid, Materials::get("SUS304"), "part4logical", 0, 0, 0);
108  part4logical->SetVisAttributes(att("iron"));
109  new G4PVPlacement(gTrans, part4logical, "part4physical", top, false, 0, overlap);
110  }
111 
112  zr_t cont_array_in[] = {{3., RI}, {ZT, RIp}, {ZT, RT - 20}, {3 + (RT - 20 - RC) / tand(th1), RT - 20}, {3, RC}};
113  std::vector<zr_t> contour_in(cont_array_in, cont_array_in + sizeof(cont_array_in) / sizeof(zr_t));
114  G4VSolid* innervolume_solid = new BelleLathe("fwd_innervolume_solid", 0, 2 * M_PI, contour_in);
115  G4LogicalVolume* innervolume_logical = new G4LogicalVolume(innervolume_solid, Materials::get("G4_AIR"),
116  "innervolume_logical", 0, 0, 0);
117  innervolume_logical->SetVisAttributes(att("air"));
118 
119  // Set up region for production cuts
120  G4Region* aRegion = new G4Region("ECLForwardEnvelope");
121  innervolume_logical->SetRegion(aRegion);
122  aRegion->AddRootLogicalVolume(innervolume_logical);
123 
124  new G4PVPlacement(gTrans, innervolume_logical, "ECLForwardPhysical", top, false, 0, overlap);
125 
126  G4VSolid* innervolumesector_solid = new BelleLathe("fwd_innervolumesector_solid", -M_PI / 8, M_PI / 4, contour_in);
127  G4LogicalVolume* innervolumesector_logical = new G4LogicalVolume(innervolumesector_solid, Materials::get("G4_AIR"),
128  "innervolumesector_logical", 0, 0, 0);
129  innervolumesector_logical->SetVisAttributes(att("air"));
130  new G4PVReplica("ECLForwardSectorPhysical", innervolumesector_logical, innervolume_logical, kPhi, 8, M_PI / 4, 0);
131 
132  if (b_ribs) {
133  double H = 60, W = 20;
134  double X0 = RIp, X1 = RT - 20;
135  G4TwoVector r0o(X1, 0), r1o(X1 * sqrt(1 - pow(W / X1, 2)), W);
136  double beta = asin(W / X0);
137  G4TwoVector r0i(X0 / cos(beta / 2), 0), r1i(X0 * cos(beta / 2) - tan(beta / 2) * (W - X0 * sin(beta / 2)), W);
138  double dxymzp = (r0o - r0i).x(), dxypzp = (r1o - r1i).x();
139  double theta = atan(tand(th0) / 2);
140  double dxymzm = dxymzp + tand(th0) * H, dxypzm = dxypzp + tand(th0) * H;
141 
142  G4TwoVector m0 = (r0i + r0o) * 0.5, m1 = (r1i + r1o) * 0.5, dm = m1 - m0;
143  double alpha = atan(dm.x() / dm.y());
144 
145  G4VSolid* solid6_p1 = new G4Trap("fwd_solid6_p1", H / 2, theta, 0, W / 2, dxymzm / 2, dxypzm / 2, alpha, W / 2, dxymzp / 2,
146  dxypzp / 2,
147  alpha);
148  G4LogicalVolume* lsolid6_p1 = new G4LogicalVolume(solid6_p1, Materials::get("SUS304"), "lsolid6", 0, 0, 0);
149  lsolid6_p1->SetVisAttributes(att("iron"));
150  G4Transform3D tsolid6_p1(G4Translate3D(X0 * cos(beta / 2) + (dxymzp / 2 + dxypzp / 2) / 2 - tan(theta)*H / 2, W / 2, ZT - H / 2));
151  new G4PVPlacement(G4RotateZ3D(-M_PI / 8)*tsolid6_p1, lsolid6_p1, "psolid6_p1", innervolumesector_logical, false, 0, overlap);
152  new G4PVPlacement(G4RotateZ3D(0)*tsolid6_p1, lsolid6_p1, "psolid6_p2", innervolumesector_logical, false, 0, overlap);
153 
154  H = 40;
155  dxymzm = dxymzp + tand(th0) * H, dxypzm = dxypzp + tand(th0) * H;
156  G4VSolid* solid6_p2 = new G4Trap("fwd_solid6_p2", H / 2, theta, 0, W / 2, dxypzm / 2, dxymzm / 2, -alpha, W / 2, dxypzp / 2,
157  dxymzp / 2,
158  -alpha);
159  G4LogicalVolume* lsolid6_p2 = new G4LogicalVolume(solid6_p2, Materials::get("SUS304"), "lsolid6", 0, 0, 0);
160  lsolid6_p2->SetVisAttributes(att("iron"));
161  G4Transform3D tsolid6_p2(G4Translate3D(X0 * cos(beta / 2) + (dxymzp / 2 + dxypzp / 2) / 2 - tan(theta)*H / 2, -W / 2, ZT - H / 2));
162  new G4PVPlacement(G4RotateZ3D(0)*tsolid6_p2, lsolid6_p2, "psolid6_p3", innervolumesector_logical, false, 0, overlap);
163  new G4PVPlacement(G4RotateZ3D(M_PI / 8)*tsolid6_p2, lsolid6_p2, "psolid6_p4", innervolumesector_logical, false, 0, overlap);
164 
165  double hpad = 148.4;
166  G4VSolid* solid7_p8 = new G4Box("fwd_solid7_p8", hpad / 2, (140. - 40) / 2 / 2, 40. / 2);
167  G4LogicalVolume* lsolid7 = new G4LogicalVolume(solid7_p8, Materials::get("SUS304"), "lsolid7", 0, 0, 0);
168  lsolid7->SetVisAttributes(att("iron"));
169  double dx = sqrt(X1 * X1 - 70 * 70) - hpad / 2;
170  G4Transform3D tsolid7_p1(G4Translate3D(dx, -20 - 25, ZT - 40. / 2));
171  new G4PVPlacement(tsolid7_p1, lsolid7, "psolid7_p1", innervolumesector_logical, false, 0, overlap);
172  G4Transform3D tsolid7_p2(G4Translate3D(dx, 20 + 25, ZT - 40. / 2));
173  new G4PVPlacement(tsolid7_p2, lsolid7, "psolid7_p2", innervolumesector_logical, false, 0, overlap);
174 
175  double L = X1 - (X0 - tand(th0) * 40) - 10;
176  G4VSolid* solid13 = new G4Box("fwd_solid13", L / 2, 5. / 2, 18. / 2);
177  G4LogicalVolume* lsolid13 = new G4LogicalVolume(solid13, Materials::get("SUS304"), "lsolid13", 0, 0, 0);
178  lsolid13->SetVisAttributes(att("iron"));
179  G4Transform3D tsolid13(G4TranslateZ3D(ZT - 60 + 18. / 2)*G4TranslateY3D(-5. / 2 - 0.5 / 2)*G4TranslateX3D(X0 - tand(
180  th0) * 40 + L / 2 + 5));
181  new G4PVPlacement(tsolid13, lsolid13, "psolid13_p1", innervolumesector_logical, false, 0, overlap);
182  new G4PVPlacement(G4RotateZ3D(M_PI / 8)*tsolid13, lsolid13, "psolid13_p2", innervolumesector_logical, false, 0, overlap);
183  }
184 
185 
186  double zsep = 125;
187  if (b_septum_wall) {
188  double d = 5;
189  Point_t vin[] = {{ZT - zsep, RIp - tand(th0)* zsep}, {ZT - 60, RIp - tand(th0) * 60}, {ZT - 60, RT - 20 - d}, {ZT - zsep, RT - 20 - d}};
190  const int n = sizeof(vin) / sizeof(Point_t);
191  Point_t c = centerofgravity(vin, vin + n);
192  G4ThreeVector contour_swall[n * 2];
193  for (int i = 0; i < n; i++) contour_swall[i + 0] = G4ThreeVector(vin[i].x - c.x, vin[i].y - c.y, -0.5 / 2);
194  for (int i = 0; i < n; i++) contour_swall[i + n] = G4ThreeVector(vin[i].x - c.x, vin[i].y - c.y, 0.5 / 2);
195 
196  G4VSolid* septumwall_solid = new BelleCrystal("fwd_septumwall_solid", n, contour_swall);
197 
198  G4LogicalVolume* septumwall_logical = new G4LogicalVolume(septumwall_solid, Materials::get("A5052"),
199  "septumwall_logical", 0, 0, 0);
200  septumwall_logical->SetVisAttributes(att("alum2"));
201  new G4PVPlacement(G4RotateZ3D(-M_PI / 2)*G4RotateY3D(-M_PI / 2)*G4Translate3D(c.x, c.y, 0), septumwall_logical,
202  "septumwall_physical", innervolumesector_logical, false, 0, overlap);
203 
204  for (int i = 0; i < n; i++) contour_swall[i + 0] = G4ThreeVector(vin[i].x - c.x, vin[i].y - c.y, -0.5 / 2 / 2);
205  for (int i = 0; i < n; i++) contour_swall[i + n] = G4ThreeVector(vin[i].x - c.x, vin[i].y - c.y, 0.5 / 2 / 2);
206 
207  G4VSolid* septumwall2_solid = new BelleCrystal("fwd_septumwall2_solid", n, contour_swall);
208 
209  G4LogicalVolume* septumwall2_logical = new G4LogicalVolume(septumwall2_solid, Materials::get("A5052"),
210  "septumwall2_logical", 0, 0, 0);
211  septumwall2_logical->SetVisAttributes(att("alum2"));
212  new G4PVPlacement(G4RotateZ3D(-M_PI / 8)*G4RotateZ3D(-M_PI / 2)*G4RotateY3D(-M_PI / 2)*G4Translate3D(c.x, c.y, 0.5 / 2 / 2),
213  septumwall2_logical, "septumwall2_physical", innervolumesector_logical, false, 0, overlap);
214  new G4PVPlacement(G4RotateZ3D(M_PI / 8)*G4RotateZ3D(-M_PI / 2)*G4RotateY3D(-M_PI / 2)*G4Translate3D(c.x, c.y, -0.5 / 2 / 2),
215  septumwall2_logical, "septumwall2_physical", innervolumesector_logical, false, 1, overlap);
216  }
217 
218  zr_t vcr[] = {{3., RI}, {ZT - zsep, RIp - tand(th0)* zsep}, {ZT - zsep, RT - 20}, {3 + (RT - 20 - RC) / tand(th1), RT - 20}, {3, RC}};
219  std::vector<zr_t> ccr(vcr, vcr + sizeof(vcr) / sizeof(zr_t));
220  G4VSolid* crystalvolume_solid = new BelleLathe("fwd_crystalvolume_solid", 0, M_PI / 8, ccr);
221  G4LogicalVolume* crystalvolume_logical = new G4LogicalVolume(crystalvolume_solid, Materials::get("G4_AIR"),
222  "crystalvolume_logical", 0, 0, 0);
223  crystalvolume_logical->SetVisAttributes(att("air"));
224  new G4PVPlacement(G4RotateZ3D(-M_PI / 8), crystalvolume_logical, "ECLForwardCrystalSectorPhysical_0", innervolumesector_logical,
225  false, 0, overlap);
226  new G4PVPlacement(G4RotateZ3D(0), crystalvolume_logical, "ECLForwardCrystalSectorPhysical_1", innervolumesector_logical, false, 1,
227  overlap);
228 
229  if (b_septum_wall) {
230  double d = 5, aRC = RC - 30e-6;
231  Point_t vin[] = {{3., RI}, {ZT - zsep, RIp - tand(th0)* zsep}, {ZT - zsep, RT - 20 - d}, {3 + (RT - 20 - d - aRC) / tand(th1), RT - 20 - d}, {3, aRC}};
232  const int n = sizeof(vin) / sizeof(Point_t);
233  Point_t c = centerofgravity(vin, vin + n);
234  G4ThreeVector contour_swall[n * 2];
235 
236  for (int i = 0; i < n; i++) contour_swall[i + 0] = G4ThreeVector(vin[i].x - c.x, vin[i].y - c.y, -0.5 / 2 / 2);
237  for (int i = 0; i < n; i++) contour_swall[i + n] = G4ThreeVector(vin[i].x - c.x, vin[i].y - c.y, 0.5 / 2 / 2);
238 
239  G4VSolid* septumwall3_solid = new BelleCrystal("fwd_septumwall3_solid", n, contour_swall);
240 
241  G4LogicalVolume* septumwall3_logical = new G4LogicalVolume(septumwall3_solid, Materials::get("A5052"),
242  "septumwall3_logical", 0, 0, 0);
243  septumwall3_logical->SetVisAttributes(att("alum2"));
244  new G4PVPlacement(G4RotateZ3D(-M_PI / 2)*G4RotateY3D(-M_PI / 2)*G4Translate3D(c.x, c.y, 0.5 / 2 / 2), septumwall3_logical,
245  "septumwall3_physical_0", crystalvolume_logical, false, 0, overlap);
246  new G4PVPlacement(G4RotateZ3D(M_PI / 8)*G4RotateZ3D(-M_PI / 2)*G4RotateY3D(-M_PI / 2)*G4Translate3D(c.x, c.y, -0.5 / 2 / 2),
247  septumwall3_logical, "septumwall3_physical_1", crystalvolume_logical, false, 1, overlap);
248  }
249 
250  if (b_crystals) {
251  // vector<shape_t*> cryst = load_shapes("/ecl/data/crystal_shape_forward.dat");
252  vector<shape_t*> cryst = load_shapes(m_sap, ECLParts::forward);
253  vector<G4LogicalVolume*> wrapped_crystals;
254  for (auto it = cryst.begin(); it != cryst.end(); it++) {
255  shape_t* s = *it;
256  wrapped_crystals.push_back(wrapped_crystal(s, "forward", 0.20 - 0.02));
257  }
258 
259  for (vector<cplacement_t>::const_iterator it = bp.begin(); it != bp.end(); ++it) {
260  const cplacement_t& t = *it;
261  auto s = find_if(cryst.begin(), cryst.end(), [&t](const shape_t* shape) {return shape->nshape == t.nshape;});
262  if (s == cryst.end()) continue;
263 
264  G4Transform3D twc = G4Translate3D(0, 0, 3) * get_transform(t);
265  int indx = it - bp.begin();
266  new G4PVPlacement(twc, wrapped_crystals[s - cryst.begin()], suf("ECLForwardWrappedCrystal_Physical", indx), crystalvolume_logical,
267  false, indx, overlap);
268  }
269  }
270 
271  if (b_preamplifier) {
272  for (vector<cplacement_t>::const_iterator it = bp.begin(); it != bp.end(); ++it) {
273  G4Transform3D twc = G4Translate3D(0, 0, 3) * get_transform(*it);
274  int indx = it - bp.begin();
275  auto pv = new G4PVPlacement(twc * G4TranslateZ3D(300 / 2 + 0.20 + get_pa_box_height() / 2)*G4RotateZ3D(-M_PI / 2), get_preamp(),
276  suf("phys_forward_preamplifier", indx), crystalvolume_logical, false, indx, 0);
277  if (overlap)pv->CheckOverlaps(1000);
278  }
279  }
280 
281  if (b_support_leg) {
282  const G4VisAttributes* batt = att("iron");
283 
284  G4VSolid* s1 = new G4Box("fwd_leg_p1", 130. / 2, 170. / 2, (40. - milled_thickness) / 2);
285  G4LogicalVolume* l1 = new G4LogicalVolume(s1, Materials::get("SUS304"), "l1", 0, 0, 0);
286  G4Transform3D t1 = G4Translate3D(0, 170. / 2, (40. - milled_thickness) / 2 + milled_thickness);
287  l1->SetVisAttributes(batt);
288 
289  G4VSolid* s2 = new G4Box("fwd_leg_p2", 60. / 2, 130. / 2, 137. / 2);
290  G4LogicalVolume* l2 = new G4LogicalVolume(s2, Materials::get("SUS304"), "l2", 0, 0, 0);
291  G4Transform3D t2 = G4Translate3D(0, 130. / 2 + 35, 40. + 137. / 2);
292  l2->SetVisAttributes(batt);
293 
294  Point_t v3[] = {{ -75. / 2, -265. / 2}, {75. / 2 - 30, -265. / 2}, {75. / 2, -265. / 2 + 30}, {75. / 2, 265. / 2} , { -75. / 2, 265. / 2}};
295  const int n3 = sizeof(v3) / sizeof(Point_t);
296  G4ThreeVector c3[n3 * 2];
297 
298  for (int i = 0; i < n3; i++) c3[i + 0] = G4ThreeVector(v3[i].x, v3[i].y, -140. / 2);
299  for (int i = 0; i < n3; i++) c3[i + n3] = G4ThreeVector(v3[i].x, v3[i].y, 140. / 2);
300 
301  G4VSolid* s3 = new BelleCrystal("fwd_leg_p3", n3, c3);
302  G4LogicalVolume* l3 = new G4LogicalVolume(s3, Materials::get("SUS304"), "l3", 0, 0, 0);
303  G4Transform3D t3 = G4Translate3D(0, 265. / 2 + 35, 40. + 137. + 75. / 2) * G4RotateY3D(-M_PI / 2);
304  l3->SetVisAttributes(batt);
305 
306  G4VSolid* s4 = new G4Box("fwd_leg_p4", 130. / 2, 5. / 2, (5. + milled_thickness) / 2);
307  G4LogicalVolume* l4 = new G4LogicalVolume(s4, Materials::get("SUS304"), "l4", 0, 0, 0);
308  G4Transform3D t4 = G4Translate3D(0, 170. - 5. / 2, (milled_thickness - 5.) / 2);
309  l4->SetVisAttributes(batt);
310 
311  G4VSolid* s5 = new G4Box("fwd_leg_p5", 140. / 2, 130. / 2, 80. / 2);
312  G4LogicalVolume* l5 = new G4LogicalVolume(s5, Materials::get("SUS304"), "l5", 0, 0, 0);
313  G4Transform3D t5 = G4Translate3D(0, 180. + 130. / 2, 97. + 80. / 2);
314  l5->SetVisAttributes(batt);
315 
316  G4VSolid* s6 = new G4Box("fwd_leg_p6", 140. / 2, 110. / 2, 160. / 2);
317  G4LogicalVolume* l6 = new G4LogicalVolume(s6, Materials::get("G4_AIR"), "l6", 0, 0, 0);
318  G4Transform3D t6 = G4Translate3D(0, 310. + 110. / 2, 97. + 160. / 2);
319  l6->SetVisAttributes(att("air"));
320 
321  G4VSolid* s6a = new G4Box("fwd_leg_p6a", 140. / 2, (110. - 45.) / 2, 160. / 2);
322  G4LogicalVolume* l6a = new G4LogicalVolume(s6a, Materials::get("SUS304"), "l6a", 0, 0, 0);
323  l6a->SetVisAttributes(batt);
324  new G4PVPlacement(G4TranslateY3D(-45. / 2), l6a, "l6a_physical", l6, false, 0, overlap);
325 
326  G4VSolid* s6b = new G4Box("fwd_leg_p6b", 60. / 2, 45. / 2, 160. / 2);
327  G4LogicalVolume* l6b = new G4LogicalVolume(s6b, Materials::get("SUS304"), "l6b", 0, 0, 0);
328  l6b->SetVisAttributes(batt);
329  double dy = 110. / 2 - 45 + 45. / 2;
330  new G4PVPlacement(G4TranslateY3D(dy), l6b, "l6b_physical", l6, false, 0, overlap);
331 
332  G4VSolid* s6c = new G4Box("fwd_leg_p6c", 40. / 2, 45. / 2, 22.5 / 2);
333  G4LogicalVolume* l6c = new G4LogicalVolume(s6c, Materials::get("SUS304"), "l6c", 0, 0, 0);
334  l6c->SetVisAttributes(batt);
335  new G4PVPlacement(G4Translate3D(30 + 20, dy, 20 + 22.5 / 2), l6c, "l6c_physical", l6, false, 0, overlap);
336  new G4PVPlacement(G4Translate3D(30 + 20, dy, -20 - 22.5 / 2), l6c, "l6c_physical", l6, false, 1, overlap);
337  new G4PVPlacement(G4Translate3D(-30 - 20, dy, 20 + 22.5 / 2), l6c, "l6c_physical", l6, false, 2, overlap);
338  new G4PVPlacement(G4Translate3D(-30 - 20, dy, -20 - 22.5 / 2), l6c, "l6c_physical", l6, false, 3, overlap);
339 
340  G4AssemblyVolume* support_leg = new G4AssemblyVolume();
341 
342  support_leg->AddPlacedVolume(l1, t1);
343  support_leg->AddPlacedVolume(l2, t2);
344  support_leg->AddPlacedVolume(l3, t3);
345  support_leg->AddPlacedVolume(l4, t4);
346  support_leg->AddPlacedVolume(l5, t5);
347  support_leg->AddPlacedVolume(l6, t6);
348 
349  for (int i = 0; i < 8; i++) {
350  G4Transform3D tp = G4Translate3D(0, 0, 1960) * G4RotateZ3D(-M_PI / 2 + M_PI / 8 + i * M_PI / 4) *
351  G4Translate3D(0, 1415 - 165 + 420. / 2, ZT + (97. + 160.) / 2) * G4Translate3D(0, -420. / 2, -(97. + 160.) / 2);
352  support_leg->MakeImprint(top, tp, 0, overlap);
353  }
354 
355  // G4VSolid* s_all = new G4Box("leg_all", 140. / 2, 420. / 2, (97. + 160) / 2);
356  // G4LogicalVolume* l_all = new G4LogicalVolume(s_all, Materials::get("G4_AIR"), "l_all", 0, 0, 0);
357  // l_all->SetVisAttributes(att("silv"));
358  // G4Transform3D tp = G4Translate3D(0, -420. / 2, -(97. + 160.) / 2);
359  // support_leg->MakeImprint(l_all, tp, 0, overlap);
360 
361  // for (int i = 0; i < 8; i++)
362  // new G4PVPlacement(G4RotateZ3D(-M_PI / 2 + M_PI / 8 + i * M_PI / 4)*G4Translate3D(0, 1415 - 165 + 420. / 2,
363  // 1960 + ZT + (97. + 160.) / 2), l_all, suf("support_leg_physical", i), top, false, i, overlap);
364 
365  // for (int i = 0; i < 8; i++)
366  // new G4PVPlacement(G4RotateZ3D(-M_PI / 2 + M_PI / 8 + i * M_PI / 4)*G4Translate3D(0, 1415 - 165 + 420. / 2,
367  // 1960 + ZT + (97. + 160.) / 2)*tp * t4, l4, suf("support_leg_p4_physical", i), top, false, i, overlap);
368  }
369 
370 
371  if (b_support_structure_13) { // numbering scheme as in ECL-004K102.pdf page 13
372 
373  // Define one layer as one assembly volume
374  G4AssemblyVolume* acs = new G4AssemblyVolume();
375 
376  double Z0 = 434, Ro = 1415 - 20;
377 
378  // double R2_0 = 667, R2_1 = 1245/cos(M_PI/16), dR2 = R2_1 - R2_0, dz = dR2*cos(M_PI/16);
379  // G4VSolid* sv_crystal_support1 = new G4Trd("sv_crystal_support1", 30/2, 30/2, R2_0*sin(M_PI/16)-40*cos(M_PI/16), R2_1*sin(M_PI/16)-40*cos(M_PI/16), dz/2);
380  // G4LogicalVolume* lv_crystal_support1 = new G4LogicalVolume(sv_crystal_support1, world_mat, "lv_crystal_support1", 0, 0, 0);
381  // // lv_crystal_support->SetVisAttributes(airvol);
382  // new G4PVPlacement(G4Translate3D(R2_0*cos(M_PI/16)+dz/2+3,0,Z0-95)*G4RotateY3D(M_PI/2), lv_crystal_support1, "phys_crystal_support1", crystalSectorLogical, false, 0, overlaps);
383 
384  // double dx=425+33, dy1 = dx*tan(M_PI/16), dz = 630+20-67, dy2 = dy1+dz*tan(M_PI/16);
385  // G4VSolid* sv_crystal_support1 = new G4Trd("sv_crystal_support1", 30/2, 30/2, dy1, dy2, dz/2);
386  // G4LogicalVolume* lv_crystal_support1 = new G4LogicalVolume(sv_crystal_support1, world_mat, "lv_crystal_support1", 0, 0, 0);
387  // // lv_crystal_support->SetVisAttributes(airvol);
388  // new G4PVPlacement(G4Translate3D(40/sin(M_PI/16)+dx+dz/2,0,Z0-95)*G4RotateY3D(M_PI/2), lv_crystal_support1, "phys_crystal_support1", crystalSectorLogical, false, 0, overlaps);
389 
390  G4VSolid* solid10_p1 = new G4Box("fwd_solid10_p1", 558. / 2 + 9.5, 20. / 2, 105. / 2);
391  G4VSolid* solid10_p2 = new G4Box("fwd_solid10_p2", 559. / 2 + 9.5, 11. / 2, 71. / 2);
392  G4VSolid* solid10_p3 = new G4SubtractionSolid("fwd_solid10_p3", solid10_p1, solid10_p2, G4Translate3D(0, -11. / 2, 71. / 2 - 17.5));
393 
394  G4LogicalVolume* lsolid10 = new G4LogicalVolume(solid10_p3, Materials::get("A6063"), "lsolid10", 0, 0, 0);
395  lsolid10->SetVisAttributes(att("alum"));
396  G4Transform3D tsolid10_p1(G4RotateZ3D(M_PI / 16)*G4Translate3D(954.5 + 2.55 - 1, -30, Z0 - 105. / 2 - 5));
397  acs->AddPlacedVolume(lsolid10, tsolid10_p1);
398  // new G4PVPlacement(tsolid10_p1, lsolid10, "psolid10_p1", crystalSectorLogical, false, 0, overlaps);
399  G4Transform3D tsolid10_p2(G4RotateZ3D(-M_PI / 16)*G4Translate3D(954.5 + 2.55 - 1, 30, Z0 - 105. / 2 - 5)*G4RotateZ3D(M_PI));
400  acs->AddPlacedVolume(lsolid10, tsolid10_p2);
401  // new G4PVPlacement(tsolid10_p2, lsolid10, "psolid10_p2", crystalSectorLogical, false, 0, overlaps);
402 
403  G4VSolid* solid1_p1 = new G4Box("fwd_solid1_p1", 100. / 2, 30. / 2, 30. / 2);
404  G4VSolid* solid1_p2 = new G4Box("fwd_solid1_p2", 80. / 2, 10. / 2, 31. / 2);
405  G4VSolid* solid1_p3 = new G4SubtractionSolid("fwd_solid1_p3", solid1_p1, solid1_p2, G4Transform3D::Identity);
406 
407  G4LogicalVolume* lsolid1 = new G4LogicalVolume(solid1_p3, Materials::get("A5052"), "lsolid1", 0, 0, 0);
408  lsolid1->SetVisAttributes(att("alum"));
409 
410  G4Transform3D tsolid1_p1(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3.))*G4Translate3D(Ro - 8 - 50 - 3 * 140, 0, Z0 - 95));
411  acs->AddPlacedVolume(lsolid1, tsolid1_p1);
412  // new G4PVPlacement(tsolid1_p1, lsolid1, "psolid1_p1", crystalSectorLogical, false, 0, overlaps);
413  G4Transform3D tsolid1_p2(G4RotateZ3D(M_PI / 16 * (1 - 2 / 3.))*G4Translate3D(Ro - 8 - 50 - 3 * 140, 0, Z0 - 95));
414  acs->AddPlacedVolume(lsolid1, tsolid1_p2);
415  // new G4PVPlacement(tsolid1_p2, lsolid1, "psolid1_p2", crystalSectorLogical, false, 0, overlaps);
416 
417  G4Transform3D tsolid1_p3(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3.))*G4Translate3D(Ro - 8 - 50 - 2 * 140, 0, Z0 - 95));
418  acs->AddPlacedVolume(lsolid1, tsolid1_p3);
419  // new G4PVPlacement(tsolid1_p3, lsolid1, "psolid1_p3", crystalSectorLogical, false, 0, overlaps);
420  G4Transform3D tsolid1_p4(G4RotateZ3D(M_PI / 16 * (1 - 2 / 3.))*G4Translate3D(Ro - 8 - 50 - 2 * 140, 0, Z0 - 95));
421  acs->AddPlacedVolume(lsolid1, tsolid1_p4);
422  // new G4PVPlacement(tsolid1_p4, lsolid1, "psolid1_p4", crystalSectorLogical, false, 0, overlaps);
423 
424  G4Transform3D tsolid1_p5(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3.))*G4Translate3D(Ro - 8 - 50 - 1 * 140, 0, Z0 - 95));
425  acs->AddPlacedVolume(lsolid1, tsolid1_p5);
426  // new G4PVPlacement(tsolid1_p5, lsolid1, "psolid1_p5", crystalSectorLogical, false, 0, overlaps);
427  G4Transform3D tsolid1_p6(G4RotateZ3D(M_PI / 16 * (1 - 2 / 3.))*G4Translate3D(Ro - 8 - 50 - 1 * 140, 0, Z0 - 95));
428  acs->AddPlacedVolume(lsolid1, tsolid1_p6);
429  // new G4PVPlacement(tsolid1_p6, lsolid1, "psolid1_p6", crystalSectorLogical, false, 0, overlaps);
430 
431  G4Transform3D tsolid1_p8(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3.))*G4Translate3D(Ro - 8 - 50, 0, Z0 - 100));
432  acs->AddPlacedVolume(lsolid1, tsolid1_p8);
433  // new G4PVPlacement(tsolid1_p8, lsolid1, "psolid1_p8", crystalSectorLogical, false, 0, overlaps);
434  G4Transform3D tsolid1_p9(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3. + (1 + 1. / 3) / 3))*G4Translate3D(Ro - 8 - 50, 0, Z0 - 100));
435  acs->AddPlacedVolume(lsolid1, tsolid1_p9);
436  // new G4PVPlacement(tsolid1_p9, lsolid1, "psolid1_p9", crystalSectorLogical, false, 0, overlaps);
437  G4Transform3D tsolid1_p10(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3. + 2 * (1 + 1. / 3) / 3))*G4Translate3D(Ro - 8 - 50, 0, Z0 - 100));
438  acs->AddPlacedVolume(lsolid1, tsolid1_p10);
439  // new G4PVPlacement(tsolid1_p10, lsolid1, "psolid1_p10", crystalSectorLogical, false, 0, overlaps);
440 
441  G4VSolid* solid1_p11 = new G4Box("fwd_solid1_p1", 100. / 2, 10. / 2, 30. / 2);
442  G4LogicalVolume* lsolid1_p2 = new G4LogicalVolume(solid1_p11, Materials::get("A5052"), "lsolid1_p2", 0, 0, 0);
443  lsolid1_p2->SetVisAttributes(att("alum"));
444  G4Transform3D tsolid1_p11(G4RotateZ3D(M_PI / 16 * (-1 + 2 / 3. - 1. / 3))*G4Translate3D(Ro - 8 - 50, 0, Z0 - 100));
445  acs->AddPlacedVolume(lsolid1_p2, tsolid1_p11);
446  // new G4PVPlacement(tsolid1_p11, lsolid1_p2, "psolid1_p11", crystalSectorLogical, false, 0, overlaps);
447 
448  G4VSolid* solid1_p12 = new G4Box("fwd_solid1_p1", 86. / 2, 10. / 2, 30. / 2);
449  G4LogicalVolume* lsolid1_p3 = new G4LogicalVolume(solid1_p12, Materials::get("A5052"), "lsolid1_p3", 0, 0, 0);
450  lsolid1_p3->SetVisAttributes(att("alum"));
451  double alpha_p12 = M_PI / 16 * (-1 + 1. / 3);
452  G4Transform3D tsolid1_p12(G4Translate3D(532.2 + 43, 0, Z0 - 75));
453  acs->AddPlacedVolume(lsolid1_p3, tsolid1_p12);
454  // new G4PVPlacement(tsolid1_p12, lsolid1_p3, "psolid1_p12", crystalSectorLogical, false, 0, overlaps);
455  G4Transform3D tsolid1_p13(G4RotateZ3D(alpha_p12)*G4Translate3D(532.2 + 43, 0, Z0 - 75));
456  acs->AddPlacedVolume(lsolid1_p3, tsolid1_p13);
457  // new G4PVPlacement(tsolid1_p13, lsolid1_p3, "psolid1_p13", crystalSectorLogical, false, 0, overlaps);
458  G4Transform3D tsolid1_p14(G4RotateZ3D(-alpha_p12)*G4Translate3D(532.2 + 43, 0, Z0 - 75));
459  acs->AddPlacedVolume(lsolid1_p3, tsolid1_p14);
460  // new G4PVPlacement(tsolid1_p14, lsolid1_p3, "psolid1_p14", crystalSectorLogical, false, 0, overlaps);
461 
462  G4VSolid* solid1_p4 = new G4Box("fwd_solid1_p4", 160. / 2, 30. / 2, 30. / 2);
463  G4VSolid* solid1_p5 = new G4Box("fwd_solid1_p5", 140. / 2, 10. / 2, 31. / 2);
464  G4VSolid* solid1_p7 = new G4SubtractionSolid("fwd_solid1_p7", solid1_p4, solid1_p5, G4Transform3D::Identity);
465  G4LogicalVolume* lsolid1_p7 = new G4LogicalVolume(solid1_p7, Materials::get("A5052"), "lsolid1_p7", 0, 0, 0);
466  lsolid1_p7->SetVisAttributes(att("alum"));
467  G4Transform3D tsolid1_p7(G4Translate3D(Ro - 8 - 80 - 4 * 140 + 4, 0, Z0 - 95));
468  acs->AddPlacedVolume(lsolid1_p7, tsolid1_p7);
469  // new G4PVPlacement(tsolid1_p7, lsolid1_p7, "psolid1_p7", crystalSectorLogical, false, 0, overlaps);
470 
471  // int sol2count = 0;
472  auto get_bracket = [&](double L, double ang, G4Transform3D & lt) {
473  double thick = 3;
474  double dL = (ang > 0) ? 0 : thick * abs(tan(ang));
475 
476  G4VSolid* solid2_p1 = new G4Box("fwd_solid2_p1", (L - 2 * dL) / 2, thick / 2, 30. / 2);
477  G4VSolid* solid2_p2 = new G4Box("fwd_solid2_p2", thick / 2, (15. - dL) / 2, 30. / 2);
478  double dx = thick / 2, y0 = (15. + dL) / 2;
479  G4Transform3D t1(G4Translate3D(L / 2, -dx, 0.)*G4RotateZ3D(-ang)*G4Translate3D(-dx, y0, 0));
480  G4Transform3D t2(G4Translate3D(-L / 2, -dx, 0.)*G4RotateZ3D(ang)*G4Translate3D(dx, y0, 0));
481  G4VSolid* solid2_p3 = new G4UnionSolid("fwd_solid2_p3", solid2_p1, solid2_p2, t1);
482  G4VSolid* solid2_p4 = new G4UnionSolid("fwd_solid2_p4", solid2_p3, solid2_p2, t2);
483 
484  G4Transform3D u((ang > 0) ? G4Transform3D::Identity : G4RotateZ3D(M_PI));
485  lt = u * G4Translate3D(dx, 0, 0) * G4RotateZ3D(-M_PI / 2);
486 
487  return solid2_p4;
488  };
489  double obj2_dz = Z0 - 95;
490  auto place_solid2 = [&](double dz, double L, double ang, double phi, double mx, double dy) {
491  G4Transform3D lt;
492  G4LogicalVolume* lsolid2 = new G4LogicalVolume(get_bracket(L, ang, lt), Materials::get("A5052"), "lsolid2", 0, 0, 0);
493  lsolid2->SetVisAttributes(att("alum"));
494 
495  G4Transform3D tsolid2_p1(G4RotateZ3D(phi)*G4Translate3D(mx, dy, dz)*lt);
496  // string pname("psolid2_p"); pname += to_string(++sol2count);
497  acs->AddPlacedVolume(lsolid2, tsolid2_p1);
498  // new G4PVPlacement(tsolid2_p1, lsolid2, pname.c_str(), crystalSectorLogical, false, 0, overlaps);
499  };
500  auto place_solid3 = [&](double L, double ang, const G4Transform3D & t) {
501  G4Transform3D lt;
502  G4LogicalVolume* lsolid2 = new G4LogicalVolume(get_bracket(L, ang, lt), Materials::get("A5052"), "lsolid2", 0, 0, 0);
503  lsolid2->SetVisAttributes(att("alum"));
504 
505  G4Transform3D tsolid2_p1(t * lt);
506  // string pname("psolid2_p"); pname += to_string(++sol2count);
507  acs->AddPlacedVolume(lsolid2, tsolid2_p1);
508  // new G4PVPlacement(tsolid2_p1, lsolid2, pname.c_str(), crystalSectorLogical, false, 0, overlaps);
509  };
510 
511  G4Point3D aa(-50 + 15, 15, 0), bb(-50 + 15, -15, 0);
512 
513  aa = tsolid1_p1 * G4Point3D(-50 + 15, 15, 0);
514  bb = tsolid1_p2 * G4Point3D(-50 + 15, -15, 0);
515  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
516 
517  aa = tsolid1_p1 * G4Point3D(50 - 15, 15, 0);
518  bb = tsolid1_p2 * G4Point3D(50 - 15, -15, 0);
519  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
520 
521  G4Point3D r0(0, 40 / cos(M_PI / 16), 0);
522  G4Vector3D np(sin(M_PI / 16), cos(M_PI / 16), 0), mid;
523  G4RotateZ3D rb(M_PI / 24);
524  double L, phi_uu;
525 
526 
527  phi_uu = (tsolid1_p1 * G4Vector3D(1, 0, 0)).angle(G4Vector3D(cos(M_PI / 16), -sin(M_PI / 16), 0));
528  G4Vector3D n = tsolid1_p1 * G4Vector3D(-sin(phi_uu / 2), -cos(phi_uu / 2), 0);
529  double xj = 50 - 15;
530  aa = tsolid1_p1 * G4Point3D(-xj, -15, 0);
531  L = -((aa - r0) * np) / (n * np);
532  place_solid3(L, -phi_uu / 2, tsolid1_p1 * G4Translate3D(-xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
533  place_solid3(L, -phi_uu / 2, tsolid1_p2 * G4Translate3D(-xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
534  aa = tsolid1_p1 * G4Point3D(xj, -15, 0);
535  L = -((aa - r0) * np) / (n * np);
536  place_solid3(L, phi_uu / 2, tsolid1_p1 * G4Translate3D(xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
537  place_solid3(L, phi_uu / 2, tsolid1_p2 * G4Translate3D(xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
538 
539  aa = tsolid1_p3 * G4Point3D(-xj, -15, 0);
540  L = -((aa - r0) * np) / (n * np);
541  place_solid3(L, -phi_uu / 2, tsolid1_p3 * G4Translate3D(-xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
542  place_solid3(L, -phi_uu / 2, tsolid1_p4 * G4Translate3D(-xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
543  aa = tsolid1_p3 * G4Point3D(xj, -15, 0);
544  L = -((aa - r0) * np) / (n * np);
545  place_solid3(L, phi_uu / 2, tsolid1_p3 * G4Translate3D(xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
546  place_solid3(L, phi_uu / 2, tsolid1_p4 * G4Translate3D(xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
547 
548  aa = tsolid1_p5 * G4Point3D(-xj, -15, 0);
549  L = -((aa - r0) * np) / (n * np);
550  place_solid3(L, -phi_uu / 2, tsolid1_p5 * G4Translate3D(-xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
551  place_solid3(L, -phi_uu / 2, tsolid1_p6 * G4Translate3D(-xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
552  aa = tsolid1_p5 * G4Point3D(xj, -15, 0);
553  L = -((aa - r0) * np) / (n * np);
554  place_solid3(L, phi_uu / 2, tsolid1_p5 * G4Translate3D(xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
555  place_solid3(L, phi_uu / 2, tsolid1_p6 * G4Translate3D(xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
556 
557  phi_uu = M_PI / 16;
558  n = tsolid1_p7 * G4Vector3D(-sin(phi_uu / 2), -cos(phi_uu / 2), 0);
559  xj = 80 - 15;
560  aa = tsolid1_p7 * G4Point3D(-xj, -15, 0);
561  L = -((aa - r0) * np) / (n * np);
562  place_solid3(L, -phi_uu / 2, tsolid1_p7 * G4Translate3D(-xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
563  place_solid3(L, -phi_uu / 2, tsolid1_p7 * G4Translate3D(-xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
564  aa = tsolid1_p7 * G4Point3D(xj, -15, 0);
565  L = -((aa - r0) * np) / (n * np);
566  place_solid3(L, phi_uu / 2, tsolid1_p7 * G4Translate3D(xj, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
567  place_solid3(L, phi_uu / 2, tsolid1_p7 * G4Translate3D(xj, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
568 
569 
570  aa = tsolid1_p3 * G4Point3D(-50 + 15, 15, 0);
571  bb = tsolid1_p4 * G4Point3D(-50 + 15, -15, 0);
572  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
573 
574  aa = tsolid1_p3 * G4Point3D(50 - 15, 15, 0);
575  bb = tsolid1_p4 * G4Point3D(50 - 15, -15, 0);
576  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
577 
578 
579  aa = tsolid1_p5 * G4Point3D(-50 + 15, 15, 0);
580  bb = tsolid1_p6 * G4Point3D(-50 + 15, -15, 0);
581  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
582 
583  aa = tsolid1_p5 * G4Point3D(50 - 15, 15, 0);
584  bb = tsolid1_p6 * G4Point3D(50 - 15, -15, 0);
585  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
586 
587 
588  obj2_dz = Z0 - 100;
589  aa = tsolid1_p8 * G4Point3D(-50 + 15, 15, 0);
590  bb = tsolid1_p9 * G4Point3D(-50 + 15, -15, 0);
591  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 72, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
592 
593  aa = tsolid1_p8 * G4Point3D(50 - 15, 15, 0);
594  bb = tsolid1_p9 * G4Point3D(50 - 15, -15, 0);
595  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 72, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
596 
597  aa = tsolid1_p9 * G4Point3D(-50 + 15, 15, 0);
598  bb = tsolid1_p10 * G4Point3D(-50 + 15, -15, 0);
599  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 72, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
600 
601  aa = tsolid1_p9 * G4Point3D(50 - 15, 15, 0);
602  bb = tsolid1_p10 * G4Point3D(50 - 15, -15, 0);
603  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 72, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
604 
605  phi_uu = (tsolid1_p8 * G4Vector3D(1, 0, 0)).angle(tsolid1_p11 * G4Vector3D(1, 0, 0));
606  r0 = tsolid1_p11 * G4Point3D(-50 + 15, 5, 0);
607  np = tsolid1_p11 * G4Vector3D(0, 1, 0);
608 
609  n = tsolid1_p8 * G4Vector3D(-sin(phi_uu / 2), -cos(phi_uu / 2), 0);
610  aa = tsolid1_p8 * G4Point3D(-50 + 15, -15, 0);
611  L = -((aa - r0) * np) / (n * np);
612  place_solid3(L, -phi_uu / 2, tsolid1_p8 * G4Translate3D(-50 + 15, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
613 
614  aa = tsolid1_p8 * G4Point3D(50 - 15, -15, 0);
615  L = -((aa - r0) * np) / (n * np);
616  place_solid3(L, phi_uu / 2, tsolid1_p8 * G4Translate3D(50 - 15, -15, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
617 
618  phi_uu = (tsolid1_p11 * G4Vector3D(1, 0, 0)).angle(G4RotateZ3D(-M_PI / 16) * G4Vector3D(1, 0, 0));
619  r0 = G4RotateZ3D(-M_PI / 16) * G4Point3D(0, 40, 0);
620  np = G4RotateZ3D(-M_PI / 16) * G4Vector3D(0, 1, 0);
621 
622  n = tsolid1_p11 * G4Vector3D(-sin(phi_uu / 2), -cos(phi_uu / 2), 0);
623  aa = tsolid1_p11 * G4Point3D(-50 + 15, -5, 0);
624  L = -((aa - r0) * np) / (n * np);
625  place_solid3(L, -phi_uu / 2, tsolid1_p11 * G4Translate3D(-50 + 15, -5, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
626 
627  aa = tsolid1_p11 * G4Point3D(50 - 15, -5, 0);
628  L = -((aa - r0) * np) / (n * np);
629  place_solid3(L, phi_uu / 2, tsolid1_p11 * G4Translate3D(50 - 15, -5, 0)*G4RotateZ3D(-phi_uu / 2)*G4Translate3D(0, -L / 2, 0));
630 
631  G4Transform3D ttt(G4RotateZ3D(M_PI / 16)*G4Translate3D(Ro - 8 - 50, 0, Z0 - 100));
632  phi_uu = (tsolid1_p10 * G4Vector3D(1, 0, 0)).angle(ttt * G4Vector3D(1, 0, 0));
633  r0 = ttt * G4Point3D(0, -40, 0);
634  np = ttt * G4Vector3D(0, 1, 0);
635  n = tsolid1_p10 * G4Vector3D(-sin(phi_uu / 2), cos(phi_uu / 2), 0);
636  aa = tsolid1_p10 * G4Point3D(-50 + 15, 15, 0);
637  L = -((aa - r0) * np) / (n * np);
638  place_solid3(L, -phi_uu / 2, tsolid1_p10 * G4Translate3D(-50 + 15, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
639 
640  aa = tsolid1_p10 * G4Point3D(50 - 15, 15, 0);
641  L = -((aa - r0) * np) / (n * np);
642  place_solid3(L, phi_uu / 2, tsolid1_p10 * G4Translate3D(50 - 15, 15, 0)*G4RotateZ3D(phi_uu / 2)*G4Translate3D(0, L / 2, 0));
643 
644  obj2_dz = Z0 - 75;
645  aa = tsolid1_p12 * G4Point3D(-43 + 15, -5, 0);
646  bb = tsolid1_p13 * G4Point3D(-43 + 15, 5, 0);
647  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
648 
649  aa = tsolid1_p12 * G4Point3D(43 - 15, -5, 0);
650  bb = tsolid1_p13 * G4Point3D(43 - 15, 5, 0);
651  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
652 
653  aa = tsolid1_p12 * G4Point3D(-43 + 15, 5, 0);
654  bb = tsolid1_p14 * G4Point3D(-43 + 15, -5, 0);
655  place_solid2(obj2_dz, (aa - bb).mag(), -M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
656 
657  aa = tsolid1_p12 * G4Point3D(43 - 15, 5, 0);
658  bb = tsolid1_p14 * G4Point3D(43 - 15, -5, 0);
659  place_solid2(obj2_dz, (aa - bb).mag(), M_PI / 48, (aa + bb).phi(), (aa + bb).rho() / 2, 0);
660 
661  G4VSolid* solid11_p1 = new G4Box("fwd_solid11_p1", 80. / 2, 30. / 2, 40. / 2);
662  G4VSolid* solid11_p2 = new G4Box("fwd_solid11_p2", 81. / 2, 30. / 2, 40. / 2);
663  G4VSolid* solid11_p3 = new G4SubtractionSolid("fwd_solid11_p3", solid11_p1, solid11_p2, G4Translate3D(0, -3, 3));
664 
665  G4LogicalVolume* lsolid11 = new G4LogicalVolume(solid11_p3, Materials::get("SUS304"), "lsolid11", 0, 0, 0);
666  lsolid11->SetVisAttributes(att("iron"));
667  G4Transform3D tsolid11_p1(G4RotateZ3D(M_PI / 16)*G4Translate3D(580, -35, Z0 - 40));
668  acs->AddPlacedVolume(lsolid11, tsolid11_p1);
669 
670  G4Transform3D tsolid11_p2(G4RotateZ3D(-M_PI / 16)*G4Translate3D(580, 35, Z0 - 40)*G4RotateZ3D(M_PI));
671  acs->AddPlacedVolume(lsolid11, tsolid11_p2);
672 
673  G4VSolid* solid12_p1 = new G4Box("fwd_solid12_p1", 120. / 2, 20. / 2, 115. / 2);
674  G4VSolid* solid12_p2 = new G4Box("fwd_solid12_p2", 121. / 2, 12. / 2, 86. / 2);
675  G4VSolid* solid12_p3 = new G4SubtractionSolid("fwd_solid12_p3", solid12_p1, solid12_p2, G4Translate3D(0, -11. / 2 + 1,
676  86. / 2 - 17.5 - 5));
677  G4LogicalVolume* lsolid12 = new G4LogicalVolume(solid12_p3, Materials::get("A6063"), "lsolid12", 0, 0, 0);
678  lsolid12->SetVisAttributes(att("alum"));
679 
680  G4Transform3D tsolid12_p2(G4RotateZ3D(-M_PI / 16)*G4Translate3D(Ro - 8 - 60, 30, Z0 - 115. / 2)*G4RotateZ3D(M_PI));
681  acs->AddPlacedVolume(lsolid12, tsolid12_p2);
682 
683  G4VSolid* solid12r_p1 = new G4Box("fwd_solid12r_p1", 100. / 2, 30. / 2, 75. / 2);
684  G4VSolid* solid12r_p2 = new G4Box("fwd_solid12r_p2", 101. / 2, 21. / 2, 41. / 2);
685  G4VSolid* solid12r_p3 = new G4SubtractionSolid("fwd_solid12r_p3", solid12r_p1, solid12r_p2, G4Translate3D(0, -21. / 2 + 5,
686  -41. / 2 - 75. / 2 + 40));
687  G4LogicalVolume* lsolid12r = new G4LogicalVolume(solid12r_p3, Materials::get("A6063"), "lsolid12r", 0, 0, 0);
688  lsolid12r->SetVisAttributes(att("alum"));
689  G4Transform3D tsolid12r_p1(G4RotateZ3D(M_PI / 16)*G4Translate3D(Ro - 8 - 50, -30 - 15, Z0 - 40 - 75. / 2));
690  acs->AddPlacedVolume(lsolid12r, tsolid12r_p1);
691 
692  G4Transform3D tr = G4RotateZ3D(M_PI / 16) * G4ReflectY3D();
693  acs->MakeImprint(innervolumesector_logical, tr, 0, overlap);
694  tr = G4RotateZ3D(-M_PI / 16);
695  acs->MakeImprint(innervolumesector_logical, tr, 1, overlap);
696  }
697 
698  if (b_support_structure_15) { // numbering scheme as in ECL-004K102.pdf page 15
699  G4AssemblyVolume* acs = new G4AssemblyVolume();
700 
701  double Z0 = 434, Ro = 1415 - 20;
702 
703  G4VSolid* solid1_p1 = new G4Box("fwd_solid1_p1", 10. / 2, 398. / 2, 5. / 2);
704  G4VSolid* solid1_p2 = new G4Box("fwd_solid1_p2", 4. / 2, 398. / 2 - 32, 6. / 2);
705  G4VSolid* solid1_p3 = new G4SubtractionSolid("fwd_solid1_p3", solid1_p1, solid1_p2, G4Transform3D(G4RotationMatrix(),
706  G4ThreeVector(-4,
707  0, 0)));
708 
709  G4LogicalVolume* lsolid1 = new G4LogicalVolume(solid1_p3, Materials::get("SUS304"), "lsolid1", 0, 0, 0);
710  lsolid1->SetVisAttributes(att("iron"));
711  G4Transform3D tsolid1_p1(G4Translate3D(1350, -16, Z0 - 40 + 3 + 2.5));
712  acs->AddPlacedVolume(lsolid1, tsolid1_p1);
713 
714  G4VSolid* solid1a_p1 = new G4Box("fwd_solid1a_p1", 10. / 2, 348.5 / 2, 5. / 2);
715  G4VSolid* solid1a_p2 = new G4Box("fwd_solid1a_p2", 4. / 2, 348.5 / 2 - 32, 6. / 2);
716  G4VSolid* solid1a_p3 = new G4SubtractionSolid("fwd_solid1a_p3", solid1a_p1, solid1a_p2, G4Transform3D(G4RotationMatrix(),
717  G4ThreeVector(4, 0, 0)));
718 
719  G4LogicalVolume* lsolid1a = new G4LogicalVolume(solid1a_p3, Materials::get("SUS304"), "lsolid1a", 0, 0, 0);
720  lsolid1a->SetVisAttributes(att("iron"));
721  G4Transform3D tsolid1a_p1(G4Translate3D(1250, -16, Z0 - 40 + 3 + 2.5));
722  acs->AddPlacedVolume(lsolid1a, tsolid1a_p1);
723 
724  G4VSolid* solid1b_p1 = new G4Box("fwd_solid1b_p1", 10. / 2, (210 + 210 + 16) / 2, 5. / 2);
725  G4VSolid* solid1b_p2 = new G4Box("fwd_solid1b_p2", 4. / 2, (210 + 210 + 16) / 2 - 16, 6. / 2);
726  G4VSolid* solid1b_p3 = new G4SubtractionSolid("fwd_solid1b_p3", solid1b_p1, solid1b_p2, G4Transform3D(G4RotationMatrix(),
727  G4ThreeVector(4, 0, 0)));
728 
729  G4LogicalVolume* lsolid1b = new G4LogicalVolume(solid1b_p3, Materials::get("SUS304"), "lsolid1b", 0, 0, 0);
730  lsolid1b->SetVisAttributes(att("iron"));
731  G4Transform3D t1b(G4Translate3D(1204 - (210 + 210 + 16) / 2 + 16, 0, Z0 - 52 + 8 + 5. / 2));
732  G4Transform3D tsolid1b_p1(t1b * G4TranslateY3D(-10)*G4RotateZ3D(-M_PI / 2));
733  acs->AddPlacedVolume(lsolid1b, tsolid1b_p1);
734  G4Transform3D tsolid1b_p2(t1b * G4TranslateY3D(10)*G4RotateZ3D(M_PI / 2));
735  acs->AddPlacedVolume(lsolid1b, tsolid1b_p2);
736  G4Transform3D tsolid1b_p3(t1b * G4TranslateY3D(-110)*G4RotateZ3D(M_PI / 2));
737  acs->AddPlacedVolume(lsolid1b, tsolid1b_p3);
738  G4Transform3D tsolid1b_p4(t1b * G4TranslateY3D(110)*G4RotateZ3D(-M_PI / 2));
739  acs->AddPlacedVolume(lsolid1b, tsolid1b_p4);
740 
741  G4VSolid* solid2_p1 = new G4Box("fwd_solid2_p1", 20. / 2, 210. / 2, 5. / 2);
742  G4VSolid* solid2_p2 = new G4Box("fwd_solid2_p2", 14. / 2, 210. / 2 - 16, 6. / 2);
743  G4VSolid* solid2_p3 = new G4SubtractionSolid("fwd_solid2_p3", solid2_p1, solid2_p2, G4Transform3D(G4RotationMatrix(),
744  G4ThreeVector(-4,
745  0, 0)));
746 
747  G4LogicalVolume* lsolid2 = new G4LogicalVolume(solid2_p3, Materials::get("SUS304"), "lsolid2", 0, 0, 0);
748  lsolid2->SetVisAttributes(att("iron"));
749  G4Transform3D tsolid2_p1(G4Translate3D(1204 - (210 + 210) - 210 / 2 + 16, 58, Z0 - 52 + 8 + 5. / 2)*G4RotateZ3D(-M_PI / 2));
750  acs->AddPlacedVolume(lsolid2, tsolid2_p1);
751  // new G4PVPlacement(tsolid2_p1, lsolid2, "psolid2_p1", crystalSectorLogical, false, 0, overlap);
752  G4Transform3D tsolid2_p2(G4Translate3D(1204 - (210 + 210) - 210 / 2 + 16, -58, Z0 - 52 + 8 + 5. / 2)*G4RotateZ3D(M_PI / 2));
753  acs->AddPlacedVolume(lsolid2, tsolid2_p2);
754  // new G4PVPlacement(tsolid2_p2, lsolid2, "psolid2_p2", crystalSectorLogical, false, 0, overlap);
755 
756  G4VSolid* solid3_p1 = new G4Box("fwd_solid3_p1", 32. / 2, 396. / 2, 8. / 2);
757  G4LogicalVolume* lsolid3 = new G4LogicalVolume(solid3_p1, Materials::get("SUS304"), "lsolid3", 0, 0, 0);
758  lsolid3->SetVisAttributes(att("iron"));
759  G4Transform3D tsolid3_p1(G4Translate3D(1204, 0, Z0 - 52 + 8. / 2));
760  acs->AddPlacedVolume(lsolid3, tsolid3_p1);
761  // new G4PVPlacement(tsolid3_p1, lsolid3, "psolid3_p1", crystalSectorLogical, false, 0, overlap);
762 
763  G4VSolid* solid3n_p1 = new G4Box("fwd_solid3n_p1", 32. / 2, 230. / 2, 8. / 2);
764  G4LogicalVolume* lsolid3n = new G4LogicalVolume(solid3n_p1, Materials::get("SUS304"), "lsolid3n", 0, 0, 0);
765  lsolid3n->SetVisAttributes(att("iron"));
766  G4Transform3D tsolid3n_p1(G4Translate3D(1204 - 420, 0, Z0 - 52 + 8. / 2));
767  acs->AddPlacedVolume(lsolid3n, tsolid3n_p1);
768  // new G4PVPlacement(tsolid3n_p1, lsolid3n, "psolid3n_p1", crystalSectorLogical, false, 0, overlap);
769 
770  G4VSolid* solid4_p1 = new G4Box("fwd_solid4_p1", 16. / 2, 160. / 2, 8. / 2);
771  G4LogicalVolume* lsolid4 = new G4LogicalVolume(solid4_p1, Materials::get("SUS304"), "lsolid4", 0, 0, 0);
772  lsolid4->SetVisAttributes(att("iron"));
773  G4Transform3D tsolid4_p1(G4Translate3D(598, 0, Z0 - 52 + 8. / 2));
774  acs->AddPlacedVolume(lsolid4, tsolid4_p1);
775  // new G4PVPlacement(tsolid4_p1, lsolid4, "psolid4_p1", crystalSectorLogical, false, 0, overlap);
776 
777  G4VSolid* solid5_p1 = new G4Box("fwd_solid5_p1", 650. / 2, 30. / 2, 40. / 2);
778  G4VSolid* solid5_p2 = new G4Box("fwd_solid5_p2", 651. / 2, 30. / 2, 40. / 2);
779  G4VSolid* solid5_p3 = new G4SubtractionSolid("solid5_p3", solid5_p1, solid5_p2, G4Translate3D(0, -3, 3));
780 
781  G4LogicalVolume* lsolid5 = new G4LogicalVolume(solid5_p3, Materials::get("SUS304"), "lsolid5", 0, 0, 0);
782  lsolid5->SetVisAttributes(att("iron"));
783  G4Transform3D tsolid5_p1(G4RotateZ3D(M_PI / 16)*G4Translate3D(910, -45, Z0 - 20 - 15));
784  acs->AddPlacedVolume(lsolid5, tsolid5_p1);
785  // new G4PVPlacement(tsolid5_p1, lsolid5, "psolid5_p1", crystalSectorLogical, false, 0, overlap);
786  G4Transform3D tsolid5_p3(G4RotateZ3D(-M_PI / 16)*G4Translate3D(910, 45, Z0 - 20 - 15)*G4RotateZ3D(M_PI));
787  acs->AddPlacedVolume(lsolid5, tsolid5_p3);
788  // new G4PVPlacement(tsolid5_p3, lsolid5, "psolid5_p3", crystalSectorLogical, false, 0, overlap);
789 
790  G4VSolid* solid7_p1 = new G4Box("fwd_solid7_p1", 130. / 2, 30. / 2, 40. / 2);
791  G4VSolid* solid7_p2 = new G4Box("fwd_solid7_p2", 131. / 2, 30. / 2, 40. / 2);
792  G4VSolid* solid7_p3 = new G4SubtractionSolid("fwd_solid7_p3", solid7_p1, solid7_p2, G4Transform3D(G4RotationMatrix(),
793  G4ThreeVector(0,
794  -3, 3)));
795  G4LogicalVolume* lsolid7 = new G4LogicalVolume(solid7_p3, Materials::get("SUS304"), "lsolid7", 0, 0, 0);
796  lsolid7->SetVisAttributes(att("iron"));
797  G4Transform3D tsolid7_p1(G4RotateZ3D(-M_PI / 16)*G4Translate3D(Ro - 8 - 65, 54, Z0 - 40. / 2)*G4RotateZ3D(M_PI));
798  acs->AddPlacedVolume(lsolid7, tsolid7_p1);
799  // new G4PVPlacement(tsolid7_p1, lsolid7, "psolid7_p1", crystalSectorLogical, false, 0, overlap);
800  G4Transform3D tsolid7_p2(G4RotateZ3D(M_PI / 16)*G4Translate3D(Ro - 8 - 65 - 8, -85, Z0 - 40. / 2));
801  acs->AddPlacedVolume(lsolid7, tsolid7_p2);
802  // new G4PVPlacement(tsolid7_p2, lsolid7, "psolid7_p2", crystalSectorLogical, false, 0, overlap);
803 
804  // G4Transform3D tsolid7_p3(G4RotateZ3D(M_PI/16)*G4TranslateZ3D(1960 + 438 - 40./2 - 1)*G4TranslateX3D(1315)*G4TranslateY3D(-85));
805  // new G4PVPlacement(tsolid7_p3, lsolid7, "psolid7_p3", crystalSectorLogical, false, 0, overlap);
806  // G4Transform3D tsolid7_p4(G4RotateZ3D(M_PI/16)*G4TranslateZ3D(1960 + 438 - 40./2 - 1)*G4TranslateX3D(1315)*G4TranslateY3D(85)*G4RotateZ3D(M_PI));
807  // new G4PVPlacement(tsolid7_p4, lsolid7, "psolid7_p4", crystalSectorLogical, false, 0, overlap);
808 
809  G4VSolid* solid8_p1 = new G4Box("fwd_solid8_p1", 120. / 2, 10. / 2, 42. / 2);
810  G4LogicalVolume* lsolid8 = new G4LogicalVolume(solid8_p1, Materials::get("SUS304"), "lsolid8", 0, 0, 0);
811  lsolid8->SetVisAttributes(att("iron"));
812  G4Transform3D tsolid8_p1(G4RotateZ3D(-M_PI / 16)*G4Translate3D(Ro - 8 - 60, 34, Z0 - 42. / 2));
813  acs->AddPlacedVolume(lsolid8, tsolid8_p1);
814  // new G4PVPlacement(tsolid8_p1, lsolid8, "psolid8_p1", crystalSectorLogical, false, 0, overlap);
815  // G4Transform3D tsolid8_p2(G4RotateZ3D(-M_PI/16)*G4TranslateZ3D(1960 + 438 - 42./2 - 1)*G4TranslateX3D(1320)*G4TranslateY3D(34)*G4RotateZ3D(M_PI));
816  // new G4PVPlacement(tsolid8_p2, lsolid8, "psolid8_p2", crystalSectorLogical, false, 0, overlap);
817 
818 
819  G4VSolid* solid9_p1 = new G4Box("fwd_solid9_p1", 26. / 2, 12. / 2, 26. / 2);
820  G4LogicalVolume* lsolid9 = new G4LogicalVolume(solid9_p1, Materials::get("SUS304"), "lsolid9", 0, 0, 0);
821  lsolid9->SetVisAttributes(att("iron"));
822  G4Transform3D tsolid9_p1(G4RotateZ3D(-M_PI / 16)*G4Translate3D(Ro - 8 - 120 + 26. / 2 + 17, 20 + 9 + 10 + 9 + 3,
823  Z0 - 37 + 26. / 2));
824  acs->AddPlacedVolume(lsolid9, tsolid9_p1);
825  // new G4PVPlacement(tsolid9_p1, lsolid9, "psolid9", crystalSectorLogical, false, 0, overlap);
826 
827 
828  G4VSolid* solid10_p1 = new G4Box("fwd_solid10_p1", 26. / 2, 12. / 2, 42. / 2);
829  G4LogicalVolume* lsolid10 = new G4LogicalVolume(solid10_p1, Materials::get("SUS304"), "lsolid10", 0, 0, 0);
830  lsolid10->SetVisAttributes(att("iron"));
831  // G4Transform3D tsolid5_p3(G4RotateZ3D(-M_PI/16)*G4Translate3D(910, 45, Z0-20-15)*G4RotateZ3D(M_PI));
832  G4Transform3D tsolid10_p1(G4RotateZ3D(-M_PI / 16)*G4Translate3D(910 + 650. / 2 - 221, 20 + 10 + 6 + 6, Z0 - 52 + 42. / 2));
833  acs->AddPlacedVolume(lsolid10, tsolid10_p1);
834  // new G4PVPlacement(tsolid10_p1, lsolid10, "psolid10", crystalSectorLogical, false, 0, overlap);
835 
836  if (b_connectors) {
837  double t = 2, h20 = 32;
838  G4VSolid* solid_connector = new G4Box("fwd_solid_connector", (110 + 2 * 20) / 2, (250 + 2 * 20) / 2, h20 / 2);
839  G4VSolid* solid_connector2 = new G4Box("fwd_solid_connector2", (20 + t) / 2, (20 + t) / 2, 1.01 * h20 / 2);
840  G4VSolid* solid_connector3 = new G4Box("fwd_solid_connector3", 20 / 2, (250 + 2 * 20 + 2) / 2, h20 / 2);
841  solid_connector = new G4SubtractionSolid("fwd_solid_connector", solid_connector, solid_connector2, G4Translate3D(55 + (20 + t) / 2,
842  -140, 0));
843  solid_connector = new G4SubtractionSolid("fwd_solid_connector", solid_connector, solid_connector3, G4Translate3D(-70, 0, -t - 1));
844  G4LogicalVolume* lsolid_connector = new G4LogicalVolume(solid_connector, Materials::get("G4_AIR"), "lsolid_connector", 0,
845  0, 0);
846  lsolid_connector->SetVisAttributes(att("air"));
847  G4Transform3D tsolid_connector(G4Translate3D(1360 - 60, 0, Z0 - h20 / 2));
848  acs->AddPlacedVolume(lsolid_connector, tsolid_connector);
849  // new G4PVPlacement(tsolid_connector, lsolid_connector, "psolid20", crystalSectorLogical, false, 0, overlap);
850 
851  auto lvolume = [&](int part, double dx, double dy, double dz) {
852  ostringstream ost(""); ost << "solid20_p" << part;
853  G4VSolid* sv = new G4Box(ost.str().c_str(), dx / 2, dy / 2, dz / 2);
854  ost.str(""); ost << "lsolid20_p" << part;
855  return new G4LogicalVolume(sv, Materials::get("A5052"), ost.str().c_str(), 0, 0, 0);
856  };
857 
858  auto place = [&](G4LogicalVolume * lv, const G4Translate3D & move, int n) {
859  lv->SetVisAttributes(att("alum"));
860  ostringstream ost(""); ost << "phys_" << lv->GetName();
861  new G4PVPlacement(move, lv, ost.str().c_str(), lsolid_connector, false, n, overlap);
862  };
863  G4LogicalVolume* lv1 = lvolume(1, 20, 250 + 2 * 20, t);
864  place(lv1, G4Translate3D(-55 - 10, 0, h20 / 2 - t / 2), 0);
865  G4LogicalVolume* lv1_2 = lvolume(1, 20, 250 + 20, t);
866  place(lv1_2, G4Translate3D(55 + 10, 10, h20 / 2 - t / 2), 1);
867 
868  G4LogicalVolume* lv2 = lvolume(2, 110., 20., t);
869  place(lv2, G4Translate3D(0, 250 / 2 + 10, h20 / 2 - t / 2), 0);
870  place(lv2, G4Translate3D(0, -250 / 2 - 10, h20 / 2 - t / 2), 1);
871 
872  G4LogicalVolume* lv3 = lvolume(3, 110., t, h20 - t);
873  place(lv3, G4Translate3D(0, 250 / 2 + t / 2, -t / 2), 0);
874  place(lv3, G4Translate3D(0, -250 / 2 - t / 2, -t / 2), 1);
875 
876  G4LogicalVolume* lv4 = lvolume(4, t, 250 + 2 * t, h20 - t);
877  place(lv4, G4Translate3D(55 + t / 2, 0, -t / 2), 0);
878  place(lv4, G4Translate3D(-55 - t / 2, 0, -t / 2), 1);
879 
880  G4LogicalVolume* lv5 = lvolume(5, 7, 250, t);
881  place(lv5, G4Translate3D(55 - 7. / 2, 0, -h20 / 2 + t / 2 + t), 0);
882  place(lv5, G4Translate3D(-55 + 7. / 2, 0, -h20 / 2 + t / 2 + t), 1);
883 
884  G4LogicalVolume* lv6 = lvolume(6, 110 - 14, 7, t);
885  place(lv6, G4Translate3D(0, 250 / 2 - 7. / 2, -h20 / 2 + t / 2 + t), 0);
886  place(lv6, G4Translate3D(0, -250 / 2 + 7. / 2, -h20 / 2 + t / 2 + t), 1);
887 
888  G4LogicalVolume* lv7 = lvolume(7, 110, 250, t);
889  place(lv7, G4Translate3D(0, 0, -h20 / 2 + t / 2), 0);
890 
891  // G4LogicalVolume *lv8 = lvolume(8, 90, 10, 30);
892  G4VSolid* p8_1 = new G4Box("fwd_solid20_p8_1", 90. / 2, 10. / 2, 30. / 2);
893  G4VSolid* p8_2 = new G4Box("fwd_solid20_p8_2", 88. / 2, 8. / 2, 30. / 2);
894  G4VSolid* sp8 = new G4SubtractionSolid("fwd_solid20_p8", p8_1, p8_2, G4TranslateZ3D(-1));
895  G4LogicalVolume* lv8 = new G4LogicalVolume(sp8, Materials::get("A5052"), "lsolid20_p8", 0, 0, 0);
896  lv8->SetVisAttributes(att("alum2"));
897  for (int i = 0; i < 10; i++) place(lv8, G4Translate3D(0, 25 * (i - 4.5), -h20 / 2 + t + 30 / 2), i);
898  }
899 
900  if (b_boards) {
901  double hbv = 30;
902  G4VSolid* solid_board = new G4Box("fwd_solid_board", (210) / 2, (110) / 2, hbv / 2);
903  G4LogicalVolume* lsolid_board = new G4LogicalVolume(solid_board, Materials::get("G4_AIR"), "lsolid_board", 0, 0, 0);
904  lsolid_board->SetVisAttributes(att("air"));
905  for (int i = 0; i < 1; i++) {
906  // G4Transform3D t0 = G4RotateZ3D(M_PI/16*(1-2*i))*G4Translate3D(598-8+210/2, 0, Z0-52+8+5+hbv/2);
907  G4Transform3D t0 = G4Translate3D(598 - 8 + 210 / 2, 0, Z0 - 52 + 8 + 5 + hbv / 2);
908  G4Transform3D t1 = t0 * G4Translate3D(210, 110 / 2 + 5, 0);
909  G4Transform3D t2 = t0 * G4Translate3D(210, -110 / 2 + 5, 0);
910  G4Transform3D t3 = t0 * G4Translate3D(2 * 210, 110 / 2 + 5, 0);
911  G4Transform3D t4 = t0 * G4Translate3D(2 * 210, -110 / 2 + 5, 0);
912  // new G4PVPlacement(t0, lsolid_board, "phys_solid_board0", crystalSectorLogical, false, 0, overlap);
913  // new G4PVPlacement(t1, lsolid_board, "phys_solid_board1", crystalSectorLogical, false, 1, overlap);
914  // new G4PVPlacement(t2, lsolid_board, "phys_solid_board2", crystalSectorLogical, false, 2, overlap);
915  // new G4PVPlacement(t3, lsolid_board, "phys_solid_board3", crystalSectorLogical, false, 3, overlap);
916  // new G4PVPlacement(t4, lsolid_board, "phys_solid_board4", crystalSectorLogical, false, 4, overlap);
917  acs->AddPlacedVolume(lsolid_board, t0);
918  acs->AddPlacedVolume(lsolid_board, t1);
919  acs->AddPlacedVolume(lsolid_board, t2);
920  acs->AddPlacedVolume(lsolid_board, t3);
921  acs->AddPlacedVolume(lsolid_board, t4);
922  }
923  G4Material* boxmaterial = Materials::get("G4_GLASS_PLATE");
924  auto lvolumeb = [&](int part, double dx, double dy, double dz) {
925  ostringstream ost(""); ost << "fwd_sboard_p" << part;
926  G4VSolid* sv = new G4Box(ost.str().c_str(), dx / 2, dy / 2, dz / 2);
927  ost.str(""); ost << "lboard_p" << part;
928  return new G4LogicalVolume(sv, boxmaterial, ost.str().c_str(), 0, 0, 0);
929  };
930 
931  const G4VisAttributes* asolid20 = att("plate");
932 
933  auto placeb = [&](G4LogicalVolume * lv, const G4Translate3D & move, int n) {
934  lv->SetVisAttributes(asolid20);
935  ostringstream ost(""); ost << "phys_" << lv->GetName();
936  new G4PVPlacement(move, lv, ost.str().c_str(), lsolid_board, false, n, overlap);
937  };
938 
939  double hboard = 2;
940  G4LogicalVolume* lb1 = lvolumeb(1, 210, 110, hboard);
941  placeb(lb1, G4Translate3D(0, 0, -hbv / 2 + hboard / 2), 0);
942 
943  double wcon = 20, hcon = 40, hc = hbv - hboard;
944  G4VSolid* sv_connector_bundle = new G4Box("fwd_sv_connector_bundle", 4 * wcon / 2, hcon / 2, hc / 2);
945  G4LogicalVolume* lv_connector_bundle = new G4LogicalVolume(sv_connector_bundle, Materials::get("G4_AIR"),
946  "lv_connector_bundle", 0, 0, 0);
947  lv_connector_bundle->SetVisAttributes(att("air"));
948  new G4PVPlacement(G4Translate3D(-210 / 2 + 10 + wcon * 2, -110 / 2 + hcon / 2, -hbv / 2 + hboard + hc / 2), lv_connector_bundle,
949  "pv_connector_bundle", lsolid_board, false, 0, overlap);
950  new G4PVPlacement(G4Translate3D(-210 / 2 + 10 + wcon * 2, 10 + hcon / 2, -hbv / 2 + hboard + hc / 2), lv_connector_bundle,
951  "pv_connector_bundle", lsolid_board, false, 0, overlap);
952  new G4PVPlacement(G4Translate3D(10 + wcon * 2, -110 / 2 + hcon / 2, -hbv / 2 + hboard + hc / 2), lv_connector_bundle,
953  "pv_connector_bundle", lsolid_board, false, 0, overlap);
954  new G4PVPlacement(G4Translate3D(10 + wcon * 2, 10 + hcon / 2, -hbv / 2 + hboard + hc / 2), lv_connector_bundle,
955  "pv_connector_bundle", lsolid_board, false, 0, overlap);
956 
957  G4VSolid* sv_crystal_connector = new G4Box("fwd_sv_crystal_connector", wcon / 2, hcon / 2, hc / 2);
958  G4LogicalVolume* lv_crystal_connector = new G4LogicalVolume(sv_crystal_connector, Materials::get("G4_AIR"),
959  "lv_crystal_connector", 0, 0, 0);
960  lv_crystal_connector->SetVisAttributes(att("air"));
961 
962  new G4PVPlacement(G4Translate3D(-1.5 * 20, 0, 0), lv_crystal_connector, "pv_crystal_connector", lv_connector_bundle, false, 0,
963  overlap);
964  new G4PVPlacement(G4Translate3D(-0.5 * 20, 0, 0), lv_crystal_connector, "pv_crystal_connector", lv_connector_bundle, false, 1,
965  overlap);
966  new G4PVPlacement(G4Translate3D(0.5 * 20, 0, 0), lv_crystal_connector, "pv_crystal_connector", lv_connector_bundle, false, 2,
967  overlap);
968  new G4PVPlacement(G4Translate3D(1.5 * 20, 0, 0), lv_crystal_connector, "pv_crystal_connector", lv_connector_bundle, false, 3,
969  overlap);
970 
971  G4VSolid* sv_crystal_connector_p1 = new G4Box("fwd_sv_crystal_connector_p1", 8 / 2, 30 / 2, 20 / 2);
972  G4LogicalVolume* lv_crystal_connector_p1 = new G4LogicalVolume(sv_crystal_connector_p1, Materials::get("SUS304"),
973  "lv_crystal_connector_p1", 0, 0, 0);
974  lv_crystal_connector_p1->SetVisAttributes(att("connector"));
975 
976  new G4PVPlacement(G4Translate3D(-5, 0, -hc / 2 + 20. / 2), lv_crystal_connector_p1, "pv_crystal_connector_p1", lv_crystal_connector,
977  false, 0, overlap);
978 
979  G4VSolid* sv_capacitor = new G4Tubs("fwd_sv_capacitor", 0, 5, 5. / 2, 0, 2 * M_PI);
980  G4LogicalVolume* lv_capacitor = new G4LogicalVolume(sv_capacitor, Materials::get("SUS304"), "lv_capacitor", 0, 0, 0);
981  lv_capacitor->SetVisAttributes(att("capacitor"));
982 
983  new G4PVPlacement(G4Translate3D(5, -15, -hc / 2 + 5. / 2), lv_capacitor, "pv_capacitor", lv_crystal_connector, false, 0, overlap);
984  new G4PVPlacement(G4Translate3D(5, -5, -hc / 2 + 5. / 2), lv_capacitor, "pv_capacitor", lv_crystal_connector, false, 1, overlap);
985  new G4PVPlacement(G4Translate3D(5, 5, -hc / 2 + 5. / 2), lv_capacitor, "pv_capacitor", lv_crystal_connector, false, 2, overlap);
986  new G4PVPlacement(G4Translate3D(5, 15, -hc / 2 + 5. / 2), lv_capacitor, "pv_capacitor", lv_crystal_connector, false, 3, overlap);
987 
988  G4VSolid* sv_board_connector_p1 = new G4Box("fwd_sv_board_connector_p1", 80. / 2, 8. / 2, 20. / 2);
989  G4LogicalVolume* lv_board_connector_p1 = new G4LogicalVolume(sv_board_connector_p1, Materials::get("SUS304"),
990  "lv_board_connector_p1", 0, 0, 0);
991  lv_board_connector_p1->SetVisAttributes(att("connector"));
992 
993  new G4PVPlacement(G4Translate3D(-210 / 2 + 10 + 80 / 2, 0, -hbv / 2 + hboard + 20. / 2), lv_board_connector_p1,
994  "pv_board_connector_p1", lsolid_board, false, 0, overlap);
995  new G4PVPlacement(G4Translate3D(210 / 2 - 10 - 80 / 2, 0, -hbv / 2 + hboard + 20. / 2), lv_board_connector_p1,
996  "pv_board_connector_p1", lsolid_board, false, 1, overlap);
997  }
998 
999  G4Transform3D tr = G4RotateZ3D(M_PI / 16) * G4ReflectY3D();
1000  acs->MakeImprint(innervolumesector_logical, tr, 0, overlap);
1001  tr = G4RotateZ3D(-M_PI / 16);
1002  acs->MakeImprint(innervolumesector_logical, tr, 1, overlap);
1003  delete acs;
1004  }// end of ECL-004K102.pdf page 15
1005 
1006  if (b_cover) {
1007  G4VSolid* solid8_p1 = new G4Tubs("fwd_solid8_p1", RI + tand(13.12) * (434 + 1) - 20 / cosd(13.12), 1415, 1. / 2, -M_PI / 16,
1008  M_PI / 8);
1009  G4VSolid* solid8_p2 = new G4Box("fwd_solid8_p2", 130. / 2, 270. / 2, 2. / 2);
1010  G4VSolid* solid8_p3 = new G4Tubs("fwd_solid8_p3", 0, 16, 2, 0, 2 * M_PI);
1011  G4VSolid* solid8_p4 = new G4Box("fwd_solid8_p4", 130. / 2, (75. - 2 * 16.) / 2, 2. / 2);
1012  double width_p5 = 180;
1013  G4VSolid* solid8_p5 = new G4Box("fwd_solid8_p5", width_p5 / 2, 2.5 + 75. / 2, 2. / 2);
1014 
1015  double xx0 = 1415 - 47.8715;
1016  G4VSolid* solid8 = new G4SubtractionSolid("fwd_solid8", solid8_p1, solid8_p2, G4TranslateX3D(xx0 - 130. / 2));
1017  double xx1 = xx0 + 1.7;
1018  solid8 = new G4SubtractionSolid("fwd_solid8", solid8, solid8_p3, G4Translate3D(xx1, 159.5, 0));
1019  solid8 = new G4SubtractionSolid("fwd_solid8", solid8, solid8_p3, G4Translate3D(xx1, 202.5, 0));
1020  solid8 = new G4SubtractionSolid("fwd_solid8", solid8, solid8_p4, G4Translate3D(xx1 - 16 + 130. / 2, (202.5 + 159.5) / 2, 0));
1021  solid8 = new G4SubtractionSolid("fwd_solid8", solid8, solid8_p5, G4Translate3D(xx1 + width_p5 / 2, (202.5 + 159.5) / 2, 0));
1022  solid8 = new G4SubtractionSolid("fwd_solid8", solid8, solid8_p5, G4Translate3D(xx1 - 130 + (1230.77 - 1230.88), -177.57,
1023  0)*G4RotateZ3D(-M_PI / 16)*G4Translate3D(width_p5 / 2, -75. / 2, 0));
1024 
1025  // for(int i=0;i<100000;i++){
1026  // G4ThreeVector v = solid8->GetPointOnSurface();
1027  // G4cout<<v.x()<<" "<<v.y()<<" "<<v.z()<<"\n";
1028  // }
1029 
1030  G4LogicalVolume* lsolid8 = new G4LogicalVolume(solid8, Materials::get("A5052"), "lsolid8", 0, 0, 0);
1031  lsolid8->SetVisAttributes(att("alum"));
1032  for (int i = 0; i < 8; i++) {
1033  G4Transform3D tc = gTrans * G4Translate3D(0, 0, 3 + 434 + 0.5) * G4RotateZ3D(M_PI / 8 + i * M_PI / 4);
1034  new G4PVPlacement(tc * G4RotateZ3D(M_PI / 16), lsolid8, suf("cover", 0 + 2 * i), top, false, 0 + 2 * i, overlap);
1035  G4ReflectionFactory::Instance()->Place(tc * G4RotateZ3D(-M_PI / 16)*G4ReflectY3D(), suf("cover", 0 + 2 * i), lsolid8, top, false,
1036  1 + 2 * i, overlap);
1037  }
1038  }
1039  // end of ECL-004K102.pdf page 11 - 12
1040 
1041 }
a Belle crystal in Geant4
Definition: BelleCrystal.h:34
void forward(G4LogicalVolume &)
Place elements inside the forward endcap.
Definition: forward.cc:36
Common code concerning the geometry representation of the detector.
Definition: CreatorBase.h:25
Abstract base class for different kinds of events.