159 align::Alignables::const_iterator ideal = ideals.begin();
160 for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
162 throw cms::Exception(
"Alignment") <<
"SurveyDets must all be defined when writing to XML" << std::endl;
179 unsigned int rawId = (*alignable)->geomDetId().rawId();
185 std::string typeName = converter.
typeToName(alignableObjectId);
188 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
193 outputFile <<
" <DTLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" layer=\"" <<
id.layer() <<
"\" />" << std::endl;
197 outputFile <<
" <DTSuperLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" />" << std::endl;
201 outputFile <<
" <DTChamber wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" />" << std::endl;
207 outputFile <<
" <DTStation wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" />" << std::endl;
210 outputFile <<
" <DTWheel wheel=\"" <<
id.wheel() <<
"\" />" << std::endl;
215 else throw cms::Exception(
"Alignment") <<
"Unknown DT Alignable StructureType" << std::endl;
224 std::string typeName = converter.
typeToName(alignableObjectId);
226 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
231 outputFile <<
" <CSCLayer endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" layer=\"" <<
id.layer() <<
"\" />" << std::endl;
235 outputFile <<
" <CSCChamber endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" />" << std::endl;
240 outputFile <<
" <CSCRing endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" />" << std::endl;
243 outputFile <<
" <CSCStation endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" />" << std::endl;
246 outputFile <<
" <CSCEndcap endcap=\"" <<
id.endcap() <<
"\" />" << std::endl;
248 else throw cms::Exception(
"Alignment") <<
"Unknown CSC Alignable StructureType" << std::endl;
259 pos = (*alignable)->survey()->position();
260 rot = (*alignable)->survey()->rotation();
263 std::string str_relativeto;
265 str_relativeto = std::string(
"none");
269 if (ideal == ideals.end() || (*ideal)->alignableObjectId() != alignableObjectId || (*ideal)->id() != (*alignable)->id()) {
270 throw cms::Exception(
"Alignment") <<
"AlignableMuon and ideal_AlignableMuon are out of sync!" << std::endl;
279 str_relativeto = std::string(
"ideal");
282 if (csc_debug && !
DT) {
285 std::cout<<
" investigating "<<
id<<std::endl<<(*alignable)->globalRotation()<<std::endl<<std::endl
286 <<idealRotation.
transposed()<<std::endl<<std::endl<<rot<<std::endl<<std::endl;
287 double phix = atan2(rot.
yz(), rot.
zz());
288 double phiy = asin(-rot.
xz());
289 double phiz = atan2(rot.
xy(), rot.
xx());
291 std::cout <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz << std::endl;
294 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) << 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;
310 str_relativeto = std::string(
"container");
315 outputFile <<
" <setposition relativeto=\"" << str_relativeto <<
"\" "
316 <<
"x=\"" << pos.
x() <<
"\" y=\"" << pos.
y() <<
"\" z=\"" << pos.
z() <<
"\" ";
320 outputFile <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) <<
"\" />" << std::endl;
326 double phix = atan2(rot.
yz(), rot.
zz());
327 double phiy = asin(-rot.
xz());
328 double phiz = atan2(rot.
xy(), rot.
xx());
330 outputFile <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz <<
"\" />" << std::endl;
337 <<
" xx=\"" << err(0,0) <<
"\" xy=\"" << err(0,1) <<
"\" xz=\"" << err(0,2) <<
"\" xa=\"" << err(0,3) <<
"\" xb=\"" << err(0,4) <<
"\" xc=\"" << err(0,5)
338 <<
"\" yy=\"" << err(1,1) <<
"\" yz=\"" << err(1,2) <<
"\" ya=\"" << err(1,3) <<
"\" yb=\"" << err(1,4) <<
"\" yc=\"" << err(1,5)
339 <<
"\" zz=\"" << err(2,2) <<
"\" za=\"" << err(2,3) <<
"\" zb=\"" << err(2,4) <<
"\" zc=\"" << err(2,5)
340 <<
"\" aa=\"" << err(3,3) <<
"\" ab=\"" << err(3,4) <<
"\" ac=\"" << err(3,5)
341 <<
"\" bb=\"" << err(4,4) <<
"\" bc=\"" << err(4,5)
342 <<
"\" cc=\"" << err(5,5) <<
"\" />" << std::endl;
345 else if (rawId != 0) {
346 CLHEP::HepSymMatrix err =
errors[(*alignable)->id()];
348 outputFile <<
" <setape xx=\"" << err(1,1) <<
"\" xy=\"" << err(1,2) <<
"\" xz=\"" << err(1,3)
349 <<
"\" yy=\"" << err(2,2) <<
"\" yz=\"" << err(2,3) <<
"\" zz=\"" << err(3,3) <<
"\" />" << std::endl;
352 outputFile <<
"</operation>" << std::endl << std::endl;
357 if (ideal != ideals.end()) {
bool m_suppressCSCEndcaps
bool m_suppressDTStations
bool m_suppressCSCChambers
const std::string & typeToName(align::StructureType type) const
Convert type to name.
Point3DBase< Scalar, GlobalTag > PositionType
bool m_suppressCSCStations
bool m_suppressDTChambers
Allows conversion between type and name, and vice-versa.
bool m_suppressDTSuperLayers
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
AlgebraicVector EulerAngles
std::vector< Alignable * > Alignables
TkRotation transposed() const
math::Error< 6 >::type ErrorMatrix
const BasicVectorType & basicVector() const
void writeComponents(align::Alignables &alignables, align::Alignables &ideals, std::map< align::ID, CLHEP::HepSymMatrix > &errors, std::ofstream &outputFile, bool DT) const