36 #include <Geant4/G4SystemOfUnits.hh>
54 G4RotationMatrix mat = mtx;
59 static const G4double kMatrixPrecision = 10
E-10;
60 const G4double cosb = std::sqrt(mtx.xx()*mtx.xx()+mtx.yx()*mtx.yx());
62 if (cosb > kMatrixPrecision)
64 x = std::atan2(mtx.zy(),mtx.zz());
65 y = std::atan2(-mtx.zx(),cosb);
66 z = std::atan2(mtx.yx(),mtx.xx());
70 x = std::atan2(-mtx.yz(),mtx.yy());
71 y = std::atan2(-mtx.zx(),cosb);
75 return G4ThreeVector(x,y,z);
80 const G4String&
name,
const G4ThreeVector& scl)
89 xercesc::DOMElement* scaleElement =
NewElement(tag);
90 scaleElement->setAttributeNode(
NewAttribute(
"name",name));
94 element->appendChild(scaleElement);
99 const G4String&
name,
const G4ThreeVector& rot)
105 xercesc::DOMElement* rotationElement =
NewElement(tag);
106 rotationElement->setAttributeNode(
NewAttribute(
"name",name));
110 rotationElement->setAttributeNode(
NewAttribute(
"unit",
"deg"));
111 element->appendChild(rotationElement);
116 const G4String&
name,
const G4ThreeVector&
pos)
122 xercesc::DOMElement* positionElement =
NewElement(tag);
123 positionElement->setAttributeNode(
NewAttribute(
"name",name));
127 positionElement->setAttributeNode(
NewAttribute(
"unit",
"mm"));
128 element->appendChild(positionElement);
133 std::cout <<
"PHG4GDML: Writing definitions..." << std::endl;