166 align::Alignables::const_iterator ideal = ideals.begin();
167 for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
168 if (
m_survey && (*alignable)->survey() ==
nullptr) {
169 throw cms::Exception(
"Alignment") <<
"SurveyDets must all be defined when writing to XML" << std::endl;
194 unsigned int rawId = (*alignable)->geomDetId().rawId();
208 outputFile <<
" <DTLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" 209 <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" layer=\"" <<
id.layer() <<
"\" />" 213 outputFile <<
" <DTSuperLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" 214 <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" />" << std::endl;
217 outputFile <<
" <DTChamber wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" 218 <<
id.sector() <<
"\" />" << std::endl;
222 outputFile <<
" <DTStation wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" />" 225 outputFile <<
" <DTWheel wheel=\"" <<
id.wheel() <<
"\" />" << std::endl;
229 throw cms::Exception(
"Alignment") <<
"Unknown DT Alignable StructureType" << std::endl;
235 if (doDet ==
doCSC) {
244 outputFile <<
" <CSCLayer endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 245 <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" layer=\"" <<
id.layer() <<
"\" />" 249 outputFile <<
" <CSCChamber endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 250 <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" />" << std::endl;
254 outputFile <<
" <CSCRing endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 255 <<
id.ring() <<
"\" />" << std::endl;
257 outputFile <<
" <CSCStation endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" />" 260 outputFile <<
" <CSCEndcap endcap=\"" <<
id.endcap() <<
"\" />" << std::endl;
262 throw cms::Exception(
"Alignment") <<
"Unknown CSC Alignable StructureType" << std::endl;
268 if (doDet ==
doGEM) {
277 outputFile <<
" <GEMSuperChambers endcap=\"" <<
id.region() <<
"\" station=\"" <<
id.station()
278 <<
"\" ring=\"" <<
id.ring() <<
"\" superchamber=\"" <<
id.chamber() <<
"\" layer=\"" 279 <<
id.layer() <<
"\" />" << std::endl;
282 outputFile <<
" <GEMSuperChamber endcap=\"" <<
id.region() <<
"\" station=\"" <<
id.station()
283 <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" />" << std::endl;
287 outputFile <<
" <GEMRing endcap=\"" <<
id.region() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" 288 <<
id.ring() <<
"\" />" << std::endl;
290 outputFile <<
" <GEMStation endcap=\"" <<
id.region() <<
"\" station=\"" <<
id.station() <<
"\" />" 293 outputFile <<
" <GEMEndcap endcap=\"" <<
id.region() <<
"\" />" << std::endl;
295 throw cms::Exception(
"Alignment") <<
"Unknown GEM Alignable StructureType" << std::endl;
305 pos = (*alignable)->survey()->position();
306 rot = (*alignable)->survey()->rotation();
315 if (ideal == ideals.end() || (*ideal)->alignableObjectId() != alignableObjectId ||
316 (*ideal)->id() != (*alignable)->id()) {
317 throw cms::Exception(
"Alignment") <<
"AlignableMuon and ideal_AlignableMuon are out of sync!" << std::endl;
328 bool csc_debug =
false;
329 if (csc_debug && doDet ==
doCSC) {
332 std::cout <<
" investigating " <<
id << std::endl
333 << (*alignable)->globalRotation() << std::endl
339 double phix = atan2(
rot.yz(),
rot.zz());
340 double phiy = asin(-
rot.xz());
341 double phiz = atan2(
rot.xy(),
rot.xx());
343 std::cout <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz << std::endl;
346 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" 347 << eulerAngles(3) << std::endl;
349 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" 350 << eulerAngles(3) << std::endl;
352 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" 353 << eulerAngles(3) << std::endl;
358 else if (
m_relativeto == 2 && (*alignable)->mother() !=
nullptr) {
371 outputFile <<
" <setposition relativeto=\"" << str_relativeto <<
"\" " 372 <<
"x=\"" <<
pos.x() <<
"\" y=\"" <<
pos.y() <<
"\" z=\"" <<
pos.z() <<
"\" ";
376 outputFile <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3)
377 <<
"\" />" << std::endl;
383 double phix = atan2(
rot.yz(),
rot.zz());
384 double phiy = asin(-
rot.xz());
385 double phiz = atan2(
rot.xy(),
rot.xx());
387 outputFile <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz <<
"\" />" << std::endl;
394 <<
" xx=\"" <<
err(0, 0) <<
"\" xy=\"" <<
err(0, 1) <<
"\" xz=\"" <<
err(0, 2) <<
"\" xa=\"" 395 <<
err(0, 3) <<
"\" xb=\"" <<
err(0, 4) <<
"\" xc=\"" <<
err(0, 5) <<
"\" yy=\"" <<
err(1, 1)
396 <<
"\" yz=\"" <<
err(1, 2) <<
"\" ya=\"" <<
err(1, 3) <<
"\" yb=\"" <<
err(1, 4) <<
"\" yc=\"" 397 <<
err(1, 5) <<
"\" zz=\"" <<
err(2, 2) <<
"\" za=\"" <<
err(2, 3) <<
"\" zb=\"" <<
err(2, 4)
398 <<
"\" zc=\"" <<
err(2, 5) <<
"\" aa=\"" <<
err(3, 3) <<
"\" ab=\"" <<
err(3, 4) <<
"\" ac=\"" 399 <<
err(3, 5) <<
"\" bb=\"" <<
err(4, 4) <<
"\" bc=\"" <<
err(4, 5) <<
"\" cc=\"" <<
err(5, 5)
400 <<
"\" />" << std::endl;
403 else if (rawId != 0) {
404 CLHEP::HepSymMatrix
err =
errors[(*alignable)->id()];
406 outputFile <<
" <setape xx=\"" <<
err(1, 1) <<
"\" xy=\"" <<
err(1, 2) <<
"\" xz=\"" <<
err(1, 3) <<
"\" xa=\"" 407 <<
err(1, 4) <<
"\" xb=\"" <<
err(1, 5) <<
"\" xc=\"" <<
err(1, 6) <<
"\" yy=\"" <<
err(2, 2)
408 <<
"\" yz=\"" <<
err(2, 3) <<
"\" ya=\"" <<
err(2, 4) <<
"\" yb=\"" <<
err(2, 5) <<
"\" yc=\"" 409 <<
err(2, 6) <<
"\" zz=\"" <<
err(3, 3) <<
"\" za=\"" <<
err(3, 4) <<
"\" zb=\"" <<
err(3, 5)
410 <<
"\" zc=\"" <<
err(3, 6) <<
"\" aa=\"" <<
err(4, 4) <<
"\" ab=\"" <<
err(4, 5) <<
"\" ac=\"" 411 <<
err(4, 6) <<
"\" bb=\"" <<
err(5, 5) <<
"\" bc=\"" <<
err(5, 6) <<
"\" cc=\"" <<
err(6, 6)
412 <<
"\" />" << std::endl;
415 outputFile <<
"</operation>" << std::endl << std::endl;
420 if (ideal != ideals.end()) {
bool m_suppressCSCEndcaps
bool m_suppressDTStations
bool m_suppressGEMStations
bool m_suppressCSCChambers
bool m_suppressGEMEndcaps
Point3DBase< Scalar, GlobalTag > PositionType
TkRotation transposed() const
bool m_suppressCSCStations
bool m_suppressDTChambers
bool m_suppressGEMEtaPartitions
bool m_suppressDTSuperLayers
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
const BasicVectorType & basicVector() const
AlgebraicVector EulerAngles
const char * idToString(align::StructureType type) const
bool m_suppressGEMSuperChambers
std::vector< Alignable * > Alignables
math::Error< 6 >::type ErrorMatrix
void writeComponents(align::Alignables &alignables, align::Alignables &ideals, std::map< align::ID, CLHEP::HepSymMatrix > &errors, std::ofstream &outputFile, const int doDet, const AlignableObjectId &) const
bool m_suppressGEMChambers