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();
187 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
192 outputFile <<
" <DTLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" layer=\"" <<
id.layer() <<
"\" />" << std::endl;
196 outputFile <<
" <DTSuperLayer wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" superlayer=\"" <<
id.superlayer() <<
"\" />" << std::endl;
200 outputFile <<
" <DTChamber wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" sector=\"" <<
id.sector() <<
"\" />" << std::endl;
206 outputFile <<
" <DTStation wheel=\"" <<
id.wheel() <<
"\" station=\"" <<
id.station() <<
"\" />" << std::endl;
209 outputFile <<
" <DTWheel wheel=\"" <<
id.wheel() <<
"\" />" << std::endl;
214 else throw cms::Exception(
"Alignment") <<
"Unknown DT Alignable StructureType" << std::endl;
224 outputFile <<
" <" << typeName <<
" rawId=\"" << rawId <<
"\" />" << std::endl;
229 outputFile <<
" <CSCLayer endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" layer=\"" <<
id.layer() <<
"\" />" << std::endl;
233 outputFile <<
" <CSCChamber endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" chamber=\"" <<
id.chamber() <<
"\" />" << std::endl;
238 outputFile <<
" <CSCRing endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" ring=\"" <<
id.ring() <<
"\" />" << std::endl;
241 outputFile <<
" <CSCStation endcap=\"" <<
id.endcap() <<
"\" station=\"" <<
id.station() <<
"\" />" << std::endl;
244 outputFile <<
" <CSCEndcap endcap=\"" <<
id.endcap() <<
"\" />" << std::endl;
246 else throw cms::Exception(
"Alignment") <<
"Unknown CSC Alignable StructureType" << std::endl;
257 pos = (*alignable)->survey()->position();
258 rot = (*alignable)->survey()->rotation();
267 if (ideal == ideals.end() || (*ideal)->alignableObjectId() != alignableObjectId || (*ideal)->id() != (*alignable)->id()) {
268 throw cms::Exception(
"Alignment") <<
"AlignableMuon and ideal_AlignableMuon are out of sync!" << std::endl;
280 if (csc_debug && !
DT) {
283 std::cout<<
" investigating "<<
id<<std::endl<<(*alignable)->globalRotation()<<std::endl<<std::endl
284 <<idealRotation.
transposed()<<std::endl<<std::endl<<rot<<std::endl<<std::endl;
285 double phix = atan2(rot.
yz(), rot.
zz());
286 double phiy = asin(-rot.
xz());
287 double phiz = atan2(rot.
xy(), rot.
xx());
289 std::cout <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz << std::endl;
292 std::cout <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) << 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;
313 outputFile <<
" <setposition relativeto=\"" << str_relativeto <<
"\" "
314 <<
"x=\"" << pos.
x() <<
"\" y=\"" << pos.
y() <<
"\" z=\"" << pos.
z() <<
"\" ";
318 outputFile <<
"alpha=\"" << eulerAngles(1) <<
"\" beta=\"" << eulerAngles(2) <<
"\" gamma=\"" << eulerAngles(3) <<
"\" />" << std::endl;
324 double phix = atan2(rot.
yz(), rot.
zz());
325 double phiy = asin(-rot.
xz());
326 double phiz = atan2(rot.
xy(), rot.
xx());
328 outputFile <<
"phix=\"" << phix <<
"\" phiy=\"" << phiy <<
"\" phiz=\"" << phiz <<
"\" />" << std::endl;
335 <<
" xx=\"" << err(0,0) <<
"\" xy=\"" << err(0,1) <<
"\" xz=\"" << err(0,2) <<
"\" xa=\"" << err(0,3) <<
"\" xb=\"" << err(0,4) <<
"\" xc=\"" << err(0,5)
336 <<
"\" yy=\"" << err(1,1) <<
"\" yz=\"" << err(1,2) <<
"\" ya=\"" << err(1,3) <<
"\" yb=\"" << err(1,4) <<
"\" yc=\"" << err(1,5)
337 <<
"\" zz=\"" << err(2,2) <<
"\" za=\"" << err(2,3) <<
"\" zb=\"" << err(2,4) <<
"\" zc=\"" << err(2,5)
338 <<
"\" aa=\"" << err(3,3) <<
"\" ab=\"" << err(3,4) <<
"\" ac=\"" << err(3,5)
339 <<
"\" bb=\"" << err(4,4) <<
"\" bc=\"" << err(4,5)
340 <<
"\" cc=\"" << err(5,5) <<
"\" />" << std::endl;
343 else if (rawId != 0) {
344 CLHEP::HepSymMatrix err =
errors[(*alignable)->id()];
346 outputFile <<
" <setape xx=\"" << err(1,1) <<
"\" xy=\"" << err(1,2) <<
"\" xz=\"" << err(1,3)
347 <<
"\" yy=\"" << err(2,2) <<
"\" yz=\"" << err(2,3) <<
"\" zz=\"" << err(3,3) <<
"\" />" << std::endl;
350 outputFile <<
"</operation>" << std::endl << std::endl;
355 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
std::vector< Alignable * > Alignables
TkRotation transposed() const
math::Error< 6 >::type ErrorMatrix
static const char * idToString(align::StructureType type)
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