89 if( params.size() < 8 ) {
91 " There must be at least 8 parameter: SOLID_TYPE POS_X POS_Y POS_Z " 92 "ANG_X ANG_Y ANG_Z SOLID_PARAM_1 (SOLID_PARAM_2 ...)",
94 G4String(
"Number of parameters given = " +
107 std::vector<double> angles;
115 if( params.size() !=1 )
122 " needs 1 argument: VOLUME_NAME").c_str());
152 G4String thePhantomFileName =
"phantom.g4pdcm";
153 fout.open(thePhantomFileName);
154 std::vector<G4Material*> materials = thePhantomParam->GetMaterials();
156 for(
unsigned int ii = 0; ii < materials.size(); ii++ ) {
157 fout << ii <<
" " << materials[ii]->GetName() <<
G4endl;
161 G4int nx = thePhantomParam->GetNoVoxelX();
162 G4int ny = thePhantomParam->GetNoVoxelY();
163 G4int nz = thePhantomParam->GetNoVoxelZ();
166 G4double voxelHalfWidthX = thePhantomParam->GetVoxelHalfX();
167 G4double voxelHalfWidthY = thePhantomParam->GetVoxelHalfY();
168 G4double voxelHalfWidthZ = thePhantomParam->GetVoxelHalfZ();
171 fout << nx <<
" " << ny <<
" " << nz <<
G4endl;
172 fout << -voxelHalfWidthX*nx+thePhantomTransform.NetTranslation().x() <<
" " 173 << voxelHalfWidthX*nx+thePhantomTransform.NetTranslation().x() <<
G4endl;
174 fout << -voxelHalfWidthY*ny+thePhantomTransform.NetTranslation().y() <<
" " 175 << voxelHalfWidthY*ny+thePhantomTransform.NetTranslation().y() <<
G4endl;
176 fout << -voxelHalfWidthZ*nz+thePhantomTransform.NetTranslation().z() <<
" " 177 << voxelHalfWidthZ*nz+thePhantomTransform.NetTranslation().z() <<
G4endl;
180 for(
G4int iy = 0; iy < ny; iy++) {
182 G4bool bPrevVoxelInside =
true;
183 G4bool b1VoxelFoundInside =
false;
184 G4int firstVoxel = -1;
185 G4int lastVoxel = -1;
186 for(
G4int ix = 0; ix < nx; ix++ ){
188 (-ny+iy*2+1)*voxelHalfWidthY, (-nz+
iz*2+1)*voxelHalfWidthZ);
190 G4bool bVoxelIsInside =
true;
191 for(
G4int ivx = -1; ivx <= 1; ivx+=2 ) {
192 for(
G4int ivy = -1; ivy <= 1; ivy+=2 ){
193 for(
G4int ivz = -1; ivz <= 1; ivz+=2 ) {
195 + ivx*voxelHalfWidthX*axisX +
196 ivy*voxelHalfWidthY*axisY + ivz*voxelHalfWidthZ*axisZ;
198 bVoxelIsInside =
false;
203 if( !bVoxelIsInside )
break;
205 if( !bVoxelIsInside )
break;
208 G4int copyNo = ix + nx*iy + nxy*
iz;
209 if( bVoxelIsInside ) {
210 if( !bPrevVoxelInside ) {
214 "Volume cannot intersect phantom in discontiguous voxels, " 215 "please use other voxel");
217 if( !b1VoxelFoundInside ) {
219 b1VoxelFoundInside =
true;
228 fout << firstVoxel <<
" " << lastVoxel <<
G4endl;
233 for(
G4int iz = 0; iz < nz; iz++ ){
234 for(
G4int iy = 0; iy < ny; iy++) {
236 for(
G4int ix = 0; ix < nx; ix++ ){
237 size_t copyNo = ix + ny*iy + nxy*
iz;
240 fout << thePhantomParam->GetMaterialIndex(copyNo)<<
" ";
249 for(
G4int iz = 0; iz < nz; iz++ ){
250 for(
G4int iy = 0; iy < ny; iy++) {
252 for(
G4int ix = 0; ix < nx; ix++ ){
253 size_t copyNo = ix + ny*iy + nxy*
iz;
255 fout <<thePhantomParam->GetMaterial(copyNo)->GetDensity()/
g*
cm3<<
" ";
const G4RotationMatrix * GetFrameRotation() const
const G4String & GetCommandName() const
std::vector< G4String > GetWordsInString(const G4String &stemp)
CLHEP::Hep3Vector G4ThreeVector
HepRotation & rotateX(double delta)
CLHEP::HepRotation G4RotationMatrix
G4ThreeVector GetFrameTranslation() const
G4UIcmdWithAString * fUserVolumeCmd
static G4String ConvertToString(G4bool boolVal)
HepRotation & rotateY(double delta)
virtual EInside Inside(const G4ThreeVector &p) const =0
static G4double ConvertToDouble(const char *st)
void BuildG4Solid(std::vector< G4String > params)
G4PhantomParameterisation * GetPhantomParam(G4bool bMustExist)
G4UIcmdWithAString * fG4VolumeCmd
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void BuildUserSolid(std::vector< G4String > params)
const G4String & GetCommandPath() const
std::vector< G4VPhysicalVolume * > GetPhysicalVolumes(const G4String &name, bool exists, G4int nVols)
static const G4double pos