722 const TString& volumePath, TString& shapeType, TArrayD& par)
728 G4String path = volumePath.Data();
729 G4int last1 = path.rfind(
'/');
730 G4int last2 = path.rfind(
'_');
731 G4String volName = path.substr(last1 + 1, last2 - last1 - 1);
732 G4String copyNoStr = path.substr(last2 + 1, path.length() - last2);
733 std::istringstream in(copyNoStr);
738 G4VPhysicalVolume* pv =
743 "Physical volume " + volumePath +
" does not exist.");
748 G4VSolid* solid = pv->GetLogicalVolume()->GetSolid();
751 Bool_t isReflected =
false;
752 G4ReflectedSolid* reflSolid =
dynamic_cast<G4ReflectedSolid*
>(solid);
754 solid = reflSolid->GetConstituentMovedSolid();
760 if (solid->GetEntityType() ==
"G4Box") {
764 G4Box* box = (G4Box*)solid;
765 par.AddAt(box->GetXHalfLength() / cm, 0);
766 par.AddAt(box->GetYHalfLength() / cm, 1);
767 par.AddAt(box->GetZHalfLength() / cm, 2);
771 if (solid->GetEntityType() ==
"G4Cons") {
775 G4Cons* cons = (G4Cons*)solid;
776 par.AddAt(cons->GetZHalfLength() / cm, 0);
778 par.AddAt(cons->GetInnerRadiusMinusZ() / cm, 1);
779 par.AddAt(cons->GetOuterRadiusMinusZ() / cm, 2);
780 par.AddAt(cons->GetInnerRadiusPlusZ() / cm, 3);
781 par.AddAt(cons->GetOuterRadiusPlusZ() / cm, 4);
784 par.AddAt(cons->GetInnerRadiusPlusZ() / cm, 1);
785 par.AddAt(cons->GetOuterRadiusPlusZ() / cm, 2);
786 par.AddAt(cons->GetInnerRadiusMinusZ() / cm, 3);
787 par.AddAt(cons->GetOuterRadiusMinusZ() / cm, 4);
789 par.AddAt(cons->GetStartPhiAngle() / deg, 5);
790 par.AddAt(cons->GetDeltaPhiAngle() / deg, 6);
794 if (solid->GetEntityType() ==
"G4EllipticalTube") {
798 G4EllipticalTube* eltu = (G4EllipticalTube*)solid;
799 par.AddAt(eltu->GetDx() / cm, 0);
800 par.AddAt(eltu->GetDy() / cm, 1);
801 par.AddAt(eltu->GetDz() / cm, 2);
806 if (solid->GetEntityType() ==
"G4Hype") {
810 G4Hype* hype = (G4Hype*)solid;
811 par.AddAt(hype->GetInnerRadius() / cm, 0);
812 par.AddAt(hype->GetOuterRadius() / cm, 1);
813 par.AddAt(hype->GetZHalfLength() / cm, 2);
814 par.AddAt(hype->GetInnerStereo(), 3);
815 par.AddAt(hype->GetOuterStereo(), 4);
821 if (solid->GetEntityType() ==
"G4Para") {
825 G4Para* para = (G4Para*)solid;
826 par.AddAt(para->GetXHalfLength() / cm, 0);
827 par.AddAt(para->GetYHalfLength() / cm, 1);
828 par.AddAt(para->GetZHalfLength() / cm, 2);
829 par.AddAt(atan(para->GetTanAlpha()) / deg, 3);
831 par.AddAt(para->GetSymAxis().theta() / deg, 4);
833 par.AddAt((M_PI - para->GetSymAxis().theta()) / deg, 4);
834 par.AddAt(para->GetSymAxis().phi() / deg, 5);
838 if (solid->GetEntityType() ==
"G4Polycone") {
840 G4Polycone* pcon = (G4Polycone*)solid;
841 Int_t nz = pcon->GetOriginalParameters()->Num_z_planes;
842 const Double_t* rmin = pcon->GetOriginalParameters()->Rmin;
843 const Double_t* rmax = pcon->GetOriginalParameters()->Rmax;
844 const Double_t* z = pcon->GetOriginalParameters()->Z_values;
847 par.AddAt(pcon->GetStartPhi() / deg, 0);
848 par.AddAt((pcon->GetEndPhi() - pcon->GetStartPhi()) / deg, 1);
849 par.AddAt(pcon->GetOriginalParameters()->Num_z_planes, 2);
850 for (Int_t i = 0; i < nz; i++) {
852 par.AddAt(z[i] / cm, 3 + 3 * i);
854 par.AddAt(-z[i] / cm, 3 + 3 * i);
855 par.AddAt(rmin[i] / cm, 3 + 3 * i + 1);
856 par.AddAt(rmax[i] / cm, 3 + 3 * i + 2);
861 if (solid->GetEntityType() ==
"G4Polyhedra") {
863 G4Polyhedra* pgon = (G4Polyhedra*)solid;
864 Int_t nz = pgon->GetOriginalParameters()->Num_z_planes;
865 const Double_t* rmin = pgon->GetOriginalParameters()->Rmin;
866 const Double_t* rmax = pgon->GetOriginalParameters()->Rmax;
867 const Double_t* z = pgon->GetOriginalParameters()->Z_values;
870 par.AddAt(pgon->GetStartPhi() / deg, 0);
871 par.AddAt((pgon->GetEndPhi() - pgon->GetStartPhi()) / deg, 1);
872 par.AddAt(pgon->GetOriginalParameters()->numSide, 2);
873 par.AddAt(pgon->GetOriginalParameters()->Num_z_planes, 3);
874 for (Int_t i = 0; i < nz; i++) {
876 par.AddAt(z[i] / cm, 4 + 3 * i);
878 par.AddAt(-z[i] / cm, 4 + 3 * i);
879 par.AddAt(rmin[i] / cm, 4 + 3 * i + 1);
880 par.AddAt(rmax[i] / cm, 4 + 3 * i + 2);
885 if (solid->GetEntityType() ==
"G4Sphere") {
889 G4Sphere* sphe = (G4Sphere*)solid;
890 par.AddAt(sphe->GetInnerRadius() / cm, 0);
891 par.AddAt(sphe->GetOuterRadius() / cm, 1);
893 par.AddAt(sphe->GetStartThetaAngle() / deg, 2);
895 par.AddAt((M_PI - sphe->GetStartThetaAngle()) / deg, 2);
896 par.AddAt(sphe->GetStartPhiAngle() / deg, 3);
897 par.AddAt(sphe->GetStartPhiAngle() / deg, 4);
898 par.AddAt(sphe->GetDeltaPhiAngle() / deg, 5);
904 if (solid->GetEntityType() ==
"G4Trap") {
908 G4Trap* trap = (G4Trap*)solid;
909 par.AddAt(trap->GetZHalfLength() / cm, 0);
911 par.AddAt(trap->GetSymAxis().theta() / deg, 1);
912 par.AddAt(trap->GetSymAxis().phi() / deg, 2);
913 par.AddAt(trap->GetYHalfLength1() / cm, 3);
914 par.AddAt(trap->GetXHalfLength1() / cm, 4);
915 par.AddAt(trap->GetXHalfLength2() / cm, 5);
916 par.AddAt(atan(trap->GetTanAlpha1()) / deg, 6);
917 par.AddAt(trap->GetYHalfLength2() / cm, 7);
918 par.AddAt(trap->GetXHalfLength3() / cm, 8);
919 par.AddAt(trap->GetXHalfLength4() / cm, 9);
922 par.AddAt(-(trap->GetSymAxis().theta()) / deg, 1);
923 par.AddAt(-(trap->GetSymAxis().phi()) / deg, 2);
924 par.AddAt(trap->GetYHalfLength2() / cm, 3);
925 par.AddAt(trap->GetXHalfLength3() / cm, 4);
926 par.AddAt(trap->GetXHalfLength4() / cm, 5);
927 par.AddAt(atan(trap->GetTanAlpha2()) / deg, 6);
928 par.AddAt(trap->GetYHalfLength1() / cm, 7);
929 par.AddAt(trap->GetXHalfLength1() / cm, 8);
930 par.AddAt(trap->GetXHalfLength2() / cm, 9);
931 par.AddAt(atan(trap->GetTanAlpha1()) / deg, 10);
936 if (solid->GetEntityType() ==
"G4Trd") {
940 G4Trd* trd2 = (G4Trd*)solid;
942 par.AddAt(trd2->GetXHalfLength1() / cm, 0);
943 par.AddAt(trd2->GetXHalfLength2() / cm, 1);
944 par.AddAt(trd2->GetYHalfLength1() / cm, 2);
945 par.AddAt(trd2->GetYHalfLength2() / cm, 3);
948 par.AddAt(trd2->GetXHalfLength2() / cm, 0);
949 par.AddAt(trd2->GetXHalfLength1() / cm, 1);
950 par.AddAt(trd2->GetYHalfLength2() / cm, 2);
951 par.AddAt(trd2->GetYHalfLength1() / cm, 3);
953 par.AddAt(trd2->GetZHalfLength() / cm, 4);
957 if (solid->GetEntityType() ==
"G4Tubs") {
961 G4Tubs* tubs = (G4Tubs*)solid;
962 par.AddAt(tubs->GetInnerRadius() / cm, 0);
963 par.AddAt(tubs->GetOuterRadius() / cm, 1);
964 par.AddAt(tubs->GetZHalfLength() / cm, 2);
965 par.AddAt(tubs->GetStartPhiAngle() / deg, 3);
966 par.AddAt(tubs->GetDeltaPhiAngle() / deg, 4);
971 if (solid->GetEntityType() ==
"G4TwistedTrap") {
975 G4TwistedTrap* trap = (G4TwistedTrap*)solid;
976 par.AddAt(trap->GetZHalfLength() / cm, 0);
978 par.AddAt(trap->GetPolarAngleTheta() / deg, 1);
979 par.AddAt(trap->GetAzimuthalAnglePhi() / deg, 2);
980 par.AddAt(trap->GetY1HalfLength() / cm, 3);
981 par.AddAt(trap->GetX1HalfLength() / cm, 4);
982 par.AddAt(trap->GetX2HalfLength() / cm, 5);
983 par.AddAt(trap->GetTiltAngleAlpha() / deg, 6);
984 par.AddAt(trap->GetY2HalfLength() / cm, 7);
985 par.AddAt(trap->GetX3HalfLength() / cm, 8);
986 par.AddAt(trap->GetX4HalfLength() / cm, 9);
987 par.AddAt(trap->GetTiltAngleAlpha() / deg, 10);
990 par.AddAt(-trap->GetPolarAngleTheta() / deg, 1);
991 par.AddAt(-trap->GetAzimuthalAnglePhi() / deg, 2);
992 par.AddAt(trap->GetY2HalfLength() / cm, 3);
993 par.AddAt(trap->GetX3HalfLength() / cm, 4);
994 par.AddAt(trap->GetX4HalfLength() / cm, 5);
995 par.AddAt(trap->GetTiltAngleAlpha() / deg, 6);
996 par.AddAt(trap->GetY1HalfLength() / cm, 7);
997 par.AddAt(trap->GetX1HalfLength() / cm, 8);
998 par.AddAt(trap->GetX2HalfLength() / cm, 9);
999 par.AddAt(trap->GetTiltAngleAlpha() / deg, 10);
1001 par.AddAt(trap->GetPhiTwist() / deg, 11);
1006 "Shape " + TString(solid->GetEntityType()) +
" not implemented.");