10 #include "Math/GenVector/Cartesian3D.h"
11 #include "Math/GenVector/DisplacementVector3D.h"
20 using namespace geant_units::operators;
31 if ((name ==
"Rotation") &&
isLeftHanded(x, y, z, nmspace) == 0) {
33 }
else if ((name ==
"Rotation") &&
isLeftHanded(x, y, z, nmspace) == 1) {
35 msg +=
" left-handed rotation with a Rotation element. If";
36 msg +=
" you meant to make a reflection, use ReflectionRotation";
37 msg +=
" elements, otherwise, please check your matrix. Other";
38 msg +=
" errors may follow. Rotation matrix not created.";
39 edm::LogError(
"DetectorDescription_Parser_Rotation_and_Reflection")
41 }
else if (name ==
"ReflectionRotation" &&
isLeftHanded(x, y, z, nmspace) == 1) {
44 ev.
eval(nmspace, atts.find(
"thetaX")->second),
45 ev.
eval(nmspace, atts.find(
"phiX")->second),
46 ev.
eval(nmspace, atts.find(
"thetaY")->second),
47 ev.
eval(nmspace, atts.find(
"phiY")->second),
48 ev.
eval(nmspace, atts.find(
"thetaZ")->second),
49 ev.
eval(nmspace, atts.find(
"phiZ")->second));
50 }
else if (name ==
"ReflectionRotation" &&
isLeftHanded(x, y, z, nmspace) == 0) {
52 msg +=
" rotation using a ReflectionRotation element. ";
53 msg +=
" If you meant to make a Rotation, use Rotation";
54 msg +=
" elements, otherwise, please check your matrix.";
55 msg +=
" Other errors may follow. ReflectionRotation";
56 msg +=
" matrix not created.";
57 edm::LogError(
"DetectorDescription_Parser_Rotation_and_Reflection")
60 std::string msg =
"\nDDLRotationAndReflection::processElement tried to process wrong element.";
87 double check = (x.Cross(y)).Dot(z);
93 std::cout <<
"DDLRotationAndReflection Coordinate axes forming rotation matrix " <<
getDDName(nmspace)
94 <<
" are not orthonormal.(tolerance=" << tol <<
" check=" <<
std::abs(check) <<
")" << std::endl
95 <<
" thetaX=" << (atts.find(
"thetaX")->second) <<
' '
97 <<
" phiX=" << (atts.find(
"phiX")->second) <<
' '
99 <<
" thetaY=" << (atts.find(
"thetaY")->second) <<
' '
101 <<
" phiY=" << (atts.find(
"phiY")->second) <<
' '
103 <<
" thetaZ=" << (atts.find(
"thetaZ")->second) <<
' '
105 <<
" phiZ=" << (atts.find(
"phiZ")->second) <<
' '
107 <<
" WAS NOT CREATED!" << std::endl;
109 }
else if (1.0 + check <= tol) {
118 if (atts.find(
"thetaX") != atts.end()) {
120 double thetaX = ev.
eval(nmspace, atts.find(
"thetaX")->second);
121 double phiX = ev.
eval(nmspace, atts.find(
"phiX")->second);
123 x.SetX(
sin(thetaX) *
cos(phiX));
124 x.SetY(
sin(thetaX) *
sin(phiX));
133 if (atts.find(
"thetaY") != atts.end()) {
135 double thetaY = ev.
eval(nmspace, atts.find(
"thetaY")->second);
136 double phiY = ev.
eval(nmspace, atts.find(
"phiY")->second);
139 y.SetX(
sin(thetaY) *
cos(phiY));
140 y.SetY(
sin(thetaY) *
sin(phiY));
149 if (atts.find(
"thetaZ") != atts.end()) {
151 double thetaZ = ev.
eval(nmspace, atts.find(
"thetaZ")->second);
152 double phiZ = ev.
eval(nmspace, atts.find(
"phiZ")->second);
155 z.SetX(
sin(thetaZ) *
cos(phiZ));
156 z.SetY(
sin(thetaZ) *
sin(phiZ));
tuple ret
prodAgent to be discontinued
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
DDLElementRegistry * myRegistry_
constexpr NumType convertRadToDeg(NumType radians)
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
Sin< T >::type sin(const T &t)
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
DD3Vector makeZ(const std::string &nmspace)
std::map< std::string, std::string > DDXMLAttribute
Represents a uniquely identifyable rotation matrix.
DD3Vector makeX(const std::string &nmspace)
ClhepEvaluator & evaluator()
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
uint16_t const *__restrict__ x
int isLeftHanded(const DD3Vector &x, const DD3Vector &y, const DD3Vector &z, const std::string &nmspace)
returns 1 = left handed rotation matrix, 0 = right-handed, -1 = not orthonormal.
DDLRotationAndReflection(DDLElementRegistry *myreg)
This is a base class for processing XML elements in the DDD.
double eval(const std::string &ns, const std::string &expr)
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
DD3Vector makeY(const std::string &nmspace)