12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Detector Definition and ResponseHaving the voxels filling completely the container volume allows to avoid the lengthy computation of ComputeStep()and ComputeSafety methods required in the traditional navigation algorithm. In this case, whena track is inside the parent volume, it has always to be inside one of the voxels and it will be only necessary tocalculate the distance to the walls of the current voxel.Skipping borders of voxels with same materialAnother speed optimisation can be provided by skipping the frontiers of two voxels which the same materialassigned, so that bigger steps can be done. This optimisation may be not very useful when the number of materialsis very big (in which case the probability of having contiguous voxels with same material is reduced), or when thephysical step is small compared to the voxel dimensions (very often the case of electrons). The optimisation canbe switched off in such cases, by invoking the following method with argument skip = 0:Phantoms with only one materialIf you want to describe a phantom of a unique material, you may spare some memory by not filling the set ofindices of materials of each voxel. If the method SetMaterialIndices() is not invoked, the index <strong>for</strong> allvoxels will be 0, that is the first (and unique) material in your list.G4RegularParameterisation::SetSkipEqualMaterials( G4bool skip );ExampleTo use the specialised navigation, it is required to first create an object of typeG4PhantomParameterisation:G4PhantomParameterisation* param = new G4PhantomParameterisation();Then, fill it with the all the necessary data:// Voxel dimensions in the three dimensions//G4double halfX = ...;G4double halfY = ...;G4double halfZ = ...;param->SetVoxelDimensions( halfX, halfY, halfZ );// Number of voxels in the three dimensions//G4int nVoxelX = ...;G4int nVoxelY = ...;G4int nVoxelZ = ...;param->SetNoVoxel( nVoxelX, nVoxelY, nVoxelZ );// Vector of materials of the voxels//std::vector < G4Material* > theMaterials;theMaterials.push_back( new G4Material( ...theMaterials.push_back( new G4Material( ...param->SetMaterials( theMaterials );// List of material indices// For each voxel it is a number that correspond to the index of its// material in the vector of materials defined above;//size_t* mateIDs = new size_t[nVoxelX*nVoxelY*nVoxelZ];mateIDs[0] = n0;mateIDs[1] = n1;...param->SetMaterialIndices( mateIDs );Then, define the volume that contains all the voxels:G4Box* cont_solid = new G4Box("PhantomContainer",nVoxelX*halfX.,nVoxelY*halfY.,nVoxelZ*halfZ);G4LogicalVolume* cont_logic =new G4LogicalVolume( cont_solid,matePatient, // material is not relevant here..."PhantomContainer",0, 0, 0 );103

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!