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