839 G4cout <<
"G4GMocrenFileSceneHandler::AddSolid(const G4Box&) : "
843 if( !IsVisible() ) { return ; }
859 for(
G4int i = 0; i < 12; i++) {
862 G4cout <<
" (" << v1.
x() <<
", "
867 << v2.
z() <<
") [" << next <<
"]"
878 if(kFlagParameterization != 2) {
883 if(pScBox != NULL) bMesh =
true;
884 if(bMesh) kFlagParameterization = 2;
886 << volName <<
" - " << bMesh <<
G4endl;
891 if (!pv_model) { return ; }
894 if (!pPVModel) { return ; }
906 G4cout <<
" density : " << dens <<
" [g/cm3]" <<
G4endl;
925 G4cout <<
"kVolumeTrans3D: " << trans1 << G4endl << rot1 <<
G4endl;
927 kVolumeTrans3D = kVolumeTrans3D*trot;
936 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
939 G4int dirAxis[3] = {-1,-1,-1};
940 G4int nDaughters[3] = {0,0,0};
944 nDaughters[0] = nReplicas;
946 case kXAxis: dirAxis[0] = 0;
break;
947 case kYAxis: dirAxis[0] = 1;
break;
948 case kZAxis: dirAxis[0] = 2;
break;
950 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
953 kNestedVolumeNames.push_back(pv[0]->
GetName());
956 <<
" # : " << nDaughters[0] <<
G4endl;
960 if(pv[0]->GetLogicalVolume()->GetNoDaughters()) {
961 G4cout <<
"# of daughters : "
972 if(pv[0]->GetLogicalVolume()->GetNoDaughters() == 0) {
973 kFlagParameterization = 1;
978 if(kFlagParameterization == 0) {
983 nDaughters[1] = nReplicas;
985 case kXAxis: dirAxis[1] = 0;
break;
986 case kYAxis: dirAxis[1] = 1;
break;
987 case kZAxis: dirAxis[1] = 2;
break;
989 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
992 kNestedVolumeNames.push_back(pv[1]->
GetName());
995 <<
" # : " << nDaughters[1]<<
G4endl;
1001 kNestedVolumeNames.push_back(pv[2]->
GetName());
1004 <<
" # : " << nDaughters[2] <<
G4endl;
1006 if(nDaughters[2] > 1) {
1009 if(nestPara == NULL)
1010 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1019 G4cout << trans0 <<
" - " << trans1 <<
" - " << diff <<
G4endl;
1021 if(diff.x() != 0.) dirAxis[2] = 0;
1022 else if(diff.y() != 0.) dirAxis[2] = 1;
1023 else if(diff.z() != 0.) dirAxis[2] = 2;
1025 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1026 "gMocren0009",
FatalException,
"Unexpected nested parameterisation");
1031 for(
G4int i = 0; i < 3; i++) {
1032 kNestedVolumeDimension[i] = nDaughters[i];
1034 kNestedVolumeDirAxis[i] = dirAxis[i];
1042 if(nestPara != NULL) {
1043 G4double prexyz[3] = {0.,0.,0.}, xyz[3] = {0.,0.,0.};
1044 for(
G4int n0 = 0; n0 < nDaughters[0]; n0++) {
1045 for(
G4int n1 = 0; n1 < nDaughters[1]; n1++) {
1046 for(
G4int n2 = 0; n2 < nDaughters[2]; n2++) {
1050 G4cout <<
" retrieve volume : copy # : " << n0
1051 <<
", " << n1 <<
", " << n2 <<
G4endl;
1057 G4cout <<
" density :" << dens <<
" [g/cm3]" <<
G4endl;
1061 xyz[0] = tbox.GetXHalfLength()/
mm;
1062 xyz[1] = tbox.GetYHalfLength()/
mm;
1063 xyz[2] = tbox.GetZHalfLength()/
mm;
1064 if(n0 != 0 || n1 != 0 || n2 != 0) {
1065 for(
G4int i = 0; i < 3; i++) {
1066 if(xyz[i] != prexyz[i])
1067 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1072 G4cout <<
" size : " << tbox.GetXHalfLength()/
mm <<
" x "
1073 << tbox.GetYHalfLength()/
mm <<
" x "
1074 << tbox.GetZHalfLength()/
mm <<
" [mm3]" <<
G4endl;
1077 idx[dirAxis[0]] = n0;
1078 idx[dirAxis[1]] = n1;
1079 idx[dirAxis[2]] = n2;
1080 Index3D i3d(idx[0],idx[1],idx[2]);
1081 kNestedModality[i3d] = dens;
1083 G4cout <<
" index: " << idx[0] <<
", " << idx[1] <<
", " << idx[2]
1084 <<
" density: " << dens <<
G4endl;
1086 for(
G4int i = 0; i < 3; i++) prexyz[i] = xyz[i];
1095 if(!kbSetModalityVoxelSize) {
1097 static_cast<G4float>(2*xyz[1]),
1098 static_cast<G4float>(2*xyz[2])};
1100 kVoxelDimension.
set(spacing[0], spacing[1], spacing[2]);
1101 kbSetModalityVoxelSize =
true;
1107 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1121 G4cout <<
" physical volume node id : "
1122 <<
"size: " << npvp <<
", PV name: ";
1123 for(
G4int i = 0; i < npvp; i++) {
1126 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->IsParameterised()
1128 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->IsReplicated();
1129 if(pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->GetParameterisation()) {
1131 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->GetParameterisation()->IsNested();
1134 << pPVModel->
GetDrawnPVPath()[i].GetPhysicalVolume()->GetCopyNo();
1143 G4Box * pbox =
dynamic_cast<G4Box *
>(pPVModel->
GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetLogicalVolume()->GetSolid());
1148 G4cout <<
" mother size ["
1149 << pPVModel->
GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetName()
1151 << pareDims[0] <<
" x "
1152 << pareDims[1] <<
" x "
1153 << pareDims[2] <<
" [mm3]"
1157 G4Box * boxP =
dynamic_cast<G4Box *
>(pPVModel->
GetDrawnPVPath()[npvp-1].GetPhysicalVolume()->GetLogicalVolume()->GetSolid());
1162 G4cout <<
" parameterised volume? ["
1163 << pPVModel->
GetDrawnPVPath()[npvp-1].GetPhysicalVolume()->GetName()
1165 << paraDims[0] <<
" x "
1166 << paraDims[1] <<
" x "
1167 << paraDims[2] <<
" [mm3] : "
1168 <<
G4int(pareDims[0]/paraDims[0]) <<
" x "
1169 <<
G4int(pareDims[1]/paraDims[1]) <<
" x "
1173 <<
" isn't a G4Box." <<
G4endl;
1179 }
else if(kFlagParameterization == 1) {
1184 if(phantomPara == NULL) {
1185 G4Exception(
"G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1191 kNestedVolumeDimension[0] = phantomPara->
GetNoVoxelX();
1192 kNestedVolumeDimension[1] = phantomPara->
GetNoVoxelY();
1193 kNestedVolumeDimension[2] = phantomPara->
GetNoVoxelZ();
1194 kNestedVolumeDirAxis[0] = 0;
1195 kNestedVolumeDirAxis[1] = 1;
1196 kNestedVolumeDirAxis[2] = 2;
1199 G4int nX = kNestedVolumeDimension[0];
1200 G4int nXY = kNestedVolumeDimension[0]*kNestedVolumeDimension[1];
1202 for(
G4int n0 = 0; n0 < kNestedVolumeDimension[0]; n0++) {
1203 for(
G4int n1 = 0; n1 < kNestedVolumeDimension[1]; n1++) {
1204 for(
G4int n2 = 0; n2 < kNestedVolumeDimension[2]; n2++) {
1206 G4int repNo = n0 + n1*nX + n2*nXY;
1212 idx[kNestedVolumeDirAxis[0]] = n0;
1213 idx[kNestedVolumeDirAxis[1]] = n1;
1214 idx[kNestedVolumeDirAxis[2]] = n2;
1215 Index3D i3d(idx[0],idx[1],idx[2]);
1216 kNestedModality[i3d] = dens;
1219 G4cout <<
" index: " << idx[0] <<
", " << idx[1] <<
", " << idx[2]
1220 <<
" density: " << dens <<
G4endl;
1231 if(!kbSetModalityVoxelSize) {
1236 kVoxelDimension.
set(spacing[0], spacing[1], spacing[2]);
1237 kbSetModalityVoxelSize =
true;
1245 if(!kFlagProcessedInteractiveScorer) {
1262 kNestedVolumeDimension[0] = nVoxels[2];
1263 kNestedVolumeDimension[1] = nVoxels[1];
1264 kNestedVolumeDimension[2] = nVoxels[0];
1265 kNestedVolumeDirAxis[0] = 2;
1266 kNestedVolumeDirAxis[1] = 1;
1267 kNestedVolumeDirAxis[2] = 0;
1270 for(
G4int n0 = 0; n0 < kNestedVolumeDimension[0]; n0++) {
1271 for(
G4int n1 = 0; n1 < kNestedVolumeDimension[1]; n1++) {
1272 for(
G4int n2 = 0; n2 < kNestedVolumeDimension[2]; n2++) {
1277 idx[kNestedVolumeDirAxis[0]] = n0;
1278 idx[kNestedVolumeDirAxis[1]] = n1;
1279 idx[kNestedVolumeDirAxis[2]] = n2;
1280 Index3D i3d(idx[0],idx[1],idx[2]);
1281 kNestedModality[i3d] = dens;
1289 G4cout <<
"Interactive Scorer : size - "
1290 << boxSize.
x()/
cm <<
" x "
1291 << boxSize.
y()/
cm <<
" x "
1292 << boxSize.
z()/
cm <<
" [cm3]" <<
G4endl;
1293 G4cout <<
"Interactive Scorer : # voxels - "
1294 << nVoxels[0] <<
" x "
1295 << nVoxels[1] <<
" x "
1298 kVolumeSize.
set(boxSize.
x()*2,
1303 if(!kbSetModalityVoxelSize) {
1305 static_cast<G4float>(boxSize.
y()*2/nVoxels[1]),
1306 static_cast<G4float>(boxSize.
z()*2/nVoxels[2])};
1309 kVoxelDimension.
set(spacing[0], spacing[1], spacing[2]);
1310 kbSetModalityVoxelSize =
true;
1320 kVolumeTrans3D = kVolumeTrans3D*sbtranslate;
1328 kVolumeTrans3D = kVolumeTrans3D*sbrotate;
1340 kVolumeTrans3D = kVolumeTrans3D*trotY*trotZ;
1345 kFlagProcessedInteractiveScorer =
true;
1358 if(kFlagParameterization == 0) {
1377 if(volName == box.
GetName()) {
1381 std::vector<G4String>::iterator itr = kNestedVolumeNames.begin();
1382 for(; itr != kNestedVolumeNames.end(); itr++) {
1388 }
else if(kFlagParameterization == 1) {
1399 if(volDSolidName == box.
GetName()) {
1403 }
else if(kFlagParameterization == 2) {
1408 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
static constexpr double g
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