160 align::Alignables::const_iterator ideal = ideals.begin();
161 for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
162 if (
m_survey && (*alignable)->survey() ==
nullptr) {
163 throw cms::Exception(
"Alignment") <<
"SurveyDets must all be defined when writing to XML" << std::endl;
179 unsigned int rawId = (*alignable)->geomDetId().rawId();
189 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
193 outputFile <<
" <DTLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" 194 <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" layer=\"" <<
id.layer() <<
"\" />" 198 outputFile <<
" <DTSuperLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" 199 <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" />" << std::endl;
202 outputFile <<
" <DTChamber wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" 203 <<
id.sector() <<
"\" />" << std::endl;
209 outputFile <<
" <DTStation wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" />" 212 outputFile <<
" <DTWheel wheel=\"" <<
id.wheel() <<
"\" />" << std::endl;
216 throw cms::Exception(
"Alignment") <<
"Unknown DT Alignable StructureType" << std::endl;
227 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
231 outputFile <<
" <CSCLayer endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 232 <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" layer=\"" <<
id.layer() <<
"\" />" 236 outputFile <<
" <CSCChamber endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 237 <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" />" << std::endl;
241 outputFile <<
" <CSCRing endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 242 <<
id.ring() <<
"\" />" << std::endl;
244 outputFile <<
" <CSCStation endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" />" 247 outputFile <<
" <CSCEndcap endcap=\"" <<
id.endcap() <<
"\" />" << std::endl;
249 throw cms::Exception(
"Alignment") <<
"Unknown CSC Alignable StructureType" << std::endl;
259 pos = (*alignable)->survey()->position();
260 rot = (*alignable)->survey()->rotation();
269 if (ideal == ideals.end() || (*ideal)->alignableObjectId() != alignableObjectId ||
270 (*ideal)->id() != (*alignable)->id()) {
271 throw cms::Exception(
"Alignment") <<
"AlignableMuon and ideal_AlignableMuon are out of sync!" << std::endl;
282 bool csc_debug =
false;
283 if (csc_debug && !
DT) {
286 std::cout <<
" investigating " <<
id << std::endl
287 << (*alignable)->globalRotation() << std::endl
293 double phix = atan2(rot.
yz(), rot.
zz());
294 double phiy = asin(-rot.
xz());
295 double phiz = atan2(rot.
xy(), rot.
xx());
297 std::cout <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz << std::endl;
300 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" 301 << eulerAngles(3) << std::endl;
303 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" 304 << eulerAngles(3) << std::endl;
306 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" 307 << eulerAngles(3) << std::endl;
312 else if (
m_relativeto == 2 && (*alignable)->mother() !=
nullptr) {
325 outputFile <<
" <setposition relativeto=\"" << str_relativeto <<
"\" " 326 <<
"x=\"" << pos.
x() <<
"\" y=\"" << pos.
y() <<
"\" z=\"" << pos.
z() <<
"\" ";
330 outputFile <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3)
331 <<
"\" />" << std::endl;
337 double phix = atan2(rot.
yz(), rot.
zz());
338 double phiy = asin(-rot.
xz());
339 double phiz = atan2(rot.
xy(), rot.
xx());
341 outputFile <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz <<
"\" />" << std::endl;
348 <<
" xx=\"" <<
err(0, 0) <<
"\" xy=\"" <<
err(0, 1) <<
"\" xz=\"" <<
err(0, 2) <<
"\" xa=\"" 349 <<
err(0, 3) <<
"\" xb=\"" <<
err(0, 4) <<
"\" xc=\"" <<
err(0, 5) <<
"\" yy=\"" <<
err(1, 1)
350 <<
"\" yz=\"" <<
err(1, 2) <<
"\" ya=\"" <<
err(1, 3) <<
"\" yb=\"" <<
err(1, 4) <<
"\" yc=\"" 351 <<
err(1, 5) <<
"\" zz=\"" <<
err(2, 2) <<
"\" za=\"" <<
err(2, 3) <<
"\" zb=\"" <<
err(2, 4)
352 <<
"\" zc=\"" <<
err(2, 5) <<
"\" aa=\"" <<
err(3, 3) <<
"\" ab=\"" <<
err(3, 4) <<
"\" ac=\"" 353 <<
err(3, 5) <<
"\" bb=\"" <<
err(4, 4) <<
"\" bc=\"" <<
err(4, 5) <<
"\" cc=\"" <<
err(5, 5)
354 <<
"\" />" << std::endl;
357 else if (rawId != 0) {
358 CLHEP::HepSymMatrix err =
errors[(*alignable)->id()];
360 outputFile <<
" <setape xx=\"" <<
err(1, 1) <<
"\" xy=\"" <<
err(1, 2) <<
"\" xz=\"" <<
err(1, 3) <<
"\" xa=\"" 361 <<
err(1, 4) <<
"\" xb=\"" <<
err(1, 5) <<
"\" xc=\"" <<
err(1, 6) <<
"\" yy=\"" <<
err(2, 2)
362 <<
"\" yz=\"" <<
err(2, 3) <<
"\" ya=\"" <<
err(2, 4) <<
"\" yb=\"" <<
err(2, 5) <<
"\" yc=\"" 363 <<
err(2, 6) <<
"\" zz=\"" <<
err(3, 3) <<
"\" za=\"" <<
err(3, 4) <<
"\" zb=\"" <<
err(3, 5)
364 <<
"\" zc=\"" <<
err(3, 6) <<
"\" aa=\"" <<
err(4, 4) <<
"\" ab=\"" <<
err(4, 5) <<
"\" ac=\"" 365 <<
err(4, 6) <<
"\" bb=\"" <<
err(5, 5) <<
"\" bc=\"" <<
err(5, 6) <<
"\" cc=\"" <<
err(6, 6)
366 <<
"\" />" << std::endl;
369 outputFile <<
"</operation>" << std::endl << std::endl;
374 if (ideal != ideals.end()) {
bool m_suppressCSCEndcaps
bool m_suppressDTStations
bool m_suppressCSCChambers
Point3DBase< Scalar, GlobalTag > PositionType
bool m_suppressCSCStations
bool m_suppressDTChambers
bool m_suppressDTSuperLayers
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
AlgebraicVector EulerAngles
const char * idToString(align::StructureType type) const
void writeComponents(align::Alignables &alignables, align::Alignables &ideals, std::map< align::ID, CLHEP::HepSymMatrix > &errors, std::ofstream &outputFile, bool DT, const AlignableObjectId &) const
std::vector< Alignable * > Alignables
TkRotation transposed() const
math::Error< 6 >::type ErrorMatrix
const BasicVectorType & basicVector() const