Geant4  10.00.p03
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 // This is the *BASIC* version of Hadrontherapy, a Geant4-based application
27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
28 //
29 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request
30 // the *COMPLETE* version of this program, together with its documentation;
31 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
32 // Institute in the framework of the MC-INFN Group
33 //
34 
35 #ifndef HadrontherapyDetectorConstruction_H
36 #define HadrontherapyDetectorConstruction_H 1
37 
38 #include "G4Box.hh"
39 #include "globals.hh"
40 #include "G4VisAttributes.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4UnitsTable.hh"
44 
45 class G4VPhysicalVolume;
46 class G4LogicalVolume;
51 class HadrontherapyLet;
53 {
54 public:
55 
57 
59 
60 public:
63  G4ThreeVector detectorToWorldPosition);
65  HadrontherapyDetectorSD* detectorSD; // Pointer to sensitive detector
66 
67 private:
68 
69  void ConstructPhantom();
70  void ConstructDetector();
71  void ParametersCheck();
72 
73 public:
74 // Get detector position relative to WORLD
76  {
78  }
80 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
82 {
86  );
87 }
88 
90 // Calculate (and set) detector position by displacement, phantom and detector sizes
91 inline void SetDetectorPosition()
92  {
93  // Adjust detector position
97 
98 
99  }
101 // Check whether detector is inside phantom
102 inline bool IsInside(G4double detectorX,
103  G4double detectorY,
104  G4double detectorZ,
105  G4double phantomX,
106  G4double phantomY,
107  G4double phantomZ,
109 {
110 // Dimensions check... X Y and Z
111 // Firstly check what dimension we are modifying
112  {
113  if (detectorX > phantomX)
114  {
115  G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
116  return false;
117  }
118  if ( (phantomX - detectorX) < pos.getX())
119  {
120  G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
121  return false;
122  }
123  }
124 
125  {
126  if (detectorY > phantomY)
127  {
128  G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
129  return false;
130  }
131  if ( (phantomY - detectorY) < pos.getY())
132  {
133  G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
134  return false;
135  }
136  }
137 
138  {
139  if (detectorZ > phantomZ)
140  {
141  G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
142  return false;
143  }
144  if ( (phantomZ - detectorZ) < pos.getZ())
145  {
146  G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
147  return false;
148  }
149  }
150 
151  return true;
152 }
154 
156  void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
157  void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
158  void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
160  void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
161  void UpdateGeometry();
162  void PrintParameters();
164 
165 
166 private:
169 
172 
176 
180 
184 
188 
189  G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
190 
194 
198 
200 
203 };
204 #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