Geant4  10.02.p03
HadrontherapyDetectorROGeometry Class Reference

#include <HadrontherapyDetectorROGeometry.hh>

Inheritance diagram for HadrontherapyDetectorROGeometry:
Collaboration diagram for HadrontherapyDetectorROGeometry:

Public Member Functions

 HadrontherapyDetectorROGeometry (G4String)
 
 ~HadrontherapyDetectorROGeometry ()
 
void Initialize (G4ThreeVector detectorPos, G4double detectorDimX, G4double detectorDimY, G4double detectorDimZ, G4int numberOfVoxelsX, G4int numberOfVoxelsY, G4int numberOfVoxelsZ)
 
void UpdateROGeometry ()
 
virtual void Construct ()
 
virtual void ConstructSD ()
 
- Public Member Functions inherited from G4VUserParallelWorld
 G4VUserParallelWorld (G4String worldName)
 
virtual ~G4VUserParallelWorld ()
 
G4String GetName ()
 

Private Attributes

G4ThreeVector detectorToWorldPosition
 
G4double detectorSizeX
 
G4double detectorSizeY
 
G4double detectorSizeZ
 
G4int numberOfVoxelsAlongX
 
G4int numberOfVoxelsAlongY
 
G4int numberOfVoxelsAlongZ
 
G4Box * RODetector
 
G4Box * RODetectorXDivision
 
G4Box * RODetectorYDivision
 
G4Box * RODetectorZDivision
 
G4LogicalVolume * worldLogical
 
G4LogicalVolume * RODetectorLog
 
G4LogicalVolume * RODetectorXDivisionLog
 
G4LogicalVolume * RODetectorYDivisionLog
 
G4LogicalVolume * RODetectorZDivisionLog
 
G4LogicalVolume * sensitiveLogicalVolume
 
G4bool isBuilt
 
G4bool isInitialized
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserParallelWorld
G4VPhysicalVolume * GetWorld ()
 
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 
- Protected Attributes inherited from G4VUserParallelWorld
G4String fWorldName
 

Detailed Description

Definition at line 40 of file HadrontherapyDetectorROGeometry.hh.

Constructor & Destructor Documentation

◆ HadrontherapyDetectorROGeometry()

HadrontherapyDetectorROGeometry::HadrontherapyDetectorROGeometry ( G4String  aString)

Definition at line 65 of file HadrontherapyDetectorROGeometry.cc.

70 {
71  isBuilt = false;
72  isInitialized = false;
73 }
G4VUserParallelWorld(G4String worldName)

◆ ~HadrontherapyDetectorROGeometry()

HadrontherapyDetectorROGeometry::~HadrontherapyDetectorROGeometry ( )

Definition at line 191 of file HadrontherapyDetectorROGeometry.cc.

192 {;}

Member Function Documentation

◆ Construct()

void HadrontherapyDetectorROGeometry::Construct ( void  )
virtual

Implements G4VUserParallelWorld.

Definition at line 195 of file HadrontherapyDetectorROGeometry.cc.

196 {
197  // A dummy material is used to fill the volumes of the readout geometry.
198  // (It will be allowed to set a NULL pointer in volumes of such virtual
199  // division in future, since this material is irrelevant for tracking.)
200 
201 
202  //
203  // World
204  //
205  G4VPhysicalVolume* ghostWorld = GetWorld();
206  worldLogical = ghostWorld->GetLogicalVolume();
207 
208  if (!isInitialized)
209  {
210  G4Exception("HadrontherapyDetectorROGeometry::Construct","had001",
211  FatalException,"Parameters of the RO geometry are not initialized");
212  return;
213  }
214 
215 
216  G4double halfDetectorSizeX = detectorSizeX;
217  G4double halfDetectorSizeY = detectorSizeY;
218  G4double halfDetectorSizeZ = detectorSizeZ;
219 
220  // World volume of ROGeometry ... SERVE SOLO PER LA ROG
221 
222  // Detector ROGeometry
223  RODetector = new G4Box("RODetector",
224  halfDetectorSizeX,
225  halfDetectorSizeY,
226  halfDetectorSizeZ);
227 
229  0,
230  "RODetectorLog",
231  0,0,0);
232 
233 
234 
235  G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,
237  "RODetectorPhys",
238  worldLogical,
239  false,0);
240 
241 
242 
243 
244  // Division along X axis: the detector is divided in slices along the X axis
245 
246  G4double halfXVoxelSizeX = halfDetectorSizeX/numberOfVoxelsAlongX;
247  G4double halfXVoxelSizeY = halfDetectorSizeY;
248  G4double halfXVoxelSizeZ = halfDetectorSizeZ;
249  G4double voxelXThickness = 2*halfXVoxelSizeX;
250 
251 
252  RODetectorXDivision = new G4Box("RODetectorXDivision",
253  halfXVoxelSizeX,
254  halfXVoxelSizeY,
255  halfXVoxelSizeZ);
256 
258  0,
259  "RODetectorXDivisionLog",
260  0,0,0);
261 
262  G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",
264  RODetectorPhys,
265  kXAxis,
267  voxelXThickness);
268 
269  // Division along Y axis: the slices along the X axis are divided along the Y axis
270 
271  G4double halfYVoxelSizeX = halfXVoxelSizeX;
272  G4double halfYVoxelSizeY = halfDetectorSizeY/numberOfVoxelsAlongY;
273  G4double halfYVoxelSizeZ = halfDetectorSizeZ;
274  G4double voxelYThickness = 2*halfYVoxelSizeY;
275 
276  RODetectorYDivision = new G4Box("RODetectorYDivision",
277  halfYVoxelSizeX,
278  halfYVoxelSizeY,
279  halfYVoxelSizeZ);
280 
282  0,
283  "RODetectorYDivisionLog",
284  0,0,0);
285 
286  G4VPhysicalVolume *RODetectorYDivisionPhys = new G4PVReplica("RODetectorYDivisionPhys",
288  RODetectorXDivisionPhys,
289  kYAxis,
291  voxelYThickness);
292 
293  // Division along Z axis: the slices along the Y axis are divided along the Z axis
294 
295  G4double halfZVoxelSizeX = halfXVoxelSizeX;
296  G4double halfZVoxelSizeY = halfYVoxelSizeY;
297  G4double halfZVoxelSizeZ = halfDetectorSizeZ/numberOfVoxelsAlongZ;
298  G4double voxelZThickness = 2*halfZVoxelSizeZ;
299 
300  RODetectorZDivision = new G4Box("RODetectorZDivision",
301  halfZVoxelSizeX,
302  halfZVoxelSizeY,
303  halfZVoxelSizeZ);
304 
306  0,
307  "RODetectorZDivisionLog",
308  0,0,0);
309 
310  new G4PVReplica("RODetectorZDivisionPhys",
312  RODetectorYDivisionPhys,
313  kZAxis,
315  voxelZThickness);
316 
318  isBuilt = true;
319 }
G4VPhysicalVolume * GetWorld()
Definition: G4Box.hh:64
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
G4LogicalVolume * GetLogicalVolume() const
Here is the call graph for this function:

◆ ConstructSD()

void HadrontherapyDetectorROGeometry::ConstructSD ( )
virtual

Reimplemented from G4VUserParallelWorld.

Definition at line 321 of file HadrontherapyDetectorROGeometry.cc.

322 {
323 
324  G4String sensitiveDetectorName = "RODetector";
325 
326  HadrontherapyDetectorSD* detectorSD = new HadrontherapyDetectorSD(sensitiveDetectorName);
327 
329 
330 
331 }
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
Here is the call graph for this function:

◆ Initialize()

void HadrontherapyDetectorROGeometry::Initialize ( G4ThreeVector  detectorPos,
G4double  detectorDimX,
G4double  detectorDimY,
G4double  detectorDimZ,
G4int  numberOfVoxelsX,
G4int  numberOfVoxelsY,
G4int  numberOfVoxelsZ 
)

Definition at line 77 of file HadrontherapyDetectorROGeometry.cc.

Here is the caller graph for this function:

◆ UpdateROGeometry()

void HadrontherapyDetectorROGeometry::UpdateROGeometry ( )

Definition at line 99 of file HadrontherapyDetectorROGeometry.cc.

100 {
101  //Nothing happens if the RO geometry is not built. But parameters are properly set.
102  if (!isBuilt)
103  {
104  //G4Exception("HadrontherapyDetectorROGeometry::UpdateROGeometry","had001",
105  // JustWarning,"Cannot update geometry before it is built");
106  return;
107  }
108 
109  //1) Update the dimensions of the G4Boxes
110  G4double halfDetectorSizeX = detectorSizeX;
111  G4double halfDetectorSizeY = detectorSizeY;
112  G4double halfDetectorSizeZ = detectorSizeZ;
113 
114  RODetector->SetXHalfLength(halfDetectorSizeX);
115  RODetector->SetYHalfLength(halfDetectorSizeY);
116  RODetector->SetZHalfLength(halfDetectorSizeZ);
117 
118  G4double halfXVoxelSizeX = halfDetectorSizeX/numberOfVoxelsAlongX;
119  G4double halfXVoxelSizeY = halfDetectorSizeY;
120  G4double halfXVoxelSizeZ = halfDetectorSizeZ;
121  G4double voxelXThickness = 2*halfXVoxelSizeX;
122 
123  RODetectorXDivision->SetXHalfLength(halfXVoxelSizeX);
124  RODetectorXDivision->SetYHalfLength(halfXVoxelSizeY);
125  RODetectorXDivision->SetZHalfLength(halfXVoxelSizeZ);
126 
127  G4double halfYVoxelSizeX = halfXVoxelSizeX;
128  G4double halfYVoxelSizeY = halfDetectorSizeY/numberOfVoxelsAlongY;
129  G4double halfYVoxelSizeZ = halfDetectorSizeZ;
130  G4double voxelYThickness = 2*halfYVoxelSizeY;
131 
132  RODetectorYDivision->SetXHalfLength(halfYVoxelSizeX);
133  RODetectorYDivision->SetYHalfLength(halfYVoxelSizeY);
134  RODetectorYDivision->SetZHalfLength(halfYVoxelSizeZ);
135 
136  G4double halfZVoxelSizeX = halfXVoxelSizeX;
137  G4double halfZVoxelSizeY = halfYVoxelSizeY;
138  G4double halfZVoxelSizeZ = halfDetectorSizeZ/numberOfVoxelsAlongZ;
139  G4double voxelZThickness = 2*halfZVoxelSizeZ;
140 
141  RODetectorZDivision->SetXHalfLength(halfZVoxelSizeX);
142  RODetectorZDivision->SetYHalfLength(halfZVoxelSizeY);
143  RODetectorZDivision->SetZHalfLength(halfZVoxelSizeZ);
144 
145  //Delete and re-build the relevant physical volumes
146  G4PhysicalVolumeStore* store =
148 
149  //Delete...
150  G4VPhysicalVolume* myVol = store->GetVolume("RODetectorPhys");
151  store->DeRegister(myVol);
152  //..and rebuild
153  G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,
156  "RODetectorPhys",
157  worldLogical,
158  false,0);
159 
160  myVol = store->GetVolume("RODetectorXDivisionPhys");
161  store->DeRegister(myVol);
162  G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",
164  RODetectorPhys,
165  kXAxis,
167  voxelXThickness);
168  myVol = store->GetVolume("RODetectorYDivisionPhys");
169  store->DeRegister(myVol);
170  G4VPhysicalVolume *RODetectorYDivisionPhys = new G4PVReplica("RODetectorYDivisionPhys",
172  RODetectorXDivisionPhys,
173  kYAxis,
175  voxelYThickness);
176 
177  myVol = store->GetVolume("RODetectorZDivisionPhys");
178  store->DeRegister(myVol);
179  new G4PVReplica("RODetectorZDivisionPhys",
181  RODetectorYDivisionPhys,
182  kZAxis,
184  voxelZThickness);
185 
186  return;
187 
188 }
void SetZHalfLength(G4double dz)
Definition: G4Box.cc:171
static void DeRegister(G4VPhysicalVolume *pSolid)
static G4PhysicalVolumeStore * GetInstance()
G4VPhysicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
void SetYHalfLength(G4double dy)
Definition: G4Box.cc:151
void SetXHalfLength(G4double dx)
Definition: G4Box.cc:131
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ detectorSizeX

G4double HadrontherapyDetectorROGeometry::detectorSizeX
private

Definition at line 62 of file HadrontherapyDetectorROGeometry.hh.

◆ detectorSizeY

G4double HadrontherapyDetectorROGeometry::detectorSizeY
private

Definition at line 63 of file HadrontherapyDetectorROGeometry.hh.

◆ detectorSizeZ

G4double HadrontherapyDetectorROGeometry::detectorSizeZ
private

Definition at line 64 of file HadrontherapyDetectorROGeometry.hh.

◆ detectorToWorldPosition

G4ThreeVector HadrontherapyDetectorROGeometry::detectorToWorldPosition
private

Definition at line 61 of file HadrontherapyDetectorROGeometry.hh.

◆ isBuilt

G4bool HadrontherapyDetectorROGeometry::isBuilt
private

Definition at line 85 of file HadrontherapyDetectorROGeometry.hh.

◆ isInitialized

G4bool HadrontherapyDetectorROGeometry::isInitialized
private

Definition at line 86 of file HadrontherapyDetectorROGeometry.hh.

◆ numberOfVoxelsAlongX

G4int HadrontherapyDetectorROGeometry::numberOfVoxelsAlongX
private

Definition at line 66 of file HadrontherapyDetectorROGeometry.hh.

◆ numberOfVoxelsAlongY

G4int HadrontherapyDetectorROGeometry::numberOfVoxelsAlongY
private

Definition at line 67 of file HadrontherapyDetectorROGeometry.hh.

◆ numberOfVoxelsAlongZ

G4int HadrontherapyDetectorROGeometry::numberOfVoxelsAlongZ
private

Definition at line 68 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetector

G4Box* HadrontherapyDetectorROGeometry::RODetector
private

Definition at line 71 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorLog

G4LogicalVolume* HadrontherapyDetectorROGeometry::RODetectorLog
private

Definition at line 78 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorXDivision

G4Box* HadrontherapyDetectorROGeometry::RODetectorXDivision
private

Definition at line 72 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorXDivisionLog

G4LogicalVolume* HadrontherapyDetectorROGeometry::RODetectorXDivisionLog
private

Definition at line 79 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorYDivision

G4Box* HadrontherapyDetectorROGeometry::RODetectorYDivision
private

Definition at line 73 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorYDivisionLog

G4LogicalVolume* HadrontherapyDetectorROGeometry::RODetectorYDivisionLog
private

Definition at line 80 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorZDivision

G4Box* HadrontherapyDetectorROGeometry::RODetectorZDivision
private

Definition at line 74 of file HadrontherapyDetectorROGeometry.hh.

◆ RODetectorZDivisionLog

G4LogicalVolume* HadrontherapyDetectorROGeometry::RODetectorZDivisionLog
private

Definition at line 81 of file HadrontherapyDetectorROGeometry.hh.

◆ sensitiveLogicalVolume

G4LogicalVolume* HadrontherapyDetectorROGeometry::sensitiveLogicalVolume
private

Definition at line 82 of file HadrontherapyDetectorROGeometry.hh.

◆ worldLogical

G4LogicalVolume* HadrontherapyDetectorROGeometry::worldLogical
private

Definition at line 77 of file HadrontherapyDetectorROGeometry.hh.


The documentation for this class was generated from the following files: