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