Geant4  10.02
HadrontherapyDetectorConstruction.hh
Go to the documentation of this file.
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 private:
64 
65  void ConstructPhantom();
66  void ConstructDetector();
67  void ParametersCheck();
68  void CheckOverlaps();
69 
70 public:
71 // Get detector position relative to WORLD
73  {
75  }
77 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
79 {
83  );
84 }
85 
87 // Calculate (and set) detector position by displacement, phantom and detector sizes
88 inline void SetDetectorPosition()
89  {
90  // Adjust detector position
94 
95 
96  }
98 // Check whether detector is inside phantom
99 inline bool IsInside(G4double detectorX,
100  G4double detectorY,
101  G4double detectorZ,
102  G4double phantomX,
103  G4double phantomY,
104  G4double phantomZ,
106 {
107 // Dimensions check... X Y and Z
108 // Firstly check what dimension we are modifying
109  {
110  if (detectorX > phantomX)
111  {
112  G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
113  return false;
114  }
115  if ( (phantomX - detectorX) < pos.getX())
116  {
117  G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
118  return false;
119  }
120  }
121 
122  {
123  if (detectorY > phantomY)
124  {
125  G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
126  return false;
127  }
128  if ( (phantomY - detectorY) < pos.getY())
129  {
130  G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
131  return false;
132  }
133  }
134 
135  {
136  if (detectorZ > phantomZ)
137  {
138  G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
139  return false;
140  }
141  if ( (phantomZ - detectorZ) < pos.getZ())
142  {
143  G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
144  return false;
145  }
146  }
147 
148  return true;
149 }
151 
153  void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
154  void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
155  void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
157  void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
158  void UpdateGeometry();
159  void PrintParameters();
161 
162 private:
165 
168 
172 
176 
180 
184 
185  G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
186 
190 
194 
196 
199 };
200 #endif
void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
static HadrontherapyDetectorConstruction * instance
HadrontherapyDetectorMessenger * detectorMessenger
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
static HadrontherapyDetectorConstruction * GetInstance()
void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition)
bool IsInside(G4double detectorX, G4double detectorY, G4double detectorZ, G4double phantomX, G4double phantomY, G4double phantomZ, G4ThreeVector pos)
HadrontherapyDetectorROGeometry * detectorROGeometry
#define G4endl
Definition: G4ios.hh:61
void InitializeDetectorROGeometry(HadrontherapyDetectorROGeometry *, G4ThreeVector detectorToWorldPosition)
double G4double
Definition: G4Types.hh:76
void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ)
static const G4double pos