Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QDetectorConstruction.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 // $Id: QDetectorConstruction.cc,v 1.3 2006-06-29 15:37:14 gunter Exp $
27 // $Name: not supported by cvs2svn $
28 // ====================================================================
29 // QDetectorConstruction.cc
30 //
31 // 2005 Q
32 // ====================================================================
33 #include "QDetectorConstruction.hh"
34 
35 #include "G4Material.hh"
36 #include "G4Tubs.hh"
37 #include "G4Box.hh"
38 #include "G4LogicalVolume.hh"
39 #include "G4PVPlacement.hh"
40 #include "G4VisAttributes.hh"
41 #include "G4SystemOfUnits.hh"
42 
43 // ====================================================================
44 //
45 // class description
46 //
47 // ====================================================================
48 
49 // constants (detector parameters)
50 static const G4double DXYZ_AREA= 30.*cm;
51 static const G4double DW= 10.*cm;
52 
56 {
57 }
58 
62 {
63 }
64 
68 {
69  G4Material* mate;
70  G4VisAttributes* va;
71 
72  // ==============================================================
73  // world volume
74  // ==============================================================
75  G4Box* areaSolid= new G4Box("AREA",
76  DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
77 
78  G4Material* vacuum= G4Material::GetMaterial("Vacuum");
79  G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
80  G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
81  areaLV, 0, false, 0);
82  // vis. attributes
83  va= new G4VisAttributes(G4Color(1.,1.,1.));
84  va-> SetForceWireframe(true);
85  areaLV-> SetVisAttributes(va);
86 
87  // ==============================================================
88  // detectors
89  // ==============================================================
90  // voxel
91  const G4double dvoxel= 10.*mm;
92  const G4double dl= 10.*cm;
93 
94  G4Box* svoxel= new G4Box("voxel", dvoxel, dl, dvoxel);
95  mate= G4Material::GetMaterial("Vacuum");
96  G4LogicalVolume* lvoxel= new G4LogicalVolume(svoxel, mate, "voxel");
97  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
98  va-> SetVisibility(false);
99  lvoxel-> SetVisAttributes(va);
100 
101  G4int ix, iz;
102  G4int index=0;
103  for (iz=0; iz<5; iz++) {
104  for (ix=-7; ix<=7; ix++) {
105  G4double x0= (2.*ix)*cm;
106  G4double z0= (-13.+2.*iz)*cm;
107  G4PVPlacement* pvoxel= new
108  G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
109  lvoxel, "voxel", areaLV, false, index);
110  index++;
111  }
112  }
113 
114  // tube
115  //G4Tubs* stube= new G4Tubs("tube", 15./2.*mm, 19./2.*mm, dl,
116  G4Tubs* stube= new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
117  0., 360.*deg);
118  mate= G4Material::GetMaterial("Al");
119  G4LogicalVolume* ltube= new G4LogicalVolume(stube, mate, "tube");
120  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
121  ltube-> SetVisAttributes(va);
122 
123  G4RotationMatrix* rmtube= new G4RotationMatrix;
124  rmtube-> rotateX(-90.*deg);
125  G4PVPlacement* ptube= new
126  G4PVPlacement(rmtube, G4ThreeVector(),
127  ltube, "tube", lvoxel, false, 0);
128 
129  // cal
130  const G4double dxycal= 25.*mm;
131  const G4double dzcal= 3.*cm;
132 
133  G4Box* scal= new G4Box("cal", dxycal, dxycal, dzcal);
134  mate= G4Material::GetMaterial("CsI");
135  G4LogicalVolume* lcal= new G4LogicalVolume(scal, mate, "cal");
136  va= new G4VisAttributes(G4Color(0.5,0.5,0.));
137  lcal-> SetVisAttributes(va);
138 
139  index= 0;
140  for (ix=-2; ix<=2; ix++) {
141  G4double x0= (5.*ix)*cm;
142  G4PVPlacement* pcal= new
143  G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
144  lcal, "cal", areaLV, false, index);
145  index++;
146  }
147 
148  return area;
149 }
150