163 align::Alignables::const_iterator ideal = ideals.begin();
164 for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
165 if (
m_survey && (*alignable)->survey() ==
nullptr) {
166 throw cms::Exception(
"Alignment") <<
"SurveyDets must all be defined when writing to XML" << std::endl;
183 unsigned int rawId = (*alignable)->geomDetId().rawId();
191 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
196 outputFile <<
" <DTLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" layer=\"" <<
id.layer() <<
"\" />" << std::endl;
200 outputFile <<
" <DTSuperLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" />" << std::endl;
204 outputFile <<
" <DTChamber wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" />" << std::endl;
210 outputFile <<
" <DTStation wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" />" << std::endl;
213 outputFile <<
" <DTWheel wheel=\"" <<
id.wheel() <<
"\" />" << std::endl;
218 else throw cms::Exception(
"Alignment") <<
"Unknown DT Alignable StructureType" << std::endl;
228 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
233 outputFile <<
" <CSCLayer endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" layer=\"" <<
id.layer() <<
"\" />" << std::endl;
237 outputFile <<
" <CSCChamber endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" />" << std::endl;
242 outputFile <<
" <CSCRing endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" />" << std::endl;
245 outputFile <<
" <CSCStation endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" />" << std::endl;
248 outputFile <<
" <CSCEndcap endcap=\"" <<
id.endcap() <<
"\" />" << std::endl;
250 else throw cms::Exception(
"Alignment") <<
"Unknown CSC Alignable StructureType" << std::endl;
261 pos = (*alignable)->survey()->position();
262 rot = (*alignable)->survey()->rotation();
271 if (ideal == ideals.end() || (*ideal)->alignableObjectId() != alignableObjectId || (*ideal)->id() != (*alignable)->id()) {
272 throw cms::Exception(
"Alignment") <<
"AlignableMuon and ideal_AlignableMuon are out of sync!" << std::endl;
283 bool csc_debug=
false;
284 if (csc_debug && !
DT) {
287 std::cout<<
" investigating "<<
id<<std::endl<<(*alignable)->globalRotation()<<std::endl<<std::endl
288 <<idealRotation.
transposed()<<std::endl<<std::endl<<rot<<std::endl<<std::endl;
289 double phix = atan2(rot.
yz(), rot.
zz());
290 double phiy = asin(-rot.
xz());
291 double phiz = atan2(rot.
xy(), rot.
xx());
293 std::cout <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz << std::endl;
296 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) << std::endl;
298 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) << std::endl;
300 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) << std::endl;
305 else if (
m_relativeto == 2 && (*alignable)->mother() !=
nullptr) {
317 outputFile <<
" <setposition relativeto=\"" << str_relativeto <<
"\" " 318 <<
"x=\"" << pos.
x() <<
"\" y=\"" << pos.
y() <<
"\" z=\"" << pos.
z() <<
"\" ";
322 outputFile <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) <<
"\" />" << std::endl;
328 double phix = atan2(rot.
yz(), rot.
zz());
329 double phiy = asin(-rot.
xz());
330 double phiz = atan2(rot.
xy(), rot.
xx());
332 outputFile <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz <<
"\" />" << std::endl;
339 <<
" xx=\"" << err(0,0) <<
"\" xy=\"" << err(0,1) <<
"\" xz=\"" << err(0,2) <<
"\" xa=\"" << err(0,3) <<
"\" xb=\"" << err(0,4) <<
"\" xc=\"" << err(0,5)
340 <<
"\" yy=\"" << err(1,1) <<
"\" yz=\"" << err(1,2) <<
"\" ya=\"" << err(1,3) <<
"\" yb=\"" << err(1,4) <<
"\" yc=\"" << err(1,5)
341 <<
"\" zz=\"" << err(2,2) <<
"\" za=\"" << err(2,3) <<
"\" zb=\"" << err(2,4) <<
"\" zc=\"" << err(2,5)
342 <<
"\" aa=\"" << err(3,3) <<
"\" ab=\"" << err(3,4) <<
"\" ac=\"" << err(3,5)
343 <<
"\" bb=\"" << err(4,4) <<
"\" bc=\"" << err(4,5)
344 <<
"\" cc=\"" << err(5,5) <<
"\" />" << std::endl;
347 else if (rawId != 0) {
349 CLHEP::HepSymMatrix err =
errors[(*alignable)->id()];
351 outputFile <<
" <setape xx=\"" << err(1,1) <<
"\" xy=\"" << err(1,2) <<
"\" xz=\"" << err(1,3) <<
"\" xa=\"" << err(1,4) <<
"\" xb=\"" << err(1,5) <<
"\" xc=\"" << err(1,6)
352 <<
"\" yy=\"" << err(2,2) <<
"\" yz=\"" << err(2,3) <<
"\" ya=\"" << err(2,4) <<
"\" yb=\"" << err(2,5) <<
"\" yc=\"" << err(2,6)
353 <<
"\" zz=\"" << err(3,3) <<
"\" za=\"" << err(3,4) <<
"\" zb=\"" << err(3,5) <<
"\" zc=\"" << err(3,6)
354 <<
"\" aa=\"" << err(4,4) <<
"\" ab=\"" << err(4,5) <<
"\" ac=\"" << err(4,6)
355 <<
"\" bb=\"" << err(5,5) <<
"\" bc=\"" << err(5,6)
356 <<
"\" cc=\"" << err(6,6) <<
"\" />" << std::endl;
359 outputFile <<
"</operation>" << std::endl << std::endl;
364 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