Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/parallel/MPI/examples/exMPI01/src/DetectorConstruction.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: DetectorConstruction.cc 78126 2013-12-03 17:43:56Z gcosmo $
27 //
30 
31 #include "G4Box.hh"
32 #include "G4LogicalVolume.hh"
33 #include "G4Material.hh"
34 #include "G4PVPlacement.hh"
35 #include "G4SystemOfUnits.hh"
36 #include "G4Tubs.hh"
37 #include "G4VisAttributes.hh"
38 #include "DetectorConstruction.hh"
39 #include "Materials.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 {
44 }
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 {
49 }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 {
54  // material definition
55  Materials* materialConstruction = new Materials;
56  materialConstruction-> Construct();
57 
58  G4Material* mate;
59  G4VisAttributes* va;
60 
61  // world volume
62  const G4double DXYZ_AREA = 32.*cm;
63  G4Box* areaSolid = new G4Box("AREA", DXYZ_AREA/2., DXYZ_AREA/2.,
64  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, 0., 360.*deg);
101  mate = G4Material::GetMaterial("Al");
102  G4LogicalVolume* ltube = new G4LogicalVolume(stube, mate, "tube");
103  va = new G4VisAttributes(G4Color(0.,0.8,0.8));
104  ltube-> SetVisAttributes(va);
105 
106  G4RotationMatrix* rmtube = new G4RotationMatrix;
107  rmtube-> rotateX(-90.*deg);
108  new G4PVPlacement(rmtube, G4ThreeVector(),
109  ltube, "tube", lvoxel, false, 0);
110 
111  // cal
112  const G4double dxycal = 25.*mm;
113  const G4double dzcal = 3.*cm;
114 
115  G4Box* scal = new G4Box("cal", dxycal, dxycal, dzcal);
116  mate = G4Material::GetMaterial("CsI");
117  G4LogicalVolume* lcal = new G4LogicalVolume(scal, mate, "cal");
118  va = new G4VisAttributes(G4Color(0.5,0.5,0.));
119  lcal-> SetVisAttributes(va);
120 
121  index = 0;
122  for ( ix = -2; ix <= 2; ix++ ) {
123  G4double x0 = (5.*ix)*cm;
124  new G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
125  lcal, "cal", areaLV, false, index);
126  index++;
127  }
128 
129  return area;
130 }
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 {
135 }
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
Definition: G4Box.hh:64
int G4int
Definition: G4Types.hh:78
static constexpr double cm
Definition: G4SIunits.hh:119