Belle II Software development
PindiodeCreator.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/pindiode/geometry/PindiodeCreator.h>
10#include <beast/pindiode/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 <TMath.h>
18
19#include <cmath>
20#include <boost/format.hpp>
21#include <boost/foreach.hpp>
22#include <boost/algorithm/string.hpp>
23
24#include <G4LogicalVolume.hh>
25#include <G4PVPlacement.hh>
26
27//Shapes
28#include <G4Box.hh>
29#include "G4SubtractionSolid.hh"
30#include <G4UserLimits.hh>
31#include "G4Tubs.hh"
32
33//Visualization
34#include "G4Colour.hh"
35#include <G4VisAttributes.hh>
36
37using namespace std;
38using namespace boost;
39
40namespace Belle2 {
47 namespace pindiode {
48
49 // Register the creator
52
54 {
55 //m_sensitive = new SensitiveDetector();
56 }
57
59 {
60 if (m_sensitive) delete m_sensitive;
61 }
62
63 void PindiodeCreator::create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes /* type */)
64 {
65
67
68 //Visualization Attributes
69 //G4VisAttributes *invis = new G4VisAttributes(G4Colour(1,1,1));
70 //invis->SetColor(0,0,0,0);
71 //invis->SetForceWireframe(true);
72 //invis->SetVisibility(false);
73 G4VisAttributes* red = new G4VisAttributes(G4Colour(1, 0, 0));
74 red->SetForceAuxEdgeVisible(true);
75 //G4VisAttributes *redwire = new G4VisAttributes(G4Colour(1,0,0));
76 //redwire->SetForceAuxEdgeVisible(true);
77 //redwire->SetForceWireframe(true);
78 G4VisAttributes* green = new G4VisAttributes(G4Colour(0, 1, 0));
79 green->SetForceAuxEdgeVisible(true);
80 //G4VisAttributes *blue = new G4VisAttributes(G4Colour(0,0,1));
81 //blue->SetForceAuxEdgeVisible(true);
82 //G4VisAttributes *white = new G4VisAttributes(G4Colour(1,1,1));
83 //white->SetForceAuxEdgeVisible(true);
84 G4VisAttributes* gray = new G4VisAttributes(G4Colour(.5, .5, .5));
85 gray->SetForceAuxEdgeVisible(true);
86 G4VisAttributes* yellow = new G4VisAttributes(G4Colour(1, 1, 0));
87 yellow->SetForceAuxEdgeVisible(true);
88 //G4VisAttributes *cyan = new G4VisAttributes(G4Colour(0,1,1));
89 //cyan->SetForceAuxEdgeVisible(true);
90 //G4VisAttributes *magenta = new G4VisAttributes(G4Colour(1,0,1));
91 //magenta->SetForceAuxEdgeVisible(true);
92 //G4VisAttributes *brown = new G4VisAttributes(G4Colour(.5,.5,0));
93 //brown->SetForceAuxEdgeVisible(true);
94 //G4VisAttributes *orange = new G4VisAttributes(G4Colour(1,2,0));
95 //orange->SetForceAuxEdgeVisible(true);
96 //G4VisAttributes* coppercolor = new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
97 //coppercolor->SetForceAuxEdgeVisible(true);
98
99 //lets get the stepsize parameter with a default value of 5 µm
100 double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
101 /*
102 //no get the array. Notice that the default framework unit is cm, so the
103 //values will be automatically converted
104 vector<double> bar = content.getArray("bar");
105 B2INFO("Contents of bar: ");
106 BOOST_FOREACH(double value, bar) {
107 B2INFO("value: " << value);
108 }
109 */
110
111 //Lets loop over all the Active nodes
112 BOOST_FOREACH(const GearDir & activeParams, content.getNodes("Active")) {
113
114 int phase = activeParams.getInt("phase");
115 G4double dx_pins = activeParams.getLength("dx_pins") / 2.*CLHEP::cm;
116 G4double dy_pins = activeParams.getLength("dy_pins") / 2.*CLHEP::cm;
117 G4double dz_pins = activeParams.getLength("dz_pins") / 2.*CLHEP::cm;
118 //Positioned PIN diodes
119 double x_pos[100];
120 double y_pos[100];
121 double z_pos[100];
122 double thetaX[100];
123 double thetaZ[100];
124 double thetaY[100];
125 double ch_wAu[100];
126 double ch_woAu[100];
127 double phi[100];
128 double r[100];
129 //int dimr_pin = 0;
130 if (phase == 1) {
131 int dimwAu = 0;
132 for (int wAu : activeParams.getArray("Ch_wAu", {0})) {
133 ch_wAu[dimwAu] = wAu;
134 dimwAu++;
135 }
136 int dimwoAu = 0;
137 for (int woAu : activeParams.getArray("Ch_woAu", {0})) {
138 ch_woAu[dimwoAu] = woAu;
139 dimwoAu++;
140 }
141 int dimx = 0;
142 for (double x : activeParams.getArray("x", {0})) {
143 x *= CLHEP::cm;
144 x_pos[dimx] = x;
145 dimx++;
146 }
147 int dimy = 0;
148 for (double y : activeParams.getArray("y", {0})) {
149 y *= CLHEP::cm;
150 y_pos[dimy] = y;
151 r[dimy] = sqrt(x_pos[dimy] * x_pos[dimy] + y_pos[dimy] * y_pos[dimy]);
152 double Phi = 0;
153 if (x_pos[dimy] >= 0) Phi = TMath::ASin(y_pos[dimy] / r[dimy]) * TMath::RadToDeg();
154 else Phi = -TMath::ASin(y_pos[dimy] / r[dimy]) * TMath::RadToDeg() + 180.;
155 //else if (x_pos[dimy] < 0) Phi = -TMath::ASin(y_pos[dimy] / r[dimy]) * TMath::RadToDeg() + 180.;
156 phi[dimy] = Phi * CLHEP::deg - 90. * CLHEP::deg;
157 dimy++;
158 }
159 int dimThetaX = 0;
160 for (double ThetaX : activeParams.getArray("ThetaX", {0})) {
161 thetaX[dimThetaX] = ThetaX;
162 dimThetaX++;
163 }
164 int dimThetaY = 0;
165 for (double ThetaY : activeParams.getArray("ThetaY", {0})) {
166 thetaY[dimThetaY] = ThetaY;
167 dimThetaY++;
168 }
169 }
170 int dimPhi = 0;
171 if (phase == 2) {
172 for (int i = 0; i < 100; i++) {
173 x_pos[i] = 0;
174 y_pos[i] = 0;
175 z_pos[i] = 0;
176 }
177 for (double Phi : activeParams.getArray("Phi", {0})) {
178 phi[dimPhi] = Phi - 90. * CLHEP::deg;
179 dimPhi++;
180 }
181 int dimr_pin = 0;
182 for (double r_pin : activeParams.getArray("r_pin", {0})) {
183 r_pin *= CLHEP::cm;
184 r[dimr_pin] = r_pin;
185 dimr_pin++;
186 }
187 }
188 int dimz = 0;
189 for (double z : activeParams.getArray("z", {0})) {
190 z *= CLHEP::cm;
191 z_pos[dimz] = z;
192 dimz++;
193 }
194 int dimThetaZ = 0;
195 for (double ThetaZ : activeParams.getArray("ThetaZ", {0})) {
196 thetaZ[dimThetaZ] = ThetaZ;
197 dimThetaZ++;
198 }
199
200 //inch to cm
201 G4double InchtoCm = 2.54 * CLHEP::cm;
202
203 //Create Air Box
204 G4double dz_airbox = 0.563 / 2. * InchtoCm;
205 G4double dx_airbox = 1. / 2. * InchtoCm;
206 G4double dy_airbox = 0.315 / 2. * InchtoCm;
207 /*
208 G4double dz_airbox_e = 0.1 / 2. * CLHEP::cm;
209 G4double dx_airbox_e = 0.1 / 2. * CLHEP::cm;
210 G4double dy_airbox_e = 0.1 / 2. * CLHEP::cm;
211 G4VSolid* s_airbox = new G4Box("s_airbox", dx_airbox + dx_airbox_e, dy_airbox + dy_airbox_e, dz_airbox + dz_airbox_e);
212 G4LogicalVolume* l_airbox = new G4LogicalVolume(s_airbox, G4Material::GetMaterial("G4_AIR"), "l_airbox");
213 for (int i = 0; i < dimz; i++) {
214 if (phase == 1) {
215 G4RotationMatrix* pRot = new G4RotationMatrix();
216 pRot->rotateX(thetaX[i]);
217 pRot->rotateY(thetaY[i]);
218 pRot->rotateZ(thetaZ[i]);
219 new G4PVPlacement(pRot, G4ThreeVector(x_pos[i], y_pos[i], z_pos[i]), l_airbox, TString::Format("p_airbox_%d", i).Data(), &topVolume,
220 false, 0);
221 } else if (phase == 2) {
222 G4Transform3D transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]);
223 new G4PVPlacement(transform, l_airbox, TString::Format("p_pin_airbox_%d", i).Data(), &topVolume, false, 0);
224 }
225 }
226 */
227 //Create PIN diode base box
228 G4double dz_base = 0.5 / 2. * InchtoCm;
229 G4double dx_base = dx_airbox;
230 G4double dy_base = 0.25 / 2. * InchtoCm;
231 G4VSolid* s_base = new G4Box("s_base", dx_base, dy_base, dz_base);
232
233 G4double ir_hole = 0.;
234 G4double or_hole = 5. / 2.*CLHEP::mm;
235 G4double h_hole = 0.382 / 2. * InchtoCm;
236 G4double sA_hole = 0.*CLHEP::deg;
237 G4double spA_hole = 360.*CLHEP::deg;
238 G4VSolid* s_hole = new G4Tubs("s_hole", ir_hole, or_hole, h_hole, sA_hole, spA_hole);
239 G4double x_pos_hole = dx_base - 0.315 * InchtoCm;
240 G4double y_pos_hole = (0.187 - 0.250 / 2.) * InchtoCm;
241 G4double z_pos_hole = -(0.5 - 0.382) * InchtoCm;
242 s_base = new G4SubtractionSolid("s_base_hole1", s_base, s_hole, 0, G4ThreeVector(x_pos_hole, y_pos_hole, z_pos_hole));
243 s_base = new G4SubtractionSolid("s_base_hole2", s_base, s_hole, 0, G4ThreeVector(-x_pos_hole, y_pos_hole, z_pos_hole));
244 /*s_base = new G4SubtractionSolid("s_base_hole1", s_base, s_hole, 0, G4ThreeVector((0.5 - 0.315)*InchtoCm,
245 (0.187 - 0.250 / 2.)*InchtoCm, -(0.5 - 0.382)*InchtoCm));
246 s_base = new G4SubtractionSolid("s_base_hole2", s_base, s_hole, 0, G4ThreeVector(-(0.5 - 0.315)*InchtoCm,
247 (0.187 - 0.250 / 2.)*InchtoCm, -(0.5 - 0.382)*InchtoCm));*/
248 const double iTheta[4] = {0, 90, 180, 270};
249 G4LogicalVolume* l_base = new G4LogicalVolume(s_base, G4Material::GetMaterial("Al6061"), "l_base");
250 l_base->SetVisAttributes(yellow);
251 G4Transform3D transform;
252 for (int i = 0; i < dimz; i++) {
253 if (phase == 1) {
254 transform = G4Translate3D(x_pos[i], y_pos[i],
255 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]);
256 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]);
257 new G4PVPlacement(transform, l_base, TString::Format("p_pin_base_%d", i).Data(), &topVolume, false, 0);
258 B2INFO("PIN base-" << (int)i / 4 << "-" << iTheta[i - ((int)i / 4) * 4] << " placed at: " << transform.getTranslation() << " mm ");
259 }
260 }
261 /*
262 for (int i = 0; i < dimz; i++) {
263 new G4PVPlacement(0, G4ThreeVector(0, dy_base - dy_airbox, dz_airbox - dz_base), l_base, TString::Format("p_base_%d", i).Data(),
264 l_airbox, false, 0);
265 }
266 */
267 //Create diode cover
268 G4double dz_cover1 = dz_airbox;
269 G4double dx_cover1 = dx_airbox;
270 G4double dy_cover1 = dy_airbox - dy_base;
271 G4VSolid* s_cover1 = new G4Box("s_cover1", dx_cover1, dy_cover1, dz_cover1);
272
273 G4double dx_shole = (0.563 - 0.406) / 2. * InchtoCm;
274 G4VSolid* s_shole = new G4Box("s_shole", dx_shole, dy_cover1, dx_shole);
275 G4double x_pos_cover_hole = dx_base - 0.392 * InchtoCm + dx_shole;
276 //G4double y_pos_cover_hole = 0;
277 G4double z_pos_cover_hole = dz_airbox - 0.406 * InchtoCm + dx_shole;
278 s_cover1 = new G4SubtractionSolid("s_cover1_hole1", s_cover1, s_shole, 0, G4ThreeVector(x_pos_cover_hole, 0, z_pos_cover_hole));
279 s_cover1 = new G4SubtractionSolid("s_cover1_hole2", s_cover1, s_shole, 0, G4ThreeVector(-x_pos_cover_hole, 0, z_pos_cover_hole));
280 /*
281 s_cover1 = new G4SubtractionSolid("s_cover1_hole1", s_cover1, s_shole, 0, G4ThreeVector((0.5 - 0.392)*InchtoCm + dx_shole, 0,
282 (0.563 / 2. - 0.406)*InchtoCm + dx_shole));
283 s_cover1 = new G4SubtractionSolid("s_cover1_hole2", s_cover1, s_shole, 0, G4ThreeVector(-(0.5 - 0.392)*InchtoCm - dx_shole, 0,
284 (0.563 / 2. - 0.406)*InchtoCm + dx_shole));
285 */
286 G4LogicalVolume* l_cover1 = new G4LogicalVolume(s_cover1, G4Material::GetMaterial("Al6061"), "l_cover1");
287 l_cover1->SetVisAttributes(yellow);
288 for (int i = 0; i < dimz; i++) {
289 if (phase == 1) {
290 transform = G4Translate3D(x_pos[i], y_pos[i],
291 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
292 G4Translate3D(0., dy_base + dy_cover1, (dz_cover1 - dz_base) - dy_cover1 * 2.);
293 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
294 // G4Translate3D(0., dy_base + dy_cover1, (dz_cover1 - dz_base) - dy_cover1 * 2.);
295 new G4PVPlacement(transform, l_cover1, TString::Format("p_pin_cover1_%d", i).Data(), &topVolume, false, 0);
296 }
297 }
298 /*
299 for (int i = 0; i < dimz; i++) {
300 new G4PVPlacement(0, G4ThreeVector(0, dy_airbox_e / 2. + dy_airbox - dy_cover1, 0), l_cover1, TString::Format("p_cover1_%d",
301 i).Data(), l_airbox,
302 false, 0);
303 }
304 */
305 G4double dz_cover2 = dz_airbox - dz_base;
306 G4double dx_cover2 = dx_airbox;
307 G4double dy_cover2 = dy_base;
308 G4VSolid* s_cover2 = new G4Box("s_cover2", dx_cover2, dy_cover2, dz_cover2);
309 G4LogicalVolume* l_cover2 = new G4LogicalVolume(s_cover2, G4Material::GetMaterial("Al6061"), "l_cover2");
310 l_cover2->SetVisAttributes(yellow);
311 for (int i = 0; i < dimz; i++) {
312 if (phase == 1) {
313 transform = G4Translate3D(x_pos[i], y_pos[i],
314 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
315 G4Translate3D(0., -2.*dy_cover1, - dz_base - dz_cover2);
316 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
317 //G4Translate3D(0., -2.*dy_cover1, - dz_base - dz_cover2);
318 new G4PVPlacement(transform, l_cover2, TString::Format("p_pin_cover2_%d", i).Data(), &topVolume, false, 0);
319 }
320 }
321 /*
322 for (int i = 0; i < dimz; i++) {
323 new G4PVPlacement(0, G4ThreeVector(0, dy_cover2 - dy_airbox, dz_cover2 - dz_airbox - dz_airbox_e / 2.), l_cover2,
324 TString::Format("p_cover2_%d",
325 i).Data(), l_airbox, false, 0);
326 }
327 */
328 //Create PIN plastic subtrate
329 /*
330 h_hole = 0.6 / 2.*CLHEP::cm;
331 sA_hole = 0.*deg;
332 spA_hole = 180.*deg;
333 G4VSolid* s_pinsubtrate = new G4Tubs("s_pinsubtrate", ir_hole, or_hole, h_hole, sA_hole, spA_hole);
334 G4LogicalVolume* l_pinsubtrate = new G4LogicalVolume(s_pinsubtrate, geometry::Materials::get("G4_POLYSTYRENE"), "l_pinsubtrate");
335 transform = G4RotateZ3D(phi) * G4Translate3D(0, r, z) * G4RotateX3D(-M_PI / 2 - thetaZ) *
336 G4Translate3D((0.5 - 0.315) * InchtoCm, (0.187 - 0.250 / 2.) * InchtoCm, -(0.5 - 0.382) * InchtoCm) * G4RotateZ3D(360.0);
337 new G4PVPlacement(transform, l_pinsubtrate, "p_pinsubtrate_1", &topVolume, false, 0);
338 transform = G4RotateZ3D(phi) * G4Translate3D(0, r, z) * G4RotateX3D(-M_PI / 2 - thetaZ) *
339 G4Translate3D(-(0.5 - 0.315) * InchtoCm, (0.187 - 0.250 / 2.) * InchtoCm, -(0.5 - 0.382) * InchtoCm) * G4RotateZ3D(360.0);
340 new G4PVPlacement(transform, l_pinsubtrate, "p_pinsubtrate_2", &topVolume, false, 0);
341 */
342
343 //Sensitive area
344 G4double dx_pin = dx_pins;
345 G4double dz_pin = dz_pins;
346 G4double dy_pin = dy_pins;
347
348 G4VSolid* s_pin = new G4Box("s_pin", dx_pin, dy_pin, dz_pin);
349 G4LogicalVolume* l_pin = new G4LogicalVolume(s_pin, geometry::Materials::get("G4_SILICON_DIOXIDE"), "l_pin", 0, m_sensitive);
350 l_pin->SetVisAttributes(yellow);
351 l_pin->SetUserLimits(new G4UserLimits(stepSize));
352 int detID = 0;
353 for (int i = 0; i < dimz; i++) {
354 int detID1 = 2 * i;
355 int detID2 = 2 * i + 1;
356 /*if (phase == 1) {
357 detID1 = ch_wAu[i];
358 detID2 = ch_woAu[i];
359 }*/
360 if (phase == 1) {
361
362 detID1 = ch_wAu[i];
363 detID2 = ch_woAu[i];
364
365 transform = G4Translate3D(x_pos[i], y_pos[i],
366 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
367 G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
368 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - 0. - dz_pin);
369 /*
370 if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
371 G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
372 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - 0. - dz_pin);
373 */
374 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_1_%d", i).Data(), &topVolume, false, detID1);
375 B2INFO("With Au PIN-" << detID1 << " placed at: " << transform.getTranslation() << " mm");
376
377 transform = G4Translate3D(x_pos[i], y_pos[i],
378 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
379 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
380 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
381 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_2_%d", i).Data(), &topVolume, false, detID2);
382 B2INFO(" PIN-" << detID2 << " placed at: " << transform.getTranslation() << " mm");
383 }
384 /*if (phase == 1) {
385 transform = G4Translate3D(x_pos[i], y_pos[i],
386 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
387 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
388 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
389 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_2_%d", i).Data(), &topVolume, false, detID2);
390 B2INFO(" PIN-" << detID2 << " placed at: " << transform.getTranslation() << " mm");
391 }*/
392 /*
393 if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
394 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
395 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
396 */
397
398 if (phase == 2) {
399 for (int j = 0; j < dimPhi; j++) {
400 transform = G4RotateZ3D(phi[j]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[j]);
401 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_%d", i).Data(), &topVolume, false, detID);
402 B2INFO("PIN-" << detID << " placed at: " << transform.getTranslation() << " mm");
403 detID ++;
404 }
405 }
406 }
407 /*
408 for (int i = 0; i < dimz; i++) {
409
410 int detID1 = 2 * i;
411 int detID2 = 2 * i + 1;
412 if (phase == 1) {
413 detID1 = ch_wAu[i];
414 detID2 = ch_woAu[i];
415 }
416
417 new G4PVPlacement(0, G4ThreeVector((0.5 - 0.392) * InchtoCm + dx_shole,
418 (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
419 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - 0. - dz_pin)
420 , l_pin, TString::Format("p_pin_1_%d", i).Data(), l_airbox, false, detID1);
421 new G4PVPlacement(0, G4ThreeVector(-(0.5 - 0.392) * InchtoCm - dx_shole,
422 (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
423 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin)
424 , l_pin, TString::Format("p_pin_2_%d", i).Data(), l_airbox, false, detID2);
425
426 new G4PVPlacement(0, G4ThreeVector(x_pos_cover_hole,
427 y_pos_hole + dy_pin,
428 z_pos_cover_hole + dx_shole - dz_pin)
429 , l_pin, TString::Format("p_pin_1_%d", i).Data(), l_airbox, false, detID1);
430 new G4PVPlacement(0, G4ThreeVector(-x_pos_cover_hole,
431 y_pos_hole + dy_pin,
432 z_pos_cover_hole + dx_shole - dz_pin)
433 , l_pin, TString::Format("p_pin_2_%d", i).Data(), l_airbox, false, detID2);
434 }
435 */
436 G4double dx_layer = 2.65 / 2.*CLHEP::mm;
437 G4double dz_layer = 2.65 / 2.*CLHEP::mm;
438 G4double dy_layer1 = 0.01 / 2.*CLHEP::mm;
439 G4VSolid* s_layer1 = new G4Box("s_layer1", dx_layer, dy_layer1, dz_layer);
440 G4LogicalVolume* l_layer1 = new G4LogicalVolume(s_layer1, geometry::Materials::get("G4_Au"), "l_layer1");
441 l_layer1->SetVisAttributes(red);
442 for (int i = 0; i < dimz; i++) {
443 if (phase == 1) {
444 transform = G4Translate3D(x_pos[i], y_pos[i],
445 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
446 G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer1 + 2.* dy_pin,
447 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
448 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
449 //G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer1 + 2.* dy_pin,
450 //(0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
451 new G4PVPlacement(transform, l_layer1, TString::Format("p_pin_layer1_%d", i).Data(), &topVolume, false, 0);
452 }
453 }
454 /*
455 for (int i = 0; i < dimz; i++) {
456
457 new G4PVPlacement(0, G4ThreeVector((0.5 - 0.392) * InchtoCm + dx_shole,
458 (0.187 - 0.250 / 2.) * InchtoCm + dy_layer1 + 2.* dy_pin,
459 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin),
460 l_layer1, TString::Format("p_layer1_%d", i).Data(), l_airbox, false, 0);
461
462 new G4PVPlacement(0, G4ThreeVector(x_pos_cover_hole,
463 y_pos_hole + dy_layer1 + 2.* dy_pin,
464 z_pos_cover_hole + dx_shole - dz_pin),
465 l_layer1, TString::Format("p_layer1_%d", i).Data(), l_airbox, false, 1);
466 }
467 */
468 G4double dy_layer2 = 0.001 / 2.*InchtoCm;
469 G4VSolid* s_layer2 = new G4Box("s_layer1", dx_layer, dy_layer2, dz_layer);
470 G4LogicalVolume* l_layer2 = new G4LogicalVolume(s_layer2, geometry::Materials::get("Al"), "l_layer2");
471 l_layer2->SetVisAttributes(green);
472 for (int i = 0; i < dimz; i++) {
473 if (phase == 1) {
474 transform = G4Translate3D(x_pos[i], y_pos[i],
475 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
476 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer2 + 2. * dy_pin,
477 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
478 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
479 //G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer2 + 2. * dy_pin,
480 //(0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
481 new G4PVPlacement(transform, l_layer2, TString::Format("p_pin_layer2_%d", i).Data(), &topVolume, false, 0);
482 }
483 }
484 /*
485 for (int i = 0; i < dimz; i++) {
486
487 new G4PVPlacement(0, G4ThreeVector(-(0.5 - 0.392) * InchtoCm - dx_shole,
488 (0.187 - 0.250 / 2.) * InchtoCm + dy_layer2 + 2. * dy_pin,
489 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin),
490 l_layer2, TString::Format("p_layer2_%d", i).Data(), l_airbox, false, 0);
491
492 new G4PVPlacement(0, G4ThreeVector(-x_pos_cover_hole,
493 y_pos_hole + dy_layer2 + 2. * dy_pin,
494 z_pos_cover_hole + dx_shole - dz_pin),
495 l_layer2, TString::Format("p_layer2_%d", i).Data(), l_airbox, false, 1);
496 }
497 */
498 }
499 }
500 } // pindiode namespace
502} // Belle2 namespace
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
std::vector< double > getArray(const std::string &path) const noexcept(false)
Get the parameter path as a list of double values converted to the standard unit.
Definition: Interface.cc:123
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
Definition: Interface.h:259
int getInt(const std::string &path="") const noexcept(false)
Get the parameter path as a int.
Definition: Interface.cc:60
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 ~PindiodeCreator()
Destructor.
SensitiveDetector * m_sensitive
SensitiveDetector PINDIODE.
Sensitive Detector implementation of the PINDIODE detector.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
GeometryTypes
Flag indiciating the type of geometry to be used.
geometry::CreatorFactory< PindiodeCreator > PindiodeFactory("PINDIODECreator")
Creator creates the PINDIODE 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.