Belle II Software development
MicrotpcCreator.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/microtpc/geometry/MicrotpcCreator.h>
10#include <beast/microtpc/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 <boost/format.hpp>
18#include <boost/foreach.hpp>
19#include <boost/algorithm/string.hpp>
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;
35using namespace boost;
36
37namespace Belle2 {
44 namespace microtpc {
45
46 // Register the creator
49
51 {
52 //m_sensitive = new SensitiveDetector();
53 }
54
56 {
57 if (m_sensitive) delete m_sensitive;
58 }
59
60 void MicrotpcCreator::create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes /* type */)
61 {
62
64
65 G4String symbol;
66 G4double a, z;
67 G4double density;
68 G4int ncomponents;
69
70 G4Element* H = new G4Element("Hydrogen", symbol = "H", z = 1., a = 1.00794 * CLHEP::g / CLHEP::mole);
71 G4Element* He = new G4Element("Helium", symbol = "He", z = 2., a = 4.002602 * CLHEP::g / CLHEP::mole);
72 G4Element* C = new G4Element("Carbon", symbol = "C", z = 6., a = 12.01 * CLHEP::g / CLHEP::mole);
73 G4Element* O = new G4Element("Oxygen", symbol = "O", z = 8., a = 16.00 * CLHEP::g / CLHEP::mole);
74 G4Element* Si = new G4Element("Silicon", symbol = "Si", z = 14., a = 28.09 * CLHEP::g / CLHEP::mole);
75 G4Element* Cl = new G4Element("Chlore", symbol = "Cl", z = 17., a = 35.453 * CLHEP::g / CLHEP::mole);
76 G4Element* Cu = new G4Element("Copper", symbol = "Cu", z = 29., a = 63.546 * CLHEP::g / CLHEP::mole);
77 G4Element* Zn = new G4Element("Zinc", symbol = "Zn", z = 30., a = 65.38 * CLHEP::g / CLHEP::mole);
78
79 //Helium 4
80 G4Material* gas_4He = new G4Material("gas_4He", density = 0.0001664 * CLHEP::g / CLHEP::cm3, ncomponents = 1, kStateGas,
81 293.15 * CLHEP::kelvin, 1.*CLHEP::atmosphere);
82 gas_4He->AddElementByNumberOfAtoms(He, 1);
83 //C02
84 G4Material* gas_CO2 = new G4Material("gas_CO2", density = 0.001842 * CLHEP::g / CLHEP::cm3, ncomponents = 2, kStateGas,
85 293.15 * CLHEP::kelvin, 1.*CLHEP::atmosphere);
86 gas_CO2->AddElementByNumberOfAtoms(C, 1);
87 gas_CO2->AddElementByNumberOfAtoms(O, 2);
88
89 //70/30 - 4He/ CO2
90 G4Material* gasmix_4HeCO2 = new G4Material("gasmix_4HeCO2", density = 0.00066908 * CLHEP::g / CLHEP::cm3, ncomponents = 2,
91 kStateGas, 293.15 * CLHEP::kelvin, 1.*CLHEP::atmosphere);
92 gasmix_4HeCO2->AddMaterial(gas_4He, 17.409 * CLHEP::perCent);
93 gasmix_4HeCO2->AddMaterial(gas_CO2, 82.591 * CLHEP::perCent);
94
95 //c8h7cl
96 G4Material* TPC_ParylenC = new G4Material("TPC_ParylenC", density = 1.298 * CLHEP::g / CLHEP::cm3, ncomponents = 3);
97 TPC_ParylenC->AddElementByMassFraction(H, 0.050908 * CLHEP::perCent);
98 TPC_ParylenC->AddElementByMassFraction(C, 0.693276 * CLHEP::perCent);
99 TPC_ParylenC->AddElementByMassFraction(Cl, 0.255816 * CLHEP::perCent);
100
101 //G10
102 G4Material* TPC_G10 = new G4Material("TPC_G10", density = 1.700 * CLHEP::g / CLHEP::cm3, ncomponents = 4);
103 TPC_G10->AddElementByNumberOfAtoms(Si, 1);
104 TPC_G10->AddElementByNumberOfAtoms(O, 2);
105 TPC_G10->AddElementByNumberOfAtoms(C, 3);
106 TPC_G10->AddElementByNumberOfAtoms(H, 3);
107
108 //Cu - copper
109 G4Material* metalCu = new G4Material("MetalCopper", density = 8.960 * CLHEP::g / CLHEP::cm3, ncomponents = 1);
110 metalCu->AddElement(Cu, 1);
111
112 //Copper screen
113 G4Material* TPC_metaCuScreen = new G4Material("TPC_metaCuScreen", density = 8.95 * CLHEP::g / CLHEP::cm3, ncomponents = 2);
114 TPC_metaCuScreen->AddElementByMassFraction(Cu, 90.*CLHEP::perCent);
115 TPC_metaCuScreen->AddElementByMassFraction(Zn, 10.*CLHEP::perCent);
116
117
118 //lets get the stepsize parameter with a default value of 5 µm
119 double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
120
121 //no get the array. Notice that the default framework unit is cm, so the
122 //values will be automatically converted
123 vector<double> bar = content.getArray("bar");
124 B2INFO("Contents of bar: ");
125 BOOST_FOREACH(double value, bar) {
126 B2INFO("value: " << value);
127 }
128 int detID = 0;
129 //Lets loop over all the Active nodes
130 BOOST_FOREACH(const GearDir & activeParams, content.getNodes("Active")) {
131
132 G4double inch = 2.54 * CLHEP::cm;
133
134 //create vessel volume inner volume will be subtracted by "inactive" gas
135 G4double dx_Vessel = activeParams.getLength("dx_Vessel") * CLHEP::cm / 2.;
136 G4double dy_Vessel = activeParams.getLength("dy_Vessel") * CLHEP::cm / 2.;
137 G4double dz_VesselEndCap = 1. / 8. / 2.*inch;
138 G4double dz_Vessel = activeParams.getLength("dz_Vessel") * CLHEP::cm / 2. + dz_VesselEndCap;
139 G4VSolid* s_Vessel = new G4Box("s_Vessel_tmp", dx_Vessel, dy_Vessel, dz_Vessel);
140
141 G4double width = 1. / 8.*inch;
142 G4double dx_iGasTPC = (dx_Vessel - width);
143 G4double dy_iGasTPC = (dy_Vessel - width);
144 G4double dz_iGasTPC = (dz_Vessel);
145
146 //create "inactive" gas volume
147 G4VSolid* s_iGasTPC = new G4Box("s_iGasTPC", dx_iGasTPC, dy_iGasTPC, dz_iGasTPC);
148
149 //create subtraction ie vessel
150 s_Vessel = new G4SubtractionSolid("s_Vessel", s_Vessel, s_iGasTPC, 0, G4ThreeVector(0, 0, 0));
151
152 G4LogicalVolume* l_Vessel = new G4LogicalVolume(s_Vessel, geometry::Materials::get("TPC_Al6061"), "l_Vessel");
153 G4LogicalVolume* l_iGasTPC = new G4LogicalVolume(s_iGasTPC, gasmix_4HeCO2, "l_iGasTPC");
154
155 G4RotationMatrix* rotXx = new G4RotationMatrix();
156 G4double AngleX = activeParams.getAngle("AngleX");
157 G4double AngleZ = activeParams.getAngle("AngleZ");
158 rotXx->rotateX(AngleX);
159 rotXx->rotateZ(AngleZ);
160 G4ThreeVector TPCpos = G4ThreeVector(
161 activeParams.getLength("TPCpos_x") * CLHEP::cm,
162 activeParams.getLength("TPCpos_y") * CLHEP::cm,
163 activeParams.getLength("TPCpos_z") * CLHEP::cm
164 );
165
166 new G4PVPlacement(rotXx, TPCpos, l_Vessel, "p_Vessel", &topVolume, false, 1);
167 new G4PVPlacement(rotXx, TPCpos, l_iGasTPC, "p_iGasTPC", &topVolume, false, 1);
168
169 B2INFO("Micro-TPC-" << detID << " placed at: " << TPCpos << " mm");
170
171 /*
172 //create endcap top and bottom
173 G4double dx_VesselEndCap = dx_Vessel;
174 G4double dy_VesselEndCap = dy_Vessel;
175 G4double dz_VesselEndCap = 1. / 8. / 2.*inch;
176 G4VSolid* s_VesselEndCap = new G4Box("s_VesselEndCap", dx_VesselEndCap, dy_VesselEndCap, dz_VesselEndCap);
177
178 string matEndCap = activeParams.getString("MaterialEndCap");
179 G4LogicalVolume* l_VesselEndCap = new G4LogicalVolume(s_VesselEndCap, geometry::Materials::get(matEndCap), "l_VesselEndCap");
180
181 G4double x_VesselEndCap[2] = {0, 0};
182 //G4double y_VesselEndCap[2] = {(dz_Vessel + dz_VesselEndCap)* sin(AngleX * CLHEP::deg), (-dz_VesselEndCap - dz_Vessel - 0.00001)* sin(AngleX * CLHEP::deg)};
183 //G4double z_VesselEndCap[2] = {(dz_Vessel + dz_VesselEndCap)* cos(AngleX * CLHEP::deg), (-dz_VesselEndCap - dz_Vessel - 0.00001)* cos(AngleX * CLHEP::deg)};
184 G4double y_VesselEndCap[2] = {(dz_Vessel + dz_VesselEndCap) * sin(AngleX * CLHEP::deg),
185 (-dz_VesselEndCap - dz_Vessel) * sin(AngleX * CLHEP::deg)};
186 G4double z_VesselEndCap[2] = {(dz_Vessel + dz_VesselEndCap) * cos(AngleX * CLHEP::deg),
187 (-dz_VesselEndCap - dz_Vessel) * cos(AngleX * CLHEP::deg)};
188
189 new G4PVPlacement(rotXx, G4ThreeVector(x_VesselEndCap[0], y_VesselEndCap[0], z_VesselEndCap[0]) + TPCpos, l_VesselEndCap,
190 "p_VesselEndCapTop", &topVolume, false, 1);
191 new G4PVPlacement(rotXx, G4ThreeVector(x_VesselEndCap[1], y_VesselEndCap[1], z_VesselEndCap[1]) + TPCpos, l_VesselEndCap,
192 "p_VesselEndCapBottom", &topVolume, false, 1);
193 */
194 G4VisAttributes* orange = new G4VisAttributes(G4Colour(1, 2, 0));
195 orange->SetForceAuxEdgeVisible(true);
196 //l_VesselEndCap->SetVisAttributes(orange);
197 l_Vessel->SetVisAttributes(orange);
198
199 G4double dx_parC1 = dx_iGasTPC;
200 G4double dy_parC1 = dy_iGasTPC;
201 G4double dz_parC1 = dz_iGasTPC;
202 G4double cwidth = 0.001 / 2. * inch;
203 G4double dx_parC2 = dx_parC1 - cwidth;
204 G4double dy_parC2 = dy_parC1 - cwidth;
205 G4double dz_parC2 = dz_parC1 - cwidth;
206 G4Box* s_parC1 = new G4Box("s_parC1", dx_parC1, dy_parC1, dz_parC1);
207 G4Box* s_parC2 = new G4Box("s_parC2", dx_parC2, dy_parC2, dz_parC2);
208 G4VSolid* s_parylenC = new G4SubtractionSolid("s_parylenC", s_parC1, s_parC2, 0, G4ThreeVector(0, 0, 0));
209 G4LogicalVolume* l_parylenC = new G4LogicalVolume(s_parylenC, TPC_ParylenC, "l_parylenC");
210 new G4PVPlacement(0, G4ThreeVector(0 * CLHEP::cm, 0 * CLHEP::cm, 0 * CLHEP::cm), l_parylenC, "p_parylenC", l_iGasTPC, false, 1);
211
212 G4double dx_kap1 = dx_parC2;
213 G4double dy_kap1 = dy_parC2;
214 G4double dz_kap1 = dz_parC2;
215 G4double kwidth = 0.05 / 2. * CLHEP::cm;
216 G4double dx_kap2 = dx_kap1 - kwidth;
217 G4double dy_kap2 = dy_kap1 - kwidth;
218 G4double dz_kap2 = dz_kap1 - kwidth;
219 G4Box* s_kap1 = new G4Box("s_kap1", dx_kap1, dy_kap1, dz_kap1);
220 G4Box* s_kap2 = new G4Box("s_kap2", dx_kap2, dy_kap2, dz_kap2);
221 G4VSolid* s_kapton = new G4SubtractionSolid("s_kapton", s_kap1, s_kap2, 0, G4ThreeVector(0, 0, 0));
222 G4LogicalVolume* l_kapton = new G4LogicalVolume(s_kapton, geometry::Materials::get("TPC_Kapton"), "l_kapton");
223 new G4PVPlacement(0, G4ThreeVector(0 * CLHEP::cm, 0 * CLHEP::cm, 0 * CLHEP::cm), l_kapton, "p_kapton", l_iGasTPC, false, 1);
224
225 //ring
226 G4double w = 1.4 * CLHEP::cm;
227 G4double rodx = 9.476 * CLHEP::cm;
228 G4double rody = 6.976 * CLHEP::cm;
229 G4double ridx = rodx - w;
230 G4double ridy = rody - w;
231 //rod hole position
232 G4double xrodh = ridx / 2. + w / 8.;
233 G4double yrodh = ridy / 2. + w / 8.;
234
235 //create rods
236 G4double iR_Rod = 0.*CLHEP::mm;
237 G4double oR_Rod = 5. / 2.*CLHEP::mm;
238 G4double h_Rod = 20. / 2. * CLHEP::cm;
239 G4double sA_Rod = 0.*CLHEP::deg;
240 G4double spA_Rod = 360.*CLHEP::deg;
241 /*cout << "h_Rod " << h_Rod / CLHEP::cm
242 << " dx " << dx_kap2 / CLHEP::cm
243 << " dy " << dy_kap2 / CLHEP::cm
244 << " dz " << dz_kap2 / CLHEP::cm
245 << endl;*/
246 //G4double x_Rod[4] = {3.2 * CLHEP::cm, 3.2 * CLHEP::cm, -3.2 * CLHEP::cm, -3.2 * CLHEP::cm};
247 //G4double y_Rod[4] = {3.2 * CLHEP::cm, -3.2 * CLHEP::cm, 3.2 * CLHEP::cm, -3.2 * CLHEP::cm};
248 G4double x_Rod[4] = {xrodh, xrodh, -xrodh, -xrodh};
249 G4double y_Rod[4] = {yrodh, -yrodh, yrodh, -yrodh};
250 //G4double z_Rod = -dz_iGasTPC + h_Rod;
251 G4double z_Rod = 0. * CLHEP::cm;
252
253 G4Tubs* s_Rod = new G4Tubs("s_Rod", iR_Rod, oR_Rod, h_Rod, sA_Rod, spA_Rod);
254 G4LogicalVolume* l_Rod = new G4LogicalVolume(s_Rod, geometry::Materials::get("G4_POLYVINYL_ACETATE"), "l_Rod");
255
256 new G4PVPlacement(0, G4ThreeVector(x_Rod[0], y_Rod[0], z_Rod), l_Rod, "p_Rod_0", l_iGasTPC, false, 1);
257 new G4PVPlacement(0, G4ThreeVector(x_Rod[1], y_Rod[1], z_Rod), l_Rod, "p_Rod_1", l_iGasTPC, false, 1);
258 new G4PVPlacement(0, G4ThreeVector(x_Rod[2], y_Rod[2], z_Rod), l_Rod, "p_Rod_2", l_iGasTPC, false, 1);
259 new G4PVPlacement(0, G4ThreeVector(x_Rod[3], y_Rod[3], z_Rod), l_Rod, "p_Rod_3", l_iGasTPC, false, 1);
260
261 //create the rings
262 //G4double dx_Ring = 7.4 / 2.*CLHEP::cm;
263 //G4double dy_Ring = 7.4 / 2.*CLHEP::cm;
264 G4double dx_Ring = rodx / 2.;
265 G4double dy_Ring = rody / 2.;
266 G4double dz_Ring = 0.127 / 2.*CLHEP::cm;
267
268 G4VSolid* s_Ring = new G4Box("s_RingFilled", dx_Ring, dy_Ring, dz_Ring);
269 //G4double dx_RingHole = 5.4 / 2.*CLHEP::cm;
270 //G4double dy_RingHole = 5.4 / 2.*CLHEP::cm;
271 G4double dx_RingHole = xrodh / 2.;
272 G4double dy_RingHole = yrodh / 2.;
273 G4double dz_RingHole = dz_Ring;
274 G4VSolid* s_RingHole = new G4Box("s_RingHole", dx_RingHole, dy_RingHole, dz_RingHole);
275 s_Ring = new G4SubtractionSolid("s_Ring", s_Ring, s_RingHole, 0, G4ThreeVector(0, 0, 0));
276
277 G4double iR_RingHoles = 0.*CLHEP::mm;
278 G4double oR_RingHoles = oR_Rod;
279 G4double h_RingHoles = dz_Ring;
280 G4double sA_RingHoles = 0.*CLHEP::deg;
281 G4double spA_RingHoles = 360.*CLHEP::deg;
282 G4VSolid* s_RingHoles = new G4Tubs("s_RingHoles", iR_RingHoles, oR_RingHoles, h_RingHoles, sA_RingHoles, spA_RingHoles);
283 char Name[400];
284 for (G4int i = 0; i < 4; i++) {
285 sprintf(Name, "s_Ring_%d", i);
286 s_Ring = new G4SubtractionSolid(Name, s_Ring, s_RingHoles, 0, G4ThreeVector(x_Rod[i], y_Rod[i], 0));
287 }
288
289 G4LogicalVolume* l_Ring = new G4LogicalVolume(s_Ring, geometry::Materials::get("TPC_Al6061"), "l_Ring");
290 G4int RingNb = 10;
291 G4double hspacer = 1.*CLHEP::cm;
292 G4double offset = dz_iGasTPC - 5.*CLHEP::cm;
293
294 G4double x_Ring[40];
295 G4double y_Ring[40];
296 G4double z_Ring[40];
297 for (G4int i = 0; i < RingNb; i++) {
298 x_Ring[i] = 0;
299 y_Ring[i] = 0;
300 z_Ring[i] = -dz_iGasTPC + offset + (hspacer + 2. * dz_Ring) * i;
301 //cout << "z ring # " << i << " pos. " << z_Ring[i] / CLHEP::cm << endl;
302 sprintf(Name, "p_Ring_%d", i);
303 new G4PVPlacement(0, G4ThreeVector(x_Ring[i], y_Ring[i], z_Ring[i]), l_Ring, Name, l_iGasTPC, false, 1);
304 }
305
306 //create anode
307 G4VSolid* s_Anode = new G4Box("s_Anode", dx_Ring, dy_Ring, dz_Ring);
308 for (G4int i = 0; i < 4; i++) {
309 sprintf(Name, "s_Anode_%d", i);
310 s_Anode = new G4SubtractionSolid(Name, s_Anode, s_RingHoles, 0, G4ThreeVector(x_Rod[i], y_Rod[i], 0));
311 }
312 G4LogicalVolume* l_Anode = new G4LogicalVolume(s_Anode, geometry::Materials::get("TPC_Al6061"), "l_Anode");
313 x_Ring[10] = 0;
314 y_Ring[10] = 0;
315 z_Ring[10] = -dz_iGasTPC + offset + (hspacer + 2.*dz_Ring) * RingNb;
316 new G4PVPlacement(0, G4ThreeVector(x_Ring[RingNb], y_Ring[RingNb], z_Ring[RingNb]), l_Anode, "p_Anode", l_iGasTPC, false, 1);
317
318 //create ring spacer
319 G4double iR_RSpacer = oR_Rod;
320 G4double oR_RSpacer = oR_Rod + 2.*CLHEP::mm;
321 G4double h_RSpacer = (z_Ring[1] - dz_Ring - (z_Ring[0] + dz_Ring)) / 2.;
322 G4double sA_RSpacer = 0.*CLHEP::deg;
323 G4double spA_RSpacer = 360.*CLHEP::deg;
324 G4Tubs* s_RSpacer = new G4Tubs("s_RSpacer1", iR_RSpacer, oR_RSpacer, h_RSpacer, sA_RSpacer, spA_RSpacer);
325 G4LogicalVolume* l_RSpacer = new G4LogicalVolume(s_RSpacer, geometry::Materials::get("G4_POLYVINYL_ACETATE"), "l_RSpacer");
326
327 G4double x_RSpacer[40];
328 G4double y_RSpacer[40];
329 G4double z_RSpacer[40];
330 for (G4int i = 0; i < 10; i++) {
331 for (G4int k = 0; k < 4; k++) {
332 x_RSpacer[i] = x_Rod[k];
333 y_RSpacer[i] = y_Rod[k];
334 z_RSpacer[i] = z_Ring[i] + dz_Ring + h_RSpacer;
335 sprintf(Name, "p_RSpacer_%d_%d", i, k);
336 new G4PVPlacement(0, G4ThreeVector(x_RSpacer[i], y_RSpacer[i], z_RSpacer[i]), l_RSpacer, Name, l_iGasTPC, false, 1);
337 }
338 }
339
340 //create GEM
341 G4double dx_GEM = 50. / 2.*CLHEP::mm;
342 G4double dy_GEM = 50. / 2.*CLHEP::mm;
343 G4double dz_GEM = 1.6 / 2.*CLHEP::mm;
344
345 G4double x_GEM = 0.*CLHEP::cm;
346 G4double y_GEM = 0.*CLHEP::cm;
347 //G4double z_GEM[] = { -dz_iGasTPC + 2.*CLHEP::cm - 0.21 * CLHEP::cm - dz_GEM, -dz_iGasTPC + 2.*CLHEP::cm - dz_GEM};
348 G4double z_GEM[] = { z_Ring[0] - dz_Ring - dz_GEM, z_Ring[0] - dz_Ring - 2. * dz_GEM - 0.28 * CLHEP::cm};
349 /*cout << "ring 1 " << z_Ring[1] / CLHEP::cm << " ring 0 " << z_Ring[0] / CLHEP::cm << " gem 1 " << z_GEM[0] / CLHEP::cm << " gem 2 "
350 << z_GEM[1] / CLHEP::cm << endl;*/
351
352 G4VSolid* s_GEM = new G4Box("s_GEM", dx_GEM, dy_GEM, dz_GEM);
353 G4LogicalVolume* l_GEM = new G4LogicalVolume(s_GEM, geometry::Materials::get("TPC_Kovar"), "l_GEM");
354 for (G4int i = 0; i < 2; i++) {
355 sprintf(Name, "p_GEM_%d", i);
356 new G4PVPlacement(0, G4ThreeVector(x_GEM, y_GEM, z_GEM[i]), l_GEM, Name, l_iGasTPC, false, 1);
357 }
358
359 //create GEM support holder
360 G4double dx_GEMSupport = dx_Ring;
361 G4double dy_GEMSupport = dy_Ring;
362 G4double dz_GEMSupport = dz_GEM;
363 G4VSolid* s_GEMSupport = new G4Box("s_GEMSupport1", dx_GEMSupport, dy_GEMSupport, dz_GEMSupport);
364
365 G4double iR_GEMSupportHoles = 0.*CLHEP::mm;
366 G4double oR_GEMSupportHoles = oR_Rod;
367 G4double h_GEMSupportHoles = dz_GEMSupport;
368 G4double sA_GEMSupportHoles = 0.*CLHEP::deg;
369 G4double spA_GEMSupportHoles = 360.*CLHEP::deg;
370 G4VSolid* s_GEMSupportHoles = new G4Tubs("s_GEMSupportHoles", iR_GEMSupportHoles, oR_GEMSupportHoles, h_GEMSupportHoles,
371 sA_GEMSupportHoles, spA_GEMSupportHoles);
372 s_GEMSupport = new G4SubtractionSolid("s_GEMSupport2", s_GEMSupport, s_GEM, 0, G4ThreeVector(0, 0, 0));
373 for (G4int i = 0; i < 4; i++) {
374 sprintf(Name, "s_GEMSupport_%d", i);
375 s_GEMSupport = new G4SubtractionSolid(Name, s_GEMSupport, s_GEMSupportHoles, 0, G4ThreeVector(x_Rod[i], y_Rod[i], 0));
376 }
377
378 G4LogicalVolume* l_GEMSupport = new G4LogicalVolume(s_GEMSupport, TPC_G10, "l_GEMSupport");
379 for (G4int i = 0; i < 2; i++) {
380 sprintf(Name, "p_GEMSupport_%d", i);
381 new G4PVPlacement(0, G4ThreeVector(x_GEM, y_GEM, z_GEM[i]), l_GEMSupport, Name, l_iGasTPC, false, 1);
382 }
383 //cout <<"gem 1 " << z_GEM[0] << " gem 2 " << z_GEM[1] << " ring 22 " << z_Ring[22] << " anode " << z_Ring[23] << " dz_GEM " << dz_GEM << " dz_Ring " << dz_Ring << endl;
384 //create sensitive volume
385 G4double dx_GasTPC = 2.95 / 2. * CLHEP::cm;
386 G4double dy_GasTPC = 2.95 / 2. * CLHEP::cm;
387 G4double dz_GasTPC = (z_Ring[10] - dz_Ring - z_GEM[0] - dz_GEM) / 2.; //13.5 * CLHEP::cm;
388 cout << " dz_GasTPC " << dz_GasTPC / CLHEP::cm << endl;
389 G4Box* s_GasTPC = new G4Box("s_GasTPC", dx_GasTPC, dy_GasTPC, dz_GasTPC);
390 G4LogicalVolume* l_GasTPC = new G4LogicalVolume(s_GasTPC, gasmix_4HeCO2, "l_GasTPC", 0, m_sensitive);
391
392 //Lets limit the Geant4 stepsize inside the volume
393 l_GasTPC->SetUserLimits(new G4UserLimits(stepSize));
394
395 G4double x_GasTPC = 0;
396 G4double y_GasTPC = 0;
397 G4double z_GasTPC = z_GEM[0] + dz_GEM + dz_GasTPC;
398
399 new G4PVPlacement(0, G4ThreeVector(x_GasTPC, y_GasTPC, z_GasTPC), l_GasTPC, "p_GasTPC", l_iGasTPC, false, detID);
400
401 B2INFO("Micro-TPC-Sensitive-Volume-" << detID << " placed at: (" << TPCpos.getX() + x_GasTPC << "," << TPCpos.getY() + y_GasTPC <<
402 "," << TPCpos.getZ() + z_GasTPC << ") mm");
403
404 //create pixel chip
405 G4double dx_PixelChip = dx_GasTPC;
406 G4double dy_PixelChip = dy_GasTPC;
407 G4double dz_PixelChip = 1. / 2.*CLHEP::mm;
408
409 G4double x_PixelChip = 0.*CLHEP::mm;
410 G4double y_PixelChip = 0.*CLHEP::mm;
411 G4double z_PixelChip = z_GEM[1] - 0.3 * CLHEP::cm;
412
413 G4Box* s_PixelChip = new G4Box("s_PixelChip", dx_PixelChip, dy_PixelChip, dz_PixelChip);
414 G4LogicalVolume* l_PixelChip = new G4LogicalVolume(s_PixelChip, geometry::Materials::get("G4_PLASTIC_SC_VINYLTOLUENE"),
415 "l_PixelChip");
416 new G4PVPlacement(0, G4ThreeVector(x_PixelChip, y_PixelChip, z_PixelChip), l_PixelChip, "p_PixelChip", l_iGasTPC, false, 1);
417
418 //create cu plate
419 G4double dx_CuPlate = dx_Ring;
420 G4double dy_CuPlate = dy_Ring;
421 G4double dz_CuPlate = dz_PixelChip;
422
423 G4VSolid* s_CuPlate = new G4Box("s_CuPlate", dx_CuPlate, dy_CuPlate, dz_CuPlate);
424 G4VSolid* s_HolesInCuPlate = new G4Tubs("HolesInCuPlate", iR_RingHoles, oR_RingHoles, dz_PixelChip, sA_RingHoles, spA_RingHoles);
425 for (G4int i = 0; i < 4; i++) {
426 sprintf(Name, "s_CuPlate_%d", i);
427 s_CuPlate = new G4SubtractionSolid(Name, s_CuPlate, s_HolesInCuPlate, 0, G4ThreeVector(x_Rod[i], y_Rod[i], 0));
428 }
429 s_CuPlate = new G4SubtractionSolid("s_CuPlate", s_CuPlate, s_PixelChip, 0, G4ThreeVector(0, 0, 0));
430
431
432 G4LogicalVolume* l_CuPlate = new G4LogicalVolume(s_CuPlate, TPC_metaCuScreen, "l_CuPlate");
433 new G4PVPlacement(0, G4ThreeVector(x_PixelChip, y_PixelChip, z_PixelChip), l_CuPlate, "p_CuPlate", l_iGasTPC, false, 1);
434
435 //create pixel board
436 G4double dx_PixelBoard = dx_Ring;
437 G4double dy_PixelBoard = dy_Ring;
438 G4double dz_PixelBoard = 2.*CLHEP::mm;
439
440 G4VSolid* s_PixelBoard = new G4Box("s_PixelBoard1", dx_PixelBoard, dy_PixelBoard, dz_PixelBoard);
441 G4VSolid* s_PixelBoardHoles = new G4Tubs("s_PixelBoardHoles", iR_RingHoles, oR_RingHoles, dz_PixelBoard, sA_RingHoles,
442 spA_RingHoles);
443 for (G4int i = 0; i < 4; i++) {
444 sprintf(Name, "s_PixelBoard_%d", i);
445 s_PixelBoard = new G4SubtractionSolid(Name, s_PixelBoard, s_PixelBoardHoles, 0, G4ThreeVector(x_Rod[i], y_Rod[i], 0));
446 }
447
448 G4double x_PixelBoard = 0.*CLHEP::mm;
449 G4double y_PixelBoard = 0.*CLHEP::mm;
450 G4double z_PixelBoard = z_PixelChip - dz_PixelBoard - dz_PixelChip;
451
452 G4LogicalVolume* l_PixelBoard = new G4LogicalVolume(s_PixelBoard, TPC_G10, "l_PixelBoard");
453
454 new G4PVPlacement(0, G4ThreeVector(x_PixelBoard, y_PixelBoard, z_PixelBoard), l_PixelBoard, "p_PixelBoard", l_iGasTPC, false, 1);
455 detID++;
456 }
457 }
458 } // microtpc namespace
460} // Belle2 namespace
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
Definition: Interface.h:299
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
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 ~MicrotpcCreator()
Destructor.
SensitiveDetector * m_sensitive
SensitiveDetector micro-tpc.
Sensitive Detector implementation of the MICROTPC detector.
GeometryTypes
Flag indiciating the type of geometry to be used.
geometry::CreatorFactory< MicrotpcCreator > MicrotpcFactory("MICROTPCCreator")
Creator creates the micro-tpc 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.