Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.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 // ********************************************************************
27 
28 #include "DetectorConstruction.hh"
29 #include "Materials.hh"
30 #include "G4Material.hh"
31 #include "G4Tubs.hh"
32 #include "G4Box.hh"
33 #include "G4LogicalVolume.hh"
34 #include "G4PVPlacement.hh"
35 #include "G4VisAttributes.hh"
36 #include "G4SystemOfUnits.hh"
37 
38 // constants (detector parameters)
39 static const G4double DXYZ_AREA= 32.*cm;
40 static const G4double DW= 10.*cm;
41 
42 // --------------------------------------------------------------------------
44 {
45 }
46 
47 // --------------------------------------------------------------------------
49 {
50 }
51 
52 // --------------------------------------------------------------------------
54 {
55  // material definition
56  Materials* materialConstruction = new Materials;
57  materialConstruction-> Construct();
58 
59  G4Material* mate;
60  G4VisAttributes* va;
61 
62  // world volume
63  G4Box* areaSolid = new G4Box("AREA",
64  DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
65 
66  G4Material* vacuum = G4Material::GetMaterial("Vacuum");
67  G4LogicalVolume* areaLV = new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
68  G4PVPlacement* area = new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
69  areaLV, 0, false, 0);
70  // vis. attributes
71  va = new G4VisAttributes(G4Color(1.,1.,1.));
72  va-> SetVisibility(false);
73  areaLV-> SetVisAttributes(va);
74 
75  // detectors
76  // voxel
77  const G4double dvoxel = 10.*mm;
78  const G4double dl = 10.*cm;
79 
80  G4Box* svoxel = new G4Box("voxel", dvoxel, dl, dvoxel);
81  mate = G4Material::GetMaterial("Vacuum");
82  G4LogicalVolume* lvoxel = new G4LogicalVolume(svoxel, mate, "voxel");
83  va = new G4VisAttributes(G4Color(0.,0.8,0.8));
84  va-> SetVisibility(false);
85  lvoxel-> SetVisAttributes(va);
86 
87  G4int ix, iz;
88  G4int index = 0;
89  for (iz = 0; iz < 5; iz++) {
90  for (ix = -7; ix <= 7; ix++) {
91  G4double x0 = (2.*ix) * cm;
92  G4double z0 = (-13.+2.*iz) * cm;
93  new G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
94  lvoxel, "voxel", areaLV, false, index);
95  index++;
96  }
97  }
98 
99  // tube
100  G4Tubs* stube = new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
101  0., 360.*deg);
102  mate = G4Material::GetMaterial("Al");
103  G4LogicalVolume* ltube = new G4LogicalVolume(stube, mate, "tube");
104  va = new G4VisAttributes(G4Color(0.,0.8,0.8));
105  ltube-> SetVisAttributes(va);
106 
107  G4RotationMatrix* rmtube = new G4RotationMatrix;
108  rmtube-> rotateX(-90.*deg);
109  new G4PVPlacement(rmtube, G4ThreeVector(),
110  ltube, "tube", lvoxel, false, 0);
111 
112  // cal
113  const G4double dxycal = 25.*mm;
114  const G4double dzcal = 3.*cm;
115 
116  G4Box* scal = new G4Box("cal", dxycal, dxycal, dzcal);
117  mate = G4Material::GetMaterial("CsI");
118  G4LogicalVolume* lcal = new G4LogicalVolume(scal, mate, "cal");
119  va = new G4VisAttributes(G4Color(0.5,0.5,0.));
120  lcal-> SetVisAttributes(va);
121 
122  index = 0;
123  for (ix = -2; ix <= 2; ix++) {
124  G4double x0 = (5.*ix)*cm;
125  new G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
126  lcal, "cal", areaLV, false, index);
127  index++;
128  }
129 
130  return area;
131 }