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