]>
Commit | Line | Data |
---|---|---|
21281598 | 1 | // $Id$ |
2 | // Flugg tag $Name$ | |
3 | ||
4 | // | |
5 | // Example with Sphere and Tub layers for testing Magnetic Field in FLUGG | |
6 | // Sara Vanini, 11/02/00. Not replicated volumes! | |
7 | // | |
8 | ||
9 | ||
10 | #include "MyDetectorConstruction.hh" | |
11 | #include "G4Material.hh" | |
12 | #include "G4Tubs.hh" | |
13 | #include "G4Box.hh" | |
14 | #include "G4Sphere.hh" | |
15 | #include "G4LogicalVolume.hh" | |
16 | #include "G4PVPlacement.hh" | |
17 | #include "G4PVReplica.hh" | |
18 | #include "G4UniformMagField.hh" | |
19 | #include "G4FieldManager.hh" | |
20 | #include "G4VisAttributes.hh" | |
21 | #include "G4Colour.hh" | |
22 | #include "G4ios.hh" | |
23 | #include "G4IntersectionSolid.hh" | |
24 | ||
25 | ||
26 | MyDetectorConstruction::MyDetectorConstruction() | |
27 | :solidWorld(NULL),logicWorld(NULL),physiWorld(NULL), | |
28 | solidDet(NULL),logicDet(NULL),physiDet(NULL), | |
29 | solidLayer(NULL),logicLayer(NULL),physiLayer1(NULL), | |
30 | physiLayer2(NULL),physiLayer3(NULL),physiLayer4(NULL), | |
31 | physiLayer5(NULL),physiLayer6(NULL), | |
32 | solidTub(NULL),logicTub(NULL),physiTub(NULL), | |
33 | solidSphere(NULL),logicSphere(NULL),physiSphere(NULL), | |
34 | TubMaterial(NULL),SphereMaterial(NULL),defaultMaterial(NULL), | |
35 | magField(NULL) | |
36 | { | |
37 | // default parameter values of the calorimeter | |
38 | WorldSize = 200.*cm; | |
39 | TubRad = 3.*mm; | |
40 | SphereRad = 5.*mm; | |
41 | NbOfLayers = 6; | |
42 | DetSizeX = 5.1*cm; | |
43 | DetSizeZ = 8.*cm; | |
44 | NbOfTubs = 13; | |
45 | NbOfSpheres = 40; | |
46 | } | |
47 | ||
48 | ||
49 | ||
50 | MyDetectorConstruction::~MyDetectorConstruction() | |
51 | {} | |
52 | ||
53 | ||
54 | ||
55 | G4VPhysicalVolume* MyDetectorConstruction::Construct() | |
56 | { | |
57 | DefineMaterials(); | |
58 | return ConstructDetector(); | |
59 | } | |
60 | ||
61 | ||
62 | ||
63 | void MyDetectorConstruction::DefineMaterials() | |
64 | { | |
65 | //This function illustrates the possible ways to define materials | |
66 | ||
67 | G4String name, symbol; //a=mass of a mole; | |
68 | G4double a, z, density; //z=mean number of protons; | |
69 | G4int iz, n; //iz=number of protons in an isotope; | |
70 | // n=number of nucleons in an isotope; | |
71 | ||
72 | G4int ncomponents, natoms; | |
73 | G4double abundance, fractionmass; | |
74 | G4double temperature, pressure; | |
75 | ||
76 | // | |
77 | // define Elements | |
78 | // | |
79 | ||
80 | a = 1.01*g/mole; | |
81 | G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); | |
82 | ||
83 | a = 12.01*g/mole; | |
84 | G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a); | |
85 | ||
86 | a = 14.01*g/mole; | |
87 | G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); | |
88 | ||
89 | a = 16.00*g/mole; | |
90 | G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); | |
91 | ||
92 | a = 28.09*g/mole; | |
93 | G4Element* Si = new G4Element(name="Silicon",symbol="Si" , z= 14., a); | |
94 | ||
95 | a = 55.85*g/mole; | |
96 | G4Element* Fe = new G4Element(name="Iron" ,symbol="Fe", z=26., a); | |
97 | ||
98 | // | |
99 | // define an Element from isotopes, by relative abundance | |
100 | // | |
101 | ||
102 | G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole); | |
103 | G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole); | |
104 | ||
105 | G4Element* U = new G4Element(name="enriched Uranium", symbol="U", ncomponents=2); | |
106 | U->AddIsotope(U5, abundance= 90.*perCent); | |
107 | U->AddIsotope(U8, abundance= 10.*perCent); | |
108 | ||
109 | // | |
110 | // define simple materials | |
111 | // | |
112 | ||
113 | density = 2.700*g/cm3; | |
114 | a = 26.98*g/mole; | |
115 | G4Material* Al = new G4Material(name="Aluminium", z=13., a, density); | |
116 | ||
117 | density = 1.390*g/cm3; | |
118 | a = 39.95*g/mole; | |
119 | G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density); | |
120 | ||
121 | density = 8.960*g/cm3; | |
122 | a = 63.55*g/mole; | |
123 | G4Material* Cu = new G4Material(name="Copper" , z=29., a, density); | |
124 | ||
125 | density = 11.35*g/cm3; | |
126 | a = 207.19*g/mole; | |
127 | G4Material* Pb = new G4Material(name="Lead" , z=82., a, density); | |
128 | ||
129 | // | |
130 | // define a material from elements. case 1: chemical molecule | |
131 | // | |
132 | ||
133 | density = 1.000*g/cm3; | |
134 | G4Material* H2O = new G4Material(name="Water", density, ncomponents=2); | |
135 | H2O->AddElement(H, natoms=2); | |
136 | H2O->AddElement(O, natoms=1); | |
137 | ||
138 | density = 1.032*g/cm3; | |
139 | G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2); | |
140 | Sci->AddElement(C, natoms=9); | |
141 | Sci->AddElement(H, natoms=10); | |
142 | ||
143 | density = 2.200*g/cm3; | |
144 | G4Material* SiO2 = new G4Material(name="quartz", density, ncomponents=2); | |
145 | SiO2->AddElement(Si, natoms=1); | |
146 | SiO2->AddElement(O , natoms=2); | |
147 | ||
148 | // | |
149 | // define a material from elements. case 2: mixture by fractional mass | |
150 | // | |
151 | ||
152 | density = 1.290*mg/cm3; | |
153 | G4Material* Air = new G4Material(name="Air" , density, ncomponents=2); | |
154 | Air->AddElement(N, fractionmass=0.7); | |
155 | Air->AddElement(O, fractionmass=0.3); | |
156 | ||
157 | // | |
158 | // define a material from elements and/or others materials (mixture of mixtures) | |
159 | // | |
160 | ||
161 | density = 0.200*g/cm3; | |
162 | G4Material* Aerog = new G4Material(name="Aerogel", density, ncomponents=3); | |
163 | Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent); | |
164 | Aerog->AddMaterial(H2O , fractionmass=37.4*perCent); | |
165 | Aerog->AddElement (C , fractionmass= 0.1*perCent); | |
166 | ||
167 | // | |
168 | // examples of gas in non STP conditions | |
169 | // | |
170 | ||
171 | density = 27.*mg/cm3; | |
172 | pressure = 50.*atmosphere; | |
173 | temperature = 325.*kelvin; | |
174 | G4Material* CO2 = new G4Material(name="CarbonicGas", density, ncomponents=2, | |
175 | kStateGas,temperature,pressure); | |
176 | CO2->AddElement(C, natoms=1); | |
177 | CO2->AddElement(O, natoms=2); | |
178 | ||
179 | density = 0.3*mg/cm3; | |
180 | pressure = 2.*atmosphere; | |
181 | temperature = 500.*kelvin; | |
182 | G4Material* steam = new G4Material(name="WaterSteam", density, ncomponents=1, | |
183 | kStateGas,temperature,pressure); | |
184 | steam->AddMaterial(H2O, fractionmass=1.); | |
185 | ||
186 | // | |
187 | // examples of vacuum | |
188 | // | |
189 | ||
190 | density = universe_mean_density; //from PhysicalConstants.h | |
191 | pressure = 3.e-18*pascal; | |
192 | temperature = 2.73*kelvin; | |
193 | new G4Material(name="Galactic", z=1., a=1.01*g/mole, density, | |
194 | kStateGas,temperature,pressure); | |
195 | ||
196 | density = 1.e-5*g/cm3; | |
197 | pressure = 2.e-2*bar; | |
198 | temperature = STP_Temperature; //from PhysicalConstants.h | |
199 | G4Material* beam = new G4Material(name="Beam", density, ncomponents=1, | |
200 | kStateGas,temperature,pressure); | |
201 | beam->AddMaterial(Air, fractionmass=1.); | |
202 | ||
203 | //G4cout << *(G4Material::GetMaterialTable()) << endl; | |
204 | ||
205 | //default materials of the calorimeter | |
206 | TubMaterial = Al; | |
207 | SphereMaterial = Sci; | |
208 | LayerMaterial = Pb; | |
209 | defaultMaterial = Air; | |
210 | } | |
211 | ||
212 | ||
213 | ||
214 | G4VPhysicalVolume* MyDetectorConstruction::ConstructDetector() | |
215 | { | |
216 | // complete the Detector parameters definition | |
217 | ComputeDetectorParameters(); | |
218 | ||
219 | // | |
220 | // World | |
221 | // | |
222 | solidWorld = new G4Box("World", //its name | |
223 | WorldSize/2,WorldSize/2,WorldSize/2); //its size | |
224 | ||
225 | logicWorld = new G4LogicalVolume(solidWorld, //its solid | |
226 | defaultMaterial, //its material | |
227 | "World"); //its name | |
228 | ||
229 | physiWorld = new G4PVPlacement(0, //no rotation | |
230 | G4ThreeVector(), //at (0,0,0) | |
231 | "World", //its name | |
232 | logicWorld, //its logical volume | |
233 | NULL, //its mother volume | |
234 | false, //no boolean operation | |
235 | 0); //copy number | |
236 | ||
237 | // | |
238 | // Detector | |
239 | // | |
240 | solidDet=NULL; logicDet=NULL; physiDet=NULL; | |
241 | solidLayer=NULL; logicLayer=NULL; physiLayer1=NULL; | |
242 | physiLayer2=NULL; physiLayer3=NULL; physiLayer4=NULL; | |
243 | physiLayer5=NULL; physiLayer6=NULL; | |
244 | solidTubLayer=NULL; logicTubLayer=NULL; physiTubLayer=NULL; | |
245 | ||
246 | solidDet = new G4Box("Detector", //its name | |
247 | DetSizeX/2,DetSizeY/2,DetSizeZ/2);//size | |
248 | ||
249 | logicDet = new G4LogicalVolume(solidDet, //its solid | |
250 | defaultMaterial, //its material | |
251 | "Detector"); //its name | |
252 | ||
253 | physiDet = new G4PVPlacement(0, //no rotation | |
254 | G4ThreeVector(2.55*cm,-0.3*cm,4.0*cm), | |
255 | "Detector", //its name | |
256 | logicDet, //its logical volume | |
257 | physiWorld, //its mother volume | |
258 | false, //no boolean operation | |
259 | 0); //copy number | |
260 | // | |
261 | // Layer | |
262 | // | |
263 | solidLayer = new G4Box("Layer", //its name | |
264 | DetSizeX/2,LayerThickness/2,DetSizeZ/2); //size | |
265 | ||
266 | logicLayer = new G4LogicalVolume(solidLayer, //its solid | |
267 | LayerMaterial, //its material | |
268 | "Layer"); //its name | |
269 | /* | |
270 | if (NbOfLayers > 1) | |
271 | physiLayer = new G4PVReplica("Layer", //its name | |
272 | logicLayer, //its logical volume | |
273 | physiDet, //its mother | |
274 | kYAxis, //axis of replication | |
275 | NbOfLayers, //number of replica | |
276 | LayerThickness); //witdth of replica | |
277 | else | |
278 | physiLayer = new G4PVPlacement(0, //no rotation | |
279 | G4ThreeVector(), //at (0,0,0) | |
280 | "Layer", //its name | |
281 | logicLayer, //its logical volume | |
282 | physiDet, //its mother volume | |
283 | false, //no boolean operation | |
284 | 0); //copy number | |
285 | */ | |
286 | ||
287 | physiLayer1 = new G4PVPlacement(0, //no rotation | |
288 | G4ThreeVector(0, | |
289 | -DetSizeY/2+LayerThickness/2,0), | |
290 | "Layer 1", //its name | |
291 | logicLayer, //its logical volume | |
292 | physiDet, //its mother volume | |
293 | false, //no boolean operation | |
294 | 0); //copy number | |
295 | ||
296 | physiLayer2 = new G4PVPlacement(0, //no rotation | |
297 | G4ThreeVector(0, | |
298 | -DetSizeY/2+3*LayerThickness/2,0), | |
299 | "Layer 2", //its name | |
300 | logicLayer, //its logical volume | |
301 | physiDet, //its mother volume | |
302 | false, //no boolean operation | |
303 | 0); //copy number | |
304 | ||
305 | physiLayer3 = new G4PVPlacement(0, //no rotation | |
306 | G4ThreeVector(0, | |
307 | -LayerThickness/2,0), | |
308 | "Layer 3", //its name | |
309 | logicLayer, //its logical volume | |
310 | physiDet, //its mother volume | |
311 | false, //no boolean operation | |
312 | 0); //copy number | |
313 | ||
314 | physiLayer4 = new G4PVPlacement(0, //no rotation | |
315 | G4ThreeVector(0, | |
316 | +LayerThickness/2,0), | |
317 | "Layer 4", //its name | |
318 | logicLayer, //its logical volume | |
319 | physiDet, //its mother volume | |
320 | false, //no boolean operation | |
321 | 0); //copy number | |
322 | ||
323 | physiLayer5 = new G4PVPlacement(0, //no rotation | |
324 | G4ThreeVector(0, | |
325 | +3*LayerThickness/2,0), | |
326 | "Layer 5", //its name | |
327 | logicLayer, //its logical volume | |
328 | physiDet, //its mother volume | |
329 | false, //no boolean operation | |
330 | 0); //copy number | |
331 | ||
332 | physiLayer6 = new G4PVPlacement(0, //no rotation | |
333 | G4ThreeVector(0, | |
334 | +5*LayerThickness/2,0), | |
335 | "Layer 6", //its name | |
336 | logicLayer, //its logical volume | |
337 | physiDet, //its mother volume | |
338 | false, //no boolean operation | |
339 | 0); //copy number | |
340 | ||
341 | ||
342 | ||
343 | ||
344 | ||
345 | ||
346 | /* | |
347 | // | |
348 | // Tub-Layer | |
349 | // | |
350 | solidTubLayer = new G4Box("Tub-Layer", //its name | |
351 | TubRad*NbOfTubs,TubRad,DetSizeX/2); //size | |
352 | ||
353 | logicTubLayer = new G4LogicalVolume(solidTubLayer, //its solid | |
354 | LayerMaterial, //its material | |
355 | "Tub Layer"); //its name | |
356 | ||
357 | G4RotationMatrix * rm = new G4RotationMatrix(); | |
358 | G4double phi = 90*deg; | |
359 | rm->rotateY(phi); | |
360 | ||
361 | physiTubLayer = new G4PVPlacement(rm, //rotation | |
362 | G4ThreeVector(0,SphereRad,-0.1*cm), | |
363 | logicTubLayer, //its logical volume | |
364 | "Tub Layer", //its name | |
365 | logicLayer, //its mother volume | |
366 | false, //no boolean operation | |
367 | 0); //copy number | |
368 | */ | |
369 | // | |
370 | // Tubs | |
371 | // | |
372 | solidTub=NULL; logicTub=NULL; physiTub=NULL;solidBoxIntersTub=NULL; | |
373 | solidTubSeg=NULL; logicTubSeg=NULL; physiTubSeg=NULL; | |
374 | ||
375 | if (TubRad > 0.) | |
376 | { solidTub = new G4Tubs("Tub", //its name | |
377 | 0, | |
378 | TubRad, | |
379 | DetSizeX/2, | |
380 | 0.*deg, | |
381 | 360.*deg); | |
382 | ||
383 | logicTub = new G4LogicalVolume(solidTub, //its solid | |
384 | TubMaterial, //its material | |
385 | "Tub"); //its name | |
386 | ||
387 | G4RotationMatrix * rm = new G4RotationMatrix(); | |
388 | G4double phi = 90*deg; | |
389 | rm->rotateY(phi); | |
390 | ||
391 | for(int tubCopy=0; tubCopy<NbOfTubs; tubCopy++) | |
392 | { | |
393 | physiTub = new G4PVPlacement(rm, //rotation | |
394 | G4ThreeVector(0,SphereRad, | |
395 | -TubRad*NbOfTubs+TubRad*(1+2*tubCopy)-0.1*cm), | |
396 | logicTub, //its logical volume | |
397 | "Tub", //its name | |
398 | logicLayer, //its mother volume | |
399 | false, //no boolean operation | |
400 | tubCopy); //copy number | |
401 | ||
402 | } | |
403 | ||
404 | ||
405 | /* | |
406 | physiTub = new G4PVReplica("Tub", //its name | |
407 | logicTub, //its logical volume | |
408 | physiTubLayer, //its mother | |
409 | kXAxis, //axis of replication | |
410 | NbOfTubs, //number of replica | |
411 | 2*TubRad); //witdth of replica | |
412 | */ | |
413 | ||
414 | //Tub segments | |
415 | solidBoxIntersTub = new G4Box("Tub segment", //its name | |
416 | TubRad, | |
417 | TubRad, | |
418 | DetSizeX/2); | |
419 | ||
420 | solidTubSeg = new G4IntersectionSolid("Tub segment", | |
421 | solidTub, | |
422 | solidBoxIntersTub, | |
423 | 0, | |
424 | G4ThreeVector(-0.4*cm,0,0)); | |
425 | ||
426 | logicTubSeg = new G4LogicalVolume(solidTubSeg, //its solid | |
427 | TubMaterial, //its material | |
428 | "Tub segment"); //its name | |
429 | ||
430 | physiTubSeg = new G4PVPlacement(rm, //rotation | |
431 | G4ThreeVector(0,SphereRad,4.1*cm), | |
432 | logicTubSeg, //its logical volume | |
433 | "Tub segment", //its name | |
434 | logicLayer, //its mother volume | |
435 | false, //no boolean operation | |
436 | 0); //copy number | |
437 | ||
438 | } | |
439 | ||
440 | // | |
441 | // Spheres | |
442 | // | |
443 | solidSphere=NULL; logicSphere=NULL; physiSphere=NULL; | |
444 | ||
445 | if (SphereRad > 0.) | |
446 | { solidSphere = new G4Sphere("Sphere", | |
447 | 0*cm,SphereRad, | |
448 | 0,360*deg, | |
449 | 0,180*deg); | |
450 | ||
451 | logicSphere = new G4LogicalVolume(solidSphere, | |
452 | SphereMaterial, | |
453 | "Sphere"); | |
454 | ||
455 | G4double serie, element, Xposition, Yposition, Zposition; | |
456 | for(int copyNo=0;copyNo<40;copyNo++) | |
457 | { | |
458 | serie = int(copyNo/9); | |
459 | element = copyNo - serie * 9 + 1; | |
460 | Yposition = -TubRad; | |
461 | ||
462 | if (element<5) | |
463 | { | |
464 | Xposition = -2.55*cm + 2*SphereRad * element; | |
465 | Zposition = -4.0*cm + SphereRad + sqrt(3)*SphereRad*2*serie; | |
466 | } | |
467 | else | |
468 | { | |
469 | Xposition = -2.55*cm + SphereRad + (2*SphereRad)*(element-5); | |
470 | Zposition = -4.0*cm + SphereRad + sqrt(3)*SphereRad*(2*serie+1); | |
471 | } | |
472 | ||
473 | physiSphere = new G4PVPlacement(0, //rotation | |
474 | G4ThreeVector(Xposition,Yposition,Zposition), | |
475 | logicSphere, //its logical volume | |
476 | "Sphere", //its name | |
477 | logicLayer, //its mother volume | |
478 | false, //no boolean operation | |
479 | copyNo); //copy number | |
480 | ||
481 | } | |
482 | ||
483 | //Sphere segments | |
484 | solidBoxIntersSph = new G4Box("Sphere segment solid", //its name | |
485 | SphereRad, | |
486 | SphereRad, | |
487 | SphereRad); | |
488 | ||
489 | ||
490 | solidSphSeg1 = new G4IntersectionSolid("Sphere segment 1", | |
491 | solidSphere, | |
492 | solidBoxIntersSph, | |
493 | 0, | |
494 | G4ThreeVector(SphereRad,0,0)); | |
495 | ||
496 | logicSphSeg1 = new G4LogicalVolume(solidSphSeg1, | |
497 | SphereMaterial, | |
498 | "Sphere segment 1"); | |
499 | ||
500 | solidSphSeg2 = new G4IntersectionSolid("Sphere segment 2", | |
501 | solidSphere, | |
502 | solidBoxIntersSph, | |
503 | 0, | |
504 | G4ThreeVector(-0.4*cm,0,0)); | |
505 | ||
506 | logicSphSeg2 = new G4LogicalVolume(solidSphSeg2, | |
507 | SphereMaterial, | |
508 | "Sphere segment 2"); | |
509 | ||
510 | solidSphSeg3 = new G4IntersectionSolid("Sphere segment 3", | |
511 | solidSphere, | |
512 | solidBoxIntersSph, | |
513 | 0, | |
514 | G4ThreeVector(-0.9*cm,0,0)); | |
515 | ||
516 | logicSphSeg3 = new G4LogicalVolume(solidSphSeg3, | |
517 | SphereMaterial, | |
518 | "Sphere segment 3"); | |
519 | ||
520 | solidSphSeg4 = new G4IntersectionSolid("Sphere segment 4", | |
521 | solidSphere, | |
522 | solidBoxIntersSph, | |
523 | 0, | |
524 | G4ThreeVector(0,0, | |
525 | 8.0*cm-(9*sqrt(3)+2)*SphereRad)); | |
526 | ||
527 | logicSphSeg4 = new G4LogicalVolume(solidSphSeg4, | |
528 | SphereMaterial, | |
529 | "Sphere segment 4"); | |
530 | ||
531 | ||
532 | for(int s1=0;s1<5;s1++) | |
533 | { | |
534 | physiSphSeg1 = new G4PVPlacement(0, //no rotation | |
535 | G4ThreeVector(-DetSizeX/2,-TubRad, | |
536 | -4.0*cm+SphereRad+sqrt(3)*SphereRad*2*s1), | |
537 | logicSphSeg1, //its logical volume | |
538 | "Sphere segments 1", //its name | |
539 | logicLayer, //its mother volume | |
540 | false, //no boolean operation | |
541 | s1); //copy number | |
542 | ||
543 | physiSphSeg2 = new G4PVPlacement(0, //no rotation | |
544 | G4ThreeVector(2.45*cm,-TubRad, | |
545 | -4.0*cm+SphereRad+sqrt(3)*SphereRad*2*s1), | |
546 | logicSphSeg2, //its logical volume | |
547 | "Sphere segments 2", //its name | |
548 | logicLayer, //its mother volume | |
549 | false, //no boolean operation | |
550 | s1); //copy number | |
551 | ||
552 | physiSphSeg4 = new G4PVPlacement(0, //no rotation | |
553 | G4ThreeVector( | |
554 | -2.55*cm+SphereRad+2*SphereRad*s1, | |
555 | -TubRad, | |
556 | -4.0*cm+SphereRad+sqrt(3)*SphereRad*9), | |
557 | logicSphSeg4, //its logical volume | |
558 | "Sphere segments 4", //its name | |
559 | logicLayer, //its mother volume | |
560 | false, //no boolean operation | |
561 | s1); //copy number | |
562 | } | |
563 | ||
564 | for(int s2=0;s2<4;s2++) | |
565 | { | |
566 | physiSphSeg3 = new G4PVPlacement(0, //no rotation | |
567 | G4ThreeVector(2.95*cm, | |
568 | -TubRad, | |
569 | -4.0*cm+SphereRad+sqrt(3)*SphereRad*(2*s2+1)), | |
570 | logicSphSeg3, //its logical volume | |
571 | "Sphere segments 3", //its name | |
572 | logicLayer, //its mother volume | |
573 | false, //no boolean operation | |
574 | s2); //copy number | |
575 | } | |
576 | } | |
577 | ||
578 | ||
579 | // | |
580 | // Visualization attributes | |
581 | // | |
582 | logicWorld->SetVisAttributes (G4VisAttributes::Invisible); | |
583 | G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); | |
584 | simpleBoxVisAtt->SetVisibility(true); | |
585 | logicDet->SetVisAttributes(simpleBoxVisAtt); | |
586 | ||
587 | // | |
588 | //always return the physical World | |
589 | // | |
590 | ||
591 | return physiWorld; | |
592 | } | |
593 | ||
594 | ||
595 | ||
596 | /* | |
597 | void MyDetectorConstruction::SetMagField(G4double fieldValue) | |
598 | { | |
599 | //apply a global uniform magnetic field along Z axis | |
600 | FGeometryInit * ptrGeoInit = FGeometryInit::GetInstance(); | |
601 | G4FieldManager* fieldMgr = ptrGeoInit->getFieldManager(); | |
602 | ||
603 | if(magField) delete magField; //delete the existing magn field | |
604 | ||
605 | if(fieldValue!=0.) // create a new one if non nul | |
606 | { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue)); | |
607 | fieldMgr->SetDetectorField(magField); | |
608 | fieldMgr->CreateChordFinder(magField); | |
609 | } else { | |
610 | magField = NULL; | |
611 | fieldMgr->SetDetectorField(magField); | |
612 | } | |
613 | } | |
614 | ||
615 | */ |