Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
MyDetectorConstruction.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: MyDetectorConstruction.cc 66241 2012-12-13 18:34:42Z gunter $
27 // ====================================================================
28 // MyDetectorConstruction.cc
29 //
30 // 2005 Q
31 // ====================================================================
33 
34 #include "G4Material.hh"
35 #include "G4Box.hh"
36 #include "G4LogicalVolume.hh"
37 #include "G4PVPlacement.hh"
38 #include "G4VisAttributes.hh"
39 #include "G4SystemOfUnits.hh"
40 
41 // ====================================================================
42 //
43 // class description
44 //
45 // ====================================================================
46 
47 
50  : scoreVoxel(0)
52 {
53 }
54 
58 {
59 }
60 
64 {
65  G4Material* mate;
66  G4VisAttributes* va;
67 
68  // ==============================================================
69  // world volume
70  // ==============================================================
71  G4Box* areaSolid= new G4Box("area", 25.*cm, 25.*cm, 1.1*m);
72  G4Material* vacuum= G4Material::GetMaterial("Vacuum");
73  G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "area");
74  G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "area",
75  areaLV, 0, false, 0);
76  // vis. attributes
77  va= new G4VisAttributes(G4Color(1.,1.,1.));
78  va-> SetVisibility(false);
79  areaLV-> SetVisAttributes(va);
80 
81  // ==============================================================
82  // phantom
83  // ==============================================================
84  // water phantom
85  const double dxyphantom= 40.*cm;
86  const double dzphantom= 50.*cm;
87 
88  G4Box* sphantom= new G4Box("phantom",
89  dxyphantom/2., dxyphantom/2., dzphantom/2.);
90  G4Material* water= G4Material::GetMaterial("Water");
91  G4LogicalVolume* lphantom= new G4LogicalVolume(sphantom,
92  water, "phantom");
93  G4PVPlacement* phantom= new G4PVPlacement(0,
94  G4ThreeVector(0.,0., dzphantom/2.),
95  lphantom, "phantom",
96  areaLV, false, 0);
97 
98  va= new G4VisAttributes(G4Color(0.,0.1,0.8));
99  lphantom-> SetVisAttributes(va);
100 
101  // score voxels
102  const G4double dvoxel= 2.*mm;
103  const G4double dvoxel_y= 20.*mm;
104 
105  G4Box* svoxel= new G4Box("voxel", dvoxel/2., dvoxel_y/2., dvoxel/2.);
106  scoreVoxel= new G4LogicalVolume(svoxel, water, "voxel");
107  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
108  va-> SetVisibility(false);
109  scoreVoxel-> SetVisAttributes(va);
110 
111  G4int ix, iz;
112  G4int index=0;
113  for (iz=0; iz<200; iz++) {
114  for (ix=-40; ix<=40; ix++) {
115  G4double x0= ix*dvoxel;
116  G4double z0= -dzphantom/2.+(iz+0.5)*dvoxel;
117  G4PVPlacement* pvoxel= new
118  G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
119  scoreVoxel, "voxel", lphantom,
120  false, index);
121  index++;
122  }
123  }
124 
125  return area;
126 }
127 
128 
132 {
133  if(scoreVoxel) {
135  }
136 }
137 
CLHEP::Hep3Vector G4ThreeVector
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static constexpr double mm
Definition: G4SIunits.hh:115
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:608
G4Colour G4Color
Definition: G4Color.hh:42
static constexpr double m
Definition: G4SIunits.hh:129
double G4double
Definition: G4Types.hh:76
void SetSDtoScoreVoxel(G4VSensitiveDetector *asd)
virtual G4VPhysicalVolume * Construct()
Definition: G4Box.hh:64
int G4int
Definition: G4Types.hh:78
static constexpr double cm
Definition: G4SIunits.hh:119