Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GammaRayTelDetectorConstruction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: GammaRayTelDetectorConstruction.cc 101905 2016-12-07 11:34:39Z gunter $
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // CERN Geneva Switzerland
31 //
32 //
33 // ------------ GammaRayTelDetectorConstruction ------
34 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
35 //
36 // ************************************************************
37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
39 
42 
43 #include "GammaRayTelTrackerSD.hh"
44 
47 
48 #include "G4PhysicalConstants.hh"
49 #include "G4SystemOfUnits.hh"
50 #include "G4Material.hh"
51 #include "G4Box.hh"
52 #include "G4LogicalVolume.hh"
53 #include "G4PVPlacement.hh"
54 #include "G4PVReplica.hh"
55 #include "G4UniformMagField.hh"
56 #include "G4FieldManager.hh"
58 #include "G4SDManager.hh"
59 #include "G4RunManager.hh"
61 #include "G4AutoDelete.hh"
62 #include "G4VisAttributes.hh"
63 #include "G4Colour.hh"
64 #include "G4UImanager.hh"
65 
66 
67 #include "G4RegionStore.hh"
68 
70  GammaRayTelDetectorConstruction::fMagFieldMessenger = 0;
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73 
75  :solidWorld(0),logicWorld(0),physiWorld(0),
76  solidPayload(0),logicPayload(0),physiPayload(0),
77  solidTKR(0),logicTKR(0),physiTKR(0),
78  solidCAL(0),logicCAL(0),physiCAL(0),
79  solidACT(0),logicACT(0),physiACT(0),
80  solidACL1(0),logicACL1(0),physiACL1(0),
81  solidACL2(0),logicACL2(0),physiACL2(0),
82  solidTKRDetectorX(0),logicTKRDetectorX(0),physiTKRDetectorX(0),
83  solidTKRDetectorY(0),logicTKRDetectorY(0),physiTKRDetectorY(0),
84  solidCALLayerX(0),logicCALLayerX(0),physiCALLayerX(0),
85  solidCALLayerY(0),logicCALLayerY(0),physiCALLayerY(0),
86  solidCALDetectorX(0),logicCALDetectorX(0),physiCALDetectorX(0),
87  solidCALDetectorY(0),logicCALDetectorY(0),physiCALDetectorY(0),
88  solidPlane(0),logicPlane(0),physiPlane(0),
89  solidConverter(0),logicConverter(0),physiConverter(0),
90  logicTKRStripX(0),logicTKRStripY(0)
91  // aTKRRegion(0), aCALRegion(0)
92 {
93  // default parameter values of the payload
94 
95  ConverterThickness = 300.*micrometer;
96  TKRSiliconThickness = 400.*micrometer;
97  TKRSiliconTileXY = 9.*cm;
98  TKRSiliconPitch = 200.*micrometer;
99  TKRLayerDistance = 3.*cm;
100  SiliconGuardRing = 1.5*mm;
101  TKRViewsDistance = 1.*mm;
102  NbOfTKRLayers = 15;
103  NbOfTKRTiles = 4;
104  CALBarThickness = 1.5*cm;
105  NbOfCALBars = 12;
106  NbOfCALLayers = 5;
107  ACDThickness = 1.*cm;
108  NbOfACDTopTiles = 1;
109  NbOfACDLateralTiles = 2;
110 
111  TilesSeparation = 100.*micrometer;
112  ACDTKRDistance = 5.*cm;
113  CALTKRDistance = 1.5*cm;
114 
115  //Initialize thread-local sensitive detectors
116  trackerSD.Put(0);
117  calorimeterSD.Put(0);
118  anticoincidenceSD.Put(0);
119 
120  ComputePayloadParameters();
121 
122  // create commands for interactive definition of the payload
123  detectorMessenger = new GammaRayTelDetectorMessenger(this);
124 
125 }
126 
127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
128 
130 { delete detectorMessenger;}
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
133 
135 {
136  DefineMaterials();
137  return ConstructPayload();
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141 
142 void GammaRayTelDetectorConstruction::DefineMaterials()
143 {
144 
145  G4String name, symbol;
146  G4double a, z, density;
147 
148  G4int ncomponents, natoms;
149  G4double fractionmass;
150  G4double temperature, pressure;
151 
152  //
153  // define Elements
154  //
155 
156  a = 1.01*g/mole;
157  G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
158 
159  a = 12.01*g/mole;
160  G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
161 
162  a = 14.006*g/mole;
163  G4Element* N = new G4Element(name="Nitrogen" ,symbol="N" , z= 7., a);
164 
165  a = 15.99*g/mole;
166  G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
167 
168  a = 26.98*g/mole;
169  G4Element* Alumin = new G4Element(name="Aluminum" ,symbol="Al" , z= 13., a);
170 
171  a = 28.09*g/mole;
172  G4Element* Silicon = new G4Element(name="Silicon", symbol="Si", z=14., a);
173 
174  a= 55.845*g/mole;
175  G4Element* Iron = new G4Element(name="Iron", symbol="Fe", z=26.,a);
176 
177  a = 126.904*g/mole;
178  G4Element* I = new G4Element(name="Iodine" ,symbol="I" , z= 53., a);
179 
180  a = 132.905*g/mole;
181  G4Element* Cs = new G4Element(name="Cesium" ,symbol="Cs" , z= 55., a);
182 
183  a = 207.19*g/mole;
184  G4Element* Lead = new G4Element(name="Lead", symbol="Pb", z=82., a);
185 
186  //
187  // define simple materials
188  //
189 
190  density = 19.3*g/cm3;
191  a = 183.84*g/mole;
192  G4Material* W = new G4Material(name="Tungsten", z=74., a, density);
193 
194 
195  //
196  // define a material from elements. case 1: chemical molecule
197  //
198 
199  density = 1.032*g/cm3;
200  G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
201  Sci->AddElement(C, natoms=9);
202  Sci->AddElement(H, natoms=10);
203 
204  density = 4.53*g/cm3;
205  G4Material* CsI = new G4Material(name="CesiumIodide", density, ncomponents=2);
206  CsI->AddElement(Cs, natoms=5);
207  CsI->AddElement(I, natoms=5);
208 
209  //
210  // define a material from elements. case 2: mixture by fractional mass
211  //
212 
213  density = 1.290*mg/cm3;
214  G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
215  Air->AddElement(N, fractionmass=0.7);
216  Air->AddElement(O, fractionmass=0.3);
217 
218  density = 2.700*g/cm3;
219  G4Material* Al = new G4Material(name="Aluminum", density, ncomponents=1);
220  Al->AddElement(Alumin, fractionmass=1.);
221 
222  density = 2.333*g/cm3;
223  G4Material* Si = new G4Material(name="Silicon", density, ncomponents=1);
224  Si->AddElement(Silicon, fractionmass=1.);
225 
226  density = 7.87*g/cm3;
227  G4Material* Fe = new G4Material(name="Iron", density, ncomponents=1);
228  Fe->AddElement(Iron, fractionmass=1.);
229 
230  density = 11.35*g/cm3;
231  G4Material* Pb = new G4Material(name="Lead", density, ncomponents=1);
232  Pb->AddElement(Lead, fractionmass=1.);
233 
234  //
235  // examples of vacuum
236  //
237 
238  density = universe_mean_density; //from PhysicalConstants.h
239  pressure = 3.e-18*pascal;
240  temperature = 2.73*kelvin;
241  G4Material* vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,kStateGas,temperature,pressure);
242 
243  density = 1.e-5*g/cm3;
244  pressure = 2.e-2*bar;
245  temperature = STP_Temperature; //from PhysicalConstants.h
246  G4Material* beam = new G4Material(name="Beam", density, ncomponents=1,
247  kStateGas,temperature,pressure);
248  beam->AddMaterial(Air, fractionmass=1.);
249 
251 
252  //default materials of the payload
253 
254  ConverterMaterial = W;
255  defaultMaterial = vacuum;
256  ACDMaterial = Sci;
257  CALMaterial = CsI;
258  TKRMaterial = Si;
259 
260 }
261 
262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
263 
264 G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
265 {
266  // complete the Payload parameters definition
267  ComputePayloadParameters();
268 
269  //
270  // World
271  //
272 
273  solidWorld = new G4Box("World",
274  WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
275 
276  logicWorld = new G4LogicalVolume(solidWorld,
277  defaultMaterial,
278  "World");
279 
280  physiWorld = new G4PVPlacement(0,G4ThreeVector(),"World",logicWorld,
281  0,false,0);
282 
283  //
284  // Payload
285  //
286 
287  /* solidPayload=0; logicPayload=0; physiPayload=0;
288  solidTKR=0;logicTKR=0;physiTKR=0;
289  solidCAL=0;logicCAL=0;physiCAL=0;
290  solidACT=0;logicACT=0;physiACT=0;
291  solidACL1=0;logicACL1=0;physiACL1=0;
292  solidACL2=0;logicACL2=0;physiACL2=0;
293  solidConverter=0;logicConverter=0;physiConverter=0;
294  solidTKRDetectorX=0;logicTKRDetectorX=0;
295  solidTKRDetectorY=0;logicTKRDetectorY=0;
296  physiTKRDetectorX=0;physiTKRDetectorY=0;
297  solidCALDetectorX=0;logicCALDetectorX=0;physiCALDetectorX=0;
298  solidCALDetectorY=0;logicCALDetectorY=0;physiCALDetectorY=0;
299  solidPlane=0;logicPlane=0;physiPlane=0;
300  aCALRegion=0; aTKRRegion=0;
301  */
302  //
303  // Payload
304  //
305 
306  solidPayload = new G4Box("Payload",
307  PayloadSizeXY/2,
308  PayloadSizeXY/2,
309  PayloadSizeZ/2);
310 
311  logicPayload = new G4LogicalVolume(solidPayload,
312  defaultMaterial,
313  "Payload");
314 
315  physiPayload = new G4PVPlacement(0,
316  G4ThreeVector(),
317  "Payload",
318  logicPayload,
319  physiWorld,
320  false,
321  0);
322  //
323  // Calorimeter (CAL)
324  //
325 
326  solidCAL = new G4Box("CAL",
327  CALSizeXY/2,CALSizeXY/2,CALSizeZ/2);
328 
329  logicCAL = new G4LogicalVolume(solidCAL,
330  defaultMaterial,
331  "CAL");
332  physiCAL = new G4PVPlacement(0,
333  G4ThreeVector(0,0,
334  -PayloadSizeZ/2+CALSizeZ/2),
335  "CAL",
336  logicCAL,
337  physiPayload,
338  false,
339  0);
340  //
341  // Tracker (TKR)
342  //
343 
344  solidTKR = new G4Box("TKR",
345  TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2);
346 
347  logicTKR = new G4LogicalVolume(solidTKR,
348  defaultMaterial,
349  "TKR");
350  physiTKR = new G4PVPlacement(0,
351  G4ThreeVector(0,0,
352  -PayloadSizeZ/2+CALSizeZ+
353  CALTKRDistance+TKRSizeZ/2),
354  "TKR",
355  logicTKR,
356  physiPayload,
357  false,
358  0);
359 
360 
361  //
362  // Anticoincidence Top (ACT)
363  //
364 
365  solidACT = new G4Box("ACT",
366  ACTSizeXY/2,ACTSizeXY/2,ACTSizeZ/2);
367 
368  logicACT = new G4LogicalVolume(solidACT,ACDMaterial,"ACT");
369 
370  physiACT = new G4PVPlacement(0,
371  G4ThreeVector(0,0,
372  -PayloadSizeZ/2+CALSizeZ+
373  CALTKRDistance+TKRSizeZ+
374  ACDTKRDistance+ACTSizeZ/2),
375  "ACT",
376  logicACT,
377  physiPayload,
378  false,
379  0);
380 
381  //
382  // Anticoincidence Lateral Side (ACL)
383  //
384 
385  solidACL1 = new G4Box("ACL1",
386  ACL1SizeX/2,ACL1SizeY/2,ACL1SizeZ/2);
387 
388  logicACL1 = new G4LogicalVolume(solidACL1,ACDMaterial,"ACL");
389 
390  physiACL1 = new G4PVPlacement(0,
391  G4ThreeVector(-PayloadSizeXY/2+ACL1SizeX/2,
392  -PayloadSizeXY/2+ACL1SizeY/2,
393  -PayloadSizeZ/2+ACL1SizeZ/2),
394  "ACL1",
395  logicACL1,
396  physiPayload,
397  false,
398  0);
399 
400  physiACL1 = new G4PVPlacement(0,
401  G4ThreeVector(PayloadSizeXY/2-ACL1SizeX/2,
402  PayloadSizeXY/2-ACL1SizeY/2,
403  -PayloadSizeZ/2+ACL1SizeZ/2),
404  "ACL1",
405  logicACL1,
406  physiPayload,
407  false,
408  1);
409 
410  solidACL2 = new G4Box("ACL2",
411  ACL2SizeX/2,ACL2SizeY/2,ACL2SizeZ/2);
412 
413  logicACL2 = new G4LogicalVolume(solidACL2,
414  ACDMaterial,
415  "ACL2");
416 
417 
418  physiACL2 = new G4PVPlacement(0,
419  G4ThreeVector(-PayloadSizeXY/2+ACL2SizeX/2,
420  PayloadSizeXY/2-ACL2SizeY/2,
421  -PayloadSizeZ/2+ACL2SizeZ/2),
422  "ACL2",
423  logicACL2,
424  physiPayload,
425  false,
426  0);
427 
428  physiACL2 = new G4PVPlacement(0,
429  G4ThreeVector(PayloadSizeXY/2-ACL2SizeX/2,
430  -PayloadSizeXY/2+ACL2SizeY/2,
431  -PayloadSizeZ/2+ACL2SizeZ/2),
432  "ACL2",
433  logicACL2,
434  physiPayload,
435  false,
436  1);
437 
438 
439  // Tracker Structure (Plane + Converter + TKRDetectorX + TKRDetectorY)
440 
441  solidPlane = new G4Box("Plane",
442  TKRSizeXY/2,TKRSizeXY/2,TKRSupportThickness/2);
443 
444  logicPlane = new G4LogicalVolume(solidPlane,
445  defaultMaterial,
446  "Plane");
447 
448  solidTKRDetectorY = new G4Box
449  ("TKRDetectorY",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
450 
451  logicTKRDetectorY = new G4LogicalVolume(solidTKRDetectorY,
452  TKRMaterial,
453  "TKRDetector Y");
454 
455 
456  solidTKRDetectorX = new G4Box
457  ("TKRDetectorX",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
458 
459  logicTKRDetectorX = new G4LogicalVolume(solidTKRDetectorX,
460  TKRMaterial,
461  "TKRDetector X");
462 
463 
464  solidConverter = new G4Box
465  ("Converter",TKRSizeXY/2,TKRSizeXY/2,ConverterThickness/2);
466 
467  logicConverter = new G4LogicalVolume(solidConverter,
468  ConverterMaterial,
469  "Converter");
470 
471  G4int i=0;
472 
473  for (i = 0; i < NbOfTKRLayers; i++)
474  {
475 
476  physiTKRDetectorY =
477  new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2
478  +TKRSiliconThickness/2
479  +(i)*TKRLayerDistance),
480  "TKRDetectorY",
481  logicTKRDetectorY,
482  physiTKR,
483  false,
484  i);
485 
486  physiTKRDetectorX =
487  new G4PVPlacement(0,G4ThreeVector(0.,0.,
488  -TKRSizeZ/2+
489  TKRSiliconThickness/2 +
490  TKRViewsDistance+
491  TKRSiliconThickness+
492  (i)*TKRLayerDistance),
493  "TKRDetectorX",
494  logicTKRDetectorX,
495  physiTKR,
496  false,
497  i);
498 
499 
500  physiConverter =
501  new G4PVPlacement(0,G4ThreeVector(0.,0.,
502  -TKRSizeZ/2+
503  2*TKRSiliconThickness +
504  TKRViewsDistance+
505  ConverterThickness/2+
506  (i)*TKRLayerDistance),
507  "Converter",
508  logicConverter,
509  physiTKR,
510  false,
511  i);
512 
513 
514 
515  physiPlane =
516  new G4PVPlacement(0,G4ThreeVector(0.,0.,
517  -TKRSizeZ/2+
518  2*TKRSiliconThickness +
519  TKRViewsDistance+
520  ConverterThickness+
521  TKRSupportThickness/2+
522  (i)*TKRLayerDistance),
523  "Plane",
524  logicPlane,
525  physiTKR,
526  false,
527  i);
528 
529  }
530 
531 
532 
533  G4VSolid * solidTKRActiveTileX = new
534  G4Box("Active Tile X", TKRActiveTileXY/2,
535  TKRActiveTileXY/2,TKRActiveTileZ/2);
536 
537 
538  G4VSolid * solidTKRActiveTileY = new
539  G4Box("Active Tile Y", TKRActiveTileXY/2,
540  TKRActiveTileXY/2,TKRActiveTileZ/2);
541 
542 
543  G4LogicalVolume* logicTKRActiveTileX =
544  new G4LogicalVolume(solidTKRActiveTileX, TKRMaterial,
545  "Active Tile X",0,0,0);
546 
547 
548  G4LogicalVolume* logicTKRActiveTileY =
549  new G4LogicalVolume(solidTKRActiveTileY, TKRMaterial,
550  "Active Tile Y",0,0,0);
551 
552 
553 
554 
555  G4int j=0;
556  G4int k=0;
557 
558  G4double x=0.;
559  G4double y=0.;
560  G4double z=0.;
561 
562  for (i=0;i< NbOfTKRTiles; i++)
563  {
564  for (j=0;j< NbOfTKRTiles; j++)
565  {
566  k = i*NbOfTKRTiles + j;
567 
568 
569  x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
570  TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+
571  TilesSeparation+TKRActiveTileXY);
572  y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
573  TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+TilesSeparation+
574  TKRActiveTileXY);
575  z = 0.;
576 
577  new G4PVPlacement(0,
578  G4ThreeVector(x,y,z),
579  logicTKRActiveTileY,
580  "Active Tile Y",
581  logicTKRDetectorY,
582  false,
583  k);
584 
585 
586  x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
587  TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+
588  TilesSeparation+TKRActiveTileXY);
589  y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
590  TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+
591  TilesSeparation+TKRActiveTileXY);
592  z = 0.;
593 
594  new G4PVPlacement(0,
595  G4ThreeVector(x,y,z),
596  logicTKRActiveTileX,
597  "Active Tile X",
598  logicTKRDetectorX,
599  false,
600  k);
601 
602  }
603  }
604 
605 
606  // STRIPS (not any more in the Readout Geometry)
607 
608  // Silicon Strips
609 
610  /*
611  G4double TKRXStripX=0.;
612  G4double TKRYStripY=0.;
613  G4double TKRYStripX=0.;
614  G4double TKRXStripY=0.;
615  */
616 
617  TKRXStripX = TKRYStripY = TKRSiliconPitch;
618  TKRYStripX = TKRXStripY = TKRActiveTileXY;
619  TKRZStrip = TKRSiliconThickness;
620 
621 
622  G4VSolid* solidTKRStripX = new G4Box("Strip X",
623  TKRXStripX/2,TKRYStripX/2,
624  TKRZStrip/2);
625 
626  logicTKRStripX =
627  new G4LogicalVolume(solidTKRStripX,TKRMaterial,"Strip X",0,0,0);
628 
629 
630  G4VSolid* solidTKRStripY = new G4Box("Strip Y",
631  TKRXStripY/2,TKRYStripY/2,
632  TKRZStrip/2);
633 
634 
635  logicTKRStripY =
636  new G4LogicalVolume(solidTKRStripY,TKRMaterial,"Strip Y",0,0,0);
637 
638 
639  for (i=0;i< NbOfTKRStrips; i++)
640  {
641  new G4PVPlacement(0,
642  G4ThreeVector(-TKRActiveTileXY/2 +TKRSiliconPitch/2 +
643  (i)*TKRSiliconPitch, 0., 0.),
644  logicTKRStripX,
645  "Strip X",
646  logicTKRActiveTileX,
647  false,
648  i);
649 
650 
651  new G4PVPlacement(0,
652  G4ThreeVector(0.,-TKRActiveTileXY/2
653  +TKRSiliconPitch/2 +
654  (i)*TKRSiliconPitch, 0.),
655  logicTKRStripY,
656  "Strip Y",
657  logicTKRActiveTileY,
658  false,
659  i);
660 
661 
662 
663 
664 
665  }
666 
667 
668 
669  // Calorimeter Structure (CALLayerX + CALLayerY)
670 
671 
672  solidCALLayerX = new G4Box("CALLayerX",
673  CALSizeXY/2,CALSizeXY/2,CALBarThickness/2);
674 
675  logicCALLayerX = new G4LogicalVolume(solidCALLayerX,
676  CALMaterial,
677  "CALLayerX");
678 
679  solidCALLayerY = new G4Box("CALLayerY",
680  CALSizeXY/2,CALSizeXY/2,CALBarThickness/2);
681 
682  logicCALLayerY = new G4LogicalVolume(solidCALLayerY,
683  CALMaterial,
684  "CALLayerY");
685 
686  for (i = 0; i < NbOfCALLayers; i++)
687  {
688 
689  physiCALLayerY =
690  new G4PVPlacement(0,G4ThreeVector(0,0,
691  -CALSizeZ/2+
692  CALBarThickness/2 +
693  (i)*2*CALBarThickness),
694  "CALLayerY",
695  logicCALLayerY,
696  physiCAL,
697  false,
698  i);
699 
700  physiCALLayerX =
701  new G4PVPlacement(0,G4ThreeVector(0,0,
702  -CALSizeZ/2+
703  CALBarThickness/2 +
704  CALBarThickness +
705  (i)*2*CALBarThickness),
706  "CALLayerX",
707  logicCALLayerX,
708  physiCAL,
709  false,
710  i);
711 
712  }
713 
714  // Calorimeter Structure (CALDetectorX + CALDetectorY)
715 
716  solidCALDetectorX = new G4Box("CALDetectorX",
717  CALBarX/2,CALBarY/2,CALBarThickness/2);
718 
719  logicCALDetectorX = new G4LogicalVolume(solidCALDetectorX,
720  CALMaterial,
721  "CALDetectorX");
722 
723  solidCALDetectorY = new G4Box("CALDetectorY",
724  CALBarY/2,CALBarX/2,CALBarThickness/2);
725 
726  logicCALDetectorY = new G4LogicalVolume(solidCALDetectorY,
727  CALMaterial,
728  "CALDetectorY");
729 
730  for (i = 0; i < NbOfCALBars; i++)
731  {
732 
733  physiCALDetectorY =
734  new G4PVPlacement(0,
735  G4ThreeVector(-CALSizeXY/2+ CALBarY/2 +
736  (i)*CALBarY, 0, 0),
737  logicCALDetectorY,
738  "CALDetectorY",
739  logicCALLayerY,
740  false,
741  i);
742 
743  physiCALDetectorX =
744  new G4PVPlacement(0,
745  G4ThreeVector(0,-CALSizeXY/2+ CALBarY/2 +
746  (i)*CALBarY, 0),
747  logicCALDetectorX,
748  "CALDetectorX",
749  logicCALLayerX,
750  false,
751  i);
752 
753  }
754 
755 
756  // Cuts by Regions
757 
758  /*
759  G4String regName[] = {"Calorimeter","Tracker"};
760  if (aCALRegion) delete aCALRegion;
761 
762  aCALRegion = new G4Region(regName[0]);
763  logicCAL->SetRegion(aCALRegion);
764  aCALRegion->AddRootLogicalVolume(logicCAL);
765 
766  if (aTKRRegion) delete aTKRRegion;
767 
768  aTKRRegion = new G4Region(regName[1]);
769  logicTKR->SetRegion(aTKRRegion);
770  aTKRRegion->AddRootLogicalVolume(logicTKR);
771  */
772 
773 
774  //
775  // Visualization attributes
776  //
777 
778  // Invisible Volume
782  logicTKRActiveTileX->SetVisAttributes(G4VisAttributes::GetInvisible());
783  logicTKRActiveTileY->SetVisAttributes(G4VisAttributes::GetInvisible());
791 
792  // Some visualization styles
793 
794  G4VisAttributes* VisAtt1= new G4VisAttributes(G4Colour(0.3,0.8,0.1));
795  VisAtt1->SetVisibility(true);
796  VisAtt1->SetForceSolid(TRUE);
797 
798  G4VisAttributes* VisAtt2= new G4VisAttributes(G4Colour(0.2,0.3,0.8));
799  VisAtt2->SetVisibility(true);
800  VisAtt2->SetForceSolid(FALSE);
801 
802  G4VisAttributes* VisAtt3= new G4VisAttributes(G4Colour(0.8,0.2,0.3));
803  VisAtt3->SetVisibility(true);
804  VisAtt3->SetForceWireframe(TRUE);
805 
806  // Visible Volumes
807 
808  logicCALDetectorX->SetVisAttributes(VisAtt1);
809  logicCALDetectorY->SetVisAttributes(VisAtt1);
810  logicTKRDetectorX->SetVisAttributes(VisAtt2);
811  logicTKRDetectorY->SetVisAttributes(VisAtt2);
812  logicACT->SetVisAttributes(VisAtt3);
813  logicACL1->SetVisAttributes(VisAtt3);
814  logicACL2->SetVisAttributes(VisAtt3);
815 
816 
817  //
818  //always return the physical World
819  //
821  return physiWorld;
822 }
823 
824 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
825 
827 {
828 
829  //
830  // Sensitive Detectors - Tracker
831  //
832  if(trackerSD.Get()==0)
833  {
834  GammaRayTelTrackerSD* SD = new GammaRayTelTrackerSD("TrackerSD");
835  trackerSD.Put(SD);
836  }
837 
839  //Flags the strips as sensitive .
840  if (logicTKRStripX)
841  SetSensitiveDetector(logicTKRStripX,trackerSD.Get()); // ActiveStripX
842  if (logicTKRStripY)
843  SetSensitiveDetector(logicTKRStripY,trackerSD.Get()); // ActiveStripY
844 
845 
846  //
847  // Sensitive Detectors: Calorimeter
848  //
849  if(calorimeterSD.Get()==0)
850  {
851  GammaRayTelCalorimeterSD* SD = new GammaRayTelCalorimeterSD("CalorimeterSD");
852  calorimeterSD.Put(SD);
853  }
854  G4SDManager::GetSDMpointer()->AddNewDetector(calorimeterSD.Get());
855  if (logicCALDetectorX)
856  SetSensitiveDetector(logicCALDetectorX,calorimeterSD.Get()); // BarX
857  if (logicCALDetectorY)
858  SetSensitiveDetector(logicCALDetectorY,calorimeterSD.Get()); // BarY
859 
860  //
861  // Sensitive Detectors: Anticoincidence
862  //
863 
864  if(anticoincidenceSD.Get()==0)
865  {
867  ("AnticoincidenceSD");
868  anticoincidenceSD.Put(SD);
869  }
870  G4SDManager::GetSDMpointer()->AddNewDetector(anticoincidenceSD.Get());
871  if (logicACT)
872  SetSensitiveDetector(logicACT,anticoincidenceSD.Get()); // ACD top
873  if (logicACL1)
874  SetSensitiveDetector(logicACL1,anticoincidenceSD.Get()); // ACD lateral side
875  if (logicACL2)
876  SetSensitiveDetector(logicACL2,anticoincidenceSD.Get()); // ACD lateral side
877 
878  // Create global magnetic field messenger.
879  // Uniform magnetic field is then created automatically if
880  // the field value is not zero.
881  G4ThreeVector fieldValue = G4ThreeVector();
882  fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
883  fMagFieldMessenger->SetVerboseLevel(1);
884 
885  // Register the field messenger for deleting
886  G4AutoDelete::Register(fMagFieldMessenger);
887 
888  return;
889 
890 }
891 
893 {
894  G4cout << "\n------------------------------------------------------------"
895  << "\n---> The Tracker is " << NbOfTKRLayers << " layers of: "
896  << ConverterThickness/mm << "mm of " << ConverterMaterial->GetName()
897  << "\n------------------------------------------------------------\n";
898 }
899 
900 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
901 
902 
903 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
904 
906 {
907  // search the material by its name
908  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
909  if (pttoMaterial)
910  {
911  ConverterMaterial = pttoMaterial;
912  logicConverter->SetMaterial(pttoMaterial);
914  }
915 }
916 
918 {
919  ConverterThickness = val;
920 }
921 
922 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
923 
925 {
926  TKRSiliconThickness = val;
927 }
928 
929 
931 {
932  TKRSiliconPitch = val;
933 }
934 
935 
937 {
938  TKRSiliconTileXY = val;
939 }
940 
941 
943 {
944  NbOfTKRLayers = val;
945 }
946 
947 
949 {
950  NbOfTKRTiles = val;
951 }
952 
954 {
955  TKRLayerDistance = val;
956 }
957 
959 {
960  TKRViewsDistance = val;
961 }
962 
963 
964 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
965 
967 {
968  NbOfCALLayers = val;
969 }
970 
972 {
973  NbOfCALBars = val;
974 }
975 
977 {
978  CALBarThickness = val;
979 }
980 
981 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
982 
984 {
985  ACDThickness = val;
986 }
987 
988 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
989 
991 {
992  // Just invoke manually the MT-safe command
993  // /globalField/setValue
994  // instantiated by the GlobalFieldMessenger
995  std::stringstream sss;
996  sss << "/globalField/setValue 0 0 " << fieldValue/tesla << " tesla";
997 
998  G4String command = sss.str();
999  G4cout << "Going to execute: " << command << G4endl;
1000 
1001  G4UImanager* UImanager = G4UImanager::GetUIpointer();
1002  UImanager->ApplyCommand(command);
1003 
1004 }
1005 
1006 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1007 
1009 {
1010  // delete payloadSD;
1011  G4RunManager::GetRunManager()->DefineWorldVolume(ConstructPayload());
1014 
1016 
1017 }
1018 
1019 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1020 
1021 
1022 
1023 
1024 
1025 
1026 
1027 
1028 
1029 
1030 
1031 
1032 
1033 
1034 
1035 
1036 
static constexpr double tesla
Definition: G4SIunits.hh:268
void SetVerboseLevel(G4int verboseLevel)
const XML_Char * name
Definition: expat.h:151
static constexpr double mm
Definition: G4SIunits.hh:115
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=0)
static constexpr double mg
Definition: G4SIunits.hh:184
CLHEP::Hep3Vector G4ThreeVector
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:467
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:602
int universe_mean_density
Definition: hepunit.py:307
Definition: G4Box.hh:64
const G4String & GetName() const
Definition: G4Material.hh:178
value_type & Get() const
Definition: G4Cache.hh:282
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
tuple x
Definition: test.py:50
double C(double temp)
float STP_Temperature
Definition: hepunit.py:302
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
void SetForceSolid(G4bool=true)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
static G4RegionStore * GetInstance()
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
void Register(T *inst)
Definition: G4AutoDelete.hh:65
G4GLOB_DLL std::ostream G4cout
void PhysicsHasBeenModified()
void SetVisibility(G4bool=true)
static constexpr double cm
Definition: G4SIunits.hh:119
#define FALSE
Definition: globals.hh:52
#define pascal
#define TRUE
Definition: globals.hh:55
static constexpr double kelvin
Definition: G4SIunits.hh:281
static constexpr double cm3
Definition: G4SIunits.hh:121
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
static const char sss[MAX_N_PAR+2]
Definition: Evaluator.cc:64
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
tuple z
Definition: test.py:28
#define G4endl
Definition: G4ios.hh:61
**D E S C R I P T I O N
Definition: HEPEvtcom.cc:77
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:362
static constexpr double bar
Definition: G4SIunits.hh:236
double G4double
Definition: G4Types.hh:76
void SetMaterial(G4Material *pMaterial)
void Put(const value_type &val) const
Definition: G4Cache.hh:286
static constexpr double micrometer
Definition: G4SIunits.hh:100
static constexpr double mole
Definition: G4SIunits.hh:286
static const G4VisAttributes & GetInvisible()
void SetForceWireframe(G4bool=true)
void SetVisAttributes(const G4VisAttributes *pVA)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447