Import Geant4 10.5.0 source tree
This commit is contained in:
@@ -45,157 +45,167 @@ class HadrontherapyDetectorSD;
|
||||
class HadrontherapyMatrix;
|
||||
class HadrontherapyLet;
|
||||
|
||||
class HadrontherapyDetectorConstruction
|
||||
class HadrontherapyDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
HadrontherapyDetectorConstruction(G4VPhysicalVolume*);
|
||||
|
||||
~HadrontherapyDetectorConstruction();
|
||||
|
||||
|
||||
HadrontherapyDetectorConstruction(G4VPhysicalVolume*);
|
||||
|
||||
~HadrontherapyDetectorConstruction();
|
||||
|
||||
public:
|
||||
static HadrontherapyDetectorConstruction* GetInstance();
|
||||
void InitializeDetectorROGeometry(HadrontherapyDetectorROGeometry*,
|
||||
G4ThreeVector detectorToWorldPosition);
|
||||
G4VPhysicalVolume* motherPhys;
|
||||
HadrontherapyDetectorSD* detectorSD; // Pointer to sensitive detector
|
||||
static HadrontherapyDetectorConstruction* GetInstance();
|
||||
void InitializeDetectorROGeometry(HadrontherapyDetectorROGeometry*,
|
||||
G4ThreeVector detectorToWorldPosition);
|
||||
G4VPhysicalVolume* motherPhys;
|
||||
HadrontherapyDetectorSD* detectorSD; // Pointer to sensitive detector
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void ConstructPhantom();
|
||||
void ConstructDetector();
|
||||
void ParametersCheck();
|
||||
void CheckOverlaps();
|
||||
|
||||
public:
|
||||
// Get detector position relative to WORLD
|
||||
inline G4ThreeVector GetDetectorToWorldPosition()
|
||||
{
|
||||
return phantomPosition + detectorPosition;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
|
||||
inline G4ThreeVector GetDetectorToPhantomPosition()
|
||||
{
|
||||
return G4ThreeVector(phantomSizeX/2 - detectorSizeX/2 + detectorPosition.getX(),
|
||||
phantomSizeY/2 - detectorSizeY/2 + detectorPosition.getY(),
|
||||
phantomSizeZ/2 - detectorSizeZ/2 + detectorPosition.getZ()
|
||||
);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Calculate (and set) detector position by displacement, phantom and detector sizes
|
||||
inline void SetDetectorPosition()
|
||||
{
|
||||
// Adjust detector position
|
||||
detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX/2 + detectorSizeX/2);
|
||||
detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY/2 + detectorSizeY/2);
|
||||
detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ/2 + detectorSizeZ/2);
|
||||
|
||||
//////////////////////////
|
||||
void VirtualLayer(G4bool Varbool);
|
||||
G4bool NewSource;
|
||||
void SetVirtualLayerPosition(G4ThreeVector);
|
||||
G4ThreeVector VirtualLayerPosition;
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Check whether detector is inside phantom
|
||||
inline bool IsInside(G4double detectorX,
|
||||
G4double detectorY,
|
||||
G4double detectorZ,
|
||||
G4double phantomX,
|
||||
G4double phantomY,
|
||||
G4double phantomZ,
|
||||
G4ThreeVector pos)
|
||||
{
|
||||
// Dimensions check... X Y and Z
|
||||
// Firstly check what dimension we are modifying
|
||||
{
|
||||
if (detectorX > phantomX)
|
||||
{
|
||||
G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
|
||||
return false;
|
||||
}
|
||||
if ( (phantomX - detectorX) < pos.getX())
|
||||
{
|
||||
G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (detectorY > phantomY)
|
||||
{
|
||||
G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
|
||||
return false;
|
||||
}
|
||||
if ( (phantomY - detectorY) < pos.getY())
|
||||
{
|
||||
G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (detectorZ > phantomZ)
|
||||
{
|
||||
G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
|
||||
return false;
|
||||
}
|
||||
if ( (phantomZ - detectorZ) < pos.getZ())
|
||||
{
|
||||
G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4bool SetPhantomMaterial(G4String material);
|
||||
void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
|
||||
void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
|
||||
void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
|
||||
void SetPhantomPosition(G4ThreeVector);
|
||||
void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
|
||||
void UpdateGeometry();
|
||||
void PrintParameters();
|
||||
G4LogicalVolume* GetDetectorLogicalVolume(){ return detectorLogicalVolume;}
|
||||
|
||||
//////////////////////////
|
||||
private:
|
||||
static HadrontherapyDetectorConstruction* instance;
|
||||
HadrontherapyDetectorMessenger* detectorMessenger;
|
||||
|
||||
G4VisAttributes* skyBlue;
|
||||
G4VisAttributes* red;
|
||||
|
||||
HadrontherapyDetectorROGeometry* detectorROGeometry; // Pointer to ROGeometry
|
||||
HadrontherapyMatrix* matrix;
|
||||
HadrontherapyLet* let;
|
||||
|
||||
G4Box *phantom , *detector;
|
||||
G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume;
|
||||
G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume;
|
||||
|
||||
G4double phantomSizeX;
|
||||
G4double phantomSizeY;
|
||||
G4double phantomSizeZ;
|
||||
|
||||
G4double detectorSizeX;
|
||||
G4double detectorSizeY;
|
||||
G4double detectorSizeZ;
|
||||
|
||||
G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
|
||||
|
||||
G4double sizeOfVoxelAlongX;
|
||||
G4double sizeOfVoxelAlongY;
|
||||
G4double sizeOfVoxelAlongZ;
|
||||
|
||||
G4int numberOfVoxelsAlongX;
|
||||
G4int numberOfVoxelsAlongY;
|
||||
G4int numberOfVoxelsAlongZ;
|
||||
|
||||
G4double volumeOfVoxel, massOfVoxel;
|
||||
|
||||
G4Material *phantomMaterial, *detectorMaterial;
|
||||
G4Region* aRegion;
|
||||
|
||||
void ConstructPhantom();
|
||||
void ConstructDetector();
|
||||
void ParametersCheck();
|
||||
void CheckOverlaps();
|
||||
|
||||
public:
|
||||
// Get detector position relative to WORLD
|
||||
inline G4ThreeVector GetDetectorToWorldPosition()
|
||||
{
|
||||
return phantomPosition + detectorPosition;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
|
||||
inline G4ThreeVector GetDetectorToPhantomPosition()
|
||||
{
|
||||
return G4ThreeVector(phantomSizeX/2 - detectorSizeX/2 + detectorPosition.getX(),
|
||||
phantomSizeY/2 - detectorSizeY/2 + detectorPosition.getY(),
|
||||
phantomSizeZ/2 - detectorSizeZ/2 + detectorPosition.getZ()
|
||||
);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Calculate (and set) detector position by displacement, phantom and detector sizes
|
||||
inline void SetDetectorPosition()
|
||||
{
|
||||
// Adjust detector position
|
||||
detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX/2 + detectorSizeX/2);
|
||||
detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY/2 + detectorSizeY/2);
|
||||
detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ/2 + detectorSizeZ/2);
|
||||
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Check whether detector is inside phantom
|
||||
inline bool IsInside(G4double detectorX,
|
||||
G4double detectorY,
|
||||
G4double detectorZ,
|
||||
G4double phantomX,
|
||||
G4double phantomY,
|
||||
G4double phantomZ,
|
||||
G4ThreeVector pos)
|
||||
{
|
||||
// Dimensions check... X Y and Z
|
||||
// Firstly check what dimension we are modifying
|
||||
{
|
||||
if (detectorX > phantomX)
|
||||
{
|
||||
G4cout << "Error: Detector X dimension must be smaller or equal to the correspondent of the phantom" << G4endl;
|
||||
return false;
|
||||
}
|
||||
if ( (phantomX - detectorX) < pos.getX())
|
||||
{
|
||||
G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (detectorY > phantomY)
|
||||
{
|
||||
G4cout << "Error: Detector Y dimension must be smaller or equal to the correspondent of the phantom" << G4endl;
|
||||
return false;
|
||||
}
|
||||
if ( (phantomY - detectorY) < pos.getY())
|
||||
{
|
||||
G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (detectorZ > phantomZ)
|
||||
{
|
||||
G4cout << "Error: Detector Z dimension must be smaller or equal to the correspondent of the phantom" << G4endl;
|
||||
return false;
|
||||
}
|
||||
if ( (phantomZ - detectorZ) < pos.getZ())
|
||||
{
|
||||
G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4bool SetPhantomMaterial(G4String material);
|
||||
void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
|
||||
void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
|
||||
void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
|
||||
void SetPhantomPosition(G4ThreeVector);
|
||||
void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
|
||||
void UpdateGeometry();
|
||||
void PrintParameters();
|
||||
G4LogicalVolume* GetDetectorLogicalVolume(){ return detectorLogicalVolume;}
|
||||
|
||||
private:
|
||||
static HadrontherapyDetectorConstruction* instance;
|
||||
HadrontherapyDetectorMessenger* detectorMessenger;
|
||||
|
||||
G4VisAttributes* skyBlue;
|
||||
G4VisAttributes* red;
|
||||
|
||||
HadrontherapyDetectorROGeometry* detectorROGeometry; // Pointer to ROGeometry
|
||||
HadrontherapyMatrix* matrix;
|
||||
HadrontherapyLet* let;
|
||||
|
||||
G4Box *phantom , *detector;
|
||||
G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume;
|
||||
G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume;
|
||||
|
||||
G4Box* solidVirtualLayer;
|
||||
G4LogicalVolume* logicVirtualLayer;
|
||||
G4VPhysicalVolume* physVirtualLayer;
|
||||
|
||||
G4double phantomSizeX;
|
||||
G4double phantomSizeY;
|
||||
G4double phantomSizeZ;
|
||||
|
||||
G4double detectorSizeX;
|
||||
G4double detectorSizeY;
|
||||
G4double detectorSizeZ;
|
||||
|
||||
G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
|
||||
|
||||
G4double sizeOfVoxelAlongX;
|
||||
G4double sizeOfVoxelAlongY;
|
||||
G4double sizeOfVoxelAlongZ;
|
||||
|
||||
G4int numberOfVoxelsAlongX;
|
||||
G4int numberOfVoxelsAlongY;
|
||||
G4int numberOfVoxelsAlongZ;
|
||||
|
||||
G4double volumeOfVoxel, massOfVoxel;
|
||||
|
||||
G4Material *phantomMaterial, *detectorMaterial;
|
||||
G4Region* aRegion;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user