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 AlignableObjectId &) const
 
AlignablegetDTnode (align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const
 
AlignablegetNode (std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) 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
std::shared_ptr< CSCGeometryidealCSCGeometry (const edm::EventSetup &iSetup) const
 
std::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 47 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.

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

Definition at line 128 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.

128  {
200 }
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 1063 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1063  {
1064  DOMAttr *node_x = node->getAttributeNode(str_x);
1065  DOMAttr *node_y = node->getAttributeNode(str_y);
1066  DOMAttr *node_z = node->getAttributeNode(str_z);
1067  if (node_x == NULL) throw cms::Exception("XMLException") << "<moveglobal> is missing required \"x\" attribute" << std::endl;
1068  if (node_y == NULL) throw cms::Exception("XMLException") << "<moveglobal> is missing required \"y\" attribute" << std::endl;
1069  if (node_z == NULL) throw cms::Exception("XMLException") << "<moveglobal> is missing required \"z\" attribute" << std::endl;
1070 
1071  double x = parseDouble(node_x->getValue(), "x");
1072  double y = parseDouble(node_y->getValue(), "y");
1073  double z = parseDouble(node_z->getValue(), "z");
1074  align::GlobalVector vect(x, y, z);
1075 
1076  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1077  Alignable *ali = aliiter->first;
1078 
1079  ali->move(vect);
1080 
1081  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1082  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1083 
1084  const SurveyDet *survey = ali->survey();
1085  if (survey != NULL) {
1086  matrix6x6 = survey->errors(); // save the constraint information
1087  }
1088  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1089  } // end loop over alignables
1090 }
double parseDouble(const XMLCh *str, const char *attribute) const
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:210
#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
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
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 1092 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1092  {
1093  DOMAttr *node_x = node->getAttributeNode(str_x);
1094  DOMAttr *node_y = node->getAttributeNode(str_y);
1095  DOMAttr *node_z = node->getAttributeNode(str_z);
1096  if (node_x == NULL) throw cms::Exception("XMLException") << "<movelocal> is missing required \"x\" attribute" << std::endl;
1097  if (node_y == NULL) throw cms::Exception("XMLException") << "<movelocal> is missing required \"y\" attribute" << std::endl;
1098  if (node_z == NULL) throw cms::Exception("XMLException") << "<movelocal> is missing required \"z\" attribute" << std::endl;
1099 
1100  double x = parseDouble(node_x->getValue(), "x");
1101  double y = parseDouble(node_y->getValue(), "y");
1102  double z = parseDouble(node_z->getValue(), "z");
1103  align::LocalVector vect(x, y, z);
1104 
1105  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1106  Alignable *ali = aliiter->first;
1107 
1108  align::GlobalVector globalVector = ali->surface().toGlobal(vect);
1109  ali->move(globalVector);
1110 
1111  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1112  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1113 
1114  const SurveyDet *survey = ali->survey();
1115  if (survey != NULL) {
1116  matrix6x6 = survey->errors(); // save the constraint information
1117  }
1118  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1119  } // end loop over alignables
1120 }
double parseDouble(const XMLCh *str, const char *attribute) const
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:210
#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
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
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_rotatebeamline ( const XERCES_CPP_NAMESPACE::DOMElement *  node,
std::map< Alignable *, bool > &  aliset,
std::map< Alignable *, Alignable * > &  alitoideal 
) const
private

Definition at line 1154 of file MuonAlignmentInputXML.cc.

References funct::cos(), SurveyDet::errors(), Exception, Alignable::move(), NULL, parseDouble(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), 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().

1154  {
1155  DOMAttr *node_rphi = node->getAttributeNode(str_rphi);
1156  DOMAttr *node_phi = node->getAttributeNode(str_phi);
1157  if (node_rphi == NULL && node_phi == NULL) throw cms::Exception("XMLException") << "<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1158  if (node_rphi != NULL && node_phi != NULL) throw cms::Exception("XMLException") << "<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute" << std::endl;
1159 
1160  double value;
1161  if (node_rphi != NULL) {
1162  value = parseDouble(node_rphi->getValue(), "rphi");
1163  }
1164  else {
1165  value = parseDouble(node_phi->getValue(), "phi");
1166  }
1167 
1168  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1169  Alignable *ali = aliiter->first;
1170 
1172 
1173  double radius = pos.perp();
1174  double phi0 = pos.phi();
1175  double deltaphi = value;
1176  if (node_rphi != NULL) deltaphi = value / radius;
1177 
1178  ali->rotateAroundGlobalZ(deltaphi);
1179  ali->move(align::GlobalVector(radius * (cos(phi0 + deltaphi) - cos(phi0)),
1180  radius * (sin(phi0 + deltaphi) - sin(phi0)),
1181  0.));
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 }
T perp() const
Definition: PV3DBase.h:72
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:210
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
#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 rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:203
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:131
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
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 1194 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1194  {
1195  DOMAttr *node_x = node->getAttributeNode(str_x);
1196  DOMAttr *node_y = node->getAttributeNode(str_y);
1197  DOMAttr *node_z = node->getAttributeNode(str_z);
1198  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1199  if (node_x == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1200  if (node_y == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1201  if (node_z == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1202  if (node_angle == NULL) throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
1203 
1204  double x = parseDouble(node_x->getValue(), "x");
1205  double y = parseDouble(node_y->getValue(), "y");
1206  double z = parseDouble(node_z->getValue(), "z");
1207  double angle = parseDouble(node_angle->getValue(), "angle");
1208 
1209  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1210  Alignable *ali = aliiter->first;
1212 
1213  ali->rotateAroundGlobalAxis(align::GlobalVector(x, y, z), angle);
1214 
1215  double aprime = x/sqrt(x*x + y*y + z*z);
1216  double bprime = y/sqrt(x*x + y*y + z*z);
1217  double cprime = z/sqrt(x*x + y*y + z*z);
1218  double q0 = cos(angle/2.);
1219  double q1 = sin(angle/2.) * aprime;
1220  double q2 = sin(angle/2.) * bprime;
1221  double q3 = sin(angle/2.) * cprime;
1222 
1223  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();
1224  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();
1225  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();
1226 
1227  double movex = pos2x - pos.x();
1228  double movey = pos2y - pos.y();
1229  double movez = pos2z - pos.z();
1230  ali->move(align::GlobalVector(movex, movey, movez));
1231 
1232  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1233  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1234 
1235  const SurveyDet *survey = ali->survey();
1236  if (survey != NULL) {
1237  matrix6x6 = survey->errors(); // save the constraint information
1238  }
1239  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1240  } // end loop over alignables
1241 }
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:210
T y() const
Definition: PV3DBase.h:63
#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:133
double q2[4]
Definition: TauolaWrapper.h:88
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
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:131
double q1[4]
Definition: TauolaWrapper.h:87
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
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
T x() const
Definition: PV3DBase.h:62
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 1122 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1122  {
1123  DOMAttr *node_axisx = node->getAttributeNode(str_axisx);
1124  DOMAttr *node_axisy = node->getAttributeNode(str_axisy);
1125  DOMAttr *node_axisz = node->getAttributeNode(str_axisz);
1126  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1127  if (node_axisx == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1128  if (node_axisy == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1129  if (node_axisz == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1130  if (node_angle == NULL) throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1131 
1132  double x = parseDouble(node_axisx->getValue(), "x");
1133  double y = parseDouble(node_axisy->getValue(), "y");
1134  double z = parseDouble(node_axisz->getValue(), "z");
1135  double angle = parseDouble(node_angle->getValue(), "angle");
1136  align::LocalVector vect(x, y, z);
1137 
1138  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1139  Alignable *ali = aliiter->first;
1140 
1141  ali->rotateAroundLocalAxis(vect, angle);
1142 
1143  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1144  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1145 
1146  const SurveyDet *survey = ali->survey();
1147  if (survey != NULL) {
1148  matrix6x6 = survey->errors(); // save the constraint information
1149  }
1150  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1151  } // end loop over alignables
1152 }
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:142
double parseDouble(const XMLCh *str, const char *attribute) const
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:210
#define NULL
Definition: scimark2.h:8
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:73
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
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 915 of file MuonAlignmentInputXML.cc.

References Exception, NULL, parseDouble(), 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, and str_zz.

Referenced by newAlignableMuon().

915  {
916  DOMAttr *node_xx = node->getAttributeNode(str_xx);
917  DOMAttr *node_xy = node->getAttributeNode(str_xy);
918  DOMAttr *node_xz = node->getAttributeNode(str_xz);
919  DOMAttr *node_xa = node->getAttributeNode(str_xa);
920  DOMAttr *node_xb = node->getAttributeNode(str_xb);
921  DOMAttr *node_xc = node->getAttributeNode(str_xc);
922  DOMAttr *node_yy = node->getAttributeNode(str_yy);
923  DOMAttr *node_yz = node->getAttributeNode(str_yz);
924  DOMAttr *node_ya = node->getAttributeNode(str_ya);
925  DOMAttr *node_yb = node->getAttributeNode(str_yb);
926  DOMAttr *node_yc = node->getAttributeNode(str_yc);
927  DOMAttr *node_zz = node->getAttributeNode(str_zz);
928  DOMAttr *node_za = node->getAttributeNode(str_za);
929  DOMAttr *node_zb = node->getAttributeNode(str_zb);
930  DOMAttr *node_zc = node->getAttributeNode(str_zc);
931  DOMAttr *node_aa = node->getAttributeNode(str_aa);
932  DOMAttr *node_ab = node->getAttributeNode(str_ab);
933  DOMAttr *node_ac = node->getAttributeNode(str_ac);
934  DOMAttr *node_bb = node->getAttributeNode(str_bb);
935  DOMAttr *node_bc = node->getAttributeNode(str_bc);
936  DOMAttr *node_cc = node->getAttributeNode(str_cc);
937 
938  if (node_xx == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xx\" attribute" << std::endl;
939  if (node_xy == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xy\" attribute" << std::endl;
940  if (node_xz == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xz\" attribute" << std::endl;
941  if (node_xa == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xa\" attribute" << std::endl;
942  if (node_xb == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xb\" attribute" << std::endl;
943  if (node_xc == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"xc\" attribute" << std::endl;
944  if (node_yy == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"yy\" attribute" << std::endl;
945  if (node_yz == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"yz\" attribute" << std::endl;
946  if (node_ya == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"ya\" attribute" << std::endl;
947  if (node_yb == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"yb\" attribute" << std::endl;
948  if (node_yc == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"yc\" attribute" << std::endl;
949  if (node_zz == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"zz\" attribute" << std::endl;
950  if (node_za == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"za\" attribute" << std::endl;
951  if (node_zb == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"zb\" attribute" << std::endl;
952  if (node_zc == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"zc\" attribute" << std::endl;
953  if (node_aa == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"aa\" attribute" << std::endl;
954  if (node_ab == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"ab\" attribute" << std::endl;
955  if (node_ac == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"ac\" attribute" << std::endl;
956  if (node_bb == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"bb\" attribute" << std::endl;
957  if (node_bc == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"bc\" attribute" << std::endl;
958  if (node_cc == NULL) throw cms::Exception("XMLException") << "<setape> is missing required \"cc\" attribute" << std::endl;
959 
960  align::ErrorMatrix matrix6x6;
961  matrix6x6(0,0) = parseDouble(node_xx->getValue(), "xx");
962  matrix6x6(0,1) = parseDouble(node_xy->getValue(), "xy");
963  matrix6x6(0,2) = parseDouble(node_xz->getValue(), "xz");
964  matrix6x6(0,3) = parseDouble(node_xa->getValue(), "xa");
965  matrix6x6(0,4) = parseDouble(node_xb->getValue(), "xb");
966  matrix6x6(0,5) = parseDouble(node_xc->getValue(), "xc");
967  matrix6x6(1,1) = parseDouble(node_yy->getValue(), "yy");
968  matrix6x6(1,2) = parseDouble(node_yz->getValue(), "yz");
969  matrix6x6(1,3) = parseDouble(node_ya->getValue(), "ya");
970  matrix6x6(1,4) = parseDouble(node_yb->getValue(), "yb");
971  matrix6x6(1,5) = parseDouble(node_yc->getValue(), "yc");
972  matrix6x6(2,2) = parseDouble(node_zz->getValue(), "zz");
973  matrix6x6(2,3) = parseDouble(node_za->getValue(), "za");
974  matrix6x6(2,4) = parseDouble(node_zb->getValue(), "zb");
975  matrix6x6(2,5) = parseDouble(node_zc->getValue(), "zc");
976  matrix6x6(3,3) = parseDouble(node_aa->getValue(), "aa");
977  matrix6x6(3,4) = parseDouble(node_ab->getValue(), "ab");
978  matrix6x6(3,5) = parseDouble(node_ac->getValue(), "ac");
979  matrix6x6(4,4) = parseDouble(node_bb->getValue(), "bb");
980  matrix6x6(4,5) = parseDouble(node_bc->getValue(), "bc");
981  matrix6x6(5,5) = parseDouble(node_cc->getValue(), "cc");
982 
983  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
984  // this sets APEs at this level and (since 2nd argument is true) all lower levels
985  aliiter->first->setAlignmentPositionError(AlignmentPositionError(matrix6x6), true);
986  }
987 }
double parseDouble(const XMLCh *str, const char *attribute) const
#define NULL
Definition: scimark2.h:8
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
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 722 of file MuonAlignmentInputXML.cc.

References alpha, assert(), PV3DBase< T, PVType, FrameType >::basicVector(), beta, funct::cos(), Exception, Alignable::globalPosition(), Alignable::globalRotation(), python.rootplot.argparse::message, Alignable::mother(), NULL, parseDouble(), 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(), x, PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), y, PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yz(), z, PV3DBase< T, PVType, FrameType >::z(), and TkRotation< T >::zz().

Referenced by newAlignableMuon().

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

References 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().

989  {
990  DOMAttr *node_xx = node->getAttributeNode(str_xx);
991  DOMAttr *node_xy = node->getAttributeNode(str_xy);
992  DOMAttr *node_xz = node->getAttributeNode(str_xz);
993  DOMAttr *node_xa = node->getAttributeNode(str_xa);
994  DOMAttr *node_xb = node->getAttributeNode(str_xb);
995  DOMAttr *node_xc = node->getAttributeNode(str_xc);
996  DOMAttr *node_yy = node->getAttributeNode(str_yy);
997  DOMAttr *node_yz = node->getAttributeNode(str_yz);
998  DOMAttr *node_ya = node->getAttributeNode(str_ya);
999  DOMAttr *node_yb = node->getAttributeNode(str_yb);
1000  DOMAttr *node_yc = node->getAttributeNode(str_yc);
1001  DOMAttr *node_zz = node->getAttributeNode(str_zz);
1002  DOMAttr *node_za = node->getAttributeNode(str_za);
1003  DOMAttr *node_zb = node->getAttributeNode(str_zb);
1004  DOMAttr *node_zc = node->getAttributeNode(str_zc);
1005  DOMAttr *node_aa = node->getAttributeNode(str_aa);
1006  DOMAttr *node_ab = node->getAttributeNode(str_ab);
1007  DOMAttr *node_ac = node->getAttributeNode(str_ac);
1008  DOMAttr *node_bb = node->getAttributeNode(str_bb);
1009  DOMAttr *node_bc = node->getAttributeNode(str_bc);
1010  DOMAttr *node_cc = node->getAttributeNode(str_cc);
1011 
1012  if (node_xx == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
1013  if (node_xy == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
1014  if (node_xz == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
1015  if (node_xa == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
1016  if (node_xb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
1017  if (node_xc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
1018  if (node_yy == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
1019  if (node_yz == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
1020  if (node_ya == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
1021  if (node_yb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
1022  if (node_yc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
1023  if (node_zz == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
1024  if (node_za == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"za\" attribute" << std::endl;
1025  if (node_zb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
1026  if (node_zc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
1027  if (node_aa == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
1028  if (node_ab == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
1029  if (node_ac == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
1030  if (node_bb == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
1031  if (node_bc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
1032  if (node_cc == NULL) throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
1033 
1034  align::ErrorMatrix matrix6x6;
1035  matrix6x6(0,0) = parseDouble(node_xx->getValue(), "xx");
1036  matrix6x6(0,1) = parseDouble(node_xy->getValue(), "xy");
1037  matrix6x6(0,2) = parseDouble(node_xz->getValue(), "xz");
1038  matrix6x6(0,3) = parseDouble(node_xa->getValue(), "xa");
1039  matrix6x6(0,4) = parseDouble(node_xb->getValue(), "xb");
1040  matrix6x6(0,5) = parseDouble(node_xc->getValue(), "xc");
1041  matrix6x6(1,1) = parseDouble(node_yy->getValue(), "yy");
1042  matrix6x6(1,2) = parseDouble(node_yz->getValue(), "yz");
1043  matrix6x6(1,3) = parseDouble(node_ya->getValue(), "ya");
1044  matrix6x6(1,4) = parseDouble(node_yb->getValue(), "yb");
1045  matrix6x6(1,5) = parseDouble(node_yc->getValue(), "yc");
1046  matrix6x6(2,2) = parseDouble(node_zz->getValue(), "zz");
1047  matrix6x6(2,3) = parseDouble(node_za->getValue(), "za");
1048  matrix6x6(2,4) = parseDouble(node_zb->getValue(), "zb");
1049  matrix6x6(2,5) = parseDouble(node_zc->getValue(), "zc");
1050  matrix6x6(3,3) = parseDouble(node_aa->getValue(), "aa");
1051  matrix6x6(3,4) = parseDouble(node_ab->getValue(), "ab");
1052  matrix6x6(3,5) = parseDouble(node_ac->getValue(), "ac");
1053  matrix6x6(4,4) = parseDouble(node_bb->getValue(), "bb");
1054  matrix6x6(4,5) = parseDouble(node_bc->getValue(), "bc");
1055  matrix6x6(5,5) = parseDouble(node_cc->getValue(), "cc");
1056 
1057  for (std::map<Alignable*, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1058  Alignable *ali = aliiter->first;
1059  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1060  }
1061 }
double parseDouble(const XMLCh *str, const char *attribute) const
#define NULL
Definition: scimark2.h:8
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
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 229 of file MuonAlignmentInputXML.cc.

References Exception.

Referenced by newAlignableMuon().

229  {
230  align::Alignables::const_iterator alignable = alignables.begin();
231  align::Alignables::const_iterator ideal = ideals.begin();
232 
233  while (alignable != alignables.end() && ideal != ideals.end()) {
234  alitoideal[*alignable] = *ideal;
235 
236  fillAliToIdeal(alitoideal, (*alignable)->components(), (*ideal)->components());
237 
238  ++alignable;
239  ++ideal;
240  }
241 
242  if (alignable != alignables.end() || ideal != ideals.end()) {
243  throw cms::Exception("Alignment") << "alignable and ideal-alignable trees are out of sync (this should never happen)";
244  }
245 }
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 AlignableObjectId alignableObjectId 
) const
private

Definition at line 553 of file MuonAlignmentInputXML.cc.

References align::AlignableCSCChamber, align::AlignableCSCEndcap, align::AlignableCSCRing, align::AlignableCSCStation, Alignable::alignableObjectId(), Reference_intrackfit_cff::endcap, Exception, AlignableObjectId::idToString(), 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().

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

Definition at line 460 of file MuonAlignmentInputXML.cc.

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

Referenced by getNode().

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

Definition at line 443 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 newAlignableMuon().

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

Reimplemented from MuonAlignmentInputMethod.

Definition at line 247 of file MuonAlignmentInputXML.cc.

References align::AlignableMuon, universalConfigTemplate::collection, AlignableMuon::CSCEndcaps(), do_moveglobal(), do_movelocal(), do_rotatebeamline(), do_rotateglobalaxis(), do_rotatelocal(), do_setape(), do_setposition(), do_setsurveyerr(), AlignableMuon::DTBarrel(), Exception, fillAliToIdeal(), getNode(), i, MuonAlignmentInputMethod::idealCSCGeometry(), MuonAlignmentInputMethod::idealDTGeometry(), j, m_fileName, python.rootplot.argparse::message, mergeVDriftHistosByStation::name, NULL, AlignableMuon::objectIdProvider(), createfilelist::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, str_setsurveyerr, AlCaHLTBitMon_QueryRunRegistry::string, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

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

Definition at line 645 of file MuonAlignmentInputXML.cc.

References Exception, HLT_FULL_cff::exponent, 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().

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

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

Referenced by newAlignableMuon().

218  {
219  for (align::Alignables::const_iterator ali = alignables.begin(); ali != alignables.end(); ++ali) {
220  if ((*ali)->alignableObjectId() == align::AlignableDetUnit || (*ali)->alignableObjectId() == align::AlignableDet ||
221  (*ali)->alignableObjectId() == align::AlignableDTChamber || (*ali)->alignableObjectId() == align::AlignableDTSuperLayer || (*ali)->alignableObjectId() == align::AlignableDTLayer ||
222  (*ali)->alignableObjectId() == align::AlignableCSCChamber || (*ali)->alignableObjectId() == align::AlignableCSCLayer) {
223  alignableNavigator[(*ali)->geomDetId().rawId()] = *ali;
224  }
225  recursiveGetId(alignableNavigator, (*ali)->components());
226  }
227 }
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 875 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().

875  {
876  const align::PositionType& oldpos = ali->globalPosition();
877  const align::RotationType& oldrot = ali->globalRotation();
878 
879  // shift needed to move from current to new position
880  align::GlobalVector posDiff = pos - oldpos;
881  align::RotationType rotDiff = oldrot.multiplyInverse(rot);
882  align::rectify(rotDiff); // correct for rounding errors
883  ali->move(posDiff);
884  ali->rotateInGlobalFrame(rotDiff);
885 
886 // // check for consistency
887 // const align::PositionType& newpos = ali->globalPosition();
888 // const align::RotationType& newrot = ali->globalRotation();
889 // align::GlobalVector posDiff2 = pos - newpos;
890 // align::RotationType rotDiff2 = newrot.multiplyInverse(rot);
891 // align::rectify(rotDiff2); // correct for rounding errors
892 
893 // if (fabs(posDiff2.x()) > 1e-6 || fabs(posDiff2.y()) > 1e-6 || fabs(posDiff2.z()) > 1e-6) {
894 // std::cout << "zeropos " << posDiff2 << std::endl;
895 // }
896 // if (fabs(rotDiff2.xx() - 1.) > 1e-4 ||
897 // fabs(rotDiff2.yy() - 1.) > 1e-4 ||
898 // fabs(rotDiff2.zz() - 1.) > 1e-4 ||
899 // fabs(rotDiff2.xy()) > 1e-8 ||
900 // fabs(rotDiff2.xz()) > 1e-8 ||
901 // fabs(rotDiff2.yz()) > 1e-8) {
902 // std::cout << "zerorot " << rotDiff2 << std::endl;
903 // }
904 
905  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
906  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
907 
908  const SurveyDet *survey = ali->survey();
909  if (survey != NULL) {
910  matrix6x6 = survey->errors(); // save the constraint information
911  }
912  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
913 }
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:210
#define NULL
Definition: scimark2.h:8
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:137
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:199
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:134
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