Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
RadioBio::DetectorConstruction Class Reference

Mandatory class for the construction of geometry. More...

#include <Doxymodules_medical.h>

Inheritance diagram for RadioBio::DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 DetectorConstruction ()
 
 ~DetectorConstruction ()
 
G4VPhysicalVolumeConstruct () override
 Method overriding pure virtual G4VUserDetectorConstruction one.
 
void ConstructSDandField () override
 Method overriding pure virtual G4VUserDetectorConstruction one.
 
void SetSize (G4double)
 Method to set the world volume to be cubical with given side.
 
void SetSize (G4ThreeVector)
 Method to set the world volume to be a box with given (potentially different) sides.
 
void SetSizeX (G4double x)
 Method to set the X width of the world volume.
 
void SetSizeY (G4double y)
 Method to set the Y width of the world volume.
 
void SetSizeZ (G4double z)
 Method to set the Z width of the world volume.
 
void SetMaterial (G4String mat)
 Method to set the world material.
 
const G4VPhysicalVolumeGetWorld ()
 Returns a pointer to the world physical volume.
 
G4double GetSizeX () const
 
G4double GetSizeY () const
 
G4double GetSizeZ () const
 
G4MaterialGetMaterial ()
 Returns a pointer to the world material.
 
void PrintParameters ()
 Prints on screen some parameters for this class.
 

Private Member Functions

G4VPhysicalVolumeConstructVolumes ()
 Private method to construct geometry.
 

Private Attributes

G4VPhysicalVolumefPBox = nullptr
 
G4LogicalVolumefLBox = nullptr
 
G4double fBoxSizeX = 1. * m
 
G4double fBoxSizeY = 1. * m
 
G4double fBoxSizeZ = 1. * m
 
G4MaterialfMaterial = nullptr
 
DetectorMessengerfDetectorMessenger = nullptr
 

Detailed Description

Mandatory class for the construction of geometry.

This class is used to create the world volume and keep track of some dimensions. World volume is the only one created and saved here, whereas voxels and sensitiveness are accounted for by another class.

Note
Different class will use some information to this class such as geometrical constraints on the simulation world volume.

Definition at line 127 of file Doxymodules_medical.h.

Constructor & Destructor Documentation

◆ DetectorConstruction()

RadioBio::DetectorConstruction::DetectorConstruction ( )

Definition at line 55 of file DetectorConstruction.cc.

56{
57 // Set the default box material
58 SetMaterial("G4_WATER");
59
60 // Create the messenger
61 fDetectorMessenger = new DetectorMessenger(this);
62
63 // Voxelize the detecctor with default size
64 VoxelizedSensitiveDetector::CreateInstance(this, 0.1 * m, 1 * m, 1 * m);
65}
void SetMaterial(G4String mat)
Method to set the world material.
static VoxelizedSensitiveDetector * CreateInstance(DetectorConstruction *det, double xWidth, double yWidth, double zWidth)
Static method to create the pointer to the only object existing in the simulation.

◆ ~DetectorConstruction()

RadioBio::DetectorConstruction::~DetectorConstruction ( )

Definition at line 69 of file DetectorConstruction.cc.

70{
71 delete fDetectorMessenger;
72}

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * RadioBio::DetectorConstruction::Construct ( )
override

Method overriding pure virtual G4VUserDetectorConstruction one.

Definition at line 76 of file DetectorConstruction.cc.

77{
78 return ConstructVolumes();
79}
G4VPhysicalVolume * ConstructVolumes()
Private method to construct geometry.

◆ ConstructSDandField()

void RadioBio::DetectorConstruction::ConstructSDandField ( )
override

Method overriding pure virtual G4VUserDetectorConstruction one.

Definition at line 83 of file DetectorConstruction.cc.

84{
86}
static VoxelizedSensitiveDetector * GetInstance()
Static method to retrieve a pointer to the only object existing in the simulation.
void ConstructSD()
Method to make the proper volume sensitive to allow scoring.

◆ SetSize() [1/2]

void RadioBio::DetectorConstruction::SetSize ( G4double  value)

Method to set the world volume to be cubical with given side.

Definition at line 166 of file DetectorConstruction.cc.

167{
168 SetSizeX(value);
169 SetSizeY(value);
170 SetSizeZ(value);
171}
void SetSizeY(G4double y)
Method to set the Y width of the world volume.
void SetSizeZ(G4double z)
Method to set the Z width of the world volume.
void SetSizeX(G4double x)
Method to set the X width of the world volume.

◆ SetSize() [2/2]

void RadioBio::DetectorConstruction::SetSize ( G4ThreeVector  size)

Method to set the world volume to be a box with given (potentially different) sides.

Definition at line 175 of file DetectorConstruction.cc.

176{
177 SetSizeX(size.getX());
178 SetSizeY(size.getY());
179 SetSizeZ(size.getZ());
180}

◆ SetSizeX()

void RadioBio::DetectorConstruction::SetSizeX ( G4double  x)

Method to set the X width of the world volume.

Parameters
xX width of the box

Definition at line 184 of file DetectorConstruction.cc.

185{
186 fBoxSizeX = sizeX;
187}

◆ SetSizeY()

void RadioBio::DetectorConstruction::SetSizeY ( G4double  y)

Method to set the Y width of the world volume.

Parameters
yY width of the box

Definition at line 191 of file DetectorConstruction.cc.

192{
193 fBoxSizeY = sizeY;
194}

◆ SetSizeZ()

void RadioBio::DetectorConstruction::SetSizeZ ( G4double  z)

Method to set the Z width of the world volume.

Parameters
zZ width of the box

Definition at line 198 of file DetectorConstruction.cc.

199{
200 fBoxSizeZ = sizeZ;
201}

◆ SetMaterial()

void RadioBio::DetectorConstruction::SetMaterial ( G4String  mat)

Method to set the world material.

Note
there will not be any different material throughout the whole simulation
Parameters
matstring containing the name of the material according to NIST database

Definition at line 140 of file DetectorConstruction.cc.

141{
142 // Search the material by its name
143 G4Material* pttoMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
144
145 if (pttoMaterial) {
146 if (fMaterial != pttoMaterial) {
147 fMaterial = pttoMaterial;
148 if (fLBox) {
149 fLBox->SetMaterial(pttoMaterial);
150 }
151 G4RunManager::GetRunManager()->PhysicsHasBeenModified();
152 }
153 }
154 else {
155 // Warning the user this material does not exist
156 std::stringstream sstr;
157 sstr << "material " << +materialChoice << " does not exist, keeping material "
158 << fMaterial->GetName();
159
160 G4Exception("DetectorConstruction::SetMaterial", "NoWorldMat", JustWarning, sstr.str().c_str());
161 }
162}

◆ GetWorld()

const G4VPhysicalVolume * RadioBio::DetectorConstruction::GetWorld ( )
inline

Returns a pointer to the world physical volume.

Definition at line 103 of file DetectorConstruction.hh.

103{ return fPBox; }

◆ GetSizeX()

G4double RadioBio::DetectorConstruction::GetSizeX ( ) const
inline

Definition at line 105 of file DetectorConstruction.hh.

105{ return fBoxSizeX; }

◆ GetSizeY()

G4double RadioBio::DetectorConstruction::GetSizeY ( ) const
inline

Definition at line 106 of file DetectorConstruction.hh.

106{ return fBoxSizeY; }

◆ GetSizeZ()

G4double RadioBio::DetectorConstruction::GetSizeZ ( ) const
inline

Definition at line 107 of file DetectorConstruction.hh.

107{ return fBoxSizeZ; }

◆ GetMaterial()

G4Material * RadioBio::DetectorConstruction::GetMaterial ( )
inline

Returns a pointer to the world material.

Definition at line 111 of file DetectorConstruction.hh.

112 {
113 return fMaterial;
114 }

◆ PrintParameters()

void RadioBio::DetectorConstruction::PrintParameters ( )

Prints on screen some parameters for this class.

Definition at line 128 of file DetectorConstruction.cc.

129{
130 G4cout << "\n The Box dimensions are: " << G4endl << "x: " << G4BestUnit(fBoxSizeX, "Length")
131 << G4endl << "y: " << G4BestUnit(fBoxSizeY, "Length") << G4endl
132 << "z: " << G4BestUnit(fBoxSizeZ, "Length") << G4endl;
133
134 G4cout << "And its volume therefore is: "
135 << fPBox->GetLogicalVolume()->GetSolid()->GetCubicVolume() / m3 << " m3" << G4endl;
136}

◆ ConstructVolumes()

G4VPhysicalVolume * RadioBio::DetectorConstruction::ConstructVolumes ( )
private

Private method to construct geometry.

Definition at line 90 of file DetectorConstruction.cc.

91{
92 // Cleanup old geometry
93 G4GeometryManager::GetInstance()->OpenGeometry();
94 G4PhysicalVolumeStore::GetInstance()->Clean();
95 G4LogicalVolumeStore::GetInstance()->Clean();
96 G4SolidStore::GetInstance()->Clean();
97
98 G4Box* sBox = new G4Box("Container", // its name
99 fBoxSizeX / 2, fBoxSizeY / 2, fBoxSizeZ / 2); // its dimensions
100
101 fLBox = new G4LogicalVolume(sBox, // its shape
102 fMaterial, // its material
103 fMaterial->GetName()); // its name
104
105 fPBox = new G4PVPlacement(0, // no rotation
106 G4ThreeVector(), // at (0,0,0)
107 fLBox, // its logical volume
108 fMaterial->GetName(), // its name
109 0, // its mother volume
110 false, // no boolean operation
111 0); // copy number
112
113 // Parameters for the world volume can be printed
114 // PrintParameters();
115
116 // Initialize pointer to world for voxelization
118
119 // Create Voxelized Geometry
121
122 // Always return the root volume
123 return fPBox;
124}
void InitializeWorldPtr(G4VPhysicalVolume *pWorld)
Method to properly initialize the pointer to the World physical volume.
void Construct()
Method to construct all the volumes for the voxelization of the geometry.

Member Data Documentation

◆ fPBox

G4VPhysicalVolume* RadioBio::DetectorConstruction::fPBox = nullptr
private

Definition at line 121 of file DetectorConstruction.hh.

◆ fLBox

G4LogicalVolume* RadioBio::DetectorConstruction::fLBox = nullptr
private

Definition at line 122 of file DetectorConstruction.hh.

◆ fBoxSizeX

G4double RadioBio::DetectorConstruction::fBoxSizeX = 1. * m
private

Definition at line 125 of file DetectorConstruction.hh.

◆ fBoxSizeY

G4double RadioBio::DetectorConstruction::fBoxSizeY = 1. * m
private

Definition at line 126 of file DetectorConstruction.hh.

◆ fBoxSizeZ

G4double RadioBio::DetectorConstruction::fBoxSizeZ = 1. * m
private

Definition at line 127 of file DetectorConstruction.hh.

◆ fMaterial

G4Material* RadioBio::DetectorConstruction::fMaterial = nullptr
private

Definition at line 130 of file DetectorConstruction.hh.

◆ fDetectorMessenger

DetectorMessenger* RadioBio::DetectorConstruction::fDetectorMessenger = nullptr
private

Definition at line 133 of file DetectorConstruction.hh.


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

Applications | User Support | Publications | Collaboration