19 #include "xercesc/parsers/XercesDOMParser.hpp"
20 #include "xercesc/dom/DOM.hpp"
21 #include "xercesc/sax/HandlerBase.hpp"
22 #include "xercesc/util/XMLString.hpp"
23 #include "xercesc/util/PlatformUtils.hpp"
24 #include "xercesc/util/XercesDefs.hpp"
49 : m_fileName(
fileName), idealGeometryLabel(idealLabel) {
53 str_name = XMLString::transcode(
"name");
74 str_rawId = XMLString::transcode(
"rawId");
75 str_wheel = XMLString::transcode(
"wheel");
79 str_layer = XMLString::transcode(
"layer");
81 str_ring = XMLString::transcode(
"ring");
83 str_axisx = XMLString::transcode(
"axisx");
84 str_axisy = XMLString::transcode(
"axisy");
85 str_axisz = XMLString::transcode(
"axisz");
86 str_angle = XMLString::transcode(
"angle");
87 str_x = XMLString::transcode(
"x");
88 str_y = XMLString::transcode(
"y");
89 str_z = XMLString::transcode(
"z");
90 str_phix = XMLString::transcode(
"phix");
91 str_phiy = XMLString::transcode(
"phiy");
92 str_phiz = XMLString::transcode(
"phiz");
93 str_alpha = XMLString::transcode(
"alpha");
94 str_beta = XMLString::transcode(
"beta");
95 str_gamma = XMLString::transcode(
"gamma");
96 str_rphi = XMLString::transcode(
"rphi");
97 str_phi = XMLString::transcode(
"phi");
98 str_xx = XMLString::transcode(
"xx");
99 str_xy = XMLString::transcode(
"xy");
100 str_xz = XMLString::transcode(
"xz");
101 str_xa = XMLString::transcode(
"xa");
102 str_xb = XMLString::transcode(
"xb");
103 str_xc = XMLString::transcode(
"xc");
104 str_yy = XMLString::transcode(
"yy");
105 str_yz = XMLString::transcode(
"yz");
106 str_ya = XMLString::transcode(
"ya");
107 str_yb = XMLString::transcode(
"yb");
108 str_yc = XMLString::transcode(
"yc");
109 str_zz = XMLString::transcode(
"zz");
110 str_za = XMLString::transcode(
"za");
111 str_zb = XMLString::transcode(
"zb");
112 str_zc = XMLString::transcode(
"zc");
113 str_aa = XMLString::transcode(
"aa");
114 str_ab = XMLString::transcode(
"ab");
115 str_ac = XMLString::transcode(
"ac");
116 str_bb = XMLString::transcode(
"bb");
117 str_bc = XMLString::transcode(
"bc");
118 str_cc = XMLString::transcode(
"cc");
119 str_none = XMLString::transcode(
"none");
120 str_ideal = XMLString::transcode(
"ideal");
222 for (align::Alignables::const_iterator ali = alignables.begin(); ali != alignables.end(); ++ali) {
229 alignableNavigator[(*ali)->geomDetId().rawId()] = *ali;
238 align::Alignables::const_iterator alignable = alignables.begin();
239 align::Alignables::const_iterator ideal = ideals.begin();
241 while (alignable != alignables.end() && ideal != ideals.end()) {
242 alitoideal[*alignable] = *ideal;
244 fillAliToIdeal(alitoideal, (*alignable)->components(), (*ideal)->components());
250 if (alignable != alignables.end() || ideal != ideals.end()) {
252 <<
"alignable and ideal-alignable trees are out of sync (this should never happen)";
263 std::map<unsigned int, Alignable *> alignableNavigator;
268 std::map<unsigned int, Alignable *> ideal_alignableNavigator;
269 recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->DTBarrel());
270 recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());
274 }
catch (
const XMLException &toCatch) {
275 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw an exception on initialization." << std::endl;
278 XercesDOMParser *
parser =
new XercesDOMParser();
279 parser->setValidationScheme(XercesDOMParser::Val_Always);
281 XERCES_CPP_NAMESPACE::ErrorHandler *errHandler = (XERCES_CPP_NAMESPACE::ErrorHandler *)(
new HandlerBase());
282 parser->setErrorHandler(errHandler);
286 }
catch (
const XMLException &toCatch) {
287 char *message = XMLString::transcode(toCatch.getMessage());
288 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw this exception: " << message << std::endl;
289 }
catch (
const DOMException &toCatch) {
290 char *message = XMLString::transcode(toCatch.msg);
291 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw this exception: " << message << std::endl;
292 }
catch (
const SAXException &toCatch) {
293 char *message = XMLString::transcode(toCatch.getMessage());
294 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw this exception: " << message << std::endl;
297 DOMDocument *
doc =
parser->getDocument();
298 DOMElement *node_MuonAlignment =
doc->getDocumentElement();
302 std::map<Alignable *, Alignable *> alitoideal;
307 std::map<std::string, std::map<Alignable *, bool> > alicollections;
310 if (
collection->getParentNode() == node_MuonAlignment) {
314 if (node_name ==
nullptr) {
315 throw cms::Exception(
"XMLException") <<
"<collection> requires a name attribute" << std::endl;
317 char *ascii_name = XMLString::transcode(node_name->getValue());
321 std::map<Alignable *, bool> aliset;
322 for (
unsigned int j = 0;
j <
children->getLength();
j++) {
325 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
326 Alignable *ali =
getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
327 if (ali ==
nullptr) {
328 throw cms::Exception(
"XMLException") <<
"<collection> must contain only alignables" << std::endl;
335 alicollections[
name] = aliset;
339 for (
unsigned int i = 0;
i < operations->getLength();
i++) {
340 DOMElement *operation = (DOMElement *)(operations->item(
i));
341 if (operation->getParentNode() != node_MuonAlignment) {
342 throw cms::Exception(
"XMLException") <<
"All operations must be top-level elements" << std::endl;
345 DOMNodeList *
children = operation->getChildNodes();
347 std::map<Alignable *, bool> aliset;
348 std::vector<DOMNode *> nodesToRemove;
349 for (
unsigned int j = 0;
j <
children->getLength();
j++) {
352 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
353 Alignable *ali =
getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
354 if (ali !=
nullptr) {
356 nodesToRemove.push_back(node);
360 DOMAttr *node_name = ((DOMElement *)(node))->getAttributeNode(
str_name);
361 if (node_name ==
nullptr) {
362 throw cms::Exception(
"XMLException") <<
"<collection> requires a name attribute" << std::endl;
364 char *ascii_name = XMLString::transcode(node_name->getValue());
368 std::map<std::string, std::map<Alignable *, bool> >::const_iterator alicollections_iter =
369 alicollections.find(
name);
370 if (alicollections_iter == alicollections.end()) {
372 <<
"<collection name=\"" <<
name <<
"\"> hasn't been defined" << std::endl;
375 for (std::map<Alignable *, bool>::const_iterator aliiter = alicollections_iter->second.begin();
376 aliiter != alicollections_iter->second.end();
378 aliset[aliiter->first] =
true;
381 nodesToRemove.push_back(node);
391 for (std::vector<DOMNode *>::const_iterator node = nodesToRemove.begin(); node != nodesToRemove.end(); ++node) {
392 operation->removeChild(*node);
394 children = operation->getChildNodes();
396 for (
unsigned int j = 0;
j <
children->getLength();
j++) {
398 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
404 do_setape((DOMElement *)(node), aliset, alitoideal);
432 char *message = XMLString::transcode(node->getNodeName());
433 throw cms::Exception(
"XMLException") <<
"Unrecognized operation: \"" << message <<
"\"" << std::endl;
445 delete ideal_alignableMuon;
446 return alignableMuon;
450 const XERCES_CPP_NAMESPACE::DOMElement *node,
479 std::map<unsigned int, Alignable *> &alignableNavigator,
480 const XERCES_CPP_NAMESPACE::DOMElement *node,
482 unsigned int rawId = 0;
484 DOMAttr *node_rawId = node->getAttributeNode(
str_rawId);
485 if (node_rawId !=
nullptr) {
487 rawId = XMLString::parseInt(node_rawId->getValue());
488 }
catch (
const XMLException &toCatch) {
489 throw cms::Exception(
"XMLException") <<
"Value of \"rawId\" must be an integer" << std::endl;
496 DOMAttr *node_wheel = node->getAttributeNode(
str_wheel);
497 if (node_wheel ==
nullptr)
498 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"wheel\" attribute" << std::endl;
500 wheel = XMLString::parseInt(node_wheel->getValue());
501 }
catch (
const XMLException &toCatch) {
502 throw cms::Exception(
"XMLException") <<
"Value of \"wheel\" must be an integer" << std::endl;
506 DOMAttr *node_station = node->getAttributeNode(
str_station);
507 if (node_station ==
nullptr)
508 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"station\" attribute" << std::endl;
510 station = XMLString::parseInt(node_station->getValue());
511 }
catch (
const XMLException &toCatch) {
512 throw cms::Exception(
"XMLException") <<
"Value of \"station\" must be an integer" << std::endl;
516 DOMAttr *node_sector = node->getAttributeNode(
str_sector);
517 if (node_sector ==
nullptr)
518 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"sector\" attribute" << std::endl;
520 sector = XMLString::parseInt(node_sector->getValue());
521 }
catch (
const XMLException &toCatch) {
522 throw cms::Exception(
"XMLException") <<
"Value of \"sector\" must be an integer" << std::endl;
526 DOMAttr *node_superlayer = node->getAttributeNode(
str_superlayer);
527 if (node_superlayer ==
nullptr)
529 <<
"DT node is missing required \"superlayer\" attribute" << std::endl;
531 superlayer = XMLString::parseInt(node_superlayer->getValue());
532 }
catch (
const XMLException &toCatch) {
533 throw cms::Exception(
"XMLException") <<
"Value of \"superlayer\" must be an integer" << std::endl;
537 DOMAttr *node_layer = node->getAttributeNode(
str_layer);
538 if (node_layer ==
nullptr)
539 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"layer\" attribute" << std::endl;
541 layer = XMLString::parseInt(node_layer->getValue());
542 }
catch (
const XMLException &toCatch) {
543 throw cms::Exception(
"XMLException") <<
"Value of \"layer\" must be an integer" << std::endl;
553 rawId = layerId.
rawId();
556 Alignable *ali = alignableNavigator[rawId];
558 throw cms::Exception(
"XMLException") <<
"rawId \"" << rawId <<
"\" is not recognized" << std::endl;
563 if (ali ==
nullptr) {
565 <<
"rawId \"" << rawId <<
"\" is not a " << alignableObjectId.
idToString(structureType) << std::endl;
572 std::map<unsigned int, Alignable *> &alignableNavigator,
573 const XERCES_CPP_NAMESPACE::DOMElement *node,
577 DOMAttr *node_rawId = node->getAttributeNode(
str_rawId);
578 if (node_rawId !=
nullptr) {
580 rawId = XMLString::parseInt(node_rawId->getValue());
581 }
catch (
const XMLException &toCatch) {
582 throw cms::Exception(
"XMLException") <<
"Value of \"rawId\" must be an integer" << std::endl;
588 DOMAttr *node_endcap = node->getAttributeNode(
str_endcap);
589 if (node_endcap ==
nullptr)
590 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"endcap\" attribute" << std::endl;
592 endcap = XMLString::parseInt(node_endcap->getValue());
593 }
catch (
const XMLException &toCatch) {
594 throw cms::Exception(
"XMLException") <<
"Value of \"endcap\" must be an integer" << std::endl;
600 DOMAttr *node_station = node->getAttributeNode(
str_station);
601 if (node_station ==
nullptr)
602 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"station\" attribute" << std::endl;
604 station = XMLString::parseInt(node_station->getValue());
605 }
catch (
const XMLException &toCatch) {
606 throw cms::Exception(
"XMLException") <<
"Value of \"station\" must be an integer" << std::endl;
610 DOMAttr *node_ring = node->getAttributeNode(
str_ring);
611 if (node_ring ==
nullptr)
612 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"ring\" attribute" << std::endl;
614 ring = XMLString::parseInt(node_ring->getValue());
615 }
catch (
const XMLException &toCatch) {
616 throw cms::Exception(
"XMLException") <<
"Value of \"ring\" must be an integer" << std::endl;
620 DOMAttr *node_chamber = node->getAttributeNode(
str_chamber);
621 if (node_chamber ==
nullptr)
622 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"chamber\" attribute" << std::endl;
624 chamber = XMLString::parseInt(node_chamber->getValue());
625 }
catch (
const XMLException &toCatch) {
626 throw cms::Exception(
"XMLException") <<
"Value of \"chamber\" must be an integer" << std::endl;
630 DOMAttr *node_layer = node->getAttributeNode(
str_layer);
631 if (node_layer ==
nullptr)
632 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"layer\" attribute" << std::endl;
634 layer = XMLString::parseInt(node_layer->getValue());
635 }
catch (
const XMLException &toCatch) {
636 throw cms::Exception(
"XMLException") <<
"Value of \"layer\" must be an integer" << std::endl;
645 rawId = layerId.
rawId();
648 Alignable *ali = alignableNavigator[rawId];
650 throw cms::Exception(
"XMLException") <<
"rawId \"" << rawId <<
"\" is not recognized" << std::endl;
655 if (ali ==
nullptr) {
657 <<
"rawId \"" << rawId <<
"\" is not a " << alignableObjectId.
idToString(structureType) << std::endl;
664 unsigned int len = XMLString::stringLen(
str);
665 char *cstr = XMLString::transcode(
str);
666 std::stringstream errmessage;
667 errmessage <<
"Value of \"" << attribute <<
"\" must be a double, not \"" << cstr <<
"\"" << std::endl;
672 if (cstr[
i] ==
'-') {
675 }
else if (cstr[
i] ==
'+')
680 while (cstr[
i] !=
'.' && cstr[
i] !=
'e' && cstr[
i] !=
'E' &&
i < len) {
681 if (cstr[
i] <
'0' || cstr[
i] >
'9') {
691 if (cstr[
i] ==
'.') {
695 while (cstr[
i] !=
'e' && cstr[
i] !=
'E' &&
i < len) {
696 if (cstr[
i] <
'0' || cstr[
i] >
'9') {
701 output += (cstr[
i] -
'0') * place;
707 if (cstr[
i] ==
'e' || cstr[
i] ==
'E') {
711 bool expminus =
false;
712 if (cstr[
i] ==
'-') {
715 }
else if (cstr[
i] ==
'+')
719 if (cstr[
i] <
'0' || cstr[
i] >
'9') {
743 std::map<Alignable *, bool> &aliset,
744 std::map<Alignable *, Alignable *> &alitoideal)
const {
745 DOMAttr *node_relativeto = node->getAttributeNode(
str_relativeto);
746 if (node_relativeto ==
nullptr)
747 throw cms::Exception(
"XMLException") <<
"<setposition> is missing required \"relativeto\" attribute" << std::endl;
757 char *message = XMLString::transcode(node_relativeto->getValue());
758 throw cms::Exception(
"XMLException") <<
"relativeto must be \"none\", \"ideal\", or \"container\", not \""
759 << message <<
"\"" << std::endl;
762 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
787 oldrot = oldrot * globalRotation.
transposed();
790 double x = oldpos.
x();
791 double y = oldpos.
y();
792 double z = oldpos.
z();
794 double phix = atan2(oldrot.
yz(), oldrot.
zz());
795 double phiy = asin(-oldrot.
xz());
796 double phiz = atan2(oldrot.
xy(), oldrot.
xx());
799 double alpha = oldEulerAngles(1);
800 double beta = oldEulerAngles(2);
801 double gamma = oldEulerAngles(3);
805 DOMAttr *node_x = node->getAttributeNode(
str_x);
806 DOMAttr *node_y = node->getAttributeNode(
str_y);
807 DOMAttr *node_z = node->getAttributeNode(
str_z);
809 if (node_x !=
nullptr)
811 if (node_y !=
nullptr)
813 if (node_z !=
nullptr)
817 DOMAttr *node_phix = node->getAttributeNode(
str_phix);
818 DOMAttr *node_phiy = node->getAttributeNode(
str_phiy);
819 DOMAttr *node_phiz = node->getAttributeNode(
str_phiz);
820 DOMAttr *node_alpha = node->getAttributeNode(
str_alpha);
821 DOMAttr *node_beta = node->getAttributeNode(
str_beta);
822 DOMAttr *node_gamma = node->getAttributeNode(
str_gamma);
825 bool phixyz = (node_phix !=
nullptr || node_phiy !=
nullptr || node_phiz !=
nullptr);
826 bool alphabetagamma = (node_alpha !=
nullptr || node_beta !=
nullptr || node_gamma !=
nullptr);
827 if (phixyz && alphabetagamma)
829 <<
"<setposition> must either have phix, phiy, and phiz or alpha, beta, and gamma, but not both" << std::endl;
830 if (!phixyz && !alphabetagamma)
831 alphabetagamma =
true;
834 if (node_phix !=
nullptr)
836 if (node_phiy !=
nullptr)
838 if (node_phiz !=
nullptr)
847 rot = rotX * rotY * rotZ;
850 else if (alphabetagamma) {
851 if (node_alpha !=
nullptr)
853 if (node_beta !=
nullptr)
855 if (node_gamma !=
nullptr)
860 eulerAngles(1) =
alpha;
861 eulerAngles(2) =
beta;
862 eulerAngles(3) =
gamma;
890 if (container !=
nullptr) {
941 if (survey !=
nullptr) {
942 matrix6x6 = survey->
errors();
948 std::map<Alignable *, bool> &aliset,
949 std::map<Alignable *, Alignable *> &alitoideal)
const {
950 DOMAttr *node_xx = node->getAttributeNode(
str_xx);
951 DOMAttr *node_xy = node->getAttributeNode(
str_xy);
952 DOMAttr *node_xz = node->getAttributeNode(
str_xz);
953 DOMAttr *node_xa = node->getAttributeNode(
str_xa);
954 DOMAttr *node_xb = node->getAttributeNode(
str_xb);
955 DOMAttr *node_xc = node->getAttributeNode(
str_xc);
956 DOMAttr *node_yy = node->getAttributeNode(
str_yy);
957 DOMAttr *node_yz = node->getAttributeNode(
str_yz);
958 DOMAttr *node_ya = node->getAttributeNode(
str_ya);
959 DOMAttr *node_yb = node->getAttributeNode(
str_yb);
960 DOMAttr *node_yc = node->getAttributeNode(
str_yc);
961 DOMAttr *node_zz = node->getAttributeNode(
str_zz);
962 DOMAttr *node_za = node->getAttributeNode(
str_za);
963 DOMAttr *node_zb = node->getAttributeNode(
str_zb);
964 DOMAttr *node_zc = node->getAttributeNode(
str_zc);
965 DOMAttr *node_aa = node->getAttributeNode(
str_aa);
966 DOMAttr *node_ab = node->getAttributeNode(
str_ab);
967 DOMAttr *node_ac = node->getAttributeNode(
str_ac);
968 DOMAttr *node_bb = node->getAttributeNode(
str_bb);
969 DOMAttr *node_bc = node->getAttributeNode(
str_bc);
970 DOMAttr *node_cc = node->getAttributeNode(
str_cc);
972 if (node_xx ==
nullptr)
973 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xx\" attribute" << std::endl;
974 if (node_xy ==
nullptr)
975 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xy\" attribute" << std::endl;
976 if (node_xz ==
nullptr)
977 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xz\" attribute" << std::endl;
978 if (node_xa ==
nullptr)
979 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xa\" attribute" << std::endl;
980 if (node_xb ==
nullptr)
981 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xb\" attribute" << std::endl;
982 if (node_xc ==
nullptr)
983 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xc\" attribute" << std::endl;
984 if (node_yy ==
nullptr)
985 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yy\" attribute" << std::endl;
986 if (node_yz ==
nullptr)
987 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yz\" attribute" << std::endl;
988 if (node_ya ==
nullptr)
989 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"ya\" attribute" << std::endl;
990 if (node_yb ==
nullptr)
991 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yb\" attribute" << std::endl;
992 if (node_yc ==
nullptr)
993 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yc\" attribute" << std::endl;
994 if (node_zz ==
nullptr)
995 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"zz\" attribute" << std::endl;
996 if (node_za ==
nullptr)
997 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"za\" attribute" << std::endl;
998 if (node_zb ==
nullptr)
999 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"zb\" attribute" << std::endl;
1000 if (node_zc ==
nullptr)
1001 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"zc\" attribute" << std::endl;
1002 if (node_aa ==
nullptr)
1003 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"aa\" attribute" << std::endl;
1004 if (node_ab ==
nullptr)
1005 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"ab\" attribute" << std::endl;
1006 if (node_ac ==
nullptr)
1007 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"ac\" attribute" << std::endl;
1008 if (node_bb ==
nullptr)
1009 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"bb\" attribute" << std::endl;
1010 if (node_bc ==
nullptr)
1011 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"bc\" attribute" << std::endl;
1012 if (node_cc ==
nullptr)
1013 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"cc\" attribute" << std::endl;
1016 matrix6x6(0, 0) =
parseDouble(node_xx->getValue(),
"xx");
1017 matrix6x6(0, 1) =
parseDouble(node_xy->getValue(),
"xy");
1018 matrix6x6(0, 2) =
parseDouble(node_xz->getValue(),
"xz");
1019 matrix6x6(0, 3) =
parseDouble(node_xa->getValue(),
"xa");
1020 matrix6x6(0, 4) =
parseDouble(node_xb->getValue(),
"xb");
1021 matrix6x6(0, 5) =
parseDouble(node_xc->getValue(),
"xc");
1022 matrix6x6(1, 1) =
parseDouble(node_yy->getValue(),
"yy");
1023 matrix6x6(1, 2) =
parseDouble(node_yz->getValue(),
"yz");
1024 matrix6x6(1, 3) =
parseDouble(node_ya->getValue(),
"ya");
1025 matrix6x6(1, 4) =
parseDouble(node_yb->getValue(),
"yb");
1026 matrix6x6(1, 5) =
parseDouble(node_yc->getValue(),
"yc");
1027 matrix6x6(2, 2) =
parseDouble(node_zz->getValue(),
"zz");
1028 matrix6x6(2, 3) =
parseDouble(node_za->getValue(),
"za");
1029 matrix6x6(2, 4) =
parseDouble(node_zb->getValue(),
"zb");
1030 matrix6x6(2, 5) =
parseDouble(node_zc->getValue(),
"zc");
1031 matrix6x6(3, 3) =
parseDouble(node_aa->getValue(),
"aa");
1032 matrix6x6(3, 4) =
parseDouble(node_ab->getValue(),
"ab");
1033 matrix6x6(3, 5) =
parseDouble(node_ac->getValue(),
"ac");
1034 matrix6x6(4, 4) =
parseDouble(node_bb->getValue(),
"bb");
1035 matrix6x6(4, 5) =
parseDouble(node_bc->getValue(),
"bc");
1036 matrix6x6(5, 5) =
parseDouble(node_cc->getValue(),
"cc");
1038 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1045 std::map<Alignable *, bool> &aliset,
1046 std::map<Alignable *, Alignable *> &alitoideal)
const {
1047 DOMAttr *node_xx = node->getAttributeNode(
str_xx);
1048 DOMAttr *node_xy = node->getAttributeNode(
str_xy);
1049 DOMAttr *node_xz = node->getAttributeNode(
str_xz);
1050 DOMAttr *node_xa = node->getAttributeNode(
str_xa);
1051 DOMAttr *node_xb = node->getAttributeNode(
str_xb);
1052 DOMAttr *node_xc = node->getAttributeNode(
str_xc);
1053 DOMAttr *node_yy = node->getAttributeNode(
str_yy);
1054 DOMAttr *node_yz = node->getAttributeNode(
str_yz);
1055 DOMAttr *node_ya = node->getAttributeNode(
str_ya);
1056 DOMAttr *node_yb = node->getAttributeNode(
str_yb);
1057 DOMAttr *node_yc = node->getAttributeNode(
str_yc);
1058 DOMAttr *node_zz = node->getAttributeNode(
str_zz);
1059 DOMAttr *node_za = node->getAttributeNode(
str_za);
1060 DOMAttr *node_zb = node->getAttributeNode(
str_zb);
1061 DOMAttr *node_zc = node->getAttributeNode(
str_zc);
1062 DOMAttr *node_aa = node->getAttributeNode(
str_aa);
1063 DOMAttr *node_ab = node->getAttributeNode(
str_ab);
1064 DOMAttr *node_ac = node->getAttributeNode(
str_ac);
1065 DOMAttr *node_bb = node->getAttributeNode(
str_bb);
1066 DOMAttr *node_bc = node->getAttributeNode(
str_bc);
1067 DOMAttr *node_cc = node->getAttributeNode(
str_cc);
1069 if (node_xx ==
nullptr)
1070 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
1071 if (node_xy ==
nullptr)
1072 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
1073 if (node_xz ==
nullptr)
1074 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
1075 if (node_xa ==
nullptr)
1076 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
1077 if (node_xb ==
nullptr)
1078 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
1079 if (node_xc ==
nullptr)
1080 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
1081 if (node_yy ==
nullptr)
1082 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
1083 if (node_yz ==
nullptr)
1084 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
1085 if (node_ya ==
nullptr)
1086 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
1087 if (node_yb ==
nullptr)
1088 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
1089 if (node_yc ==
nullptr)
1090 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
1091 if (node_zz ==
nullptr)
1092 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
1093 if (node_za ==
nullptr)
1094 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"za\" attribute" << std::endl;
1095 if (node_zb ==
nullptr)
1096 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
1097 if (node_zc ==
nullptr)
1098 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
1099 if (node_aa ==
nullptr)
1100 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
1101 if (node_ab ==
nullptr)
1102 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
1103 if (node_ac ==
nullptr)
1104 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
1105 if (node_bb ==
nullptr)
1106 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
1107 if (node_bc ==
nullptr)
1108 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
1109 if (node_cc ==
nullptr)
1110 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
1113 matrix6x6(0, 0) =
parseDouble(node_xx->getValue(),
"xx");
1114 matrix6x6(0, 1) =
parseDouble(node_xy->getValue(),
"xy");
1115 matrix6x6(0, 2) =
parseDouble(node_xz->getValue(),
"xz");
1116 matrix6x6(0, 3) =
parseDouble(node_xa->getValue(),
"xa");
1117 matrix6x6(0, 4) =
parseDouble(node_xb->getValue(),
"xb");
1118 matrix6x6(0, 5) =
parseDouble(node_xc->getValue(),
"xc");
1119 matrix6x6(1, 1) =
parseDouble(node_yy->getValue(),
"yy");
1120 matrix6x6(1, 2) =
parseDouble(node_yz->getValue(),
"yz");
1121 matrix6x6(1, 3) =
parseDouble(node_ya->getValue(),
"ya");
1122 matrix6x6(1, 4) =
parseDouble(node_yb->getValue(),
"yb");
1123 matrix6x6(1, 5) =
parseDouble(node_yc->getValue(),
"yc");
1124 matrix6x6(2, 2) =
parseDouble(node_zz->getValue(),
"zz");
1125 matrix6x6(2, 3) =
parseDouble(node_za->getValue(),
"za");
1126 matrix6x6(2, 4) =
parseDouble(node_zb->getValue(),
"zb");
1127 matrix6x6(2, 5) =
parseDouble(node_zc->getValue(),
"zc");
1128 matrix6x6(3, 3) =
parseDouble(node_aa->getValue(),
"aa");
1129 matrix6x6(3, 4) =
parseDouble(node_ab->getValue(),
"ab");
1130 matrix6x6(3, 5) =
parseDouble(node_ac->getValue(),
"ac");
1131 matrix6x6(4, 4) =
parseDouble(node_bb->getValue(),
"bb");
1132 matrix6x6(4, 5) =
parseDouble(node_bc->getValue(),
"bc");
1133 matrix6x6(5, 5) =
parseDouble(node_cc->getValue(),
"cc");
1135 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1142 std::map<Alignable *, bool> &aliset,
1143 std::map<Alignable *, Alignable *> &alitoideal)
const {
1144 DOMAttr *node_x = node->getAttributeNode(
str_x);
1145 DOMAttr *node_y = node->getAttributeNode(
str_y);
1146 DOMAttr *node_z = node->getAttributeNode(
str_z);
1147 if (node_x ==
nullptr)
1148 throw cms::Exception(
"XMLException") <<
"<moveglobal> is missing required \"x\" attribute" << std::endl;
1149 if (node_y ==
nullptr)
1150 throw cms::Exception(
"XMLException") <<
"<moveglobal> is missing required \"y\" attribute" << std::endl;
1151 if (node_z ==
nullptr)
1152 throw cms::Exception(
"XMLException") <<
"<moveglobal> is missing required \"z\" attribute" << std::endl;
1159 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1168 if (survey !=
nullptr) {
1169 matrix6x6 = survey->
errors();
1176 std::map<Alignable *, bool> &aliset,
1177 std::map<Alignable *, Alignable *> &alitoideal)
const {
1178 DOMAttr *node_x = node->getAttributeNode(
str_x);
1179 DOMAttr *node_y = node->getAttributeNode(
str_y);
1180 DOMAttr *node_z = node->getAttributeNode(
str_z);
1181 if (node_x ==
nullptr)
1182 throw cms::Exception(
"XMLException") <<
"<movelocal> is missing required \"x\" attribute" << std::endl;
1183 if (node_y ==
nullptr)
1184 throw cms::Exception(
"XMLException") <<
"<movelocal> is missing required \"y\" attribute" << std::endl;
1185 if (node_z ==
nullptr)
1186 throw cms::Exception(
"XMLException") <<
"<movelocal> is missing required \"z\" attribute" << std::endl;
1193 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1197 ali->
move(globalVector);
1203 if (survey !=
nullptr) {
1204 matrix6x6 = survey->
errors();
1211 std::map<Alignable *, bool> &aliset,
1212 std::map<Alignable *, Alignable *> &alitoideal)
const {
1213 DOMAttr *node_axisx = node->getAttributeNode(
str_axisx);
1214 DOMAttr *node_axisy = node->getAttributeNode(
str_axisy);
1215 DOMAttr *node_axisz = node->getAttributeNode(
str_axisz);
1216 DOMAttr *node_angle = node->getAttributeNode(
str_angle);
1217 if (node_axisx ==
nullptr)
1218 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1219 if (node_axisy ==
nullptr)
1220 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1221 if (node_axisz ==
nullptr)
1222 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1223 if (node_angle ==
nullptr)
1224 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1232 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1241 if (survey !=
nullptr) {
1242 matrix6x6 = survey->
errors();
1249 std::map<Alignable *, bool> &aliset,
1250 std::map<Alignable *, Alignable *> &alitoideal)
const {
1251 DOMAttr *node_rphi = node->getAttributeNode(
str_rphi);
1252 DOMAttr *node_phi = node->getAttributeNode(
str_phi);
1253 if (node_rphi ==
nullptr && node_phi ==
nullptr)
1254 throw cms::Exception(
"XMLException") <<
"<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1255 if (node_rphi !=
nullptr && node_phi !=
nullptr)
1256 throw cms::Exception(
"XMLException") <<
"<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute"
1260 if (node_rphi !=
nullptr) {
1266 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1272 double phi0 =
pos.phi();
1273 double deltaphi =
value;
1274 if (node_rphi !=
nullptr)
1285 if (survey !=
nullptr) {
1286 matrix6x6 = survey->
errors();
1293 std::map<Alignable *, bool> &aliset,
1294 std::map<Alignable *, Alignable *> &alitoideal)
const {
1295 DOMAttr *node_x = node->getAttributeNode(
str_x);
1296 DOMAttr *node_y = node->getAttributeNode(
str_y);
1297 DOMAttr *node_z = node->getAttributeNode(
str_z);
1298 DOMAttr *node_angle = node->getAttributeNode(
str_angle);
1299 if (node_x ==
nullptr)
1300 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1301 if (node_y ==
nullptr)
1302 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1303 if (node_z ==
nullptr)
1304 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1305 if (node_angle ==
nullptr)
1306 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
1313 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1325 double q3 =
sin(
angle / 2.) * cprime;
1331 double pos2z = 2. * (q3 *
q1 -
q0 *
q2) *
pos.x() + 2. * (q3 *
q2 +
q0 *
q1) *
pos.y() +
1334 double movex = pos2x -
pos.x();
1335 double movey = pos2y -
pos.y();
1336 double movez = pos2z -
pos.z();
1343 if (survey !=
nullptr) {
1344 matrix6x6 = survey->
errors();