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