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