Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
tests/gtest01/module/QDetectorConstruction.cc
이 파일의 문서화 페이지로 가기
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 66241 2012-12-13 18:34:42Z gunter $
27 // ====================================================================
28 // QDetectorConstruction.cc
29 //
30 // 2005 Q
31 // ====================================================================
32 #include "QDetectorConstruction.hh"
33 
34 #include "G4Material.hh"
35 #include "G4Tubs.hh"
36 #include "G4Box.hh"
37 #include "G4LogicalVolume.hh"
38 #include "G4PVPlacement.hh"
39 #include "G4VisAttributes.hh"
40 #include "G4SystemOfUnits.hh"
41 
42 // ====================================================================
43 //
44 // class description
45 //
46 // ====================================================================
47 
48 // constants (detector parameters)
49 static const G4double DXYZ_AREA= 30.*cm;
50 static const G4double DW= 10.*cm;
51 
55 {
56 }
57 
61 {
62 }
63 
67 {
68  G4Material* mate;
69  G4VisAttributes* va;
70 
71  // ==============================================================
72  // world volume
73  // ==============================================================
74  G4Box* areaSolid= new G4Box("AREA",
75  DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
76 
77  G4Material* vacuum= G4Material::GetMaterial("Vacuum");
78  G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
79  G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
80  areaLV, 0, false, 0);
81  // vis. attributes
82  va= new G4VisAttributes(G4Color(1.,1.,1.));
83  va-> SetForceWireframe(true);
84  areaLV-> SetVisAttributes(va);
85 
86  // ==============================================================
87  // detectors
88  // ==============================================================
89  // voxel
90  const G4double dvoxel= 10.*mm;
91  const G4double dl= 10.*cm;
92 
93  G4Box* svoxel= new G4Box("voxel", dvoxel, dl, dvoxel);
94  mate= G4Material::GetMaterial("Vacuum");
95  G4LogicalVolume* lvoxel= new G4LogicalVolume(svoxel, mate, "voxel");
96  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
97  va-> SetVisibility(false);
98  lvoxel-> SetVisAttributes(va);
99 
100  G4int ix, iz;
101  G4int index=0;
102  for (iz=0; iz<5; iz++) {
103  for (ix=-7; ix<=7; ix++) {
104  G4double x0= (2.*ix)*cm;
105  G4double z0= (-13.+2.*iz)*cm;
106  G4PVPlacement* pvoxel= new
107  G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
108  lvoxel, "voxel", areaLV, false, index);
109  index++;
110  }
111  }
112 
113  // tube
114  //G4Tubs* stube= new G4Tubs("tube", 15./2.*mm, 19./2.*mm, dl,
115  G4Tubs* stube= new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
116  0., 360.*deg);
117  mate= G4Material::GetMaterial("Al");
118  G4LogicalVolume* ltube= new G4LogicalVolume(stube, mate, "tube");
119  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
120  ltube-> SetVisAttributes(va);
121 
122  G4RotationMatrix* rmtube= new G4RotationMatrix;
123  rmtube-> rotateX(-90.*deg);
124  G4PVPlacement* ptube= new
125  G4PVPlacement(rmtube, G4ThreeVector(),
126  ltube, "tube", lvoxel, false, 0);
127 
128  // cal
129  const G4double dxycal= 25.*mm;
130  const G4double dzcal= 3.*cm;
131 
132  G4Box* scal= new G4Box("cal", dxycal, dxycal, dzcal);
133  mate= G4Material::GetMaterial("CsI");
134  G4LogicalVolume* lcal= new G4LogicalVolume(scal, mate, "cal");
135  va= new G4VisAttributes(G4Color(0.5,0.5,0.));
136  lcal-> SetVisAttributes(va);
137 
138  index= 0;
139  for (ix=-2; ix<=2; ix++) {
140  G4double x0= (5.*ix)*cm;
141  G4PVPlacement* pcal= new
142  G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
143  lcal, "cal", areaLV, false, index);
144  index++;
145  }
146 
147  return area;
148 }
149 
CLHEP::Hep3Vector G4ThreeVector
static constexpr double mm
Definition: G4SIunits.hh:115
Definition: G4Tubs.hh:85
CLHEP::HepRotation G4RotationMatrix
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:608
G4Colour G4Color
Definition: G4Color.hh:42
double G4double
Definition: G4Types.hh:76
static constexpr double deg
Definition: G4SIunits.hh:152
static const G4double DW
Definition: G4Box.hh:64
int G4int
Definition: G4Types.hh:78
static constexpr double cm
Definition: G4SIunits.hh:119
static const G4double DXYZ_AREA