Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
HadrontherapyDetectorConstruction.hh
이 파일의 문서화 페이지로 가기
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 // Hadrontherapy advanced example for Geant4
27 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
28 
29 #ifndef HadrontherapyDetectorConstruction_H
30 #define HadrontherapyDetectorConstruction_H 1
31 
32 #include "G4Box.hh"
33 #include "globals.hh"
34 #include "G4VisAttributes.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4UnitsTable.hh"
38 
39 class G4VPhysicalVolume;
40 class G4LogicalVolume;
41 class G4PVPlacement;
46 class HadrontherapyLet;
47 
49 {
50 public:
51 
53 
55 
56 public:
59  G4ThreeVector detectorToWorldPosition);
61  HadrontherapyDetectorSD* detectorSD; // Pointer to sensitive detector
62 
63 
64 private:
65 
66  void ConstructPhantom();
67  void ConstructDetector();
68  void ParametersCheck();
69  void CheckOverlaps();
70 
71 public:
72 // Get detector position relative to WORLD
74  {
76  }
78 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
80 {
84  );
85 }
86 
88 // Calculate (and set) detector position by displacement, phantom and detector sizes
89 inline void SetDetectorPosition()
90  {
91  // Adjust detector position
95 
96 
97  }
99 // Check whether detector is inside phantom
100 inline bool IsInside(G4double detectorX,
101  G4double detectorY,
102  G4double detectorZ,
103  G4double phantomX,
104  G4double phantomY,
105  G4double phantomZ,
107 {
108 // Dimensions check... X Y and Z
109 // Firstly check what dimension we are modifying
110  {
111  if (detectorX > phantomX)
112  {
113  G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
114  return false;
115  }
116  if ( (phantomX - detectorX) < pos.getX())
117  {
118  G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
119  return false;
120  }
121  }
122 
123  {
124  if (detectorY > phantomY)
125  {
126  G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
127  return false;
128  }
129  if ( (phantomY - detectorY) < pos.getY())
130  {
131  G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
132  return false;
133  }
134  }
135 
136  {
137  if (detectorZ > phantomZ)
138  {
139  G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
140  return false;
141  }
142  if ( (phantomZ - detectorZ) < pos.getZ())
143  {
144  G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
145  return false;
146  }
147  }
148 
149  return true;
150 }
152 
154  void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
155  void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
156  void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
158  void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
159  void UpdateGeometry();
160  void PrintParameters();
162 
163 private:
166 
169 
173 
177 
181 
185 
186  G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
187 
191 
195 
197 
200 };
201 #endif
CLHEP::Hep3Vector G4ThreeVector
static const G4double pos
double getZ() const
void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ)
#define G4endl
Definition: G4ios.hh:61
HadrontherapyDetectorMessenger * detectorMessenger
bool IsInside(G4double detectorX, G4double detectorY, G4double detectorZ, G4double phantomX, G4double phantomY, G4double phantomZ, G4ThreeVector pos)
void InitializeDetectorROGeometry(HadrontherapyDetectorROGeometry *, G4ThreeVector detectorToWorldPosition)
void setX(double)
HadrontherapyDetectorROGeometry * detectorROGeometry
static HadrontherapyDetectorConstruction * GetInstance()
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
static HadrontherapyDetectorConstruction * instance
void setZ(double)
Definition: G4Box.hh:64
double getX() const
double getY() const
int G4int
Definition: G4Types.hh:78
void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition)
G4GLOB_DLL std::ostream G4cout
void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
void setY(double)