CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonAlignmentInputXML Class Reference

#include <Alignment/MuonAlignment/interface/MuonAlignmentInputXML.h>

Inheritance diagram for MuonAlignmentInputXML:
MuonAlignmentInputMethod

Public Member Functions

 MuonAlignmentInputXML (std::string fileName)
 
virtual AlignableMuonnewAlignableMuon (const edm::EventSetup &iSetup) const
 
virtual ~MuonAlignmentInputXML ()
 
- Public Member Functions inherited from MuonAlignmentInputMethod
 MuonAlignmentInputMethod ()
 
virtual ~MuonAlignmentInputMethod ()
 

Private Member Functions

void do_moveglobal (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_movelocal (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_rotatebeamline (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_rotateglobalaxis (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_rotatelocal (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_setape (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_setposition (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void do_setsurveyerr (const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
 
void fillAliToIdeal (std::map< Alignable *, Alignable * > &alitoideal, const align::Alignables alignables, const align::Alignables ideals) const
 
AlignablegetCSCnode (align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node) const
 
AlignablegetDTnode (align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node) const
 
AlignablegetNode (std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node) const
 
 MuonAlignmentInputXML (const MuonAlignmentInputXML &)
 
const MuonAlignmentInputXMLoperator= (const MuonAlignmentInputXML &)
 
double parseDouble (const XMLCh *str, const char *attribute) const
 
void recursiveGetId (std::map< unsigned int, Alignable * > &alignableNavigator, const align::Alignables &alignables) const
 
void set_one_position (Alignable *ali, const align::PositionType &pos, const align::RotationType &rot) const
 

Private Attributes

std::string m_fileName
 
XMLCh * str_aa
 
XMLCh * str_ab
 
XMLCh * str_ac
 
XMLCh * str_alpha
 
XMLCh * str_angle
 
XMLCh * str_axisx
 
XMLCh * str_axisy
 
XMLCh * str_axisz
 
XMLCh * str_bb
 
XMLCh * str_bc
 
XMLCh * str_beta
 
XMLCh * str_cc
 
XMLCh * str_chamber
 
XMLCh * str_collection
 
XMLCh * str_container
 
XMLCh * str_CSCChamber
 
XMLCh * str_CSCEndcap
 
XMLCh * str_CSCLayer
 
XMLCh * str_CSCRing
 
XMLCh * str_CSCStation
 
XMLCh * str_DTBarrel
 
XMLCh * str_DTChamber
 
XMLCh * str_DTLayer
 
XMLCh * str_DTStation
 
XMLCh * str_DTSuperLayer
 
XMLCh * str_DTWheel
 
XMLCh * str_endcap
 
XMLCh * str_gamma
 
XMLCh * str_ideal
 
XMLCh * str_layer
 
XMLCh * str_moveglobal
 
XMLCh * str_movelocal
 
XMLCh * str_name
 
XMLCh * str_none
 
XMLCh * str_operation
 
XMLCh * str_phi
 
XMLCh * str_phix
 
XMLCh * str_phiy
 
XMLCh * str_phiz
 
XMLCh * str_rawId
 
XMLCh * str_relativeto
 
XMLCh * str_ring
 
XMLCh * str_rotatebeamline
 
XMLCh * str_rotateglobalaxis
 
XMLCh * str_rotatelocal
 
XMLCh * str_rphi
 
XMLCh * str_sector
 
XMLCh * str_setape
 
XMLCh * str_setposition
 
XMLCh * str_setsurveyerr
 
XMLCh * str_station
 
XMLCh * str_superlayer
 
XMLCh * str_wheel
 
XMLCh * str_x
 
XMLCh * str_xa
 
XMLCh * str_xb
 
XMLCh * str_xc
 
XMLCh * str_xx
 
XMLCh * str_xy
 
XMLCh * str_xz
 
XMLCh * str_y
 
XMLCh * str_ya
 
XMLCh * str_yb
 
XMLCh * str_yc
 
XMLCh * str_yy
 
XMLCh * str_yz
 
XMLCh * str_z
 
XMLCh * str_za
 
XMLCh * str_zb
 
XMLCh * str_zc
 
XMLCh * str_zz
 

Additional Inherited Members

- Protected Member Functions inherited from MuonAlignmentInputMethod
boost::shared_ptr< CSCGeometryidealCSCGeometry (const edm::EventSetup &iSetup) const
 
boost::shared_ptr< DTGeometryidealDTGeometry (const edm::EventSetup &iSetup) const
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 34 of file MuonAlignmentInputXML.h.

Constructor & Destructor Documentation

XERCES_CPP_NAMESPACE_USE MuonAlignmentInputXML::MuonAlignmentInputXML ( std::string  fileName)

Definition at line 45 of file MuonAlignmentInputXML.cc.

References str_aa, str_ab, str_ac, str_alpha, str_angle, str_axisx, str_axisy, str_axisz, str_bb, str_bc, str_beta, str_cc, str_chamber, str_collection, str_container, str_CSCChamber, str_CSCEndcap, str_CSCLayer, str_CSCRing, str_CSCStation, str_DTBarrel, str_DTChamber, str_DTLayer, str_DTStation, str_DTSuperLayer, str_DTWheel, str_endcap, str_gamma, str_ideal, str_layer, str_moveglobal, str_movelocal, str_name, str_none, str_operation, str_phi, str_phix, str_phiy, str_phiz, str_rawId, str_relativeto, str_ring, str_rotatebeamline, str_rotateglobalaxis, str_rotatelocal, str_rphi, str_sector, str_setape, str_setposition, str_setsurveyerr, str_station, str_superlayer, str_wheel, str_x, str_xa, str_xb, str_xc, str_xx, str_xy, str_xz, str_y, str_ya, str_yb, str_yc, str_yy, str_yz, str_z, str_za, str_zb, str_zc, and str_zz.

47 {
48  str_operation = XMLString::transcode("operation");
49  str_collection = XMLString::transcode("collection");
50  str_name = XMLString::transcode("name");
51  str_DTBarrel = XMLString::transcode("DTBarrel");
52  str_DTWheel = XMLString::transcode("DTWheel");
53  str_DTStation = XMLString::transcode("DTStation");
54  str_DTChamber = XMLString::transcode("DTChamber");
55  str_DTSuperLayer = XMLString::transcode("DTSuperLayer");
56  str_DTLayer = XMLString::transcode("DTLayer");
57  str_CSCEndcap = XMLString::transcode("CSCEndcap");
58  str_CSCStation = XMLString::transcode("CSCStation");
59  str_CSCRing = XMLString::transcode("CSCRing");
60  str_CSCChamber = XMLString::transcode("CSCChamber");
61  str_CSCLayer = XMLString::transcode("CSCLayer");
62  str_setposition = XMLString::transcode("setposition");
63  str_setape = XMLString::transcode("setape");
64  str_setsurveyerr = XMLString::transcode("setsurveyerr");
65  str_moveglobal = XMLString::transcode("moveglobal");
66  str_movelocal = XMLString::transcode("movelocal");
67  str_rotatelocal = XMLString::transcode("rotatelocal");
68  str_rotatebeamline = XMLString::transcode("rotatebeamline");
69  str_rotateglobalaxis = XMLString::transcode("rotateglobalaxis");
70  str_relativeto = XMLString::transcode("relativeto");
71  str_rawId = XMLString::transcode("rawId");
72  str_wheel = XMLString::transcode("wheel");
73  str_station = XMLString::transcode("station");
74  str_sector = XMLString::transcode("sector");
75  str_superlayer = XMLString::transcode("superlayer");
76  str_layer = XMLString::transcode("layer");
77  str_endcap = XMLString::transcode("endcap");
78  str_ring = XMLString::transcode("ring");
79  str_chamber = XMLString::transcode("chamber");
80  str_axisx = XMLString::transcode("axisx");
81  str_axisy = XMLString::transcode("axisy");
82  str_axisz = XMLString::transcode("axisz");
83  str_angle = XMLString::transcode("angle");
84  str_x = XMLString::transcode("x");
85  str_y = XMLString::transcode("y");
86  str_z = XMLString::transcode("z");
87  str_phix = XMLString::transcode("phix");
88  str_phiy = XMLString::transcode("phiy");
89  str_phiz = XMLString::transcode("phiz");
90  str_alpha = XMLString::transcode("alpha");
91  str_beta = XMLString::transcode("beta");
92  str_gamma = XMLString::transcode("gamma");
93  str_rphi = XMLString::transcode("rphi");
94  str_phi = XMLString::transcode("phi");
95  str_xx = XMLString::transcode("xx");
96  str_xy = XMLString::transcode("xy");
97  str_xz = XMLString::transcode("xz");
98  str_xa = XMLString::transcode("xa");
99  str_xb = XMLString::transcode("xb");
100  str_xc = XMLString::transcode("xc");
101  str_yy = XMLString::transcode("yy");
102  str_yz = XMLString::transcode("yz");
103  str_ya = XMLString::transcode("ya");
104  str_yb = XMLString::transcode("yb");
105  str_yc = XMLString::transcode("yc");
106  str_zz = XMLString::transcode("zz");
107  str_za = XMLString::transcode("za");
108  str_zb = XMLString::transcode("zb");
109  str_zc = XMLString::transcode("zc");
110  str_aa = XMLString::transcode("aa");
111  str_ab = XMLString::transcode("ab");
112  str_ac = XMLString::transcode("ac");
113  str_bb = XMLString::transcode("bb");
114  str_bc = XMLString::transcode("bc");
115  str_cc = XMLString::transcode("cc");
116  str_none = XMLString::transcode("none");
117  str_ideal = XMLString::transcode("ideal");
118  str_container = XMLString::transcode("container");
119 }
MuonAlignmentInputXML::~MuonAlignmentInputXML ( )
virtual

Definition at line 126 of file MuonAlignmentInputXML.cc.

References fetchall_from_DQM_v2::release, str_aa, str_ab, str_ac, str_alpha, str_angle, str_axisx, str_axisy, str_axisz, str_bb, str_bc, str_beta, str_cc, str_chamber, str_collection, str_container, str_CSCChamber, str_CSCEndcap, str_CSCLayer, str_CSCRing, str_CSCStation, str_DTBarrel, str_DTChamber, str_DTLayer, str_DTStation, str_DTSuperLayer, str_DTWheel, str_endcap, str_gamma, str_ideal, str_layer, str_moveglobal, str_movelocal, str_name, str_none, str_operation, str_phi, str_phix, str_phiy, str_phiz, str_rawId, str_relativeto, str_ring, str_rotatebeamline, str_rotateglobalaxis, str_rotatelocal, str_rphi, str_sector, str_setape, str_setposition, str_setsurveyerr, str_station, str_superlayer, str_wheel, str_x, str_xa, str_xb, str_xc, str_xx, str_xy, str_xz, str_y, str_ya, str_yb, str_yc, str_yy, str_yz, str_z, str_za, str_zb, str_zc, and str_zz.

126  {
198 }
MuonAlignmentInputXML::MuonAlignmentInputXML ( const MuonAlignmentInputXML )
private

Member Function Documentation

void MuonAlignmentInputXML::do_moveglobal ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 1014 of file MuonAlignmentInputXML.cc.

References SurveyDet::errors(), edm::hlt::Exception, Alignable::move(), NULL, parseDouble(), Alignable::setSurvey(), str_x, str_y, str_z, Alignable::surface(), Alignable::survey(), vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by newAlignableMuon().

1014  {
1015  DOMAttr *node_x = node->getAttributeNode(str_x);
1016  DOMAttr *node_y = node->getAttributeNode(str_y);
1017  DOMAttr *node_z = node->getAttributeNode(str_z);
1018  if (node_x == NULL) throw cms::Exception("XMLException") << "<moveglobal> is missing required \"x\" attribute" << std::endl;
1019  if (node_y == NULL) throw cms::Exception("XMLException") << "<moveglobal> is missing required \"y\" attribute" << std::endl;
1020  if (node_z == NULL) throw cms::Exception("XMLException") << "<moveglobal> is missing required \"z\" attribute" << std::endl;
1021 
1022  double x = parseDouble(node_x->getValue(), "x");
1023  double y = parseDouble(node_y->getValue(), "y");
1024  double z = parseDouble(node_z->getValue(), "z");
1025  align::GlobalVector vect(x, y, z);
1026 
1027  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1028  Alignable *ali = aliiter->first;
1029 
1030  ali->move(vect);
1031 
1032  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1033  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1034 
1035  const SurveyDet *survey = ali->survey();
1036  if (survey != NULL) {
1037  matrix6x6 = survey->errors(); // save the constraint information
1038  }
1039  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1040  } // end loop over alignables
1041 }
double parseDouble(const XMLCh *str, const char *attribute) const
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:205
#define NULL
Definition: scimark2.h:8
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
double double double z
tuple node
Definition: Node.py:50
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
x
Definition: VDTMath.h:216
void MuonAlignmentInputXML::do_movelocal ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 1043 of file MuonAlignmentInputXML.cc.

References SurveyDet::errors(), edm::hlt::Exception, Alignable::move(), NULL, parseDouble(), Alignable::setSurvey(), str_x, str_y, str_z, Alignable::surface(), Alignable::survey(), AlignableSurface::toGlobal(), vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by newAlignableMuon().

1043  {
1044  DOMAttr *node_x = node->getAttributeNode(str_x);
1045  DOMAttr *node_y = node->getAttributeNode(str_y);
1046  DOMAttr *node_z = node->getAttributeNode(str_z);
1047  if (node_x == NULL) throw cms::Exception("XMLException") << "<movelocal> is missing required \"x\" attribute" << std::endl;
1048  if (node_y == NULL) throw cms::Exception("XMLException") << "<movelocal> is missing required \"y\" attribute" << std::endl;
1049  if (node_z == NULL) throw cms::Exception("XMLException") << "<movelocal> is missing required \"z\" attribute" << std::endl;
1050 
1051  double x = parseDouble(node_x->getValue(), "x");
1052  double y = parseDouble(node_y->getValue(), "y");
1053  double z = parseDouble(node_z->getValue(), "z");
1054  align::LocalVector vect(x, y, z);
1055 
1056  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1057  Alignable *ali = aliiter->first;
1058 
1059  align::GlobalVector globalVector = ali->surface().toGlobal(vect);
1060  ali->move(globalVector);
1061 
1062  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1063  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1064 
1065  const SurveyDet *survey = ali->survey();
1066  if (survey != NULL) {
1067  matrix6x6 = survey->errors(); // save the constraint information
1068  }
1069  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1070  } // end loop over alignables
1071 }
double parseDouble(const XMLCh *str, const char *attribute) const
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:205
#define NULL
Definition: scimark2.h:8
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
double double double z
tuple node
Definition: Node.py:50
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
x
Definition: VDTMath.h:216
void MuonAlignmentInputXML::do_rotatebeamline ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 1105 of file MuonAlignmentInputXML.cc.

References funct::cos(), SurveyDet::errors(), edm::hlt::Exception, Alignable::move(), NULL, parseDouble(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), pos, CosmicsPD_Skims::radius, Alignable::rotateAroundGlobalZ(), Alignable::setSurvey(), funct::sin(), str_phi, str_rphi, Alignable::surface(), Alignable::survey(), AlignableSurface::toGlobal(), and relativeConstraints::value.

Referenced by newAlignableMuon().

1105  {
1106  DOMAttr *node_rphi = node->getAttributeNode(str_rphi);
1107  DOMAttr *node_phi = node->getAttributeNode(str_phi);
1108  if (node_rphi == NULL && node_phi == NULL) throw cms::Exception("XMLException") << "<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1109  if (node_rphi != NULL && node_phi != NULL) throw cms::Exception("XMLException") << "<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute" << std::endl;
1110 
1111  double value;
1112  if (node_rphi != NULL) {
1113  value = parseDouble(node_rphi->getValue(), "rphi");
1114  }
1115  else {
1116  value = parseDouble(node_phi->getValue(), "phi");
1117  }
1118 
1119  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1120  Alignable *ali = aliiter->first;
1121 
1123 
1124  double radius = pos.perp();
1125  double phi0 = pos.phi();
1126  double deltaphi = value;
1127  if (node_rphi != NULL) deltaphi = value / radius;
1128 
1129  ali->rotateAroundGlobalZ(deltaphi);
1130  ali->move(align::GlobalVector(radius * (cos(phi0 + deltaphi) - cos(phi0)),
1131  radius * (sin(phi0 + deltaphi) - sin(phi0)),
1132  0.));
1133 
1134  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1135  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1136 
1137  const SurveyDet *survey = ali->survey();
1138  if (survey != NULL) {
1139  matrix6x6 = survey->errors(); // save the constraint information
1140  }
1141  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1142  } // end loop over alignables
1143 }
T perp() const
Definition: PV3DBase.h:71
double parseDouble(const XMLCh *str, const char *attribute) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:205
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
#define NULL
Definition: scimark2.h:8
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
tuple node
Definition: Node.py:50
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:174
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
void MuonAlignmentInputXML::do_rotateglobalaxis ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 1145 of file MuonAlignmentInputXML.cc.

References angle(), funct::cos(), SurveyDet::errors(), edm::hlt::Exception, Alignable::move(), NULL, parseDouble(), pos, q1, q2, Alignable::rotateAroundGlobalAxis(), Alignable::setSurvey(), funct::sin(), mathSSE::sqrt(), str_angle, str_x, str_y, str_z, Alignable::surface(), Alignable::survey(), AlignableSurface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by newAlignableMuon().

1145  {
1146  DOMAttr *node_x = node->getAttributeNode(str_x);
1147  DOMAttr *node_y = node->getAttributeNode(str_y);
1148  DOMAttr *node_z = node->getAttributeNode(str_z);
1149  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1150  if (node_x == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1151  if (node_y == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1152  if (node_z == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1153  if (node_angle == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
1154 
1155  double x = parseDouble(node_x->getValue(), "x");
1156  double y = parseDouble(node_y->getValue(), "y");
1157  double z = parseDouble(node_z->getValue(), "z");
1158  double angle = parseDouble(node_angle->getValue(), "angle");
1159 
1160  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1161  Alignable *ali = aliiter->first;
1163 
1164  ali->rotateAroundGlobalAxis(align::GlobalVector(x, y, z), angle);
1165 
1166  double aprime = x/sqrt(x*x + y*y + z*z);
1167  double bprime = y/sqrt(x*x + y*y + z*z);
1168  double cprime = z/sqrt(x*x + y*y + z*z);
1169  double q0 = cos(angle/2.);
1170  double q1 = sin(angle/2.) * aprime;
1171  double q2 = sin(angle/2.) * bprime;
1172  double q3 = sin(angle/2.) * cprime;
1173 
1174  double pos2x = (q0*q0 + q1*q1 - q2*q2 - q3*q3) * pos.x() + 2.*(q1*q2 - q0*q3) * pos.y() + 2.*(q1*q3 + q0*q2) * pos.z();
1175  double pos2y = 2.*(q2*q1 + q0*q3) * pos.x() + (q0*q0 - q1*q1 + q2*q2 - q3*q3) * pos.y() + 2.*(q2*q3 - q0*q1) * pos.z();
1176  double pos2z = 2.*(q3*q1 - q0*q2) * pos.x() + 2.*(q3*q2 + q0*q1) * pos.y() + (q0*q0 - q1*q1 - q2*q2 + q3*q3) * pos.z();
1177 
1178  double movex = pos2x - pos.x();
1179  double movey = pos2y - pos.y();
1180  double movez = pos2z - pos.z();
1181  ali->move(align::GlobalVector(movex, movey, movez));
1182 
1183  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1184  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1185 
1186  const SurveyDet *survey = ali->survey();
1187  if (survey != NULL) {
1188  matrix6x6 = survey->errors(); // save the constraint information
1189  }
1190  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1191  } // end loop over alignables
1192 }
double parseDouble(const XMLCh *str, const char *attribute) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:205
T y() const
Definition: PV3DBase.h:62
#define NULL
Definition: scimark2.h:8
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
virtual void rotateAroundGlobalAxis(const GlobalVector &axis, Scalar radians)
Rotation around arbitratry global axis.
Definition: Alignable.cc:104
double double double z
double q2[4]
Definition: TauolaWrapper.h:88
tuple node
Definition: Node.py:50
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
double q1[4]
Definition: TauolaWrapper.h:87
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void MuonAlignmentInputXML::do_rotatelocal ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 1073 of file MuonAlignmentInputXML.cc.

References angle(), SurveyDet::errors(), edm::hlt::Exception, NULL, parseDouble(), Alignable::rotateAroundLocalAxis(), Alignable::setSurvey(), str_angle, str_axisx, str_axisy, str_axisz, Alignable::surface(), Alignable::survey(), vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by newAlignableMuon().

1073  {
1074  DOMAttr *node_axisx = node->getAttributeNode(str_axisx);
1075  DOMAttr *node_axisy = node->getAttributeNode(str_axisy);
1076  DOMAttr *node_axisz = node->getAttributeNode(str_axisz);
1077  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1078  if (node_axisx == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1079  if (node_axisy == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1080  if (node_axisz == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1081  if (node_angle == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1082 
1083  double x = parseDouble(node_axisx->getValue(), "x");
1084  double y = parseDouble(node_axisy->getValue(), "y");
1085  double z = parseDouble(node_axisz->getValue(), "z");
1086  double angle = parseDouble(node_angle->getValue(), "angle");
1087  align::LocalVector vect(x, y, z);
1088 
1089  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1090  Alignable *ali = aliiter->first;
1091 
1092  ali->rotateAroundLocalAxis(vect, angle);
1093 
1094  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1095  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1096 
1097  const SurveyDet *survey = ali->survey();
1098  if (survey != NULL) {
1099  matrix6x6 = survey->errors(); // save the constraint information
1100  }
1101  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1102  } // end loop over alignables
1103 }
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:113
double parseDouble(const XMLCh *str, const char *attribute) const
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:205
#define NULL
Definition: scimark2.h:8
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
double double double z
tuple node
Definition: Node.py:50
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
x
Definition: VDTMath.h:216
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void MuonAlignmentInputXML::do_setape ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 911 of file MuonAlignmentInputXML.cc.

References edm::hlt::Exception, NULL, parseDouble(), str_xx, str_xy, str_xz, str_yy, str_yz, and str_zz.

Referenced by newAlignableMuon().

911  {
912  DOMAttr *node_xx = node->getAttributeNode(str_xx);
913  DOMAttr *node_xy = node->getAttributeNode(str_xy);
914  DOMAttr *node_xz = node->getAttributeNode(str_xz);
915  DOMAttr *node_yy = node->getAttributeNode(str_yy);
916  DOMAttr *node_yz = node->getAttributeNode(str_yz);
917  DOMAttr *node_zz = node->getAttributeNode(str_zz);
918 
919  if (node_xx == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xx\" attribute" << std::endl;
920  if (node_xy == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xy\" attribute" << std::endl;
921  if (node_xz == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xz\" attribute" << std::endl;
922  if (node_yy == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"yy\" attribute" << std::endl;
923  if (node_yz == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"yz\" attribute" << std::endl;
924  if (node_zz == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"zz\" attribute" << std::endl;
925 
926  AlgebraicSymMatrix33 matrix3x3;
927  matrix3x3(0,0) = parseDouble(node_xx->getValue(), "xx");
928  matrix3x3(0,1) = parseDouble(node_xy->getValue(), "xy");
929  matrix3x3(0,2) = parseDouble(node_xz->getValue(), "xz");
930  matrix3x3(1,1) = parseDouble(node_yy->getValue(), "yy");
931  matrix3x3(1,2) = parseDouble(node_yz->getValue(), "yz");
932  matrix3x3(2,2) = parseDouble(node_zz->getValue(), "zz");
933 
934  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
935  // this sets APEs at this level and (since 2nd argument is true) all lower levels
936  aliiter->first->setAlignmentPositionError(AlignmentPositionError(matrix3x3), true);
937  }
938 }
double parseDouble(const XMLCh *str, const char *attribute) const
#define NULL
Definition: scimark2.h:8
tuple node
Definition: Node.py:50
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
void MuonAlignmentInputXML::do_setposition ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 718 of file MuonAlignmentInputXML.cc.

References alpha, PV3DBase< T, PVType, FrameType >::basicVector(), beta, funct::cos(), edm::hlt::Exception, Alignable::globalPosition(), Alignable::globalRotation(), python.rootplot.argparse::message, Alignable::mother(), NULL, parseDouble(), pos, makeMuonMisalignmentScenario::rot, set_one_position(), funct::sin(), str_alpha, str_beta, str_container, str_gamma, str_ideal, str_none, str_phix, str_phiy, str_phiz, str_relativeto, str_x, str_y, str_z, align::toAngles(), align::toMatrix(), TkRotation< T >::transposed(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yz(), detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), and TkRotation< T >::zz().

Referenced by newAlignableMuon().

718  {
719  DOMAttr *node_relativeto = node->getAttributeNode(str_relativeto);
720  if (node_relativeto == NULL) throw cms::Exception("XMLException") << "<setposition> is missing required \"relativeto\" attribute" << std::endl;
721 
722  int relativeto = 0;
723  if (XMLString::equals(node_relativeto->getValue(), str_none)) {
724  relativeto = 0;
725  }
726  else if (XMLString::equals(node_relativeto->getValue(), str_ideal)) {
727  relativeto = 1;
728  }
729  else if (XMLString::equals(node_relativeto->getValue(), str_container)) {
730  relativeto = 2;
731  }
732  else {
733  char *message = XMLString::transcode(node_relativeto->getValue());
734  throw cms::Exception("XMLException") << "relativeto must be \"none\", \"ideal\", or \"container\", not \"" << message << "\"" << std::endl;
735  }
736 
737  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
738  // first reconstruct the old position: how it would look in this coordinate system
739 
740  Alignable *ali = aliiter->first;
741  Alignable *ideal = alitoideal[ali];
742 
743  align::PositionType oldpos = ali->globalPosition();
744  align::RotationType oldrot = ali->globalRotation();
745 
746  if (relativeto == 0) {}
747 
748  else if (relativeto == 1) {
749  align::PositionType idealPosition = ideal->globalPosition();
750  align::RotationType idealRotation = ideal->globalRotation();
751 
752  oldpos = align::PositionType(idealRotation * (oldpos.basicVector() - idealPosition.basicVector()));
753  oldrot = oldrot * idealRotation.transposed();
754  }
755 
756  else if (relativeto == 2 && ali->mother() != NULL) {
757  align::PositionType globalPosition = ali->mother()->globalPosition();
758  align::RotationType globalRotation = ali->mother()->globalRotation();
759 
760  oldpos = align::PositionType(globalRotation * (oldpos.basicVector() - globalPosition.basicVector()));
761  oldrot = oldrot * globalRotation.transposed();
762  }
763 
764  double x = oldpos.x();
765  double y = oldpos.y();
766  double z = oldpos.z();
767 
768  double phix = atan2(oldrot.yz(), oldrot.zz());
769  double phiy = asin(-oldrot.xz());
770  double phiz = atan2(oldrot.xy(), oldrot.xx());
771 
772  align::EulerAngles oldEulerAngles = align::toAngles(oldrot);
773  double alpha = oldEulerAngles(1);
774  double beta = oldEulerAngles(2);
775  double gamma = oldEulerAngles(3);
776 
777  // now get the new information; if it's incomplete, use the old position for those coordinates
778 
779  DOMAttr *node_x = node->getAttributeNode(str_x);
780  DOMAttr *node_y = node->getAttributeNode(str_y);
781  DOMAttr *node_z = node->getAttributeNode(str_z);
782 
783  if (node_x != NULL) x = parseDouble(node_x->getValue(), "x");
784  if (node_y != NULL) y = parseDouble(node_y->getValue(), "y");
785  if (node_z != NULL) z = parseDouble(node_z->getValue(), "z");
786  align::PositionType pos(x, y, z);
787 
788  DOMAttr *node_phix = node->getAttributeNode(str_phix);
789  DOMAttr *node_phiy = node->getAttributeNode(str_phiy);
790  DOMAttr *node_phiz = node->getAttributeNode(str_phiz);
791  DOMAttr *node_alpha = node->getAttributeNode(str_alpha);
792  DOMAttr *node_beta = node->getAttributeNode(str_beta);
793  DOMAttr *node_gamma = node->getAttributeNode(str_gamma);
795 
796  bool phixyz = (node_phix != NULL || node_phiy != NULL || node_phiz != NULL);
797  bool alphabetagamma = (node_alpha != NULL || node_beta != NULL || node_gamma != NULL);
798  if (phixyz && alphabetagamma) throw cms::Exception("XMLException") << "<setposition> must either have phix, phiy, and phiz or alpha, beta, and gamma, but not both" << std::endl;
799  if (!phixyz && !alphabetagamma) alphabetagamma = true;
800 
801  if (phixyz) {
802  if (node_phix != NULL) phix = parseDouble(node_phix->getValue(), "phix");
803  if (node_phiy != NULL) phiy = parseDouble(node_phiy->getValue(), "phiy");
804  if (node_phiz != NULL) phiz = parseDouble(node_phiz->getValue(), "phiz");
805 
806  // the angle convention originally used in alignment, also known as "non-standard Euler angles with a Z-Y-X convention"
807  // this also gets the sign convention right
808  align::RotationType rotX( 1., 0., 0.,
809  0., cos(phix), sin(phix),
810  0., -sin(phix), cos(phix));
811  align::RotationType rotY( cos(phiy), 0., -sin(phiy),
812  0., 1., 0.,
813  sin(phiy), 0., cos(phiy));
814  align::RotationType rotZ( cos(phiz), sin(phiz), 0.,
815  -sin(phiz), cos(phiz), 0.,
816  0., 0., 1.);
817 
818  rot = rotX * rotY * rotZ;
819  }
820 
821  else if (alphabetagamma) {
822  if (node_alpha != NULL) alpha = parseDouble(node_alpha->getValue(), "alpha");
823  if (node_beta != NULL) beta = parseDouble(node_beta->getValue(), "beta");
824  if (node_gamma != NULL) gamma = parseDouble(node_gamma->getValue(), "gamma");
825 
826  // standard Euler angles (how they're internally stored in the database)
827  align::EulerAngles eulerAngles(3);
828  eulerAngles(1) = alpha;
829  eulerAngles(2) = beta;
830  eulerAngles(3) = gamma;
831  rot = align::RotationType(align::toMatrix(eulerAngles));
832  }
833 
834  else assert(false); // see above
835 
836  if (relativeto == 0) {
837  set_one_position(aliiter->first, pos, rot);
838  } // end relativeto="none"
839 
840  else if (relativeto == 1) {
841  Alignable *ali = aliiter->first;
842  Alignable *ideal = alitoideal[ali];
843 
844  align::PositionType idealPosition = ideal->globalPosition();
845  align::RotationType idealRotation = ideal->globalRotation();
846  align::PositionType newpos = align::PositionType(idealRotation.transposed() * pos.basicVector() + idealPosition.basicVector());
847  align::RotationType newrot = rot * idealRotation;
848 
849  set_one_position(ali, newpos, newrot);
850  } // end relativeto="ideal"
851 
852  else if (relativeto == 2) {
853  Alignable *ali = aliiter->first;
854  Alignable *container = ali->mother();
855 
856  if (container != NULL) {
857  align::PositionType globalPosition = container->globalPosition();
858  align::RotationType globalRotation = container->globalRotation();
859  align::PositionType newpos = align::PositionType(globalRotation.transposed() * pos.basicVector() + globalPosition.basicVector());
860  align::RotationType newrot = rot * globalRotation;
861  set_one_position(ali, newpos, newrot);
862  }
863  else {
864  set_one_position(ali, pos, rot);
865  }
866  } // end relativeto="container"
867 
868  } // end loop over alignables
869 }
T xx() const
const double beta
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
float alpha
Definition: AMPTWrapper.h:95
double parseDouble(const XMLCh *str, const char *attribute) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:62
#define NULL
Definition: scimark2.h:8
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:132
double double double z
tuple node
Definition: Node.py:50
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:30
T xy() const
T zz() const
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:7
AlgebraicVector EulerAngles
Definition: Definitions.h:36
T xz() const
TkRotation transposed() const
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:40
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
x
Definition: VDTMath.h:216
void set_one_position(Alignable *ali, const align::PositionType &pos, const align::RotationType &rot) const
T x() const
Definition: PV3DBase.h:61
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:85
T yz() const
void MuonAlignmentInputXML::do_setsurveyerr ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 940 of file MuonAlignmentInputXML.cc.

References edm::hlt::Exception, NULL, parseDouble(), Alignable::setSurvey(), str_aa, str_ab, str_ac, str_bb, str_bc, str_cc, str_xa, str_xb, str_xc, str_xx, str_xy, str_xz, str_ya, str_yb, str_yc, str_yy, str_yz, str_za, str_zb, str_zc, str_zz, and Alignable::surface().

Referenced by newAlignableMuon().

940  {
941  DOMAttr *node_xx = node->getAttributeNode(str_xx);
942  DOMAttr *node_xy = node->getAttributeNode(str_xy);
943  DOMAttr *node_xz = node->getAttributeNode(str_xz);
944  DOMAttr *node_xa = node->getAttributeNode(str_xa);
945  DOMAttr *node_xb = node->getAttributeNode(str_xb);
946  DOMAttr *node_xc = node->getAttributeNode(str_xc);
947  DOMAttr *node_yy = node->getAttributeNode(str_yy);
948  DOMAttr *node_yz = node->getAttributeNode(str_yz);
949  DOMAttr *node_ya = node->getAttributeNode(str_ya);
950  DOMAttr *node_yb = node->getAttributeNode(str_yb);
951  DOMAttr *node_yc = node->getAttributeNode(str_yc);
952  DOMAttr *node_zz = node->getAttributeNode(str_zz);
953  DOMAttr *node_za = node->getAttributeNode(str_za);
954  DOMAttr *node_zb = node->getAttributeNode(str_zb);
955  DOMAttr *node_zc = node->getAttributeNode(str_zc);
956  DOMAttr *node_aa = node->getAttributeNode(str_aa);
957  DOMAttr *node_ab = node->getAttributeNode(str_ab);
958  DOMAttr *node_ac = node->getAttributeNode(str_ac);
959  DOMAttr *node_bb = node->getAttributeNode(str_bb);
960  DOMAttr *node_bc = node->getAttributeNode(str_bc);
961  DOMAttr *node_cc = node->getAttributeNode(str_cc);
962 
963  if (node_xx == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
964  if (node_xy == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
965  if (node_xz == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
966  if (node_xa == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
967  if (node_xb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
968  if (node_xc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
969  if (node_yy == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
970  if (node_yz == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
971  if (node_ya == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
972  if (node_yb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
973  if (node_yc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
974  if (node_zz == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
975  if (node_za == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"za\" attribute" << std::endl;
976  if (node_zb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
977  if (node_zc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
978  if (node_aa == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
979  if (node_ab == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
980  if (node_ac == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
981  if (node_bb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
982  if (node_bc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
983  if (node_cc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
984 
985  align::ErrorMatrix matrix6x6;
986  matrix6x6(0,0) = parseDouble(node_xx->getValue(), "xx");
987  matrix6x6(0,1) = parseDouble(node_xy->getValue(), "xy");
988  matrix6x6(0,2) = parseDouble(node_xz->getValue(), "xz");
989  matrix6x6(0,3) = parseDouble(node_xa->getValue(), "xa");
990  matrix6x6(0,4) = parseDouble(node_xb->getValue(), "xb");
991  matrix6x6(0,5) = parseDouble(node_xc->getValue(), "xc");
992  matrix6x6(1,1) = parseDouble(node_yy->getValue(), "yy");
993  matrix6x6(1,2) = parseDouble(node_yz->getValue(), "yz");
994  matrix6x6(1,3) = parseDouble(node_ya->getValue(), "ya");
995  matrix6x6(1,4) = parseDouble(node_yb->getValue(), "yb");
996  matrix6x6(1,5) = parseDouble(node_yc->getValue(), "yc");
997  matrix6x6(2,2) = parseDouble(node_zz->getValue(), "zz");
998  matrix6x6(2,3) = parseDouble(node_za->getValue(), "za");
999  matrix6x6(2,4) = parseDouble(node_zb->getValue(), "zb");
1000  matrix6x6(2,5) = parseDouble(node_zc->getValue(), "zc");
1001  matrix6x6(3,3) = parseDouble(node_aa->getValue(), "aa");
1002  matrix6x6(3,4) = parseDouble(node_ab->getValue(), "ab");
1003  matrix6x6(3,5) = parseDouble(node_ac->getValue(), "ac");
1004  matrix6x6(4,4) = parseDouble(node_bb->getValue(), "bb");
1005  matrix6x6(4,5) = parseDouble(node_bc->getValue(), "bc");
1006  matrix6x6(5,5) = parseDouble(node_cc->getValue(), "cc");
1007 
1008  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1009  Alignable *ali = aliiter->first;
1010  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1011  }
1012 }
double parseDouble(const XMLCh *str, const char *attribute) const
#define NULL
Definition: scimark2.h:8
tuple node
Definition: Node.py:50
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
void MuonAlignmentInputXML::fillAliToIdeal ( std::map< Alignable *, Alignable * > &  alitoideal,
const align::Alignables  alignables,
const align::Alignables  ideals 
) const
private

Definition at line 227 of file MuonAlignmentInputXML.cc.

References edm::hlt::Exception.

Referenced by newAlignableMuon().

227  {
228  align::Alignables::const_iterator alignable = alignables.begin();
229  align::Alignables::const_iterator ideal = ideals.begin();
230 
231  while (alignable != alignables.end() && ideal != ideals.end()) {
232  alitoideal[*alignable] = *ideal;
233 
234  fillAliToIdeal(alitoideal, (*alignable)->components(), (*ideal)->components());
235 
236  ++alignable;
237  ++ideal;
238  }
239 
240  if (alignable != alignables.end() || ideal != ideals.end()) {
241  throw cms::Exception("Alignment") << "alignable and ideal-alignable trees are out of sync (this should never happen)";
242  }
243 }
void fillAliToIdeal(std::map< Alignable *, Alignable * > &alitoideal, const align::Alignables alignables, const align::Alignables ideals) const
Alignable * MuonAlignmentInputXML::getCSCnode ( align::StructureType  structureType,
std::map< unsigned int, Alignable * > &  alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *  node 
) const
private

Definition at line 549 of file MuonAlignmentInputXML.cc.

References align::AlignableCSCChamber, align::AlignableCSCEndcap, align::AlignableCSCRing, align::AlignableCSCStation, align::AlignableDetUnit, Alignable::alignableObjectId(), Reference_intrackfit_cff::endcap, edm::hlt::Exception, Alignable::mother(), NULL, DetId::rawId(), relativeConstraints::ring, relativeConstraints::station, str_chamber, str_endcap, str_layer, str_rawId, str_ring, and str_station.

Referenced by getNode().

549  {
550  unsigned int rawId;
551 
552  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
553  if (node_rawId != NULL) {
554  try {
555  rawId = XMLString::parseInt(node_rawId->getValue());
556  }
557  catch (const XMLException &toCatch) {
558  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
559  }
560  }
561  else {
562  int endcap, station, ring, chamber, layer;
563  endcap = station = ring = chamber = layer = 1;
564 
565  DOMAttr *node_endcap = node->getAttributeNode(str_endcap);
566  if (node_endcap == NULL) throw cms::Exception("XMLException") << "CSC node is missing required \"endcap\" attribute" << std::endl;
567  try {
568  endcap = XMLString::parseInt(node_endcap->getValue());
569  }
570  catch (const XMLException &toCatch) {
571  throw cms::Exception("XMLException") << "Value of \"endcap\" must be an integer" << std::endl;
572  }
573  if (endcap == -1) endcap = 2;
574 
575  if (structureType != align::AlignableCSCEndcap) {
576  DOMAttr *node_station = node->getAttributeNode(str_station);
577  if (node_station == NULL) throw cms::Exception("XMLException") << "CSC node is missing required \"station\" attribute" << std::endl;
578  try {
579  station = XMLString::parseInt(node_station->getValue());
580  }
581  catch (const XMLException &toCatch) {
582  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
583  }
584 
585  if (structureType != align::AlignableCSCStation) {
586  DOMAttr *node_ring = node->getAttributeNode(str_ring);
587  if (node_ring == NULL) throw cms::Exception("XMLException") << "CSC node is missing required \"ring\" attribute" << std::endl;
588  try {
589  ring = XMLString::parseInt(node_ring->getValue());
590  }
591  catch (const XMLException &toCatch) {
592  throw cms::Exception("XMLException") << "Value of \"ring\" must be an integer" << std::endl;
593  }
594 
595  if (structureType != align::AlignableCSCRing) {
596  DOMAttr *node_chamber = node->getAttributeNode(str_chamber);
597  if (node_chamber == NULL) throw cms::Exception("XMLException") << "CSC node is missing required \"chamber\" attribute" << std::endl;
598  try {
599  chamber = XMLString::parseInt(node_chamber->getValue());
600  }
601  catch (const XMLException &toCatch) {
602  throw cms::Exception("XMLException") << "Value of \"chamber\" must be an integer" << std::endl;
603  }
604 
605  if (structureType != align::AlignableCSCChamber) {
606  DOMAttr *node_layer = node->getAttributeNode(str_layer);
607  if (node_layer == NULL) throw cms::Exception("XMLException") << "CSC node is missing required \"layer\" attribute" << std::endl;
608  try {
609  layer = XMLString::parseInt(node_layer->getValue());
610  }
611  catch (const XMLException &toCatch) {
612  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
613  }
614 
615  } // end if we need a layer number
616  } // end if we need a chamber number
617  } // end if we need a ring number
618  } // end if we need a station number
619 
620  CSCDetId layerId(endcap, station, ring, chamber, layer);
621  rawId = layerId.rawId();
622  } // end if it's specified by endcap, station, ring, chamber, layer
623 
624  Alignable *ali = alignableNavigator[rawId];
625  if (ali == NULL) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
626 
627  while (ali->alignableObjectId() != structureType) {
628  ali = ali->mother();
629 
630  if (ali == NULL) {
631  if (structureType == align::AlignableCSCEndcap) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a CSCEndcap" << std::endl;
632  else if (structureType == align::AlignableCSCStation) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a CSCStation" << std::endl;
633  else if (structureType == align::AlignableCSCRing) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a CSCRing" << std::endl;
634  else if (structureType == align::AlignableCSCChamber) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a CSCChamber" << std::endl;
635  else if (structureType == align::AlignableDetUnit) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a CSCLayer" << std::endl;
636  }
637  }
638  return ali;
639 }
#define NULL
Definition: scimark2.h:8
tuple node
Definition: Node.py:50
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:85
Alignable * MuonAlignmentInputXML::getDTnode ( align::StructureType  structureType,
std::map< unsigned int, Alignable * > &  alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *  node 
) const
private

Definition at line 455 of file MuonAlignmentInputXML.cc.

References align::AlignableDetUnit, align::AlignableDTBarrel, align::AlignableDTChamber, align::AlignableDTStation, align::AlignableDTSuperLayer, align::AlignableDTWheel, Alignable::alignableObjectId(), edm::hlt::Exception, Alignable::mother(), NULL, DetId::rawId(), relativeConstraints::station, str_layer, str_rawId, str_sector, str_station, str_superlayer, and str_wheel.

Referenced by getNode().

455  {
456  unsigned int rawId = 0;
457 
458  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
459  if (node_rawId != NULL) {
460  try {
461  rawId = XMLString::parseInt(node_rawId->getValue());
462  }
463  catch (const XMLException &toCatch) {
464  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
465  }
466  }
467  else {
468  int wheel, station, sector, superlayer, layer;
469  wheel = station = sector = superlayer = layer = 1;
470 
471  if (structureType != align::AlignableDTBarrel) {
472  DOMAttr *node_wheel = node->getAttributeNode(str_wheel);
473  if (node_wheel == NULL) throw cms::Exception("XMLException") << "DT node is missing required \"wheel\" attribute" << std::endl;
474  try {
475  wheel = XMLString::parseInt(node_wheel->getValue());
476  }
477  catch (const XMLException &toCatch) {
478  throw cms::Exception("XMLException") << "Value of \"wheel\" must be an integer" << std::endl;
479  }
480 
481  if (structureType != align::AlignableDTWheel) {
482  DOMAttr *node_station = node->getAttributeNode(str_station);
483  if (node_station == NULL) throw cms::Exception("XMLException") << "DT node is missing required \"station\" attribute" << std::endl;
484  try {
485  station = XMLString::parseInt(node_station->getValue());
486  }
487  catch (const XMLException &toCatch) {
488  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
489  }
490 
491  if (structureType != align::AlignableDTStation) {
492  DOMAttr *node_sector = node->getAttributeNode(str_sector);
493  if (node_sector == NULL) throw cms::Exception("XMLException") << "DT node is missing required \"sector\" attribute" << std::endl;
494  try {
495  sector = XMLString::parseInt(node_sector->getValue());
496  }
497  catch (const XMLException &toCatch) {
498  throw cms::Exception("XMLException") << "Value of \"sector\" must be an integer" << std::endl;
499  }
500 
501  if (structureType != align::AlignableDTChamber) {
502  DOMAttr *node_superlayer = node->getAttributeNode(str_superlayer);
503  if (node_superlayer == NULL) throw cms::Exception("XMLException") << "DT node is missing required \"superlayer\" attribute" << std::endl;
504  try {
505  superlayer = XMLString::parseInt(node_superlayer->getValue());
506  }
507  catch (const XMLException &toCatch) {
508  throw cms::Exception("XMLException") << "Value of \"superlayer\" must be an integer" << std::endl;
509  }
510 
511  if (structureType != align::AlignableDTSuperLayer) {
512  DOMAttr *node_layer = node->getAttributeNode(str_layer);
513  if (node_layer == NULL) throw cms::Exception("XMLException") << "DT node is missing required \"layer\" attribute" << std::endl;
514  try {
515  layer = XMLString::parseInt(node_layer->getValue());
516  }
517  catch (const XMLException &toCatch) {
518  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
519  }
520 
521  } // end if we need a layer number
522  } // end if we need a superlayer number
523  } // end if we need a sector number
524  } // end if we need a station number
525  } // end if we need a wheel number
526 
527  DTLayerId layerId(wheel, station, sector, superlayer, layer);
528  rawId = layerId.rawId();
529  } // end if it's specified by wheel, station, sector, superlayer, layer
530 
531  Alignable *ali = alignableNavigator[rawId];
532  if (ali == NULL) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
533 
534  while (ali->alignableObjectId() != structureType) {
535  ali = ali->mother();
536 
537  if (ali == NULL) {
538  if (structureType == align::AlignableDTBarrel) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a DTBarrel" << std::endl;
539  else if (structureType == align::AlignableDTWheel) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a DTWheel" << std::endl;
540  else if (structureType == align::AlignableDTStation) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a DTStation" << std::endl;
541  else if (structureType == align::AlignableDTChamber) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a DTChamber" << std::endl;
542  else if (structureType == align::AlignableDTSuperLayer) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a DTSuperLayer" << std::endl;
543  else if (structureType == align::AlignableDetUnit) throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not a DTLayer" << std::endl;
544  }
545  }
546  return ali;
547 }
#define NULL
Definition: scimark2.h:8
tuple node
Definition: Node.py:50
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:85
Alignable * MuonAlignmentInputXML::getNode ( std::map< unsigned int, Alignable * > &  alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *  node 
) const
private

Definition at line 440 of file MuonAlignmentInputXML.cc.

References align::AlignableCSCChamber, align::AlignableCSCEndcap, align::AlignableCSCRing, align::AlignableCSCStation, align::AlignableDetUnit, align::AlignableDTBarrel, align::AlignableDTChamber, align::AlignableDTStation, align::AlignableDTSuperLayer, align::AlignableDTWheel, getCSCnode(), getDTnode(), NULL, str_CSCChamber, str_CSCEndcap, str_CSCLayer, str_CSCRing, str_CSCStation, str_DTBarrel, str_DTChamber, str_DTLayer, str_DTStation, str_DTSuperLayer, and str_DTWheel.

Referenced by python.TagTree.tagTree::deleteNode(), python.TagTree.tagTree::deleteSubtree(), python.TagTree.tagTree::getPath(), python.TagTree.tagTree::getSubtree(), python.TagTree.tagTree::insertNode(), python.TagTree.tagTree::nChildren(), and newAlignableMuon().

440  {
441  if (XMLString::equals(node->getNodeName(), str_DTBarrel)) return getDTnode(align::AlignableDTBarrel, alignableNavigator, node);
442  else if (XMLString::equals(node->getNodeName(), str_DTWheel)) return getDTnode(align::AlignableDTWheel, alignableNavigator, node);
443  else if (XMLString::equals(node->getNodeName(), str_DTStation)) return getDTnode(align::AlignableDTStation, alignableNavigator, node);
444  else if (XMLString::equals(node->getNodeName(), str_DTChamber)) return getDTnode(align::AlignableDTChamber, alignableNavigator, node);
445  else if (XMLString::equals(node->getNodeName(), str_DTSuperLayer)) return getDTnode(align::AlignableDTSuperLayer, alignableNavigator, node);
446  else if (XMLString::equals(node->getNodeName(), str_DTLayer)) return getDTnode(align::AlignableDetUnit, alignableNavigator, node);
447  else if (XMLString::equals(node->getNodeName(), str_CSCEndcap)) return getCSCnode(align::AlignableCSCEndcap, alignableNavigator, node);
448  else if (XMLString::equals(node->getNodeName(), str_CSCStation)) return getCSCnode(align::AlignableCSCStation, alignableNavigator, node);
449  else if (XMLString::equals(node->getNodeName(), str_CSCRing)) return getCSCnode(align::AlignableCSCRing, alignableNavigator, node);
450  else if (XMLString::equals(node->getNodeName(), str_CSCChamber)) return getCSCnode(align::AlignableCSCChamber, alignableNavigator, node);
451  else if (XMLString::equals(node->getNodeName(), str_CSCLayer)) return getCSCnode(align::AlignableDetUnit, alignableNavigator, node);
452  else return NULL;
453 }
#define NULL
Definition: scimark2.h:8
tuple node
Definition: Node.py:50
Alignable * getDTnode(align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node) const
Alignable * getCSCnode(align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node) const
AlignableMuon * MuonAlignmentInputXML::newAlignableMuon ( const edm::EventSetup iSetup) const
virtual

Reimplemented from MuonAlignmentInputMethod.

Definition at line 245 of file MuonAlignmentInputXML.cc.

References align::AlignableMuon, runEdmFileComparison::collection, AlignableMuon::CSCEndcaps(), do_moveglobal(), do_movelocal(), do_rotatebeamline(), do_rotateglobalaxis(), do_rotatelocal(), do_setape(), do_setposition(), do_setsurveyerr(), asciidump::doc, AlignableMuon::DTBarrel(), edm::hlt::Exception, fillAliToIdeal(), getNode(), i, MuonAlignmentInputMethod::idealCSCGeometry(), MuonAlignmentInputMethod::idealDTGeometry(), j, m_fileName, python.rootplot.argparse::message, mergeVDriftHistosByStation::name, python.Node::node, NULL, geometryXMLtoCSV::parser, recursiveGetId(), fetchall_from_DQM_v2::release, str_collection, str_moveglobal, str_movelocal, str_name, str_operation, str_rotatebeamline, str_rotateglobalaxis, str_rotatelocal, str_setape, str_setposition, and str_setsurveyerr.

245  {
246  boost::shared_ptr<DTGeometry> dtGeometry = idealDTGeometry(iSetup);
247  boost::shared_ptr<CSCGeometry> cscGeometry = idealCSCGeometry(iSetup);
248 
249  AlignableMuon *alignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
250  std::map<unsigned int, Alignable*> alignableNavigator; // real AlignableNavigators don't have const methods
251  recursiveGetId(alignableNavigator, alignableMuon->DTBarrel());
252  recursiveGetId(alignableNavigator, alignableMuon->CSCEndcaps());
253 
254  AlignableMuon *ideal_alignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
255  std::map<unsigned int, Alignable*> ideal_alignableNavigator; // real AlignableNavigators don't have const methods
256  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->DTBarrel());
257  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());
258 
259  try {
260  XMLPlatformUtils::Initialize();
261  }
262  catch (const XMLException &toCatch) {
263  throw cms::Exception("XMLException") << "Xerces XML parser threw an exception on initialization." << std::endl;
264  }
265 
266  XercesDOMParser *parser = new XercesDOMParser();
267  parser->setValidationScheme(XercesDOMParser::Val_Always);
268 
269  ErrorHandler *errHandler = (ErrorHandler*)(new HandlerBase());
270  parser->setErrorHandler(errHandler);
271 
272  try {
273  parser->parse(m_fileName.c_str());
274  }
275  catch (const XMLException &toCatch) {
276  char *message = XMLString::transcode(toCatch.getMessage());
277  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
278  }
279  catch (const DOMException &toCatch) {
280  char *message = XMLString::transcode(toCatch.msg);
281  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
282  }
283  catch (const SAXException &toCatch) {
284  char *message = XMLString::transcode(toCatch.getMessage());
285  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
286  }
287  catch (...) {
288  throw cms::Exception("XMLException") << "Xerces XML parser threw an unknown exception" << std::endl;
289  }
290 
291  DOMDocument *doc = parser->getDocument();
292  DOMElement *node_MuonAlignment = doc->getDocumentElement();
293  DOMNodeList *collections = doc->getElementsByTagName(str_collection);
294  DOMNodeList *operations = doc->getElementsByTagName(str_operation);
295 
296  std::map<Alignable*, Alignable*> alitoideal;
297  fillAliToIdeal(alitoideal, alignableMuon->DTBarrel(), ideal_alignableMuon->DTBarrel());
298  fillAliToIdeal(alitoideal, alignableMuon->CSCEndcaps(), ideal_alignableMuon->CSCEndcaps());
299 
300  std::map<std::string, std::map<Alignable*, bool> > alicollections;
301  for (unsigned int i = 0; i < collections->getLength(); i++) {
302  DOMElement *collection = (DOMElement*)(collections->item(i));
303  if (collection->getParentNode() == node_MuonAlignment) {
304  DOMNodeList *children = collection->getChildNodes();
305 
306  DOMAttr *node_name = collection->getAttributeNode(str_name);
307  if (node_name == NULL) {
308  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
309  }
310  char *ascii_name = XMLString::transcode(node_name->getValue());
311  std::string name(ascii_name);
312  XMLString::release(&ascii_name);
313 
314  std::map<Alignable*, bool> aliset;
315  for (unsigned int j = 0; j < children->getLength(); j++) {
316  DOMNode *node = children->item(j);
317 
318  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
319  Alignable *ali = getNode(alignableNavigator, (DOMElement*)(node));
320  if (ali == NULL) {
321  throw cms::Exception("XMLException") << "<collection> must contain only alignables" << std::endl;
322  }
323 
324  aliset[ali] = true;
325  } // end if this node is an element
326  } // end loop over collection's children
327 
328  alicollections[name] = aliset;
329  } // end if this is a top-level collection
330  } // end loop over collections
331 
332  for (unsigned int i = 0; i < operations->getLength(); i++) {
333  DOMElement *operation = (DOMElement*)(operations->item(i));
334  if (operation->getParentNode() != node_MuonAlignment) {
335  throw cms::Exception("XMLException") << "All operations must be top-level elements" << std::endl;
336  }
337 
338  DOMNodeList *children = operation->getChildNodes();
339 
340  std::map<Alignable*, bool> aliset;
341  std::vector<DOMNode*> nodesToRemove;
342  for (unsigned int j = 0; j < children->getLength(); j++) {
343  DOMNode *node = children->item(j);
344 
345  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
346  Alignable *ali = getNode(alignableNavigator, (DOMElement*)(node));
347  if (ali != NULL) {
348  aliset[ali] = true;
349  nodesToRemove.push_back(node);
350  } // end if this node is an alignable
351 
352  else if (XMLString::equals(node->getNodeName(), str_collection)) {
353  DOMAttr *node_name = ((DOMElement*)(node))->getAttributeNode(str_name);
354  if (node_name == NULL) {
355  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
356  }
357  char *ascii_name = XMLString::transcode(node_name->getValue());
358  std::string name(ascii_name);
359  XMLString::release(&ascii_name);
360 
361  std::map<std::string, std::map<Alignable*, bool> >::const_iterator alicollections_iter = alicollections.find(name);
362  if (alicollections_iter == alicollections.end()) {
363  throw cms::Exception("XMLException") << "<collection name=\"" << name << "\"> hasn't been defined" << std::endl;
364  }
365 
366  for (std::map<Alignable*, bool>::const_iterator aliiter = alicollections_iter->second.begin();
367  aliiter != alicollections_iter->second.end();
368  ++aliiter) {
369  aliset[aliiter->first] = true;
370  } // end loop over alignables in this collection
371 
372  nodesToRemove.push_back(node);
373  } // end if this node is a collection
374 
375  else {} // anything else? assume it's a position/rotation directive
376 
377  } // end if node is node is an element
378  } // end first loop over operation's children
379 
380  // from now on, we only want to see position/rotation directives
381  for (std::vector<DOMNode*>::const_iterator node = nodesToRemove.begin(); node != nodesToRemove.end(); ++node) {
382  operation->removeChild(*node);
383  }
384  children = operation->getChildNodes();
385 
386  for (unsigned int j = 0; j < children->getLength(); j++) {
387  DOMNode *node = children->item(j);
388  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
389 
390  if (XMLString::equals(node->getNodeName(), str_setposition)) {
391  do_setposition((DOMElement*)(node), aliset, alitoideal);
392  }
393 
394  else if (XMLString::equals(node->getNodeName(), str_setape)) {
395  do_setape((DOMElement*)(node), aliset, alitoideal);
396  }
397 
398  else if (XMLString::equals(node->getNodeName(), str_setsurveyerr)) {
399  do_setsurveyerr((DOMElement*)(node), aliset, alitoideal);
400  }
401 
402  else if (XMLString::equals(node->getNodeName(), str_moveglobal)) {
403  do_moveglobal((DOMElement*)(node), aliset, alitoideal);
404  }
405 
406  else if (XMLString::equals(node->getNodeName(), str_movelocal)) {
407  do_movelocal((DOMElement*)(node), aliset, alitoideal);
408  }
409 
410  else if (XMLString::equals(node->getNodeName(), str_rotatelocal)) {
411  do_rotatelocal((DOMElement*)(node), aliset, alitoideal);
412  }
413 
414  else if (XMLString::equals(node->getNodeName(), str_rotatebeamline)) {
415  do_rotatebeamline((DOMElement*)(node), aliset, alitoideal);
416  }
417 
418  else if (XMLString::equals(node->getNodeName(), str_rotateglobalaxis)) {
419  do_rotateglobalaxis((DOMElement*)(node), aliset, alitoideal);
420  }
421 
422  else {
423  char *message = XMLString::transcode(node->getNodeName());
424  throw cms::Exception("XMLException") << "Unrecognized operation: \"" << message << "\"" << std::endl;
425  }
426 
427  } // end if node is an element
428  } // end second loop over operation's children
429  } // end loop over operations
430 
431  delete parser;
432  delete errHandler;
433 
434  XMLPlatformUtils::Terminate();
435 
436  delete ideal_alignableMuon;
437  return alignableMuon;
438 }
void do_setsurveyerr(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
int i
Definition: DBlmapReader.cc:9
void fillAliToIdeal(std::map< Alignable *, Alignable * > &alitoideal, const align::Alignables alignables, const align::Alignables ideals) const
void do_rotatelocal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
align::Alignables DTBarrel()
#define NULL
Definition: scimark2.h:8
void do_movelocal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
void do_moveglobal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
tuple node
Definition: Node.py:50
void do_rotatebeamline(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
align::Alignables CSCEndcaps()
void recursiveGetId(std::map< unsigned int, Alignable * > &alignableNavigator, const align::Alignables &alignables) const
Alignable * getNode(std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node) const
int j
Definition: DBlmapReader.cc:9
void do_setape(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
tuple doc
Definition: asciidump.py:381
boost::shared_ptr< CSCGeometry > idealCSCGeometry(const edm::EventSetup &iSetup) const
void do_rotateglobalaxis(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
void do_setposition(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Constructor of the full muon geometry.
Definition: AlignableMuon.h:36
boost::shared_ptr< DTGeometry > idealDTGeometry(const edm::EventSetup &iSetup) const
const MuonAlignmentInputXML& MuonAlignmentInputXML::operator= ( const MuonAlignmentInputXML )
private
double MuonAlignmentInputXML::parseDouble ( const XMLCh *  str,
const char *  attribute 
) const
private

Definition at line 641 of file MuonAlignmentInputXML.cc.

References edm::hlt::Exception, i, reco::HaloData::minus, convertSQLitetoXML_cfg::output, funct::pow(), and fetchall_from_DQM_v2::release.

Referenced by do_moveglobal(), do_movelocal(), do_rotatebeamline(), do_rotateglobalaxis(), do_rotatelocal(), do_setape(), do_setposition(), and do_setsurveyerr().

641  {
642  unsigned int len = XMLString::stringLen(str);
643  char *cstr = XMLString::transcode(str);
644  std::stringstream errmessage;
645  errmessage << "Value of \"" << attribute << "\" must be a double, not \"" << cstr << "\"" << std::endl;
646 
647  unsigned int i = 0;
648 
649  bool minus = false;
650  if (cstr[i] == '-') {
651  minus = true;
652  i++;
653  }
654  else if (cstr[i] == '+') i++;
655 
656  double output = 0.;
657 
658  while (cstr[i] != '.' && cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
659  if (cstr[i] < '0' || cstr[i] > '9') {
660  XMLString::release(&cstr);
661  throw cms::Exception("XMLException") << errmessage.str();
662  }
663 
664  output *= 10;
665  output += cstr[i] - '0';
666  i++;
667  }
668 
669  if (cstr[i] == '.') {
670  double place = 0.1;
671  i++;
672 
673  while (cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
674  if (cstr[i] < '0' || cstr[i] > '9') {
675  XMLString::release(&cstr);
676  throw cms::Exception("XMLException") << errmessage.str();
677  }
678 
679  output += (cstr[i] - '0') * place;
680  place /= 10.;
681  i++;
682  }
683  }
684 
685  if (cstr[i] == 'e' || cstr[i] == 'E') {
686  i++;
687 
688  int exponent = 0;
689  bool expminus = false;
690  if (cstr[i] == '-') {
691  expminus = true;
692  i++;
693  }
694  else if (cstr[i] == '+') i++;
695 
696  while (i < len) {
697  if (cstr[i] < '0' || cstr[i] > '9') {
698  XMLString::release(&cstr);
699  throw cms::Exception("XMLException") << errmessage.str();
700  }
701 
702  exponent *= 10;
703  exponent += cstr[i] - '0';
704  i++;
705  }
706 
707  if (expminus) exponent *= -1;
708 
709  output *= pow(10., exponent);
710  }
711 
712  if (minus) output *= -1.;
713 
714  XMLString::release(&cstr);
715  return output;
716 }
int i
Definition: DBlmapReader.cc:9
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void MuonAlignmentInputXML::recursiveGetId ( std::map< unsigned int, Alignable * > &  alignableNavigator,
const align::Alignables alignables 
) const
private

Definition at line 216 of file MuonAlignmentInputXML.cc.

References align::AlignableCSCChamber, align::AlignableCSCLayer, align::AlignableDet, align::AlignableDetUnit, align::AlignableDTChamber, align::AlignableDTLayer, and align::AlignableDTSuperLayer.

Referenced by newAlignableMuon().

216  {
217  for (align::Alignables::const_iterator ali = alignables.begin(); ali != alignables.end(); ++ali) {
218  if ((*ali)->alignableObjectId() == align::AlignableDetUnit || (*ali)->alignableObjectId() == align::AlignableDet ||
219  (*ali)->alignableObjectId() == align::AlignableDTChamber || (*ali)->alignableObjectId() == align::AlignableDTSuperLayer || (*ali)->alignableObjectId() == align::AlignableDTLayer ||
220  (*ali)->alignableObjectId() == align::AlignableCSCChamber || (*ali)->alignableObjectId() == align::AlignableCSCLayer) {
221  alignableNavigator[(*ali)->geomDetId().rawId()] = *ali;
222  }
223  recursiveGetId(alignableNavigator, (*ali)->components());
224  }
225 }
void recursiveGetId(std::map< unsigned int, Alignable * > &alignableNavigator, const align::Alignables &alignables) const
void MuonAlignmentInputXML::set_one_position ( Alignable ali,
const align::PositionType pos,
const align::RotationType rot 
) const
private

Definition at line 871 of file MuonAlignmentInputXML.cc.

References SurveyDet::errors(), Alignable::globalPosition(), Alignable::globalRotation(), Alignable::move(), TkRotation< T >::multiplyInverse(), NULL, align::rectify(), Alignable::rotateInGlobalFrame(), Alignable::setSurvey(), Alignable::surface(), and Alignable::survey().

Referenced by do_setposition().

871  {
872  const align::PositionType& oldpos = ali->globalPosition();
873  const align::RotationType& oldrot = ali->globalRotation();
874 
875  // shift needed to move from current to new position
876  align::GlobalVector posDiff = pos - oldpos;
877  align::RotationType rotDiff = oldrot.multiplyInverse(rot);
878  align::rectify(rotDiff); // correct for rounding errors
879  ali->move(posDiff);
880  ali->rotateInGlobalFrame(rotDiff);
881 
882 // // check for consistency
883 // const align::PositionType& newpos = ali->globalPosition();
884 // const align::RotationType& newrot = ali->globalRotation();
885 // align::GlobalVector posDiff2 = pos - newpos;
886 // align::RotationType rotDiff2 = newrot.multiplyInverse(rot);
887 // align::rectify(rotDiff2); // correct for rounding errors
888 
889 // if (fabs(posDiff2.x()) > 1e-6 || fabs(posDiff2.y()) > 1e-6 || fabs(posDiff2.z()) > 1e-6) {
890 // std::cout << "zeropos " << posDiff2 << std::endl;
891 // }
892 // if (fabs(rotDiff2.xx() - 1.) > 1e-4 ||
893 // fabs(rotDiff2.yy() - 1.) > 1e-4 ||
894 // fabs(rotDiff2.zz() - 1.) > 1e-4 ||
895 // fabs(rotDiff2.xy()) > 1e-8 ||
896 // fabs(rotDiff2.xz()) > 1e-8 ||
897 // fabs(rotDiff2.yz()) > 1e-8) {
898 // std::cout << "zerorot " << rotDiff2 << std::endl;
899 // }
900 
901  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
902  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
903 
904  const SurveyDet *survey = ali->survey();
905  if (survey != NULL) {
906  matrix6x6 = survey->errors(); // save the constraint information
907  }
908  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
909 }
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:205
#define NULL
Definition: scimark2.h:8
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:132
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:196
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const

Member Data Documentation

std::string MuonAlignmentInputXML::m_fileName
private

Definition at line 73 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

XMLCh* MuonAlignmentInputXML::str_aa
private
XMLCh* MuonAlignmentInputXML::str_ab
private
XMLCh* MuonAlignmentInputXML::str_ac
private
XMLCh* MuonAlignmentInputXML::str_alpha
private
XMLCh* MuonAlignmentInputXML::str_angle
private
XMLCh* MuonAlignmentInputXML::str_axisx
private
XMLCh* MuonAlignmentInputXML::str_axisy
private
XMLCh* MuonAlignmentInputXML::str_axisz
private
XMLCh* MuonAlignmentInputXML::str_bb
private
XMLCh* MuonAlignmentInputXML::str_bc
private
XMLCh* MuonAlignmentInputXML::str_beta
private
XMLCh* MuonAlignmentInputXML::str_cc
private
XMLCh* MuonAlignmentInputXML::str_chamber
private
XMLCh* MuonAlignmentInputXML::str_collection
private
XMLCh* MuonAlignmentInputXML::str_container
private
XMLCh* MuonAlignmentInputXML::str_CSCChamber
private

Definition at line 87 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_CSCEndcap
private

Definition at line 84 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_CSCLayer
private

Definition at line 88 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_CSCRing
private

Definition at line 86 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_CSCStation
private

Definition at line 85 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_DTBarrel
private

Definition at line 78 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_DTChamber
private

Definition at line 81 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_DTLayer
private

Definition at line 83 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_DTStation
private

Definition at line 80 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_DTSuperLayer
private

Definition at line 82 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_DTWheel
private

Definition at line 79 of file MuonAlignmentInputXML.h.

Referenced by getNode(), MuonAlignmentInputXML(), and ~MuonAlignmentInputXML().

XMLCh* MuonAlignmentInputXML::str_endcap
private
XMLCh* MuonAlignmentInputXML::str_gamma
private
XMLCh* MuonAlignmentInputXML::str_ideal
private
XMLCh* MuonAlignmentInputXML::str_layer
private
XMLCh* MuonAlignmentInputXML::str_moveglobal
private
XMLCh* MuonAlignmentInputXML::str_movelocal
private
XMLCh* MuonAlignmentInputXML::str_name
private
XMLCh* MuonAlignmentInputXML::str_none
private
XMLCh* MuonAlignmentInputXML::str_operation
private
XMLCh* MuonAlignmentInputXML::str_phi
private
XMLCh* MuonAlignmentInputXML::str_phix
private
XMLCh* MuonAlignmentInputXML::str_phiy
private
XMLCh* MuonAlignmentInputXML::str_phiz
private
XMLCh* MuonAlignmentInputXML::str_rawId
private
XMLCh* MuonAlignmentInputXML::str_relativeto
private
XMLCh* MuonAlignmentInputXML::str_ring
private
XMLCh* MuonAlignmentInputXML::str_rotatebeamline
private
XMLCh* MuonAlignmentInputXML::str_rotateglobalaxis
private
XMLCh* MuonAlignmentInputXML::str_rotatelocal
private
XMLCh* MuonAlignmentInputXML::str_rphi
private
XMLCh* MuonAlignmentInputXML::str_sector
private
XMLCh* MuonAlignmentInputXML::str_setape
private
XMLCh* MuonAlignmentInputXML::str_setposition
private
XMLCh* MuonAlignmentInputXML::str_setsurveyerr
private
XMLCh* MuonAlignmentInputXML::str_station
private
XMLCh* MuonAlignmentInputXML::str_superlayer
private
XMLCh* MuonAlignmentInputXML::str_wheel
private
XMLCh* MuonAlignmentInputXML::str_x
private
XMLCh* MuonAlignmentInputXML::str_xa
private
XMLCh* MuonAlignmentInputXML::str_xb
private
XMLCh* MuonAlignmentInputXML::str_xc
private
XMLCh* MuonAlignmentInputXML::str_xx
private
XMLCh* MuonAlignmentInputXML::str_xy
private
XMLCh* MuonAlignmentInputXML::str_xz
private
XMLCh* MuonAlignmentInputXML::str_y
private
XMLCh* MuonAlignmentInputXML::str_ya
private
XMLCh* MuonAlignmentInputXML::str_yb
private
XMLCh* MuonAlignmentInputXML::str_yc
private
XMLCh* MuonAlignmentInputXML::str_yy
private
XMLCh* MuonAlignmentInputXML::str_yz
private
XMLCh* MuonAlignmentInputXML::str_z
private
XMLCh* MuonAlignmentInputXML::str_za
private
XMLCh* MuonAlignmentInputXML::str_zb
private
XMLCh* MuonAlignmentInputXML::str_zc
private
XMLCh* MuonAlignmentInputXML::str_zz
private