63 {
67 double rotX = record->
getDouble(
"ROTX") * Gaudi::Units::degree;
68 double rotY = record->
getDouble(
"ROTY") * Gaudi::Units::degree;
69 double rotZ = record->
getDouble(
"ROTZ") * Gaudi::Units::degree;
70 int rotOrder = record->
getInt(
"ROTORDER");
71
72
73 GeoTrf::Translate3D
transform(posX, posY, posZ);
74
75
76 if (rotX == 0 && rotY == 0 && rotZ == 0) {
78 }
79
80
81
82
83
84
85 int ixyz1 = rotOrder / 100 - 1;
86 int ixyz2 = (rotOrder % 100) / 10 - 1;
87 int ixyz3 = (rotOrder % 10) - 1;
88
89 if (ixyz1 < 0 || ixyz1 > 2 ||
90 ixyz2 < 0 || ixyz2 > 2 ||
91 ixyz3 < 0 || ixyz3 > 2) {
92 std::cout << "ERROR: Invalid rotation order:" << rotOrder << std::endl;
93 ixyz1 = 0;
94 ixyz2 = 1;
95 ixyz3 = 2;
96 }
97
98
99 GeoTrf::Transform3D* xformList[3] = {
100 nullptr, nullptr, nullptr
101 };
102 if (rotX != 0) xformList[0] = new GeoTrf::RotateX3D(rotX);
103 if (rotY != 0) xformList[1] = new GeoTrf::RotateY3D(rotY);
104 if (rotZ != 0) xformList[2] = new GeoTrf::RotateZ3D(rotZ);
105
106 GeoTrf::Transform3D
rotation(GeoTrf::Transform3D::Identity());
107 if (xformList[ixyz1])
rotation = *(xformList[ixyz1]) * rotation;
108 if (xformList[ixyz2])
rotation = *(xformList[ixyz2]) * rotation;
109 if (xformList[ixyz3])
rotation = *(xformList[ixyz3]) * rotation;
110
111 delete xformList[0];
112 delete xformList[1];
113 delete xformList[2];
114
116}
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
const GeoTrf::Transform3D & transform(const std::string &partName) const