841 G4cout <<
"G4GMocrenFileSceneHandler::AddSolid(const G4Box&) : "
845 if( !IsVisible() ) { return ; }
861 for(
G4int i = 0; i < 12; i++) {
864 G4cout <<
" (" << v1.
x() <<
", "
869 << v2.
z() <<
") [" << next <<
"]"
880 if(kFlagParameterization != 2) {
885 if(pScBox != NULL) bMesh =
true;
886 if(bMesh) kFlagParameterization = 2;
888 << volName <<
" - " << bMesh <<
G4endl;
893 if (!pv_model) { return ; }
896 if (!pPVModel) { return ; }
908 G4cout <<
" density : " << dens <<
" [g/cm3]" <<
G4endl;
927 G4cout <<
"kVolumeTrans3D: " << trans1 << G4endl << rot1 <<
G4endl;
929 kVolumeTrans3D = kVolumeTrans3D*trot;
938 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
941 G4int dirAxis[3] = {-1,-1,-1};
942 G4int nDaughters[3] = {0,0,0};
946 nDaughters[0] = nReplicas;
948 case kXAxis: dirAxis[0] = 0;
break;
949 case kYAxis: dirAxis[0] = 1;
break;
950 case kZAxis: dirAxis[0] = 2;
break;
952 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
955 kNestedVolumeNames.push_back(pv[0]->
GetName());
958 <<
" # : " << nDaughters[0] <<
G4endl;
962 if(pv[0]->GetLogicalVolume()->GetNoDaughters()) {
963 G4cout <<
"# of daughters : "
974 if(pv[0]->GetLogicalVolume()->GetNoDaughters() == 0) {
975 kFlagParameterization = 1;
980 if(kFlagParameterization == 0) {
985 nDaughters[1] = nReplicas;
987 case kXAxis: dirAxis[1] = 0;
break;
988 case kYAxis: dirAxis[1] = 1;
break;
989 case kZAxis: dirAxis[1] = 2;
break;
991 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
994 kNestedVolumeNames.push_back(pv[1]->
GetName());
997 <<
" # : " << nDaughters[1]<<
G4endl;
1003 kNestedVolumeNames.push_back(pv[2]->
GetName());
1006 <<
" # : " << nDaughters[2] <<
G4endl;
1008 if(nDaughters[2] > 1) {
1011 if(nestPara == NULL)
1012 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1021 G4cout << trans0 <<
" - " << trans1 <<
" - " << diff <<
G4endl;
1023 if(diff.x() != 0.) dirAxis[2] = 0;
1024 else if(diff.y() != 0.) dirAxis[2] = 1;
1025 else if(diff.z() != 0.) dirAxis[2] = 2;
1027 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1028 "gMocren0009",
FatalException,
"Unexpected nested parameterisation");
1033 for(
G4int i = 0; i < 3; i++) {
1034 kNestedVolumeDimension[i] = nDaughters[i];
1036 kNestedVolumeDirAxis[i] = dirAxis[i];
1044 if(nestPara != NULL) {
1045 G4double prexyz[3] = {0.,0.,0.}, xyz[3] = {0.,0.,0.};
1046 for(
G4int n0 = 0; n0 < nDaughters[0]; n0++) {
1047 for(
G4int n1 = 0; n1 < nDaughters[1]; n1++) {
1048 for(
G4int n2 = 0; n2 < nDaughters[2]; n2++) {
1052 G4cout <<
" retrieve volume : copy # : " << n0
1053 <<
", " << n1 <<
", " << n2 <<
G4endl;
1059 G4cout <<
" density :" << dens <<
" [g/cm3]" <<
G4endl;
1063 xyz[0] = tbox.GetXHalfLength()/
mm;
1064 xyz[1] = tbox.GetYHalfLength()/
mm;
1065 xyz[2] = tbox.GetZHalfLength()/
mm;
1066 if(n0 != 0 || n1 != 0 || n2 != 0) {
1067 for(
G4int i = 0; i < 3; i++) {
1068 if(xyz[i] != prexyz[i])
1069 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1074 G4cout <<
" size : " << tbox.GetXHalfLength()/
mm <<
" x "
1075 << tbox.GetYHalfLength()/
mm <<
" x "
1076 << tbox.GetZHalfLength()/
mm <<
" [mm3]" <<
G4endl;
1079 idx[dirAxis[0]] = n0;
1080 idx[dirAxis[1]] = n1;
1081 idx[dirAxis[2]] = n2;
1082 Index3D i3d(idx[0],idx[1],idx[2]);
1083 kNestedModality[i3d] = dens;
1085 G4cout <<
" index: " << idx[0] <<
", " << idx[1] <<
", " << idx[2]
1086 <<
" density: " << dens <<
G4endl;
1088 for(
G4int i = 0; i < 3; i++) prexyz[i] = xyz[i];
1097 if(!kbSetModalityVoxelSize) {
1099 static_cast<G4float>(2*xyz[1]),
1100 static_cast<G4float>(2*xyz[2])};
1102 kVoxelDimension.
set(spacing[0], spacing[1], spacing[2]);
1103 kbSetModalityVoxelSize =
true;
1109 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1123 G4cout <<
" physical volume node id : "
1124 <<
"size: " << npvp <<
", PV name: ";
1125 for(
G4int i = 0; i < npvp; i++) {
1128 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->IsParameterised()
1130 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->IsReplicated();
1131 if(pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->GetParameterisation()) {
1133 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->GetParameterisation()->IsNested();
1136 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->GetCopyNo();
1145 G4Box * pbox =
dynamic_cast<G4Box *
>(pPVModel->
GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetLogicalVolume()->GetSolid());
1150 G4cout <<
" mother size ["
1151 << pPVModel->
GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetName()
1153 << pareDims[0] <<
" x "
1154 << pareDims[1] <<
" x "
1155 << pareDims[2] <<
" [mm3]"
1159 G4Box * boxP =
dynamic_cast<G4Box *
>(pPVModel->
GetDrawnPVPath()[npvp-1].GetPhysicalVolume()->GetLogicalVolume()->GetSolid());
1164 G4cout <<
" parameterised volume? ["
1165 << pPVModel->
GetDrawnPVPath()[npvp-1].GetPhysicalVolume()->GetName()
1167 << paraDims[0] <<
" x "
1168 << paraDims[1] <<
" x "
1169 << paraDims[2] <<
" [mm3] : "
1170 <<
G4int(pareDims[0]/paraDims[0]) <<
" x "
1171 <<
G4int(pareDims[1]/paraDims[1]) <<
" x "
1175 <<
" isn't a G4Box." <<
G4endl;
1181 }
else if(kFlagParameterization == 1) {
1186 if(phantomPara == NULL) {
1187 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1193 kNestedVolumeDimension[0] = phantomPara->
GetNoVoxelX();
1194 kNestedVolumeDimension[1] = phantomPara->
GetNoVoxelY();
1195 kNestedVolumeDimension[2] = phantomPara->
GetNoVoxelZ();
1196 kNestedVolumeDirAxis[0] = 0;
1197 kNestedVolumeDirAxis[1] = 1;
1198 kNestedVolumeDirAxis[2] = 2;
1201 G4int nX = kNestedVolumeDimension[0];
1202 G4int nXY = kNestedVolumeDimension[0]*kNestedVolumeDimension[1];
1204 for(
G4int n0 = 0; n0 < kNestedVolumeDimension[0]; n0++) {
1205 for(
G4int n1 = 0; n1 < kNestedVolumeDimension[1]; n1++) {
1206 for(
G4int n2 = 0; n2 < kNestedVolumeDimension[2]; n2++) {
1208 G4int repNo = n0 + n1*nX + n2*nXY;
1214 idx[kNestedVolumeDirAxis[0]] = n0;
1215 idx[kNestedVolumeDirAxis[1]] = n1;
1216 idx[kNestedVolumeDirAxis[2]] = n2;
1217 Index3D i3d(idx[0],idx[1],idx[2]);
1218 kNestedModality[i3d] = dens;
1221 G4cout <<
" index: " << idx[0] <<
", " << idx[1] <<
", " << idx[2]
1222 <<
" density: " << dens <<
G4endl;
1233 if(!kbSetModalityVoxelSize) {
1238 kVoxelDimension.
set(spacing[0], spacing[1], spacing[2]);
1239 kbSetModalityVoxelSize =
true;
1247 if(!kFlagProcessedInteractiveScorer) {
1264 kNestedVolumeDimension[0] = nVoxels[2];
1265 kNestedVolumeDimension[1] = nVoxels[1];
1266 kNestedVolumeDimension[2] = nVoxels[0];
1267 kNestedVolumeDirAxis[0] = 2;
1268 kNestedVolumeDirAxis[1] = 1;
1269 kNestedVolumeDirAxis[2] = 0;
1272 for(
G4int n0 = 0; n0 < kNestedVolumeDimension[0]; n0++) {
1273 for(
G4int n1 = 0; n1 < kNestedVolumeDimension[1]; n1++) {
1274 for(
G4int n2 = 0; n2 < kNestedVolumeDimension[2]; n2++) {
1279 idx[kNestedVolumeDirAxis[0]] = n0;
1280 idx[kNestedVolumeDirAxis[1]] = n1;
1281 idx[kNestedVolumeDirAxis[2]] = n2;
1282 Index3D i3d(idx[0],idx[1],idx[2]);
1283 kNestedModality[i3d] = dens;
1291 G4cout <<
"Interactive Scorer : size - "
1292 << boxSize.
x()/
cm <<
" x "
1293 << boxSize.
y()/
cm <<
" x "
1294 << boxSize.
z()/
cm <<
" [cm3]" <<
G4endl;
1295 G4cout <<
"Interactive Scorer : # voxels - "
1296 << nVoxels[0] <<
" x "
1297 << nVoxels[1] <<
" x "
1300 kVolumeSize.
set(boxSize.
x()*2,
1305 if(!kbSetModalityVoxelSize) {
1307 static_cast<G4float>(boxSize.
y()*2/nVoxels[1]),
1308 static_cast<G4float>(boxSize.
z()*2/nVoxels[2])};
1311 kVoxelDimension.
set(spacing[0], spacing[1], spacing[2]);
1312 kbSetModalityVoxelSize =
true;
1322 kVolumeTrans3D = kVolumeTrans3D*sbtranslate;
1330 kVolumeTrans3D = kVolumeTrans3D*sbrotate;
1342 kVolumeTrans3D = kVolumeTrans3D*trotY*trotZ;
1347 kFlagProcessedInteractiveScorer =
true;
1360 if(kFlagParameterization == 0) {
1379 if(volName == box.
GetName()) {
1383 std::vector<G4String>::iterator itr = kNestedVolumeNames.begin();
1384 for(; itr != kNestedVolumeNames.end(); itr++) {
1390 }
else if(kFlagParameterization == 1) {
1401 if(volDSolidName == box.
GetName()) {
1405 }
else if(kFlagParameterization == 2) {
1410 if(bAddDet) AddDetector(box);
void set(double x, double y, double z)
virtual G4Material * ComputeMaterial(G4VPhysicalVolume *currentVol, const G4int repNo, const G4VTouchable *parentTouch=0)=0
G4VModel * GetModel() const
void GetNumberOfSegments(G4int nSegment[3])
G4double GetXHalfLength() const
G4RotationMatrix GetRotationMatrix() const
static constexpr double mm
virtual G4bool IsNested() const
virtual G4bool IsReplicated() const =0
G4bool GetNextEdge(G4Point3D &p1, G4Point3D &p2, G4int &edgeFlag) const
const G4String & GetName() const
G4Material * GetCurrentMaterial() const
G4double GetDensity() const
virtual G4String getVolumeName()
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
const G4String & GetName() const
G4Transform3D fObjectTransformation
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
static constexpr double rad
const std::vector< G4PhysicalVolumeNodeID > & GetDrawnPVPath() const
HepPolyhedron & Transform(const G4Transform3D &t)
G4ThreeVector GetSize() const
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
G4int GetCurrentDepth() const
G4double GetZHalfLength() const
G4Polyhedron * CreatePolyhedron() const
size_t GetNoVoxelZ() const
HepRotation inverse() const
virtual G4bool getDrawVolumeGrid()
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
G4ThreeVector GetTranslation() const
static constexpr double cm
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual void ComputeTransformation(const G4int no, G4VPhysicalVolume *currentPV) const =0
G4double GetYHalfLength() const
G4double GetVoxelHalfY() const
static constexpr double cm3
G4int GetNoDaughters() const
void setVoxelSpacing(float _spacing[3])
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4VPhysicalVolume * GetTopPhysicalVolume() const
virtual G4bool IsParameterised() const =0
size_t GetNoVoxelY() const
G4LogicalVolume * GetLogicalVolume() const
G4double GetVoxelHalfX() const
virtual G4int GetCopyNo() const =0
virtual G4int GetMultiplicity() const
static Verbosity GetVerbosity()
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
G4double GetVoxelHalfZ() const
static constexpr double pi
size_t GetNoVoxelX() const
static G4ScoringManager * GetScoringManager()
G4ThreeVector GetObjectTranslation() const
G4VPhysicalVolume * GetCurrentPV() const