Belle II Software development
Ph1sustrCreator.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#include <beast/ph1sustr/geometry/Ph1sustrCreator.h>
10#include <beast/ph1sustr/simulation/SensitiveDetector.h>
11
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
14#include <framework/gearbox/GearDir.h>
15#include <framework/logging/Logger.h>
16
17#include <cmath>
18
19#include <G4LogicalVolume.hh>
20#include <G4PVPlacement.hh>
21
22//Shapes
23#include <G4Box.hh>
24#include "G4UnionSolid.hh"
25#include "G4SubtractionSolid.hh"
26
27//Visualization
28#include "G4Colour.hh"
29#include <G4VisAttributes.hh>
30
31using namespace std;
32
33namespace Belle2 {
40 namespace ph1sustr {
41
42 // Register the creator
45
47 {
48 //m_sensitive = new SensitiveDetector();
49 }
50
52 {
53 if (m_sensitive) delete m_sensitive;
54 }
55
56 void Ph1sustrCreator::create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes /* type */)
57 {
58
60
61 //lets get the stepsize parameter with a default value of 5 µm
62 //double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
63
64
65 //no get the array. Notice that the default framework unit is cm, so the
66 //values will be automatically converted
67 vector<double> bar = content.getArray("bar");
68 B2INFO("Contents of bar: ");
69 for (double value : bar) {
70 B2INFO("value: " << value);
71 }
72 /*double x_tpcbeamR = 0;
73 double y_tpcbeamR = 0;
74 double z_tpcbeamR = 0;
75 double x_tpcbeamL = 0;
76 double y_tpcbeamL = 0;
77 double z_tpcbeamL = 0;
78 double x_tpcbeamT = 0;
79 double y_tpcbeamT = 0;
80 double z_tpcbeamT = 0;
81 double x_tpcbeamB = 0;
82 double y_tpcbeamB = 0;
83 double z_tpcbeamB = 0;*/
84 //Lets loop over all the Active nodes
85 for (const GearDir& activeParams : content.getNodes("Active")) {
86
87 //plate positions
88 double x_tpcbeamR = activeParams.getLength("x_tpcbeamR") * CLHEP::cm;
89 double y_tpcbeamR = activeParams.getLength("y_tpcbeamR") * CLHEP::cm;
90 double z_tpcbeamR = activeParams.getLength("z_tpcbeamR") * CLHEP::cm;
91 double x_tpcbeamL = activeParams.getLength("x_tpcbeamL") * CLHEP::cm;
92 double y_tpcbeamL = activeParams.getLength("y_tpcbeamL") * CLHEP::cm;
93 double z_tpcbeamL = activeParams.getLength("z_tpcbeamL") * CLHEP::cm;
94 double x_tpcbeamT = activeParams.getLength("x_tpcbeamT") * CLHEP::cm;
95 double y_tpcbeamT = activeParams.getLength("y_tpcbeamT") * CLHEP::cm;
96 double z_tpcbeamT = activeParams.getLength("z_tpcbeamT") * CLHEP::cm;
97 double x_tpcbeamB = activeParams.getLength("x_tpcbeamB") * CLHEP::cm;
98 double y_tpcbeamB = activeParams.getLength("y_tpcbeamB") * CLHEP::cm;
99 double z_tpcbeamB = activeParams.getLength("z_tpcbeamB") * CLHEP::cm;
100
101 //TPC vertical: 4x @ 1614/ea
102 //TPC horizontal + BGO base: 8x @ 1583/ea
103 //TPC railroad: 8x @ 2200/ea
104 //BGO vertical: 4x @ 928/ea
105 //BGO horizontal: 4x @ 318/ea
106 //G4double dz_20V2100bgov = 843.72 / 2.*CLHEP::mm;
107 //G4double dz_20V2100bgoh = 280.00 / 2.*CLHEP::mm;
108
109 //Beam supporting the TPC-Tube-plate
110 //define tpc beam and plate dimensions
111 double betpcbeam = 190.8 / 2. * CLHEP::mm;
112 G4double dx_tpcbeam = 2.54 * 1.63 / 2.*CLHEP::cm;
113 G4double dy_tpcbeam = 2.54 * 1.63 / 2.*CLHEP::cm;
114 G4double dz_tpcbeam = 2200. / 2.*CLHEP::mm;
115 G4double dw_tpcbeam = 2.54 * 0.25 / 2.*CLHEP::cm;
116 //G4double dx_plate = 2.54 * 0.35 / 2.*CLHEP::cm;
117
118 //G4double dx_plate_short = 0.4765 * CLHEP::cm;
119 G4double dx_plate_short = 0.5 / 2. * CLHEP::cm;
120 G4double dy_plate_short = 27.47788 / 2.*CLHEP::cm;
121 G4double dz_plate_short = 40. / 2.*CLHEP::cm;
122
123 G4double dx_plate = 0.5 / 2. * CLHEP::cm;
124 G4double dy_plate = 32. / 2.*CLHEP::cm;
125 G4double dz_plate = 50. / 2.*CLHEP::cm;
126
127 //Right from e^-~--~beam
128 //create plate volume
129 G4VSolid* s_plate = new G4Box("s_plate", dx_plate, dy_plate, dz_plate);
130 G4VSolid* s_plate_short = new G4Box("s_plate_short", dx_plate_short, dy_plate_short, dz_plate_short);
131
132 //place plate volume
133 G4LogicalVolume* l_plate = new G4LogicalVolume(s_plate, geometry::Materials::get("Al"), "l_plate", 0, 0);
134 G4LogicalVolume* l_plate_short = new G4LogicalVolume(s_plate_short, geometry::Materials::get("Al"), "l_plate_short", 0, 0);
135 G4VisAttributes* white = new G4VisAttributes(G4Colour(1, 1, 1));
136 white->SetForceAuxEdgeVisible(true);
137 l_plate->SetVisAttributes(white);
138 l_plate_short->SetVisAttributes(white);
139
140 G4VSolid* s_tpcbeam_a = new G4Box("s_tpcbeam_a", dx_tpcbeam, dy_tpcbeam, dz_tpcbeam);
141 G4VSolid* s_tpcbeam_b = new G4Box("s_tpcbeam_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_tpcbeam);
142 G4VSolid* s_tpcbeampos = new G4SubtractionSolid("s_tpcbeampos", s_tpcbeam_a, s_tpcbeam_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
143 G4VSolid* s_tpcbeamneg = new G4SubtractionSolid("s_tpcbeamneg", s_tpcbeam_a, s_tpcbeam_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
144 G4VSolid* s_tpcbeam = new G4UnionSolid("s_tpcbeam", s_tpcbeampos, s_tpcbeamneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
145
146 //create tpc beam volumes
147 G4LogicalVolume* l_tpcbeam = new G4LogicalVolume(s_tpcbeam, geometry::Materials::get("FG_Epoxy"), "l_tpcbeam", 0, 0);
148
149 //place plate volume
150 G4ThreeVector PH1SUSTRpos = G4ThreeVector(
151 x_tpcbeamR,
152 y_tpcbeamR,
153 z_tpcbeamR
154 );
155 new G4PVPlacement(0, PH1SUSTRpos, l_plate, "p_plateR", &topVolume, false, 1);
156
157 //offsets hori
158 //G4double offset_h = /*110.*CLHEP::cm*/dz_tpcbeam + /*80.*CLHEP::cm*/ dz_plate - 2. * dz_tpcbeam;
159 G4double offset_h = /*110.*CLHEP::cm*/dz_tpcbeam + 80.*CLHEP::cm - 2. * dz_tpcbeam;
160
161 //place 1st tpc beam volume
162 /*PH1SUSTRpos = G4ThreeVector(
163 x_tpcbeamR + dx_plate + dx_tpcbeam,
164 y_tpcbeamR + betpcbeam + 2. * dy_tpcbeam,
165 -offset_h / 2.
166 );
167 new G4PVPlacement(0, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
168 G4Transform3D TransForm = G4Translate3D(x_tpcbeamR + dx_plate + dx_tpcbeam,
169 y_tpcbeamR + betpcbeam + 2. * dy_tpcbeam,
170 -offset_h / 2.) * G4RotateZ3D(90.*CLHEP::deg);
171 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamR1", &topVolume, false, 1);
172
173 //place 2nd tpc beam volume
174 /*PH1SUSTRpos = G4ThreeVector(
175 x_tpcbeamR + dx_plate + dx_tpcbeam,
176 y_tpcbeamR - betpcbeam - 2. * dy_tpcbeam,
177 -offset_h / 2.
178 );
179 new G4PVPlacement(0, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
180 TransForm = G4Translate3D(x_tpcbeamR + dx_plate + dx_tpcbeam,
181 y_tpcbeamR - betpcbeam - 2. * dy_tpcbeam,
182 -offset_h / 2.) * G4RotateZ3D(90.*CLHEP::deg);
183 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamR2", &topVolume, false, 1);
184
185 //Left from e^-~--~beam
186 //place plate volume
187 PH1SUSTRpos = G4ThreeVector(
188 x_tpcbeamL,
189 y_tpcbeamL,
190 z_tpcbeamL
191 );
192 new G4PVPlacement(0, PH1SUSTRpos, l_plate, "p_plateL", &topVolume, false, 1);
193
194 //place 1st tpc beam volume
195 /*PH1SUSTRpos = G4ThreeVector(
196 x_tpcbeamL - dx_plate - dx_tpcbeam,
197 y_tpcbeamL + betpcbeam + 2. * dy_tpcbeam,
198 -offset_h / 2.
199 );
200 new G4PVPlacement(0, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
201 TransForm = G4Translate3D(x_tpcbeamL - dx_plate - 3. * dx_tpcbeam,
202 y_tpcbeamL + betpcbeam + 2. * dy_tpcbeam,
203 -offset_h / 2.) * G4RotateZ3D(90.*CLHEP::deg);
204 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamL1", &topVolume, false, 1);
205
206 //place 2nd tpc beam volume
207 /*PH1SUSTRpos = G4ThreeVector(
208 x_tpcbeamL - dx_plate - dx_tpcbeam,
209 y_tpcbeamL - betpcbeam - 2. * dy_tpcbeam,
210 -offset_h / 2.
211 );
212 new G4PVPlacement(0, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
213 TransForm = G4Translate3D(x_tpcbeamL - dx_plate - 3. * dx_tpcbeam,
214 y_tpcbeamL - betpcbeam - 2. * dy_tpcbeam,
215 -offset_h / 2.) * G4RotateZ3D(90.*CLHEP::deg);
216 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamL2", &topVolume, false, 1);
217
218 //Bottom
219 G4RotationMatrix* rotXx = new G4RotationMatrix();
220 double Angle = 90. * CLHEP::deg;
221 rotXx->rotateZ(Angle);
222 //place bottom plate
223 PH1SUSTRpos = G4ThreeVector(
224 x_tpcbeamB,
225 y_tpcbeamB,
226 z_tpcbeamB
227 );
228 new G4PVPlacement(rotXx, PH1SUSTRpos, l_plate_short, "p_plateB", &topVolume, false, 1);
229
230 //place 1st tpc beam volume
231 /*PH1SUSTRpos = G4ThreeVector(
232 x_tpcbeamB + betpcbeam + 2. * dx_tpcbeam,
233 y_tpcbeamB - dx_plate - dy_tpcbeam,
234 -offset_h / 2.
235 );
236 new G4PVPlacement(rotXx, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
237 TransForm = G4Translate3D(x_tpcbeamB + betpcbeam + 1.5 * dx_tpcbeam,
238 y_tpcbeamB - dx_plate - 1.5 * dy_tpcbeam,
239 -offset_h / 2.) /* G4RotateZ3D(90.*CLHEP::deg)*/;
240 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamB1", &topVolume, false, 1);
241
242 //place 2nd tpc beam volume
243 /*PH1SUSTRpos = G4ThreeVector(
244 x_tpcbeamB - betpcbeam - 2. * dx_tpcbeam,
245 y_tpcbeamB - dx_plate - dy_tpcbeam,
246 -offset_h / 2.
247 );
248 new G4PVPlacement(rotXx, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
249 TransForm = G4Translate3D(x_tpcbeamB - betpcbeam - 1.5 * dx_tpcbeam,
250 y_tpcbeamB - dx_plate - 1.5 * dy_tpcbeam,
251 -offset_h / 2.) /* G4RotateZ3D(90.*CLHEP::deg)*/;
252 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamB2", &topVolume, false, 1);
253
254 //Top
255 //rotXx = new G4RotationMatrix();
256 //rotXx->rotateZ( 90. );
257 //place top plate
258 PH1SUSTRpos = G4ThreeVector(
259 x_tpcbeamT,
260 y_tpcbeamT,
261 z_tpcbeamT
262 );
263 new G4PVPlacement(rotXx, PH1SUSTRpos, l_plate, "p_plateT", &topVolume, false, 1);
264
265 //place 1st tpc beam volume
266 /*PH1SUSTRpos = G4ThreeVector(
267 x_tpcbeamT + betpcbeam + 2. * dx_tpcbeam,
268 y_tpcbeamT + dx_plate + dy_tpcbeam,
269 -offset_h / 2.
270 );
271 new G4PVPlacement(rotXx, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
272 TransForm = G4Translate3D(x_tpcbeamT + betpcbeam + 1.5 * dx_tpcbeam,
273 y_tpcbeamT + dx_plate + 3. * dy_tpcbeam,
274 -offset_h / 2.) /* G4RotateZ3D(90.*CLHEP::deg)*/;
275 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamT1", &topVolume, false, 1);
276
277 //place 2nd tpc beam volume
278 /*PH1SUSTRpos = G4ThreeVector(
279 x_tpcbeamT - betpcbeam - 2. * dx_tpcbeam,
280 y_tpcbeamT + dx_plate + dy_tpcbeam,
281 -offset_h / 2.
282 );
283 new G4PVPlacement(rotXx, PH1SUSTRpos, l_tpcbeam, "p_tpcbeam", &topVolume, false, 1);*/
284 TransForm = G4Translate3D(x_tpcbeamT - betpcbeam - 1.5 * dx_tpcbeam,
285 y_tpcbeamT + dx_plate + 3 * dy_tpcbeam,
286 -offset_h / 2.) /* G4RotateZ3D(90.*CLHEP::deg)*/;
287 new G4PVPlacement(TransForm, l_tpcbeam, "p_tpcbeamT2", &topVolume, false, 1);
288
289 //vertical beams
290 //G4double dz_tpcbeamv = 1537.37 / 2.*CLHEP::mm;
291 G4double dz_tpcbeamv = 1583. / 2.*CLHEP::mm;
292 G4VSolid* s_tpcbeamv_a = new G4Box("s_tpcbeamv_a", dx_tpcbeam, dy_tpcbeam, dz_tpcbeamv);
293 G4VSolid* s_tpcbeamv_b = new G4Box("s_tpcbeamv_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_tpcbeamv);
294 G4VSolid* s_tpcbeamvpos = new G4SubtractionSolid("s_tpcbeamvpos", s_tpcbeamv_a, s_tpcbeamv_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
295 G4VSolid* s_tpcbeamvneg = new G4SubtractionSolid("s_tpcbeamvneg", s_tpcbeamv_a, s_tpcbeamv_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
296 G4VSolid* s_tpcbeamv = new G4UnionSolid("s_tpcbeamv", s_tpcbeamvpos, s_tpcbeamvneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
297 G4LogicalVolume* l_tpcbeamv = new G4LogicalVolume(s_tpcbeamv, geometry::Materials::get("FG_Epoxy"), "l_tpcbeamv", 0, 0);
298
299 //offset verti
300 //G4double offset_v = fabs(76.*CLHEP::cm - 2. * dz_tpcbeamv) / 2.;
301 G4double offset_v = fabs(110.*CLHEP::cm - 2. * dz_tpcbeamv) / 2.;
302
303 //place 1st vertical TPC beam
304 G4RotationMatrix* rotX = new G4RotationMatrix();
305 rotX->rotateX(90.*CLHEP::deg);
306 PH1SUSTRpos = G4ThreeVector(
307 x_tpcbeamL - dx_plate - 3 * dx_tpcbeam - 2.*dx_tpcbeam,
308 offset_v / 2.,
309 -800.*CLHEP::mm
310 );
311 new G4PVPlacement(rotX, PH1SUSTRpos, l_tpcbeamv, "p_tpcbeamv1", &topVolume, false, 0);
312 //place 2nd vertical TPC beam
313 PH1SUSTRpos = G4ThreeVector(
314 x_tpcbeamR + dx_plate + 3.*dx_tpcbeam + 2.*dx_tpcbeam,
315 offset_v / 2.,
316 -800.*CLHEP::mm
317 );
318 new G4PVPlacement(rotX, PH1SUSTRpos, l_tpcbeamv, "p_tpcbeamv2", &topVolume, false, 0);
319 //place 3rd vertical TPC beam
320 PH1SUSTRpos = G4ThreeVector(
321 x_tpcbeamL - dx_plate - 3.*dx_tpcbeam - 2.*dx_tpcbeam,
322 offset_v / 2.,
323 1100.*CLHEP::mm
324 );
325 new G4PVPlacement(rotX, PH1SUSTRpos, l_tpcbeamv, "p_tpcbeamv3", &topVolume, false, 0);
326 //place 4th vertical TPC beam
327 PH1SUSTRpos = G4ThreeVector(
328 x_tpcbeamR + dx_plate + 3.*dx_tpcbeam + 2.*dx_tpcbeam,
329 offset_v / 2.,
330 1100.*CLHEP::mm
331 );
332 new G4PVPlacement(rotX, PH1SUSTRpos, l_tpcbeamv, "p_tpcbeamv4", &topVolume, false, 0);
333
334 //horizontal beams
335 //G4double dz_tpcbeamh = 1792. / 2.*CLHEP::mm;
336 G4double dz_tpcbeamh = 1614. / 2.*CLHEP::mm;
337 G4VSolid* s_tpcbeamh_a = new G4Box("s_tpcbeamh_a", dx_tpcbeam, dy_tpcbeam, dz_tpcbeamh);
338 G4VSolid* s_tpcbeamh_b = new G4Box("s_tpcbeamh_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_tpcbeamh);
339 G4VSolid* s_tpcbeamhpos = new G4SubtractionSolid("s_tpcbeamhpos", s_tpcbeamh_a, s_tpcbeamh_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
340 G4VSolid* s_tpcbeamhneg = new G4SubtractionSolid("s_tpcbeanhneg", s_tpcbeamh_a, s_tpcbeamh_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
341 G4VSolid* s_tpcbeamh = new G4UnionSolid("s_tpcbeamh", s_tpcbeamhpos, s_tpcbeamhneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
342
343 G4LogicalVolume* l_tpcbeamh = new G4LogicalVolume(s_tpcbeamh, geometry::Materials::get("FG_Epoxy"), "l_tpcbeamh", 0, 0);
344
345 //place 1st horizontal TPC beam
346 G4RotationMatrix* rotY = new G4RotationMatrix();
347 rotY->rotateY(90.*CLHEP::deg);
348 PH1SUSTRpos = G4ThreeVector(
349 0 * CLHEP::mm,
350 y_tpcbeamB - dx_plate - 4. * dy_tpcbeam - 2. * dy_tpcbeam,
351 1100.*CLHEP::mm - 2. * dy_tpcbeam
352 );
353 new G4PVPlacement(rotY, PH1SUSTRpos, l_tpcbeamh, "p_tpcbeamh1", &topVolume, false, 0);
354
355 //place 2nd horizontal TPC beam
356 PH1SUSTRpos = G4ThreeVector(
357 0 * CLHEP::mm,
358 y_tpcbeamT + dx_plate + 5. * dy_tpcbeam + 2. * dy_tpcbeam,
359 1100.*CLHEP::mm - 2. * dy_tpcbeam
360 );
361 new G4PVPlacement(rotY, PH1SUSTRpos, l_tpcbeamh, "p_tpcbeamh2", &topVolume, false, 0);
362
363 //place 3rd horizontal TPC beam
364 PH1SUSTRpos = G4ThreeVector(
365 0 * CLHEP::mm,
366 y_tpcbeamB - dx_plate - 4. * dy_tpcbeam - 2. * dy_tpcbeam,
367 -800.*CLHEP::mm + 4. * dy_tpcbeam
368 );
369 new G4PVPlacement(rotY, PH1SUSTRpos, l_tpcbeamh, "p_tpcbeamh3", &topVolume, false, 0);
370
371 //place 4th horizontal TPC beam
372 PH1SUSTRpos = G4ThreeVector(
373 0 * CLHEP::mm,
374 y_tpcbeamT + dx_plate + 5. * dy_tpcbeam + 2. * dy_tpcbeam,
375 -800.*CLHEP::mm + 4. * dy_tpcbeam
376 );
377 new G4PVPlacement(rotY, PH1SUSTRpos, l_tpcbeamh, "p_tpcbeamh4", &topVolume, false, 0);
378
379 G4VisAttributes* brown = new G4VisAttributes(G4Colour(.5, .5, 0));
380 brown->SetForceAuxEdgeVisible(true);
381 l_tpcbeam->SetVisAttributes(brown);
382 l_tpcbeamv->SetVisAttributes(brown);
383 l_tpcbeamh->SetVisAttributes(brown);
384
385 //CsI box beams
386 G4double dz_csibeamh = activeParams.getLength("lcsiBeamh") * CLHEP::cm / 2.;
387 G4VSolid* s_csibeamh_a = new G4Box("s_csibeamh_a", dx_tpcbeam, dy_tpcbeam, dz_csibeamh);
388 G4VSolid* s_csibeamh_b = new G4Box("s_csibeamh_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_csibeamh);
389 G4VSolid* s_csibeamhpos = new G4SubtractionSolid("s_csibeamhpos", s_csibeamh_a, s_csibeamh_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
390 G4VSolid* s_csibeamhneg = new G4SubtractionSolid("s_csibeamhneg", s_csibeamh_a, s_csibeamh_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
391 //G4VSolid* s_csibeamhpos = new G4SubtractionSolid("s_csibeamhpos", s_csibeamh_a, s_csibeamh_b, 0, G4ThreeVector(dw_tpcbeam, 0, 0));
392 //G4VSolid* s_csibeamhneg = new G4SubtractionSolid("s_csibeamhneg", s_csibeamh_a, s_csibeamh_b, 0, G4ThreeVector(-dw_tpcbeam, 0, 0));
393 G4VSolid* s_csibeamh = new G4UnionSolid("s_csibeamh", s_csibeamhpos, s_csibeamhneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
394 G4LogicalVolume* l_csibeamh = new G4LogicalVolume(s_csibeamh, geometry::Materials::get("FG_Epoxy"), "l_csibeamh", 0, 0);
395
396 double x_offset = activeParams.getLength("x_offset") * CLHEP::cm;
397 double y_offset = activeParams.getLength("y_offset") * CLHEP::cm;
398
399 std::vector<double> xcsiBeamh = activeParams.getArray("xcsiBeamh", {0});
400 std::vector<double> ycsiBeamh = activeParams.getArray("ycsiBeamh", {0});
401 std::vector<double> zcsiBeamh = activeParams.getArray("zcsiBeamh", {0});
402 for (unsigned int i = 0; i < xcsiBeamh.size(); ++i) {
403 xcsiBeamh[i] = xcsiBeamh[i] - x_offset;
404 ycsiBeamh[i] = ycsiBeamh[i] - y_offset;
405 G4Transform3D transform = G4Translate3D(xcsiBeamh[i], ycsiBeamh[i] - dy_tpcbeam,
406 zcsiBeamh[i] + 2. * dy_tpcbeam) * G4RotateY3D(90.*CLHEP::deg) * G4RotateZ3D(90.*CLHEP::deg);
407 new G4PVPlacement(transform, l_csibeamh, TString::Format("p_csibeamh1_%d", i).Data(), &topVolume, false, 1);
408 transform = G4Translate3D(xcsiBeamh[i], ycsiBeamh[i] + dy_tpcbeam,
409 zcsiBeamh[i] + 2. * dy_tpcbeam) * G4RotateY3D(90.*CLHEP::deg) * G4RotateZ3D(90.*CLHEP::deg);
410 new G4PVPlacement(transform, l_csibeamh, TString::Format("p_csibeamh2_%d", i).Data(), &topVolume, false, 1);
411 }
412
413 G4double dz_csibeamvF = activeParams.getLength("lcsiBeamvF") * CLHEP::cm / 2.;
414 G4VSolid* s_csibeamvF_a = new G4Box("s_csibeamvF_a", dx_tpcbeam, dy_tpcbeam, dz_csibeamvF);
415 G4VSolid* s_csibeamvF_b = new G4Box("s_csibeamvF_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_csibeamvF);
416 G4VSolid* s_csibeamvFpos = new G4SubtractionSolid("s_csibeamvFpos", s_csibeamvF_a, s_csibeamvF_b, 0, G4ThreeVector(0, dw_tpcbeam,
417 0));
418 G4VSolid* s_csibeamvFneg = new G4SubtractionSolid("s_csibeamvFneg", s_csibeamvF_a, s_csibeamvF_b, 0, G4ThreeVector(0, -dw_tpcbeam,
419 0));
420 G4VSolid* s_csibeamvF = new G4UnionSolid("s_csibeamvF", s_csibeamvFpos, s_csibeamvFneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
421 G4LogicalVolume* l_csibeamvF = new G4LogicalVolume(s_csibeamvF, geometry::Materials::get("FG_Epoxy"), "l_csibeamvF", 0, 0);
422
423 std::vector<double> xcsiBeamvF =
424 activeParams.getArray("xcsiBeamvF", {0});
425 std::vector<double> ycsiBeamvF =
426 activeParams.getArray("ycsiBeamvF", {0});
427 std::vector<double> zcsiBeamvF =
428 activeParams.getArray("zcsiBeamvF", {0});
429 for (unsigned int i = 0; i < xcsiBeamvF.size(); ++i) {
430 xcsiBeamvF[i] = xcsiBeamvF[i] - x_offset;
431 ycsiBeamvF[i] = ycsiBeamvF[i] - y_offset;
432 PH1SUSTRpos = G4ThreeVector(xcsiBeamvF[i], ycsiBeamvF[i], zcsiBeamvF[i]);
433 new G4PVPlacement(rotX, PH1SUSTRpos, l_csibeamvF, TString::Format("p_csibeamvF_%d", i).Data(), &topVolume, false, 0);
434 }
435
436 G4double dz_csibeamvB = activeParams.getLength("lcsiBeamvB") * CLHEP::cm / 2.;
437 G4VSolid* s_csibeamvB_a = new G4Box("s_csibeamvB_a", dx_tpcbeam, dy_tpcbeam, dz_csibeamvB);
438 G4VSolid* s_csibeamvB_b = new G4Box("s_csibeamvB_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_csibeamvB);
439 G4VSolid* s_csibeamvBpos = new G4SubtractionSolid("s_csibeamvBpos", s_csibeamvB_a, s_csibeamvB_b, 0, G4ThreeVector(0, dw_tpcbeam,
440 0));
441 G4VSolid* s_csibeamvBneg = new G4SubtractionSolid("s_csibeamvBneg", s_csibeamvB_a, s_csibeamvB_b, 0, G4ThreeVector(0, -dw_tpcbeam,
442 0));
443 G4VSolid* s_csibeamvB = new G4UnionSolid("s_csibeamvB", s_csibeamvBpos, s_csibeamvBneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
444 G4LogicalVolume* l_csibeamvB = new G4LogicalVolume(s_csibeamvB, geometry::Materials::get("FG_Epoxy"), "l_csibeamvB", 0, 0);
445
446 std::vector<double> xcsiBeamvB =
447 activeParams.getArray("xcsiBeamvB", {0});
448 std::vector<double> ycsiBeamvB =
449 activeParams.getArray("ycsiBeamvB", {0});
450 std::vector<double> zcsiBeamvB =
451 activeParams.getArray("zcsiBeamvB", {0});
452 for (unsigned int i = 0; i < xcsiBeamvB.size(); ++i) {
453 xcsiBeamvB[i] = xcsiBeamvB[i] - x_offset;
454 ycsiBeamvB[i] = ycsiBeamvB[i] - y_offset;
455 PH1SUSTRpos = G4ThreeVector(xcsiBeamvB[i], ycsiBeamvB[i], zcsiBeamvB[i]);
456 new G4PVPlacement(rotX, PH1SUSTRpos, l_csibeamvB, TString::Format("p_csibeamvB_%d", i).Data(), &topVolume, false, 0);
457 }
458
459 G4double dz_base = activeParams.getLength("lBase") * CLHEP::cm / 2.;
460 G4VSolid* s_base_a = new G4Box("s_base_a", dx_tpcbeam, dy_tpcbeam, dz_base);
461 G4VSolid* s_base_b = new G4Box("s_base_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_base);
462 G4VSolid* s_base = new G4SubtractionSolid("s_base", s_base_a, s_base_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
463 G4LogicalVolume* l_base = new G4LogicalVolume(s_base, geometry::Materials::get("FG_Epoxy"), "l_base", 0, 0);
464
465 std::vector<double> xBase = activeParams.getArray("xBase", {0});
466 std::vector<double> yBase = activeParams.getArray("yBase", {0});
467 std::vector<double> zBase = activeParams.getArray("zBase", {0});
468 for (unsigned int i = 0; i < xBase.size(); ++i) {
469 xBase[i] = xBase[i] - x_offset;
470 yBase[i] = yBase[i] - y_offset;
471 PH1SUSTRpos = G4ThreeVector(xBase[i], yBase[i], zBase[i]);
472 new G4PVPlacement(0, PH1SUSTRpos, l_base, TString::Format("p_base_%d", i).Data(), &topVolume, false, 0);
473 }
474
475 G4double dz_bgobeamv = activeParams.getLength("lbgoBeamv") * CLHEP::cm / 2.;
476 G4VSolid* s_bgobeamv_a = new G4Box("s_bgobeamv_a", dx_tpcbeam, dy_tpcbeam, dz_bgobeamv);
477 G4VSolid* s_bgobeamv_b = new G4Box("s_bgobeamv_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_bgobeamv);
478 G4VSolid* s_bgobeamvpos = new G4SubtractionSolid("s_bgobeamvpos", s_bgobeamv_a, s_bgobeamv_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
479 G4VSolid* s_bgobeamvneg = new G4SubtractionSolid("s_bgobeamvneg", s_bgobeamv_a, s_bgobeamv_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
480 G4VSolid* s_bgobeamv = new G4UnionSolid("s_bgobeamv", s_bgobeamvpos, s_bgobeamvneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
481 G4LogicalVolume* l_bgobeamv = new G4LogicalVolume(s_bgobeamv, geometry::Materials::get("FG_Epoxy"), "l_bgobeamv", 0, 0);
482
483 std::vector<double> xbgoBeamv = activeParams.getArray("xbgoBeamv", {0});
484 std::vector<double> ybgoBeamv = activeParams.getArray("ybgoBeamv", {0});
485 std::vector<double> zbgoBeamv = activeParams.getArray("zbgoBeamv", {0});
486 for (unsigned int i = 0; i < xbgoBeamv.size(); ++i) {
487 ybgoBeamv[i] = ybgoBeamv[i] - y_offset;
488 PH1SUSTRpos = G4ThreeVector(xbgoBeamv[i], ybgoBeamv[i], zbgoBeamv[i]);
489 new G4PVPlacement(rotX, PH1SUSTRpos, l_bgobeamv, TString::Format("p_bgobeamv_%d", i).Data(), &topVolume, false, 0);
490 }
491
492 G4double dz_bgobeamh = activeParams.getLength("lbgoBeamh") * CLHEP::cm / 2.;
493 G4VSolid* s_bgobeamh_a = new G4Box("s_bgobeamh_a", dx_tpcbeam, dy_tpcbeam, dz_bgobeamh);
494 G4VSolid* s_bgobeamh_b = new G4Box("s_bgobeamh_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_bgobeamh);
495 G4VSolid* s_bgobeamhpos = new G4SubtractionSolid("s_bgobeamhpos", s_bgobeamh_a, s_bgobeamh_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
496 G4VSolid* s_bgobeamhneg = new G4SubtractionSolid("s_bgobeamhneg", s_bgobeamh_a, s_bgobeamh_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
497 G4VSolid* s_bgobeamh = new G4UnionSolid("s_bgobeamh", s_bgobeamhpos, s_bgobeamhneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
498 G4LogicalVolume* l_bgobeamh = new G4LogicalVolume(s_bgobeamh, geometry::Materials::get("FG_Epoxy"), "l_bgobeamh", 0, 0);
499
500 std::vector<double> xbgoBeamh = activeParams.getArray("xbgoBeamh", {0});
501 std::vector<double> ybgoBeamh = activeParams.getArray("ybgoBeamh", {0});
502 std::vector<double> zbgoBeamh = activeParams.getArray("zbgoBeamh", {0});
503 for (unsigned int i = 0; i < xbgoBeamh.size(); ++i) {
504 ybgoBeamh[i] = ybgoBeamh[i] - y_offset;
505 G4Transform3D transform = G4Translate3D(xbgoBeamh[i], ybgoBeamh[i],
506 zbgoBeamh[i] + 2. * dy_tpcbeam) * G4RotateY3D(90.*CLHEP::deg) * G4RotateZ3D(90.*CLHEP::deg);
507 new G4PVPlacement(transform, l_bgobeamh, TString::Format("p_bgobeamh_%d", i).Data(), &topVolume, false, 0);
508 }
509
510 G4double dz_bgobeamt = activeParams.getLength("lbgoBeamt") * CLHEP::cm / 2.;
511 G4VSolid* s_bgobeamt_a = new G4Box("s_bgobeamt_a", dx_tpcbeam, dy_tpcbeam, dz_bgobeamt);
512 G4VSolid* s_bgobeamt_b = new G4Box("s_bgobeamt_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_bgobeamt);
513 G4VSolid* s_bgobeamt = new G4SubtractionSolid("s_bgobeamt", s_bgobeamt_a, s_bgobeamt_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
514 G4LogicalVolume* l_bgobeamt = new G4LogicalVolume(s_bgobeamt, geometry::Materials::get("FG_Epoxy"), "l_bgobeamt", 0, 0);
515
516 std::vector<double> xbgoBeamt = activeParams.getArray("xbgoBeamt", {0});
517 std::vector<double> ybgoBeamt = activeParams.getArray("ybgoBeamt", {0});
518 std::vector<double> zbgoBeamt = activeParams.getArray("zbgoBeamt", {0});
519 for (unsigned int i = 0; i < xbgoBeamt.size(); ++i) {
520 ybgoBeamt[i] = ybgoBeamt[i] - y_offset;
521 PH1SUSTRpos = G4ThreeVector(xbgoBeamt[i], ybgoBeamt[i], zbgoBeamt[i]);
522 new G4PVPlacement(0, PH1SUSTRpos, l_bgobeamt, TString::Format("p_bgobeamt_%d", i).Data(), &topVolume, false, 0);
523 }
524
525 G4double dz_bgobeamb = activeParams.getLength("lbgoBeamb") * CLHEP::cm / 2.;
526 G4VSolid* s_bgobeamb_a = new G4Box("s_bgobeamb_a", dx_tpcbeam, dy_tpcbeam, dz_bgobeamb);
527 G4VSolid* s_bgobeamb_b = new G4Box("s_bgobeamb_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_bgobeamb);
528 G4VSolid* s_bgobeambpos = new G4SubtractionSolid("s_bgobeambpos", s_bgobeamb_a, s_bgobeamb_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
529 G4VSolid* s_bgobeambneg = new G4SubtractionSolid("s_bgobeambneg", s_bgobeamb_a, s_bgobeamb_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
530 G4VSolid* s_bgobeamb = new G4UnionSolid("s_bgobeamb", s_bgobeambpos, s_bgobeambneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
531 G4LogicalVolume* l_bgobeamb = new G4LogicalVolume(s_bgobeamb, geometry::Materials::get("FG_Epoxy"), "l_bgobeamb", 0, 0);
532 std::vector<double> xbgoBeamb = activeParams.getArray("xbgoBeamb", {0});
533 std::vector<double> ybgoBeamb = activeParams.getArray("ybgoBeamb", {0});
534 std::vector<double> zbgoBeamb = activeParams.getArray("zbgoBeamb", {0});
535 for (unsigned int i = 0; i < xbgoBeamb.size(); ++i) {
536 xbgoBeamb[i] = xbgoBeamb[i] - x_offset;
537 ybgoBeamb[i] = ybgoBeamb[i] - y_offset;
538 G4Transform3D transform = G4Translate3D(xbgoBeamb[i], ybgoBeamb[i],
539 zbgoBeamb[i] + 2. * dy_tpcbeam) * G4RotateY3D(90.*CLHEP::deg) * G4RotateZ3D(90.*CLHEP::deg);
540 new G4PVPlacement(transform, l_bgobeamb, TString::Format("p_bgobeamb_%d", i).Data(), &topVolume, false, 1);
541 }
542
543 G4double dz_tpcbeamb = activeParams.getLength("ltpcBeamb") * CLHEP::cm / 2.;
544 G4VSolid* s_tpcbeamb_a = new G4Box("s_tpcbeamb_a", dx_tpcbeam, dy_tpcbeam, dz_tpcbeamb);
545 G4VSolid* s_tpcbeamb_b = new G4Box("s_tpcbeamb_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_tpcbeamb);
546 G4VSolid* s_tpcbeambpos = new G4SubtractionSolid("s_tpcbeambpos", s_tpcbeamb_a, s_tpcbeamb_b, 0, G4ThreeVector(0, dw_tpcbeam, 0));
547 G4VSolid* s_tpcbeambneg = new G4SubtractionSolid("s_tpcbeambneg", s_tpcbeamb_a, s_tpcbeamb_b, 0, G4ThreeVector(0, -dw_tpcbeam, 0));
548 G4VSolid* s_tpcbeamb = new G4UnionSolid("s_tpcbeamb", s_tpcbeambpos, s_tpcbeambneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam, 0));
549 G4LogicalVolume* l_tpcbeamb = new G4LogicalVolume(s_tpcbeamb, geometry::Materials::get("FG_Epoxy"), "l_tpcbeamb", 0, 0);
550 std::vector<double> xtpcBeamb = activeParams.getArray("xtpcBeamb", {0});
551 std::vector<double> ytpcBeamb = activeParams.getArray("ytpcBeamb", {0});
552 std::vector<double> ztpcBeamb = activeParams.getArray("ztpcBeamb", {0});
553 for (unsigned int i = 0; i < xtpcBeamb.size(); ++i) {
554 xtpcBeamb[i] = xtpcBeamb[i] - x_offset;
555 ytpcBeamb[i] = ytpcBeamb[i] - y_offset;
556 G4Transform3D transform =
557 G4Translate3D(xtpcBeamb[i], ytpcBeamb[i], ztpcBeamb[i] + 2. * dy_tpcbeam) *
558 G4RotateY3D(90.*CLHEP::deg) * G4RotateZ3D(90.*CLHEP::deg);
559 new G4PVPlacement(transform, l_tpcbeamb, TString::Format("p_tpcbeamb_%d", i).Data(), &topVolume, false, 1);
560 }
561
562 G4double dz_fangsbeamhf = activeParams.getLength("lfangsBeamhf") * CLHEP::cm / 2.;
563 G4VSolid* s_fangsbeamhf_a = new G4Box("s_fangsbeamhf_a", dx_tpcbeam, dy_tpcbeam, dz_fangsbeamhf);
564 G4VSolid* s_fangsbeamhf_b = new G4Box("s_fangsbeamhf_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_fangsbeamhf);
565 G4VSolid* s_fangsbeamhf = new G4SubtractionSolid("s_fangsbeamhf", s_fangsbeamhf_a, s_fangsbeamhf_b, 0, G4ThreeVector(0, dw_tpcbeam,
566 0));
567 G4LogicalVolume* l_fangsbeamhf = new G4LogicalVolume(s_fangsbeamhf, geometry::Materials::get("FG_Epoxy"), "l_fangsbeamhf", 0, 0);
568 double xfangsbeamhf = activeParams.getLength("xfangsBeamhf") * CLHEP::cm;
569 double yfangsbeamhf = activeParams.getLength("yfangsBeamhf") * CLHEP::cm;
570 double zfangsbeamhf = activeParams.getLength("zfangsBeamhf") * CLHEP::cm;
571 PH1SUSTRpos = G4ThreeVector(xfangsbeamhf, yfangsbeamhf, zfangsbeamhf);
572 new G4PVPlacement(rotY, PH1SUSTRpos, l_fangsbeamhf, "p_fangsbeamhf", &topVolume, false, 0);
573
574 G4double dz_fangsbeamhb = activeParams.getLength("lfangsBeamhb") * CLHEP::cm / 2.;
575 G4VSolid* s_fangsbeamhb_a = new G4Box("s_fangsbeamhb_a", dx_tpcbeam, dy_tpcbeam, dz_fangsbeamhb);
576 G4VSolid* s_fangsbeamhb_b = new G4Box("s_fangsbeamhb_b", dx_tpcbeam - 2.*dw_tpcbeam, dy_tpcbeam - dw_tpcbeam, dz_fangsbeamhb);
577 G4VSolid* s_fangsbeamhbpos = new G4SubtractionSolid("s_fangsbeamhbpos", s_fangsbeamhb_a, s_fangsbeamhb_b, 0, G4ThreeVector(0,
578 dw_tpcbeam, 0));
579 G4VSolid* s_fangsbeamhbneg = new G4SubtractionSolid("s_fangsbeamhbneg", s_fangsbeamhb_a, s_fangsbeamhb_b, 0, G4ThreeVector(0,
580 -dw_tpcbeam, 0));
581 G4VSolid* s_fangsbeamhb = new G4UnionSolid("s_fangsbeamhb", s_fangsbeamhbpos, s_fangsbeamhbneg, 0, G4ThreeVector(0, -2.*dy_tpcbeam,
582 0));
583 G4LogicalVolume* l_fangsbeamhb = new G4LogicalVolume(s_fangsbeamhb, geometry::Materials::get("FG_Epoxy"), "l_fangsbeamhb", 0, 0);
584 double xfangsbeamhb = activeParams.getLength("xfangsBeamhb") * CLHEP::cm;
585 double yfangsbeamhb = activeParams.getLength("yfangsBeamhb") * CLHEP::cm;
586 double zfangsbeamhb = activeParams.getLength("zfangsBeamhb") * CLHEP::cm;
587 TransForm = G4Translate3D(xfangsbeamhb, yfangsbeamhb, zfangsbeamhb) /* G4RotateX3D(90.*CLHEP::deg)*/ * G4RotateY3D(90.*CLHEP::deg);
588 new G4PVPlacement(TransForm, l_fangsbeamhb, "p_fangsbeamhb", &topVolume, false, 1);
589 }
590 }
591 } // ph1sustr namespace
593} // Belle2 namespace
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Creation of the detector geometry from Gearbox (XML).
virtual ~Ph1sustrCreator()
Destructor.
SensitiveDetector * m_sensitive
SensitiveDetector phase 1 support structure.
Sensitive Detector implementation of the PH1SUSTR detector.
GeometryTypes
Flag indicating the type of geometry to be used.
geometry::CreatorFactory< Ph1sustrCreator > Ph1sustrFactory("PH1SUSTRCreator")
Creator creates the phase 1 support structure geometry.
Abstract base class for different kinds of events.
STL namespace.
Very simple class to provide an easy way to register creators with the CreatorManager.