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