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