Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/electromagnetic/TestEm2/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 // $Id: DetectorConstruction.cc 109103 2018-03-27 07:39:04Z gcosmo $
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "DetectorConstruction.hh"
36 #include "DetectorMessenger.hh"
37 
38 #include "G4Tubs.hh"
39 #include "G4LogicalVolume.hh"
40 #include "G4PVPlacement.hh"
41 
42 #include "G4GeometryManager.hh"
43 #include "G4PhysicalVolumeStore.hh"
44 #include "G4LogicalVolumeStore.hh"
45 #include "G4SolidStore.hh"
46 
48 
49 #include "G4NistManager.hh"
50 #include "G4RunManager.hh"
51 
52 #include "G4SystemOfUnits.hh"
53 #include "G4UnitsTable.hh"
54 
55 #include "G4AutoDelete.hh"
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
60  fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1),
61  fDLlength(0.),fDRlength(0.),fMaterial(nullptr),
62  fEcalLength(0.),fEcalRadius(0.),
63  fSolidEcal(nullptr),fLogicEcal(nullptr),fPhysiEcal(nullptr)
64 {
66  SetMaterial("G4_PbWO4");
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 {
74  delete fDetectorMessenger;
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  //
82  // define few Elements by hand
83  //
84  G4double a, z;
85 
86  G4Element* H = new G4Element("Hydrogen", "H", z= 1., a= 1.01*g/mole);
87  G4Element* O = new G4Element("Oxygen" , "O", z= 8., a= 16.00*g/mole);
88  G4Element* Ge = new G4Element("Germanium", "Ge",z=32., a= 72.59*g/mole);
89  G4Element* Bi = new G4Element("Bismuth", "Bi",z=83., a= 208.98*g/mole);
90 
91  //
92  // define materials
93  //
94  G4double density;
95  G4int ncomponents, natoms;
96 
97  // water with ionisation potential 78 eV
98  G4Material* H2O =
99  new G4Material("Water", density= 1.00*g/cm3, ncomponents=2);
100  H2O->AddElement(H, natoms=2);
101  H2O->AddElement(O, natoms=1);
103 
104  // pure materails
105  new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
106  new G4Material("Aluminium", z=13., a= 26.98*g/mole, density= 2.7*g/cm3);
107  new G4Material("Iron", z=26., a= 55.85*g/mole, density= 7.87*g/cm3);
108  new G4Material("Copper", z=29., a= 63.55*g/mole, density= 8.960*g/cm3);
109  new G4Material("Tungsten", z=74., a=183.84*g/mole, density=19.35*g/cm3);
110  new G4Material("Lead", z=82., a=207.19*g/mole, density=11.35*g/cm3);
111  new G4Material("Uranium" , z=92., a=238.03*g/mole, density= 18.95*g/cm3);
112 
113  // compound material
114  G4Material* BGO =
115  new G4Material("BGO", density= 7.10*g/cm3, ncomponents=3);
116  BGO->AddElement(O , natoms=12);
117  BGO->AddElement(Ge, natoms= 3);
118  BGO->AddElement(Bi, natoms= 4);
119 
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
126 {
127  G4double Radl = fMaterial->GetRadlen();
128  fDLlength = fDLradl*Radl; fDRlength = fDRradl*Radl;
130  if(fSolidEcal) {
133  }
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
139 {
141  //
142  // Ecal
143  //
144  if(!fPhysiEcal) {
145  fSolidEcal = new G4Tubs("Ecal",0.,fEcalRadius,0.5*fEcalLength,0.,360*deg);
146  fLogicEcal = new G4LogicalVolume( fSolidEcal,fMaterial,"Ecal",0,0,0);
148  fLogicEcal,"Ecal",0,false,0);
149  }
150  G4cout << "Absorber is " << G4BestUnit(fEcalLength,"Length")
151  << " of " << fMaterial->GetName()
152  << " R= " << fEcalRadius/cm << " cm" << G4endl;
153  //
154  //always return the physical World
155  //
156  return fPhysiEcal;
157 }
158 
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160 
161 void DetectorConstruction::SetMaterial(const G4String& materialChoice)
162 {
163  // search the material by its name
164  G4Material* pttoMaterial =
165  G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
166 
167  if(pttoMaterial && fMaterial != pttoMaterial) {
168  fMaterial = pttoMaterial;
171  }
172 }
173 
174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
175 
177 {
178  fNLtot = (G4int)Value(0);
179  if (fNLtot > kMaxBin) {
180  G4cout << "\n ---> warning from SetLBining: "
181  << fNLtot << " truncated to " << kMaxBin << G4endl;
182  fNLtot = kMaxBin;
183  }
184  fDLradl = Value(1);
186 }
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
189 
191 {
192  fNRtot = (G4int)Value(0);
193  if (fNRtot > kMaxBin) {
194  G4cout << "\n ---> warning from SetRBining: "
195  << fNRtot << " truncated to " << kMaxBin << G4endl;
196  fNRtot = kMaxBin;
197  }
198  fDRradl = Value(1);
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
203 
205 {
206  if ( fFieldMessenger.Get() == nullptr ) {
207  // Create global magnetic field messenger.
208  // Uniform magnetic field is then created automatically if
209  // the field value is not zero.
210  G4ThreeVector fieldValue = G4ThreeVector();
212  new G4GlobalMagFieldMessenger(fieldValue);
213  //msg->SetVerboseLevel(1);
215  fFieldMessenger.Put( msg );
216  }
217 }
218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
void SetOuterRadius(G4double newRMax)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
Definition: G4Tubs.hh:85
#define G4endl
Definition: G4ios.hh:61
G4double GetRadlen() const
Definition: G4Material.hh:221
Double_t z
void SetMeanExcitationEnergy(G4double value)
void Register(T *inst)
Definition: G4AutoDelete.hh:65
const G4String & GetName() const
Definition: G4Material.hh:179
static constexpr double g
Definition: G4SIunits.hh:183
double G4double
Definition: G4Types.hh:76
static constexpr double deg
Definition: G4SIunits.hh:152
void SetZHalfLength(G4double newDz)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double eV
Definition: G4SIunits.hh:215
value_type & Get() const
Definition: G4Cache.hh:314
void Put(const value_type &val) const
Definition: G4Cache.hh:318
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:227
void PhysicsHasBeenModified()
G4Cache< G4GlobalMagFieldMessenger * > fFieldMessenger
static constexpr double cm
Definition: G4SIunits.hh:119
G4GLOB_DLL std::ostream G4cout
void SetMaterial(G4Material *pMaterial)
static constexpr double mole
Definition: G4SIunits.hh:286
static constexpr double cm3
Definition: G4SIunits.hh:121
static G4NistManager * Instance()