@@ -784,25 +784,27 @@ void DDCoreToDDXMLOutput::position(const TGeoVolume& parent,
784784 xos << " <rChild name=\" " << childVolName << " \" />" << std::endl;
785785
786786 const auto matrix = child.GetMatrix ();
787- if (matrix != nullptr && !matrix->IsIdentity ()) {
788- auto rot = matrix->GetRotationMatrix ();
789- if (cms::rotation_utils::rotHash (rot) != cms::rotation_utils::identityHash) {
790- std::string rotNameStr = cms::rotation_utils::rotName (rot, context);
791- if (rotNameStr == " NULL" ) {
792- rotNameStr = child.GetName (); // Phys vol name
793- rotNameStr += parent.GetName ();
794- cms::DDNamespace nameSpace (context);
795- cms::rotation_utils::addRotWithNewName (nameSpace, rotNameStr, rot);
787+ if (matrix != nullptr ) {
788+ if (!matrix->IsIdentity ()) {
789+ auto rot = matrix->GetRotationMatrix ();
790+ if (cms::rotation_utils::rotHash (rot) != cms::rotation_utils::identityHash) {
791+ std::string rotNameStr = cms::rotation_utils::rotName (rot, context);
792+ if (rotNameStr == " NULL" ) {
793+ rotNameStr = child.GetName (); // Phys vol name
794+ rotNameStr += parent.GetName ();
795+ cms::DDNamespace nameSpace (context);
796+ cms::rotation_utils::addRotWithNewName (nameSpace, rotNameStr, rot);
797+ }
798+ xos << " <rRotation name=\" " << rotNameStr << " \" />" << std::endl;
796799 }
797- xos << " <rRotation name=\" " << rotNameStr << " \" />" << std::endl;
798800 }
801+ auto trans = matrix->GetTranslation ();
802+ using namespace cms_rounding ;
803+ xos << " <Translation x=\" " << roundIfNear0 (trans[0 ]) << " *mm\" " ;
804+ xos << " y=\" " << roundIfNear0 (trans[1 ]) << " *mm\" " ;
805+ xos << " z=\" " << roundIfNear0 (trans[2 ]) << " *mm\" " ;
806+ xos << " />" << std::endl;
799807 }
800- auto trans = matrix->GetTranslation ();
801- using namespace cms_rounding ;
802- xos << " <Translation x=\" " << roundIfNear0 (trans[0 ]) << " *mm\" " ;
803- xos << " y=\" " << roundIfNear0 (trans[1 ]) << " *mm\" " ;
804- xos << " z=\" " << roundIfNear0 (trans[2 ]) << " *mm\" " ;
805- xos << " />" << std::endl;
806808 xos << " </PosPart>" << std::endl;
807809}
808810
0 commit comments