Geant4  10.01.p02
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;
47 class G4PVPlacement;
52 class HadrontherapyLet;
53 
55 {
56 public:
57 
59 
61 
62 public:
65  G4ThreeVector detectorToWorldPosition);
67  HadrontherapyDetectorSD* detectorSD; // Pointer to sensitive detector
68 
69 private:
70 
71  void ConstructPhantom();
72  void ConstructDetector();
73  void ParametersCheck();
74  void CheckOverlaps();
75 
76 public:
77 // Get detector position relative to WORLD
79  {
81  }
83 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
85 {
89  );
90 }
91 
93 // Calculate (and set) detector position by displacement, phantom and detector sizes
94 inline void SetDetectorPosition()
95  {
96  // Adjust detector position
100 
101 
102  }
104 // Check whether detector is inside phantom
105 inline bool IsInside(G4double detectorX,
106  G4double detectorY,
107  G4double detectorZ,
108  G4double phantomX,
109  G4double phantomY,
110  G4double phantomZ,
112 {
113 // Dimensions check... X Y and Z
114 // Firstly check what dimension we are modifying
115  {
116  if (detectorX > phantomX)
117  {
118  G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
119  return false;
120  }
121  if ( (phantomX - detectorX) < pos.getX())
122  {
123  G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
124  return false;
125  }
126  }
127 
128  {
129  if (detectorY > phantomY)
130  {
131  G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
132  return false;
133  }
134  if ( (phantomY - detectorY) < pos.getY())
135  {
136  G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
137  return false;
138  }
139  }
140 
141  {
142  if (detectorZ > phantomZ)
143  {
144  G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
145  return false;
146  }
147  if ( (phantomZ - detectorZ) < pos.getZ())
148  {
149  G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
150  return false;
151  }
152  }
153 
154  return true;
155 }
157 
159  void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
160  void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
161  void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
163  void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
164  void UpdateGeometry();
165  void PrintParameters();
167 
168 private:
171 
174 
178 
182 
186 
190 
191  G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
192 
196 
200 
202 
205 };
206 #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