Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/optical/OpNovice2/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 //
28 //
29 //
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "DetectorConstruction.hh"
35 #include "DetectorMessenger.hh"
36 
37 #include "G4NistManager.hh"
38 #include "G4Material.hh"
39 #include "G4Element.hh"
41 #include "G4LogicalSkinSurface.hh"
42 #include "G4OpticalSurface.hh"
43 #include "G4Box.hh"
44 #include "G4LogicalVolume.hh"
45 #include "G4ThreeVector.hh"
46 #include "G4PVPlacement.hh"
47 #include "G4SystemOfUnits.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
53  fDetectorMessenger(nullptr)
54 {
55  fExpHall_x = fExpHall_y = fExpHall_z = 10.0*m;
56  fTank_x = fTank_y = fTank_z = 1.0*m;
57 
58  fTank = nullptr;
59  fSurface = nullptr;
60 
64 
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {
72  delete fDetectorMessenger;
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79 
80 // ------------- Materials -------------
81 
83 
84  G4Material* air = man->FindOrBuildMaterial("G4_AIR");
85  G4Material* water = man->FindOrBuildMaterial("G4_WATER");
86 
87 //
88 // ------------ Generate & Add Material Properties Table ------------
89 //
90 
91 
93  water->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
94 
96 
97  // ------------- Volumes --------------
98  // The experimental Hall
99  G4Box* world_box = new G4Box("World", fExpHall_x, fExpHall_y, fExpHall_z);
100 
101  G4LogicalVolume* world_LV
102  = new G4LogicalVolume(world_box,air, "World", 0, 0, 0);
103 
104  G4VPhysicalVolume* world_PV
105  = new G4PVPlacement(0, G4ThreeVector(), world_LV, "World", 0, false, 0);
106 
107  // The Water Tank
108  G4Box* waterTank_box = new G4Box("Tank",fTank_x,fTank_y,fTank_z);
109 
110  G4LogicalVolume* waterTank_log
111  = new G4LogicalVolume(waterTank_box,water,"Tank",0,0,0);
112 
113  fTank
114  = new G4PVPlacement(0, G4ThreeVector(), waterTank_log, "Tank",
115  world_LV, false, 0);
116 
117  // ------------- Surface --------------
118 
119  fSurface = new G4OpticalSurface("Surface");
123 
125 
126  G4LogicalBorderSurface* surface =
127  new G4LogicalBorderSurface("Surface",
128  fTank, world_PV, fSurface);
129 
130  G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
131  (surface->GetSurface(fTank,world_PV)->GetSurfaceProperty());
132  G4cout << "opticalSurface->DumpInfo" << G4endl;
133  if (opticalSurface) opticalSurface->DumpInfo();
134 
135  return world_PV;
136 }
137 
138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
142 
143  G4cout << "Surface sigma alpha set to: " << fSurface->GetSigmaAlpha()
144  << G4endl;
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
150  mpv->SetSpline(true);
151  fBoxMPT->AddProperty(c, mpv);
152  G4cout << "The MPT for the box is now: " << G4endl;
153  fBoxMPT->DumpTable();
154  G4cout << "............." << G4endl;
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160  mpv->SetSpline(true);
161  fWorldMPT->AddProperty(c, mpv);
162  G4cout << "The MPT for the world is now: " << G4endl;
163  fWorldMPT->DumpTable();
164  G4cout << "............." << G4endl;
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
170  mpv->SetSpline(true);
171  fSurfaceMPT->AddProperty(c, mpv);
172  G4cout << "The MPT for the surface is now: " << G4endl;
174  G4cout << "............." << G4endl;
175 }
176 
177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179  fBoxMPT->AddConstProperty(c, v);
180  G4cout << "The MPT for the box is now: " << G4endl;
181  fBoxMPT->DumpTable();
182  G4cout << "............." << G4endl;
183 }
184 
185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
188  G4cout << "The MPT for the world is now: " << G4endl;
189  fWorldMPT->DumpTable();
190  G4cout << "............." << G4endl;
191 
192 }
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
void AddWorldMPV(const char *c, G4MaterialPropertyVector *mpv)
CLHEP::Hep3Vector G4ThreeVector
static constexpr double MeV
Definition: G4SIunits.hh:214
static constexpr double mm
Definition: G4SIunits.hh:115
void AddBoxMPV(const char *c, G4MaterialPropertyVector *mpv)
#define G4endl
Definition: G4ios.hh:61
void AddConstProperty(const char *key, G4double PropertyValue)
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
void SetBirksConstant(G4double value)
static constexpr double m
Definition: G4SIunits.hh:129
void AddSurfaceMPV(const char *c, G4MaterialPropertyVector *mpv)
double G4double
Definition: G4Types.hh:76
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
Definition: G4Material.cc:730
void SetType(const G4SurfaceType &type)
G4MaterialPropertyVector * AddProperty(const char *key, G4double *PhotonEnergies, G4double *PropertyValues, G4int NumEntries)
Definition: G4Box.hh:64
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
void SetSpline(G4bool)
G4SurfaceProperty * GetSurfaceProperty() const
void SetSigmaAlpha(const G4double s_a)
void GeometryHasBeenModified(G4bool prop=true)
G4double GetSigmaAlpha() const
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:227
G4GLOB_DLL std::ostream G4cout
void DumpInfo() const
void SetModel(const G4OpticalSurfaceModel model)
static G4NistManager * Instance()
void SetFinish(const G4OpticalSurfaceFinish)