CMS 3D CMS Logo

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 (const std::string &fileName, const DTGeometry *dtGeometry, const CSCGeometry *cscGeometry, const GEMGeometry *gemGeometry, const DTGeometry *dtGeometryIdeal, const CSCGeometry *cscGeometryIdeal, const GEMGeometry *gemGeometryIdeal)
 
 MuonAlignmentInputXML (const MuonAlignmentInputXML &)=delete
 
AlignableMuonnewAlignableMuon () const override
 
const MuonAlignmentInputXMLoperator= (const MuonAlignmentInputXML &)=delete
 
 ~MuonAlignmentInputXML () override
 
- Public Member Functions inherited from MuonAlignmentInputMethod
 MuonAlignmentInputMethod ()
 
 MuonAlignmentInputMethod (const DTGeometry *dtGeometry, const CSCGeometry *cscGeometry, const GEMGeometry *gemGeometry)
 
 MuonAlignmentInputMethod (const MuonAlignmentInputMethod &)=delete
 
const MuonAlignmentInputMethodoperator= (const MuonAlignmentInputMethod &)=delete
 
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
 
AlignablegetGEMnode (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
 
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

const CSCGeometrycscGeometry_
 
const CSCGeometrycscGeometryIdeal_
 
const DTGeometrydtGeometry_
 
const DTGeometrydtGeometryIdeal_
 
const GEMGeometrygemGeometry_
 
const GEMGeometrygemGeometryIdeal_
 
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_etaPartition
 
XMLCh * str_gamma
 
XMLCh * str_GEMChamber
 
XMLCh * str_GEMEndcap
 
XMLCh * str_GEMEtaPartition
 
XMLCh * str_GEMRing
 
XMLCh * str_GEMStation
 
XMLCh * str_GEMSuperChamber
 
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_superChamber
 
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
 

Detailed Description

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

Usage: <usage>

Definition at line 33 of file MuonAlignmentInputXML.h.

Constructor & Destructor Documentation

◆ MuonAlignmentInputXML() [1/2]

XERCES_CPP_NAMESPACE_USE MuonAlignmentInputXML::MuonAlignmentInputXML ( const std::string &  fileName,
const DTGeometry dtGeometry,
const CSCGeometry cscGeometry,
const GEMGeometry gemGeometry,
const DTGeometry dtGeometryIdeal,
const CSCGeometry cscGeometryIdeal,
const GEMGeometry gemGeometryIdeal 
)

Definition at line 49 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_etaPartition, str_gamma, str_GEMChamber, str_GEMEndcap, str_GEMEtaPartition, str_GEMRing, str_GEMStation, str_GEMSuperChamber, 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_superChamber, 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, str_zz, and cms::concurrency::xercesInitialize().

57  dtGeometry_(dtGeometry),
58  cscGeometry_(cscGeometry),
60  dtGeometryIdeal_(dtGeometryIdeal),
61  cscGeometryIdeal_(cscGeometryIdeal),
62  gemGeometryIdeal_(gemGeometryIdeal) {
64  str_operation = XMLString::transcode("operation");
65  str_collection = XMLString::transcode("collection");
66  str_name = XMLString::transcode("name");
67  str_DTBarrel = XMLString::transcode("DTBarrel");
68  str_DTWheel = XMLString::transcode("DTWheel");
69  str_DTStation = XMLString::transcode("DTStation");
70  str_DTChamber = XMLString::transcode("DTChamber");
71  str_DTSuperLayer = XMLString::transcode("DTSuperLayer");
72  str_DTLayer = XMLString::transcode("DTLayer");
73  str_CSCEndcap = XMLString::transcode("CSCEndcap");
74  str_CSCStation = XMLString::transcode("CSCStation");
75  str_CSCRing = XMLString::transcode("CSCRing");
76  str_CSCChamber = XMLString::transcode("CSCChamber");
77  str_CSCLayer = XMLString::transcode("CSCLayer");
78  str_GEMEndcap = XMLString::transcode("GEMEndcap");
79  str_GEMStation = XMLString::transcode("GEMStation");
80  str_GEMRing = XMLString::transcode("GEMRing");
81  str_GEMSuperChamber = XMLString::transcode("GEMSuperChamber");
82  str_GEMChamber = XMLString::transcode("GEMChamber");
83  str_GEMEtaPartition = XMLString::transcode("GEMEtaPartition");
84  str_setposition = XMLString::transcode("setposition");
85  str_setape = XMLString::transcode("setape");
86  str_setsurveyerr = XMLString::transcode("setsurveyerr");
87  str_moveglobal = XMLString::transcode("moveglobal");
88  str_movelocal = XMLString::transcode("movelocal");
89  str_rotatelocal = XMLString::transcode("rotatelocal");
90  str_rotatebeamline = XMLString::transcode("rotatebeamline");
91  str_rotateglobalaxis = XMLString::transcode("rotateglobalaxis");
92  str_relativeto = XMLString::transcode("relativeto");
93  str_rawId = XMLString::transcode("rawId");
94  str_wheel = XMLString::transcode("wheel");
95  str_station = XMLString::transcode("station");
96  str_sector = XMLString::transcode("sector");
97  str_superlayer = XMLString::transcode("superlayer");
98  str_layer = XMLString::transcode("layer");
99  str_endcap = XMLString::transcode("endcap");
100  str_ring = XMLString::transcode("ring");
101  str_chamber = XMLString::transcode("chamber");
102  str_superChamber = XMLString::transcode("SuperChamber");
103  str_etaPartition = XMLString::transcode("etaPartition");
104  str_axisx = XMLString::transcode("axisx");
105  str_axisy = XMLString::transcode("axisy");
106  str_axisz = XMLString::transcode("axisz");
107  str_angle = XMLString::transcode("angle");
108  str_x = XMLString::transcode("x");
109  str_y = XMLString::transcode("y");
110  str_z = XMLString::transcode("z");
111  str_phix = XMLString::transcode("phix");
112  str_phiy = XMLString::transcode("phiy");
113  str_phiz = XMLString::transcode("phiz");
114  str_alpha = XMLString::transcode("alpha");
115  str_beta = XMLString::transcode("beta");
116  str_gamma = XMLString::transcode("gamma");
117  str_rphi = XMLString::transcode("rphi");
118  str_phi = XMLString::transcode("phi");
119  str_xx = XMLString::transcode("xx");
120  str_xy = XMLString::transcode("xy");
121  str_xz = XMLString::transcode("xz");
122  str_xa = XMLString::transcode("xa");
123  str_xb = XMLString::transcode("xb");
124  str_xc = XMLString::transcode("xc");
125  str_yy = XMLString::transcode("yy");
126  str_yz = XMLString::transcode("yz");
127  str_ya = XMLString::transcode("ya");
128  str_yb = XMLString::transcode("yb");
129  str_yc = XMLString::transcode("yc");
130  str_zz = XMLString::transcode("zz");
131  str_za = XMLString::transcode("za");
132  str_zb = XMLString::transcode("zb");
133  str_zc = XMLString::transcode("zc");
134  str_aa = XMLString::transcode("aa");
135  str_ab = XMLString::transcode("ab");
136  str_ac = XMLString::transcode("ac");
137  str_bb = XMLString::transcode("bb");
138  str_bc = XMLString::transcode("bc");
139  str_cc = XMLString::transcode("cc");
140  str_none = XMLString::transcode("none");
141  str_ideal = XMLString::transcode("ideal");
142  str_container = XMLString::transcode("container");
143 }
const DTGeometry * dtGeometryIdeal_
void xercesInitialize()
Definition: Xerces.cc:18
const DTGeometry * dtGeometry_
const GEMGeometry * gemGeometryIdeal_
const GEMGeometry * gemGeometry_
const CSCGeometry * cscGeometryIdeal_
const CSCGeometry * cscGeometry_

◆ ~MuonAlignmentInputXML()

MuonAlignmentInputXML::~MuonAlignmentInputXML ( )
override

Definition at line 150 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_etaPartition, str_gamma, str_GEMChamber, str_GEMEndcap, str_GEMEtaPartition, str_GEMRing, str_GEMStation, str_GEMSuperChamber, 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_superChamber, 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, str_zz, and cms::concurrency::xercesTerminate().

150  {
231 }
void xercesTerminate()
Definition: Xerces.cc:23

◆ MuonAlignmentInputXML() [2/2]

MuonAlignmentInputXML::MuonAlignmentInputXML ( const MuonAlignmentInputXML )
delete

Member Function Documentation

◆ do_moveglobal()

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 1261 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1263  {
1264  DOMAttr *node_x = node->getAttributeNode(str_x);
1265  DOMAttr *node_y = node->getAttributeNode(str_y);
1266  DOMAttr *node_z = node->getAttributeNode(str_z);
1267  if (node_x == nullptr)
1268  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"x\" attribute" << std::endl;
1269  if (node_y == nullptr)
1270  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"y\" attribute" << std::endl;
1271  if (node_z == nullptr)
1272  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"z\" attribute" << std::endl;
1273 
1274  double x = parseDouble(node_x->getValue(), "x");
1275  double y = parseDouble(node_y->getValue(), "y");
1276  double z = parseDouble(node_z->getValue(), "z");
1277  align::GlobalVector vect(x, y, z);
1278 
1279  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1280  Alignable *ali = aliiter->first;
1281 
1282  ali->move(vect);
1283 
1284  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1285  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1286 
1287  const SurveyDet *survey = ali->survey();
1288  if (survey != nullptr) {
1289  matrix6x6 = survey->errors(); // save the constraint information
1290  }
1291  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1292  } // end loop over alignables
1293 }
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
double parseDouble(const XMLCh *str, const char *attribute) const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

◆ do_movelocal()

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 1295 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1297  {
1298  DOMAttr *node_x = node->getAttributeNode(str_x);
1299  DOMAttr *node_y = node->getAttributeNode(str_y);
1300  DOMAttr *node_z = node->getAttributeNode(str_z);
1301  if (node_x == nullptr)
1302  throw cms::Exception("XMLException") << "<movelocal> is missing required \"x\" attribute" << std::endl;
1303  if (node_y == nullptr)
1304  throw cms::Exception("XMLException") << "<movelocal> is missing required \"y\" attribute" << std::endl;
1305  if (node_z == nullptr)
1306  throw cms::Exception("XMLException") << "<movelocal> is missing required \"z\" attribute" << std::endl;
1307 
1308  double x = parseDouble(node_x->getValue(), "x");
1309  double y = parseDouble(node_y->getValue(), "y");
1310  double z = parseDouble(node_z->getValue(), "z");
1311  align::LocalVector vect(x, y, z);
1312 
1313  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1314  Alignable *ali = aliiter->first;
1315 
1316  align::GlobalVector globalVector = ali->surface().toGlobal(vect);
1317  ali->move(globalVector);
1318 
1319  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1320  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1321 
1322  const SurveyDet *survey = ali->survey();
1323  if (survey != nullptr) {
1324  matrix6x6 = survey->errors(); // save the constraint information
1325  }
1326  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1327  } // end loop over alignables
1328 }
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
double parseDouble(const XMLCh *str, const char *attribute) const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

◆ do_rotatebeamline()

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 1368 of file MuonAlignmentInputXML.cc.

References funct::cos(), SurveyDet::errors(), Exception, Alignable::move(), parseDouble(), 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().

1370  {
1371  DOMAttr *node_rphi = node->getAttributeNode(str_rphi);
1372  DOMAttr *node_phi = node->getAttributeNode(str_phi);
1373  if (node_rphi == nullptr && node_phi == nullptr)
1374  throw cms::Exception("XMLException") << "<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1375  if (node_rphi != nullptr && node_phi != nullptr)
1376  throw cms::Exception("XMLException") << "<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute"
1377  << std::endl;
1378 
1379  double value;
1380  if (node_rphi != nullptr) {
1381  value = parseDouble(node_rphi->getValue(), "rphi");
1382  } else {
1383  value = parseDouble(node_phi->getValue(), "phi");
1384  }
1385 
1386  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1387  Alignable *ali = aliiter->first;
1388 
1390 
1391  double radius = pos.perp();
1392  double phi0 = pos.phi();
1393  double deltaphi = value;
1394  if (node_rphi != nullptr)
1395  deltaphi = value / radius;
1396 
1397  ali->rotateAroundGlobalZ(deltaphi);
1399  radius * (cos(phi0 + deltaphi) - cos(phi0)), radius * (sin(phi0 + deltaphi) - sin(phi0)), 0.));
1400 
1401  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1402  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1403 
1404  const SurveyDet *survey = ali->survey();
1405  if (survey != nullptr) {
1406  matrix6x6 = survey->errors(); // save the constraint information
1407  }
1408  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1409  } // end loop over alignables
1410 }
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:176
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: value.py:1
double parseDouble(const XMLCh *str, const char *attribute) const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

◆ do_rotateglobalaxis()

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 1412 of file MuonAlignmentInputXML.cc.

References angle(), funct::cos(), SurveyDet::errors(), Exception, Alignable::move(), parseDouble(), SiStripMonitorCluster_cfi::q0, Alignable::rotateAroundGlobalAxis(), Alignable::setSurvey(), funct::sin(), mathSSE::sqrt(), str_angle, str_x, str_y, str_z, Alignable::surface(), Alignable::survey(), AlignableSurface::toGlobal(), x, y, and z.

Referenced by newAlignableMuon().

1414  {
1415  DOMAttr *node_x = node->getAttributeNode(str_x);
1416  DOMAttr *node_y = node->getAttributeNode(str_y);
1417  DOMAttr *node_z = node->getAttributeNode(str_z);
1418  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1419  if (node_x == nullptr)
1420  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1421  if (node_y == nullptr)
1422  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1423  if (node_z == nullptr)
1424  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1425  if (node_angle == nullptr)
1426  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
1427 
1428  double x = parseDouble(node_x->getValue(), "x");
1429  double y = parseDouble(node_y->getValue(), "y");
1430  double z = parseDouble(node_z->getValue(), "z");
1431  double angle = parseDouble(node_angle->getValue(), "angle");
1432 
1433  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1434  Alignable *ali = aliiter->first;
1436 
1438 
1439  double aprime = x / sqrt(x * x + y * y + z * z);
1440  double bprime = y / sqrt(x * x + y * y + z * z);
1441  double cprime = z / sqrt(x * x + y * y + z * z);
1442  double q0 = cos(angle / 2.);
1443  double q1 = sin(angle / 2.) * aprime;
1444  double q2 = sin(angle / 2.) * bprime;
1445  double q3 = sin(angle / 2.) * cprime;
1446 
1447  double pos2x = (q0 * q0 + q1 * q1 - q2 * q2 - q3 * q3) * pos.x() + 2. * (q1 * q2 - q0 * q3) * pos.y() +
1448  2. * (q1 * q3 + q0 * q2) * pos.z();
1449  double pos2y = 2. * (q2 * q1 + q0 * q3) * pos.x() + (q0 * q0 - q1 * q1 + q2 * q2 - q3 * q3) * pos.y() +
1450  2. * (q2 * q3 - q0 * q1) * pos.z();
1451  double pos2z = 2. * (q3 * q1 - q0 * q2) * pos.x() + 2. * (q3 * q2 + q0 * q1) * pos.y() +
1452  (q0 * q0 - q1 * q1 - q2 * q2 + q3 * q3) * pos.z();
1453 
1454  double movex = pos2x - pos.x();
1455  double movey = pos2y - pos.y();
1456  double movez = pos2z - pos.z();
1457  ali->move(align::GlobalVector(movex, movey, movez));
1458 
1459  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1460  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1461 
1462  const SurveyDet *survey = ali->survey();
1463  if (survey != nullptr) {
1464  matrix6x6 = survey->errors(); // save the constraint information
1465  }
1466  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1467  } // end loop over alignables
1468 }
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual void rotateAroundGlobalAxis(const GlobalVector &axis, Scalar radians)
Rotation around arbitratry global axis.
Definition: Alignable.cc:138
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double parseDouble(const XMLCh *str, const char *attribute) const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ do_rotatelocal()

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 1330 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

1332  {
1333  DOMAttr *node_axisx = node->getAttributeNode(str_axisx);
1334  DOMAttr *node_axisy = node->getAttributeNode(str_axisy);
1335  DOMAttr *node_axisz = node->getAttributeNode(str_axisz);
1336  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1337  if (node_axisx == nullptr)
1338  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1339  if (node_axisy == nullptr)
1340  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1341  if (node_axisz == nullptr)
1342  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1343  if (node_angle == nullptr)
1344  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1345 
1346  double x = parseDouble(node_axisx->getValue(), "x");
1347  double y = parseDouble(node_axisy->getValue(), "y");
1348  double z = parseDouble(node_axisz->getValue(), "z");
1349  double angle = parseDouble(node_angle->getValue(), "angle");
1350  align::LocalVector vect(x, y, z);
1351 
1352  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1353  Alignable *ali = aliiter->first;
1354 
1355  ali->rotateAroundLocalAxis(vect, angle);
1356 
1357  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1358  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1359 
1360  const SurveyDet *survey = ali->survey();
1361  if (survey != nullptr) {
1362  matrix6x6 = survey->errors(); // save the constraint information
1363  }
1364  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1365  } // end loop over alignables
1366 }
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:143
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
double parseDouble(const XMLCh *str, const char *attribute) const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ do_setape()

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 1067 of file MuonAlignmentInputXML.cc.

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

1069  {
1070  DOMAttr *node_xx = node->getAttributeNode(str_xx);
1071  DOMAttr *node_xy = node->getAttributeNode(str_xy);
1072  DOMAttr *node_xz = node->getAttributeNode(str_xz);
1073  DOMAttr *node_xa = node->getAttributeNode(str_xa);
1074  DOMAttr *node_xb = node->getAttributeNode(str_xb);
1075  DOMAttr *node_xc = node->getAttributeNode(str_xc);
1076  DOMAttr *node_yy = node->getAttributeNode(str_yy);
1077  DOMAttr *node_yz = node->getAttributeNode(str_yz);
1078  DOMAttr *node_ya = node->getAttributeNode(str_ya);
1079  DOMAttr *node_yb = node->getAttributeNode(str_yb);
1080  DOMAttr *node_yc = node->getAttributeNode(str_yc);
1081  DOMAttr *node_zz = node->getAttributeNode(str_zz);
1082  DOMAttr *node_za = node->getAttributeNode(str_za);
1083  DOMAttr *node_zb = node->getAttributeNode(str_zb);
1084  DOMAttr *node_zc = node->getAttributeNode(str_zc);
1085  DOMAttr *node_aa = node->getAttributeNode(str_aa);
1086  DOMAttr *node_ab = node->getAttributeNode(str_ab);
1087  DOMAttr *node_ac = node->getAttributeNode(str_ac);
1088  DOMAttr *node_bb = node->getAttributeNode(str_bb);
1089  DOMAttr *node_bc = node->getAttributeNode(str_bc);
1090  DOMAttr *node_cc = node->getAttributeNode(str_cc);
1091 
1092  if (node_xx == nullptr)
1093  throw cms::Exception("XMLException") << "<setape> is missing required \"xx\" attribute" << std::endl;
1094  if (node_xy == nullptr)
1095  throw cms::Exception("XMLException") << "<setape> is missing required \"xy\" attribute" << std::endl;
1096  if (node_xz == nullptr)
1097  throw cms::Exception("XMLException") << "<setape> is missing required \"xz\" attribute" << std::endl;
1098  if (node_xa == nullptr)
1099  throw cms::Exception("XMLException") << "<setape> is missing required \"xa\" attribute" << std::endl;
1100  if (node_xb == nullptr)
1101  throw cms::Exception("XMLException") << "<setape> is missing required \"xb\" attribute" << std::endl;
1102  if (node_xc == nullptr)
1103  throw cms::Exception("XMLException") << "<setape> is missing required \"xc\" attribute" << std::endl;
1104  if (node_yy == nullptr)
1105  throw cms::Exception("XMLException") << "<setape> is missing required \"yy\" attribute" << std::endl;
1106  if (node_yz == nullptr)
1107  throw cms::Exception("XMLException") << "<setape> is missing required \"yz\" attribute" << std::endl;
1108  if (node_ya == nullptr)
1109  throw cms::Exception("XMLException") << "<setape> is missing required \"ya\" attribute" << std::endl;
1110  if (node_yb == nullptr)
1111  throw cms::Exception("XMLException") << "<setape> is missing required \"yb\" attribute" << std::endl;
1112  if (node_yc == nullptr)
1113  throw cms::Exception("XMLException") << "<setape> is missing required \"yc\" attribute" << std::endl;
1114  if (node_zz == nullptr)
1115  throw cms::Exception("XMLException") << "<setape> is missing required \"zz\" attribute" << std::endl;
1116  if (node_za == nullptr)
1117  throw cms::Exception("XMLException") << "<setape> is missing required \"za\" attribute" << std::endl;
1118  if (node_zb == nullptr)
1119  throw cms::Exception("XMLException") << "<setape> is missing required \"zb\" attribute" << std::endl;
1120  if (node_zc == nullptr)
1121  throw cms::Exception("XMLException") << "<setape> is missing required \"zc\" attribute" << std::endl;
1122  if (node_aa == nullptr)
1123  throw cms::Exception("XMLException") << "<setape> is missing required \"aa\" attribute" << std::endl;
1124  if (node_ab == nullptr)
1125  throw cms::Exception("XMLException") << "<setape> is missing required \"ab\" attribute" << std::endl;
1126  if (node_ac == nullptr)
1127  throw cms::Exception("XMLException") << "<setape> is missing required \"ac\" attribute" << std::endl;
1128  if (node_bb == nullptr)
1129  throw cms::Exception("XMLException") << "<setape> is missing required \"bb\" attribute" << std::endl;
1130  if (node_bc == nullptr)
1131  throw cms::Exception("XMLException") << "<setape> is missing required \"bc\" attribute" << std::endl;
1132  if (node_cc == nullptr)
1133  throw cms::Exception("XMLException") << "<setape> is missing required \"cc\" attribute" << std::endl;
1134 
1135  align::ErrorMatrix matrix6x6;
1136  matrix6x6(0, 0) = parseDouble(node_xx->getValue(), "xx");
1137  matrix6x6(0, 1) = parseDouble(node_xy->getValue(), "xy");
1138  matrix6x6(0, 2) = parseDouble(node_xz->getValue(), "xz");
1139  matrix6x6(0, 3) = parseDouble(node_xa->getValue(), "xa");
1140  matrix6x6(0, 4) = parseDouble(node_xb->getValue(), "xb");
1141  matrix6x6(0, 5) = parseDouble(node_xc->getValue(), "xc");
1142  matrix6x6(1, 1) = parseDouble(node_yy->getValue(), "yy");
1143  matrix6x6(1, 2) = parseDouble(node_yz->getValue(), "yz");
1144  matrix6x6(1, 3) = parseDouble(node_ya->getValue(), "ya");
1145  matrix6x6(1, 4) = parseDouble(node_yb->getValue(), "yb");
1146  matrix6x6(1, 5) = parseDouble(node_yc->getValue(), "yc");
1147  matrix6x6(2, 2) = parseDouble(node_zz->getValue(), "zz");
1148  matrix6x6(2, 3) = parseDouble(node_za->getValue(), "za");
1149  matrix6x6(2, 4) = parseDouble(node_zb->getValue(), "zb");
1150  matrix6x6(2, 5) = parseDouble(node_zc->getValue(), "zc");
1151  matrix6x6(3, 3) = parseDouble(node_aa->getValue(), "aa");
1152  matrix6x6(3, 4) = parseDouble(node_ab->getValue(), "ab");
1153  matrix6x6(3, 5) = parseDouble(node_ac->getValue(), "ac");
1154  matrix6x6(4, 4) = parseDouble(node_bb->getValue(), "bb");
1155  matrix6x6(4, 5) = parseDouble(node_bc->getValue(), "bc");
1156  matrix6x6(5, 5) = parseDouble(node_cc->getValue(), "cc");
1157 
1158  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1159  // this sets APEs at this level and (since 2nd argument is true) all lower levels
1160  aliiter->first->setAlignmentPositionError(AlignmentPositionError(matrix6x6), true);
1161  }
1162 }
double parseDouble(const XMLCh *str, const char *attribute) const
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

◆ do_setposition()

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 862 of file MuonAlignmentInputXML.cc.

References simBeamSpotPI::alpha, cms::cuda::assert(), PV3DBase< T, PVType, FrameType >::basicVector(), HLT_2023v12_cff::beta, funct::cos(), equals(), Exception, CustomPhysics_cfi::gamma, Alignable::globalPosition(), Alignable::globalRotation(), Alignable::mother(), parseDouble(), convertToXML_global_cfg::relativeto, 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().

864  {
865  DOMAttr *node_relativeto = node->getAttributeNode(str_relativeto);
866  if (node_relativeto == nullptr)
867  throw cms::Exception("XMLException") << "<setposition> is missing required \"relativeto\" attribute" << std::endl;
868 
869  int relativeto = 0;
870  if (XMLString::equals(node_relativeto->getValue(), str_none)) {
871  relativeto = 0;
872  } else if (XMLString::equals(node_relativeto->getValue(), str_ideal)) {
873  relativeto = 1;
874  } else if (XMLString::equals(node_relativeto->getValue(), str_container)) {
875  relativeto = 2;
876  } else {
877  char *message = XMLString::transcode(node_relativeto->getValue());
878  throw cms::Exception("XMLException") << "relativeto must be \"none\", \"ideal\", or \"container\", not \""
879  << message << "\"" << std::endl;
880  }
881 
882  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
883  // first reconstruct the old position: how it would look in this coordinate system
884 
885  Alignable *ali = aliiter->first;
886  Alignable *ideal = alitoideal[ali];
887 
888  align::PositionType oldpos = ali->globalPosition();
889  align::RotationType oldrot = ali->globalRotation();
890 
891  if (relativeto == 0) {
892  }
893 
894  else if (relativeto == 1) {
895  const align::PositionType &idealPosition = ideal->globalPosition();
896  align::RotationType idealRotation = ideal->globalRotation();
897 
898  oldpos = align::PositionType(idealRotation * (oldpos.basicVector() - idealPosition.basicVector()));
899  oldrot = oldrot * idealRotation.transposed();
900  }
901 
902  else if (relativeto == 2 && ali->mother() != nullptr) {
903  align::PositionType globalPosition = ali->mother()->globalPosition();
904  align::RotationType globalRotation = ali->mother()->globalRotation();
905 
906  oldpos = align::PositionType(globalRotation * (oldpos.basicVector() - globalPosition.basicVector()));
907  oldrot = oldrot * globalRotation.transposed();
908  }
909 
910  double x = oldpos.x();
911  double y = oldpos.y();
912  double z = oldpos.z();
913 
914  double phix = atan2(oldrot.yz(), oldrot.zz());
915  double phiy = asin(-oldrot.xz());
916  double phiz = atan2(oldrot.xy(), oldrot.xx());
917 
918  align::EulerAngles oldEulerAngles = align::toAngles(oldrot);
919  double alpha = oldEulerAngles(1);
920  double beta = oldEulerAngles(2);
921  double gamma = oldEulerAngles(3);
922 
923  // now get the new information; if it's incomplete, use the old position for those coordinates
924 
925  DOMAttr *node_x = node->getAttributeNode(str_x);
926  DOMAttr *node_y = node->getAttributeNode(str_y);
927  DOMAttr *node_z = node->getAttributeNode(str_z);
928 
929  if (node_x != nullptr)
930  x = parseDouble(node_x->getValue(), "x");
931  if (node_y != nullptr)
932  y = parseDouble(node_y->getValue(), "y");
933  if (node_z != nullptr)
934  z = parseDouble(node_z->getValue(), "z");
936 
937  DOMAttr *node_phix = node->getAttributeNode(str_phix);
938  DOMAttr *node_phiy = node->getAttributeNode(str_phiy);
939  DOMAttr *node_phiz = node->getAttributeNode(str_phiz);
940  DOMAttr *node_alpha = node->getAttributeNode(str_alpha);
941  DOMAttr *node_beta = node->getAttributeNode(str_beta);
942  DOMAttr *node_gamma = node->getAttributeNode(str_gamma);
944 
945  bool phixyz = (node_phix != nullptr || node_phiy != nullptr || node_phiz != nullptr);
946  bool alphabetagamma = (node_alpha != nullptr || node_beta != nullptr || node_gamma != nullptr);
947  if (phixyz && alphabetagamma)
948  throw cms::Exception("XMLException")
949  << "<setposition> must either have phix, phiy, and phiz or alpha, beta, and gamma, but not both" << std::endl;
950  if (!phixyz && !alphabetagamma)
951  alphabetagamma = true;
952 
953  if (phixyz) {
954  if (node_phix != nullptr)
955  phix = parseDouble(node_phix->getValue(), "phix");
956  if (node_phiy != nullptr)
957  phiy = parseDouble(node_phiy->getValue(), "phiy");
958  if (node_phiz != nullptr)
959  phiz = parseDouble(node_phiz->getValue(), "phiz");
960 
961  // the angle convention originally used in alignment, also known as "non-standard Euler angles with a Z-Y-X convention"
962  // this also gets the sign convention right
963  align::RotationType rotX(1., 0., 0., 0., cos(phix), sin(phix), 0., -sin(phix), cos(phix));
964  align::RotationType rotY(cos(phiy), 0., -sin(phiy), 0., 1., 0., sin(phiy), 0., cos(phiy));
965  align::RotationType rotZ(cos(phiz), sin(phiz), 0., -sin(phiz), cos(phiz), 0., 0., 0., 1.);
966 
967  rot = rotX * rotY * rotZ;
968  }
969 
970  else if (alphabetagamma) {
971  if (node_alpha != nullptr)
972  alpha = parseDouble(node_alpha->getValue(), "alpha");
973  if (node_beta != nullptr)
974  beta = parseDouble(node_beta->getValue(), "beta");
975  if (node_gamma != nullptr)
976  gamma = parseDouble(node_gamma->getValue(), "gamma");
977 
978  // standard Euler angles (how they're internally stored in the database)
979  align::EulerAngles eulerAngles(3);
980  eulerAngles(1) = alpha;
981  eulerAngles(2) = beta;
982  eulerAngles(3) = gamma;
983  rot = align::RotationType(align::toMatrix(eulerAngles));
984  }
985 
986  else
987  assert(false); // see above
988 
989  if (relativeto == 0) {
990  set_one_position(aliiter->first, pos, rot);
991  } // end relativeto="none"
992 
993  else if (relativeto == 1) {
994  Alignable *ali = aliiter->first;
995  Alignable *ideal = alitoideal[ali];
996 
997  const align::PositionType &idealPosition = ideal->globalPosition();
998  align::RotationType idealRotation = ideal->globalRotation();
999  align::PositionType newpos =
1000  align::PositionType(idealRotation.transposed() * pos.basicVector() + idealPosition.basicVector());
1001  align::RotationType newrot = rot * idealRotation;
1002 
1003  set_one_position(ali, newpos, newrot);
1004  } // end relativeto="ideal"
1005 
1006  else if (relativeto == 2) {
1007  Alignable *ali = aliiter->first;
1008  Alignable *container = ali->mother();
1009 
1010  if (container != nullptr) {
1011  const align::PositionType &globalPosition = container->globalPosition();
1012  align::RotationType globalRotation = container->globalRotation();
1013  align::PositionType newpos =
1014  align::PositionType(globalRotation.transposed() * pos.basicVector() + globalPosition.basicVector());
1015  align::RotationType newrot = rot * globalRotation;
1016  set_one_position(ali, newpos, newrot);
1017  } else {
1018  set_one_position(ali, pos, rot);
1019  }
1020  } // end relativeto="container"
1021 
1022  } // end loop over alignables
1023 }
TkRotation< Scalar > RotationType
Definition: Definitions.h:27
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
T xx() const
T z() const
Definition: PV3DBase.h:61
T xy() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T zz() const
T yz() const
assert(be >=bs)
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:28
T x() const
Definition: PV3DBase.h:59
TkRotation transposed() const
T y() const
Definition: PV3DBase.h:60
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
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:8
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
double parseDouble(const XMLCh *str, const char *attribute) const
AlgebraicVector EulerAngles
Definition: Definitions.h:34
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
T xz() const
void set_one_position(Alignable *ali, const align::PositionType &pos, const align::RotationType &rot) const

◆ do_setsurveyerr()

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 1164 of file MuonAlignmentInputXML.cc.

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

1166  {
1167  DOMAttr *node_xx = node->getAttributeNode(str_xx);
1168  DOMAttr *node_xy = node->getAttributeNode(str_xy);
1169  DOMAttr *node_xz = node->getAttributeNode(str_xz);
1170  DOMAttr *node_xa = node->getAttributeNode(str_xa);
1171  DOMAttr *node_xb = node->getAttributeNode(str_xb);
1172  DOMAttr *node_xc = node->getAttributeNode(str_xc);
1173  DOMAttr *node_yy = node->getAttributeNode(str_yy);
1174  DOMAttr *node_yz = node->getAttributeNode(str_yz);
1175  DOMAttr *node_ya = node->getAttributeNode(str_ya);
1176  DOMAttr *node_yb = node->getAttributeNode(str_yb);
1177  DOMAttr *node_yc = node->getAttributeNode(str_yc);
1178  DOMAttr *node_zz = node->getAttributeNode(str_zz);
1179  DOMAttr *node_za = node->getAttributeNode(str_za);
1180  DOMAttr *node_zb = node->getAttributeNode(str_zb);
1181  DOMAttr *node_zc = node->getAttributeNode(str_zc);
1182  DOMAttr *node_aa = node->getAttributeNode(str_aa);
1183  DOMAttr *node_ab = node->getAttributeNode(str_ab);
1184  DOMAttr *node_ac = node->getAttributeNode(str_ac);
1185  DOMAttr *node_bb = node->getAttributeNode(str_bb);
1186  DOMAttr *node_bc = node->getAttributeNode(str_bc);
1187  DOMAttr *node_cc = node->getAttributeNode(str_cc);
1188 
1189  if (node_xx == nullptr)
1190  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
1191  if (node_xy == nullptr)
1192  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
1193  if (node_xz == nullptr)
1194  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
1195  if (node_xa == nullptr)
1196  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
1197  if (node_xb == nullptr)
1198  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
1199  if (node_xc == nullptr)
1200  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
1201  if (node_yy == nullptr)
1202  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
1203  if (node_yz == nullptr)
1204  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
1205  if (node_ya == nullptr)
1206  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
1207  if (node_yb == nullptr)
1208  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
1209  if (node_yc == nullptr)
1210  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
1211  if (node_zz == nullptr)
1212  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
1213  if (node_za == nullptr)
1214  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"za\" attribute" << std::endl;
1215  if (node_zb == nullptr)
1216  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
1217  if (node_zc == nullptr)
1218  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
1219  if (node_aa == nullptr)
1220  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
1221  if (node_ab == nullptr)
1222  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
1223  if (node_ac == nullptr)
1224  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
1225  if (node_bb == nullptr)
1226  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
1227  if (node_bc == nullptr)
1228  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
1229  if (node_cc == nullptr)
1230  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
1231 
1232  align::ErrorMatrix matrix6x6;
1233  matrix6x6(0, 0) = parseDouble(node_xx->getValue(), "xx");
1234  matrix6x6(0, 1) = parseDouble(node_xy->getValue(), "xy");
1235  matrix6x6(0, 2) = parseDouble(node_xz->getValue(), "xz");
1236  matrix6x6(0, 3) = parseDouble(node_xa->getValue(), "xa");
1237  matrix6x6(0, 4) = parseDouble(node_xb->getValue(), "xb");
1238  matrix6x6(0, 5) = parseDouble(node_xc->getValue(), "xc");
1239  matrix6x6(1, 1) = parseDouble(node_yy->getValue(), "yy");
1240  matrix6x6(1, 2) = parseDouble(node_yz->getValue(), "yz");
1241  matrix6x6(1, 3) = parseDouble(node_ya->getValue(), "ya");
1242  matrix6x6(1, 4) = parseDouble(node_yb->getValue(), "yb");
1243  matrix6x6(1, 5) = parseDouble(node_yc->getValue(), "yc");
1244  matrix6x6(2, 2) = parseDouble(node_zz->getValue(), "zz");
1245  matrix6x6(2, 3) = parseDouble(node_za->getValue(), "za");
1246  matrix6x6(2, 4) = parseDouble(node_zb->getValue(), "zb");
1247  matrix6x6(2, 5) = parseDouble(node_zc->getValue(), "zc");
1248  matrix6x6(3, 3) = parseDouble(node_aa->getValue(), "aa");
1249  matrix6x6(3, 4) = parseDouble(node_ab->getValue(), "ab");
1250  matrix6x6(3, 5) = parseDouble(node_ac->getValue(), "ac");
1251  matrix6x6(4, 4) = parseDouble(node_bb->getValue(), "bb");
1252  matrix6x6(4, 5) = parseDouble(node_bc->getValue(), "bc");
1253  matrix6x6(5, 5) = parseDouble(node_cc->getValue(), "cc");
1254 
1255  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1256  Alignable *ali = aliiter->first;
1257  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1258  }
1259 }
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
double parseDouble(const XMLCh *str, const char *attribute) const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

◆ fillAliToIdeal()

void MuonAlignmentInputXML::fillAliToIdeal ( std::map< Alignable *, Alignable *> &  alitoideal,
const align::Alignables alignables,
const align::Alignables ideals 
) const
private

Definition at line 267 of file MuonAlignmentInputXML.cc.

References Exception.

Referenced by newAlignableMuon().

269  {
270  align::Alignables::const_iterator alignable = alignables.begin();
271  align::Alignables::const_iterator ideal = ideals.begin();
272 
273  while (alignable != alignables.end() && ideal != ideals.end()) {
274  alitoideal[*alignable] = *ideal;
275 
276  fillAliToIdeal(alitoideal, (*alignable)->components(), (*ideal)->components());
277 
278  ++alignable;
279  ++ideal;
280  }
281 
282  if (alignable != alignables.end() || ideal != ideals.end()) {
283  throw cms::Exception("Alignment")
284  << "alignable and ideal-alignable trees are out of sync (this should never happen)";
285  }
286 }
void fillAliToIdeal(std::map< Alignable *, Alignable *> &alitoideal, const align::Alignables &alignables, const align::Alignables &ideals) const

◆ getCSCnode()

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 613 of file MuonAlignmentInputXML.cc.

References align::AlignableCSCChamber, align::AlignableCSCEndcap, align::AlignableCSCRing, align::AlignableCSCStation, Alignable::alignableObjectId(), relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, Exception, AlignableObjectId::idToString(), nano_mu_digi_cff::layer, Alignable::mother(), nano_mu_digi_cff::rawId, DetId::rawId(), relativeConstraints::ring, relativeConstraints::station, str_chamber, str_endcap, str_layer, str_rawId, str_ring, and str_station.

Referenced by getNode().

616  {
617  unsigned int rawId;
618 
619  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
620  if (node_rawId != nullptr) {
621  try {
622  rawId = XMLString::parseInt(node_rawId->getValue());
623  } catch (const XMLException &toCatch) {
624  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
625  }
626  } else {
627  int endcap, station, ring, chamber, layer;
628  endcap = station = ring = chamber = layer = 1;
629 
630  DOMAttr *node_endcap = node->getAttributeNode(str_endcap);
631  if (node_endcap == nullptr)
632  throw cms::Exception("XMLException") << "CSC node is missing required \"endcap\" attribute" << std::endl;
633  try {
634  endcap = XMLString::parseInt(node_endcap->getValue());
635  } catch (const XMLException &toCatch) {
636  throw cms::Exception("XMLException") << "Value of \"endcap\" must be an integer" << std::endl;
637  }
638  if (endcap == -1)
639  endcap = 2;
640 
641  if (structureType != align::AlignableCSCEndcap) {
642  DOMAttr *node_station = node->getAttributeNode(str_station);
643  if (node_station == nullptr)
644  throw cms::Exception("XMLException") << "CSC node is missing required \"station\" attribute" << std::endl;
645  try {
646  station = XMLString::parseInt(node_station->getValue());
647  } catch (const XMLException &toCatch) {
648  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
649  }
650 
651  if (structureType != align::AlignableCSCStation) {
652  DOMAttr *node_ring = node->getAttributeNode(str_ring);
653  if (node_ring == nullptr)
654  throw cms::Exception("XMLException") << "CSC node is missing required \"ring\" attribute" << std::endl;
655  try {
656  ring = XMLString::parseInt(node_ring->getValue());
657  } catch (const XMLException &toCatch) {
658  throw cms::Exception("XMLException") << "Value of \"ring\" must be an integer" << std::endl;
659  }
660 
661  if (structureType != align::AlignableCSCRing) {
662  DOMAttr *node_chamber = node->getAttributeNode(str_chamber);
663  if (node_chamber == nullptr)
664  throw cms::Exception("XMLException") << "CSC node is missing required \"chamber\" attribute" << std::endl;
665  try {
666  chamber = XMLString::parseInt(node_chamber->getValue());
667  } catch (const XMLException &toCatch) {
668  throw cms::Exception("XMLException") << "Value of \"chamber\" must be an integer" << std::endl;
669  }
670 
671  if (structureType != align::AlignableCSCChamber) {
672  DOMAttr *node_layer = node->getAttributeNode(str_layer);
673  if (node_layer == nullptr)
674  throw cms::Exception("XMLException") << "CSC node is missing required \"layer\" attribute" << std::endl;
675  try {
676  layer = XMLString::parseInt(node_layer->getValue());
677  } catch (const XMLException &toCatch) {
678  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
679  }
680 
681  } // end if we need a layer number
682  } // end if we need a chamber number
683  } // end if we need a ring number
684  } // end if we need a station number
685 
686  CSCDetId layerId(endcap, station, ring, chamber, layer);
687  rawId = layerId.rawId();
688  } // end if it's specified by endcap, station, ring, chamber, layer
689 
690  Alignable *ali = alignableNavigator[rawId];
691  if (ali == nullptr)
692  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
693 
694  while (ali->alignableObjectId() != structureType) {
695  ali = ali->mother();
696 
697  if (ali == nullptr) {
698  throw cms::Exception("XMLException")
699  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
700  }
701  }
702  return ali;
703 }
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const char * idToString(align::StructureType type) const

◆ getDTnode()

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 520 of file MuonAlignmentInputXML.cc.

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

Referenced by getNode().

523  {
524  unsigned int rawId = 0;
525 
526  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
527  if (node_rawId != nullptr) {
528  try {
529  rawId = XMLString::parseInt(node_rawId->getValue());
530  } catch (const XMLException &toCatch) {
531  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
532  }
533  } else {
534  int wheel, station, sector, superlayer, layer;
535  wheel = station = sector = superlayer = layer = 1;
536 
537  if (structureType != align::AlignableDTBarrel) {
538  DOMAttr *node_wheel = node->getAttributeNode(str_wheel);
539  if (node_wheel == nullptr)
540  throw cms::Exception("XMLException") << "DT node is missing required \"wheel\" attribute" << std::endl;
541  try {
542  wheel = XMLString::parseInt(node_wheel->getValue());
543  } catch (const XMLException &toCatch) {
544  throw cms::Exception("XMLException") << "Value of \"wheel\" must be an integer" << std::endl;
545  }
546 
547  if (structureType != align::AlignableDTWheel) {
548  DOMAttr *node_station = node->getAttributeNode(str_station);
549  if (node_station == nullptr)
550  throw cms::Exception("XMLException") << "DT node is missing required \"station\" attribute" << std::endl;
551  try {
552  station = XMLString::parseInt(node_station->getValue());
553  } catch (const XMLException &toCatch) {
554  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
555  }
556 
557  if (structureType != align::AlignableDTStation) {
558  DOMAttr *node_sector = node->getAttributeNode(str_sector);
559  if (node_sector == nullptr)
560  throw cms::Exception("XMLException") << "DT node is missing required \"sector\" attribute" << std::endl;
561  try {
562  sector = XMLString::parseInt(node_sector->getValue());
563  } catch (const XMLException &toCatch) {
564  throw cms::Exception("XMLException") << "Value of \"sector\" must be an integer" << std::endl;
565  }
566 
567  if (structureType != align::AlignableDTChamber) {
568  DOMAttr *node_superlayer = node->getAttributeNode(str_superlayer);
569  if (node_superlayer == nullptr)
570  throw cms::Exception("XMLException")
571  << "DT node is missing required \"superlayer\" attribute" << std::endl;
572  try {
573  superlayer = XMLString::parseInt(node_superlayer->getValue());
574  } catch (const XMLException &toCatch) {
575  throw cms::Exception("XMLException") << "Value of \"superlayer\" must be an integer" << std::endl;
576  }
577 
578  if (structureType != align::AlignableDTSuperLayer) {
579  DOMAttr *node_layer = node->getAttributeNode(str_layer);
580  if (node_layer == nullptr)
581  throw cms::Exception("XMLException") << "DT node is missing required \"layer\" attribute" << std::endl;
582  try {
583  layer = XMLString::parseInt(node_layer->getValue());
584  } catch (const XMLException &toCatch) {
585  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
586  }
587 
588  } // end if we need a layer number
589  } // end if we need a superlayer number
590  } // end if we need a sector number
591  } // end if we need a station number
592  } // end if we need a wheel number
593 
594  DTLayerId layerId(wheel, station, sector, superlayer, layer);
595  rawId = layerId.rawId();
596  } // end if it's specified by wheel, station, sector, superlayer, layer
597 
598  Alignable *ali = alignableNavigator[rawId];
599  if (ali == nullptr)
600  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
601 
602  while (ali->alignableObjectId() != structureType) {
603  ali = ali->mother();
604 
605  if (ali == nullptr) {
606  throw cms::Exception("XMLException")
607  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
608  }
609  }
610  return ali;
611 }
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const char * idToString(align::StructureType type) const

◆ getGEMnode()

Alignable * MuonAlignmentInputXML::getGEMnode ( align::StructureType  structureType,
std::map< unsigned int, Alignable *> &  alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *  node,
const AlignableObjectId alignableObjectId 
) const
private

Definition at line 705 of file MuonAlignmentInputXML.cc.

References align::AlignableGEMEndcap, align::AlignableGEMRing, align::AlignableGEMStation, Alignable::alignableObjectId(), relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, Exception, AlignableObjectId::idToString(), Alignable::mother(), nano_mu_digi_cff::rawId, DetId::rawId(), relativeConstraints::ring, relativeConstraints::station, str_chamber, str_endcap, str_rawId, str_ring, and str_station.

Referenced by getNode().

708  {
709  unsigned int rawId;
710 
711  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
712  if (node_rawId != nullptr) {
713  try {
714  rawId = XMLString::parseInt(node_rawId->getValue());
715  } catch (const XMLException &toCatch) {
716  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
717  }
718  } else {
719  int endcap, station, ring, superChamber, chamber;
720  endcap = station = ring = superChamber = chamber = 1;
721 
722  DOMAttr *node_endcap = node->getAttributeNode(str_endcap);
723  if (node_endcap == nullptr)
724  throw cms::Exception("XMLException") << "GEM node is missing required \"endcap\" attribute" << std::endl;
725  try {
726  endcap = XMLString::parseInt(node_endcap->getValue());
727  } catch (const XMLException &toCatch) {
728  throw cms::Exception("XMLException") << "Value of \"endcap\" must be an integer" << std::endl;
729  }
730 
731  if (structureType != align::AlignableGEMEndcap) {
732  DOMAttr *node_station = node->getAttributeNode(str_station);
733  if (node_station == nullptr)
734  throw cms::Exception("XMLException") << "GEM node is missing required \"station\" attribute" << std::endl;
735  try {
736  station = XMLString::parseInt(node_station->getValue());
737  } catch (const XMLException &toCatch) {
738  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
739  }
740 
741  if (structureType != align::AlignableGEMStation) {
742  DOMAttr *node_ring = node->getAttributeNode(str_ring);
743  if (node_ring == nullptr)
744  throw cms::Exception("XMLException") << "GEM node is missing required \"ring\" attribute" << std::endl;
745  try {
746  ring = XMLString::parseInt(node_ring->getValue());
747  } catch (const XMLException &toCatch) {
748  throw cms::Exception("XMLException") << "Value of \"ring\" must be an integer" << std::endl;
749  }
750 
751  if (structureType != align::AlignableGEMRing) {
752  DOMAttr *node_superChamber = node->getAttributeNode(str_chamber);
753  if (node_superChamber == nullptr)
754  throw cms::Exception("XMLException")
755  << "GEM node is missing required \"superChamber\" attribute" << std::endl;
756  try {
757  superChamber = XMLString::parseInt(node_superChamber->getValue());
758  } catch (const XMLException &toCatch) {
759  throw cms::Exception("XMLException") << "Value of \"superChamber\" must be an integer" << std::endl;
760  }
761  } // end if we need a chamber number
762  } // end if we need a ring number
763  } // end if we need a station number
764 
765  GEMDetId chamberId(endcap, ring, station, 0, superChamber, 0);
766  rawId = chamberId.rawId();
767  } // end if it's specified by endcap, station, ring, chamber, layer
768  Alignable *ali = alignableNavigator[rawId];
769  if (ali == nullptr)
770  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
771 
772  while (ali->alignableObjectId() != structureType) {
773  ali = ali->mother();
774 
775  if (ali == nullptr) {
776  throw cms::Exception("XMLException")
777  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
778  }
779  }
780  return ali;
781 }
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const char * idToString(align::StructureType type) const

◆ getNode()

Alignable * MuonAlignmentInputXML::getNode ( std::map< unsigned int, Alignable *> &  alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *  node,
const AlignableObjectId alignableObjectId 
) const
private

Definition at line 479 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, align::AlignableGEMChamber, align::AlignableGEMEndcap, align::AlignableGEMRing, align::AlignableGEMStation, align::AlignableGEMSuperChamber, equals(), getCSCnode(), getDTnode(), getGEMnode(), str_CSCChamber, str_CSCEndcap, str_CSCLayer, str_CSCRing, str_CSCStation, str_DTBarrel, str_DTChamber, str_DTLayer, str_DTStation, str_DTSuperLayer, str_DTWheel, str_GEMChamber, str_GEMEndcap, str_GEMEtaPartition, str_GEMRing, str_GEMStation, and str_GEMSuperChamber.

Referenced by newAlignableMuon().

481  {
482  if (XMLString::equals(node->getNodeName(), str_DTBarrel))
483  return getDTnode(align::AlignableDTBarrel, alignableNavigator, node, alignableObjectId);
484  else if (XMLString::equals(node->getNodeName(), str_DTWheel))
485  return getDTnode(align::AlignableDTWheel, alignableNavigator, node, alignableObjectId);
486  else if (XMLString::equals(node->getNodeName(), str_DTStation))
487  return getDTnode(align::AlignableDTStation, alignableNavigator, node, alignableObjectId);
488  else if (XMLString::equals(node->getNodeName(), str_DTChamber))
489  return getDTnode(align::AlignableDTChamber, alignableNavigator, node, alignableObjectId);
490  else if (XMLString::equals(node->getNodeName(), str_DTSuperLayer))
491  return getDTnode(align::AlignableDTSuperLayer, alignableNavigator, node, alignableObjectId);
492  else if (XMLString::equals(node->getNodeName(), str_DTLayer))
493  return getDTnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
494  else if (XMLString::equals(node->getNodeName(), str_CSCEndcap))
495  return getCSCnode(align::AlignableCSCEndcap, alignableNavigator, node, alignableObjectId);
496  else if (XMLString::equals(node->getNodeName(), str_CSCStation))
497  return getCSCnode(align::AlignableCSCStation, alignableNavigator, node, alignableObjectId);
498  else if (XMLString::equals(node->getNodeName(), str_CSCRing))
499  return getCSCnode(align::AlignableCSCRing, alignableNavigator, node, alignableObjectId);
500  else if (XMLString::equals(node->getNodeName(), str_CSCChamber))
501  return getCSCnode(align::AlignableCSCChamber, alignableNavigator, node, alignableObjectId);
502  else if (XMLString::equals(node->getNodeName(), str_CSCLayer))
503  return getCSCnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
504  else if (XMLString::equals(node->getNodeName(), str_GEMEndcap))
505  return getGEMnode(align::AlignableGEMEndcap, alignableNavigator, node, alignableObjectId);
506  else if (XMLString::equals(node->getNodeName(), str_GEMStation))
507  return getGEMnode(align::AlignableGEMStation, alignableNavigator, node, alignableObjectId);
508  else if (XMLString::equals(node->getNodeName(), str_GEMRing))
509  return getGEMnode(align::AlignableGEMRing, alignableNavigator, node, alignableObjectId);
510  else if (XMLString::equals(node->getNodeName(), str_GEMSuperChamber))
511  return getGEMnode(align::AlignableGEMSuperChamber, alignableNavigator, node, alignableObjectId);
512  else if (XMLString::equals(node->getNodeName(), str_GEMChamber))
513  return getGEMnode(align::AlignableGEMChamber, alignableNavigator, node, alignableObjectId);
514  else if (XMLString::equals(node->getNodeName(), str_GEMEtaPartition))
515  return getGEMnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
516  else
517  return nullptr;
518 }
Alignable * getCSCnode(align::StructureType structureType, std::map< unsigned int, Alignable *> &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const
Alignable * getGEMnode(align::StructureType structureType, std::map< unsigned int, Alignable *> &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
Alignable * getDTnode(align::StructureType structureType, std::map< unsigned int, Alignable *> &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const

◆ newAlignableMuon()

AlignableMuon * MuonAlignmentInputXML::newAlignableMuon ( ) const
overridevirtual

Reimplemented from MuonAlignmentInputMethod.

Definition at line 288 of file MuonAlignmentInputXML.cc.

References align::AlignableMuon, class-composition::children, universalConfigTemplate::collection, oniaPATMuonsWithTrigger_cff::collections, AlignableMuon::CSCEndcaps(), cscGeometry_, cscGeometryIdeal_, do_moveglobal(), do_movelocal(), do_rotatebeamline(), do_rotateglobalaxis(), do_rotatelocal(), do_setape(), do_setposition(), do_setsurveyerr(), hcalRecHitTable_cff::doc, AlignableMuon::DTBarrel(), dtGeometry_, dtGeometryIdeal_, equals(), Exception, fillAliToIdeal(), AlignableMuon::GEMEndcaps(), gemGeometry_, gemGeometryIdeal_, getNode(), mps_fire::i, dqmiolumiharvest::j, m_fileName, Skims_PA_cff::name, AlignableMuon::objectIdProvider(), writedatasetfile::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().

288  {
290  std::map<unsigned int, Alignable *> alignableNavigator; // real AlignableNavigators don't have const methods
291  recursiveGetId(alignableNavigator, alignableMuon->DTBarrel());
292  recursiveGetId(alignableNavigator, alignableMuon->CSCEndcaps());
293  recursiveGetId(alignableNavigator, alignableMuon->GEMEndcaps());
294 
296  std::map<unsigned int, Alignable *> ideal_alignableNavigator; // real AlignableNavigators don't have const methods
297  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->DTBarrel());
298  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());
299  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->GEMEndcaps());
300 
301  try {
303  } catch (const XMLException &toCatch) {
304  throw cms::Exception("XMLException") << "Xerces XML parser threw an exception on initialization." << std::endl;
305  }
306 
307  XercesDOMParser *parser = new XercesDOMParser();
308  parser->setValidationScheme(XercesDOMParser::Val_Always);
309 
310  XERCES_CPP_NAMESPACE::ErrorHandler *errHandler = (XERCES_CPP_NAMESPACE::ErrorHandler *)(new HandlerBase());
311  parser->setErrorHandler(errHandler);
312 
313  try {
314  parser->parse(m_fileName.c_str());
315  } catch (const XMLException &toCatch) {
316  char *message = XMLString::transcode(toCatch.getMessage());
317  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
318  } catch (const DOMException &toCatch) {
319  char *message = XMLString::transcode(toCatch.msg);
320  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
321  } catch (const SAXException &toCatch) {
322  char *message = XMLString::transcode(toCatch.getMessage());
323  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
324  }
325 
326  DOMDocument *doc = parser->getDocument();
327  DOMElement *node_MuonAlignment = doc->getDocumentElement();
328  DOMNodeList *collections = doc->getElementsByTagName(str_collection);
329  DOMNodeList *operations = doc->getElementsByTagName(str_operation);
330 
331  std::map<Alignable *, Alignable *> alitoideal;
332  fillAliToIdeal(alitoideal, alignableMuon->DTBarrel(), ideal_alignableMuon->DTBarrel());
333  fillAliToIdeal(alitoideal, alignableMuon->CSCEndcaps(), ideal_alignableMuon->CSCEndcaps());
334  fillAliToIdeal(alitoideal, alignableMuon->GEMEndcaps(), ideal_alignableMuon->GEMEndcaps());
335 
336  const auto &alignableObjectId = alignableMuon->objectIdProvider();
337  std::map<std::string, std::map<Alignable *, bool> > alicollections;
338  for (unsigned int i = 0; i < collections->getLength(); i++) {
339  DOMElement *collection = (DOMElement *)(collections->item(i));
340  if (collection->getParentNode() == node_MuonAlignment) {
341  DOMNodeList *children = collection->getChildNodes();
342 
343  DOMAttr *node_name = collection->getAttributeNode(str_name);
344  if (node_name == nullptr) {
345  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
346  }
347  char *ascii_name = XMLString::transcode(node_name->getValue());
348  std::string name(ascii_name);
349  XMLString::release(&ascii_name);
350 
351  std::map<Alignable *, bool> aliset;
352  for (unsigned int j = 0; j < children->getLength(); j++) {
353  DOMNode *node = children->item(j);
354 
355  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
356  Alignable *ali = getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
357  if (ali == nullptr) {
358  throw cms::Exception("XMLException") << "<collection> must contain only alignables" << std::endl;
359  }
360 
361  aliset[ali] = true;
362  } // end if this node is an element
363  } // end loop over collection's children
364 
365  alicollections[name] = aliset;
366  } // end if this is a top-level collection
367  } // end loop over collections
368 
369  for (unsigned int i = 0; i < operations->getLength(); i++) {
370  DOMElement *operation = (DOMElement *)(operations->item(i));
371  if (operation->getParentNode() != node_MuonAlignment) {
372  throw cms::Exception("XMLException") << "All operations must be top-level elements" << std::endl;
373  }
374 
375  DOMNodeList *children = operation->getChildNodes();
376 
377  std::map<Alignable *, bool> aliset;
378  std::vector<DOMNode *> nodesToRemove;
379  for (unsigned int j = 0; j < children->getLength(); j++) {
380  DOMNode *node = children->item(j);
381 
382  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
383  Alignable *ali = getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
384  if (ali != nullptr) {
385  aliset[ali] = true;
386  nodesToRemove.push_back(node);
387  } // end if this node is an alignable
388 
389  else if (XMLString::equals(node->getNodeName(), str_collection)) {
390  DOMAttr *node_name = ((DOMElement *)(node))->getAttributeNode(str_name);
391  if (node_name == nullptr) {
392  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
393  }
394  char *ascii_name = XMLString::transcode(node_name->getValue());
395  std::string name(ascii_name);
396  XMLString::release(&ascii_name);
397 
398  std::map<std::string, std::map<Alignable *, bool> >::const_iterator alicollections_iter =
399  alicollections.find(name);
400  if (alicollections_iter == alicollections.end()) {
401  throw cms::Exception("XMLException")
402  << "<collection name=\"" << name << "\"> hasn't been defined" << std::endl;
403  }
404 
405  for (std::map<Alignable *, bool>::const_iterator aliiter = alicollections_iter->second.begin();
406  aliiter != alicollections_iter->second.end();
407  ++aliiter) {
408  aliset[aliiter->first] = true;
409  } // end loop over alignables in this collection
410 
411  nodesToRemove.push_back(node);
412  } // end if this node is a collection
413 
414  else {
415  } // anything else? assume it's a position/rotation directive
416 
417  } // end if node is node is an element
418  } // end first loop over operation's children
419 
420  // from now on, we only want to see position/rotation directives
421  for (std::vector<DOMNode *>::const_iterator node = nodesToRemove.begin(); node != nodesToRemove.end(); ++node) {
422  operation->removeChild(*node);
423  }
424  children = operation->getChildNodes();
425 
426  for (unsigned int j = 0; j < children->getLength(); j++) {
427  DOMNode *node = children->item(j);
428  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
429  if (XMLString::equals(node->getNodeName(), str_setposition)) {
430  do_setposition((DOMElement *)(node), aliset, alitoideal);
431  }
432 
433  else if (XMLString::equals(node->getNodeName(), str_setape)) {
434  do_setape((DOMElement *)(node), aliset, alitoideal);
435  }
436 
437  else if (XMLString::equals(node->getNodeName(), str_setsurveyerr)) {
438  do_setsurveyerr((DOMElement *)(node), aliset, alitoideal);
439  }
440 
441  else if (XMLString::equals(node->getNodeName(), str_moveglobal)) {
442  do_moveglobal((DOMElement *)(node), aliset, alitoideal);
443  }
444 
445  else if (XMLString::equals(node->getNodeName(), str_movelocal)) {
446  do_movelocal((DOMElement *)(node), aliset, alitoideal);
447  }
448 
449  else if (XMLString::equals(node->getNodeName(), str_rotatelocal)) {
450  do_rotatelocal((DOMElement *)(node), aliset, alitoideal);
451  }
452 
453  else if (XMLString::equals(node->getNodeName(), str_rotatebeamline)) {
454  do_rotatebeamline((DOMElement *)(node), aliset, alitoideal);
455  }
456 
457  else if (XMLString::equals(node->getNodeName(), str_rotateglobalaxis)) {
458  do_rotateglobalaxis((DOMElement *)(node), aliset, alitoideal);
459  }
460 
461  else {
462  char *message = XMLString::transcode(node->getNodeName());
463  throw cms::Exception("XMLException") << "Unrecognized operation: \"" << message << "\"" << std::endl;
464  }
465 
466  } // end if node is an element
467  } // end second loop over operation's children
468  } // end loop over operations
469 
470  delete parser;
471  delete errHandler;
472 
474 
475  delete ideal_alignableMuon;
476  return alignableMuon;
477 }
void do_moveglobal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable *> &alitoideal) const
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 AlignableObjectId &) const
void xercesTerminate()
Definition: Xerces.cc:23
const AlignableObjectId & objectIdProvider() const
Return muon alignable object ID provider derived from the muon system geometry.
Definition: AlignableMuon.h:92
align::Alignables DTBarrel()
void do_rotateglobalaxis(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable *> &alitoideal) const
const DTGeometry * dtGeometryIdeal_
void xercesInitialize()
Definition: Xerces.cc:18
void do_setape(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable *> &alitoideal) const
const DTGeometry * dtGeometry_
void do_setposition(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable *> &alitoideal) const
align::Alignables CSCEndcaps()
void do_rotatebeamline(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 do_rotatelocal(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
const GEMGeometry * gemGeometryIdeal_
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
const GEMGeometry * gemGeometry_
const CSCGeometry * cscGeometryIdeal_
align::Alignables GEMEndcaps()
void fillAliToIdeal(std::map< Alignable *, Alignable *> &alitoideal, const align::Alignables &alignables, const align::Alignables &ideals) const
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
const CSCGeometry * cscGeometry_

◆ operator=()

const MuonAlignmentInputXML& MuonAlignmentInputXML::operator= ( const MuonAlignmentInputXML )
delete

◆ parseDouble()

double MuonAlignmentInputXML::parseDouble ( const XMLCh *  str,
const char *  attribute 
) const
private

Definition at line 783 of file MuonAlignmentInputXML.cc.

References Exception, HLT_2023v12_cff::exponent, mps_fire::i, reco::HaloData::minus, convertSQLitetoXML_cfg::output, funct::pow(), fetchall_from_DQM_v2::release, and str.

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

783  {
784  unsigned int len = XMLString::stringLen(str);
785  char *cstr = XMLString::transcode(str);
786  std::stringstream errmessage;
787  errmessage << "Value of \"" << attribute << "\" must be a double, not \"" << cstr << "\"" << std::endl;
788 
789  unsigned int i = 0;
790 
791  bool minus = false;
792  if (cstr[i] == '-') {
793  minus = true;
794  i++;
795  } else if (cstr[i] == '+')
796  i++;
797 
798  double output = 0.;
799 
800  while (cstr[i] != '.' && cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
801  if (cstr[i] < '0' || cstr[i] > '9') {
802  XMLString::release(&cstr);
803  throw cms::Exception("XMLException") << errmessage.str();
804  }
805 
806  output *= 10;
807  output += cstr[i] - '0';
808  i++;
809  }
810 
811  if (cstr[i] == '.') {
812  double place = 0.1;
813  i++;
814 
815  while (cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
816  if (cstr[i] < '0' || cstr[i] > '9') {
817  XMLString::release(&cstr);
818  throw cms::Exception("XMLException") << errmessage.str();
819  }
820 
821  output += (cstr[i] - '0') * place;
822  place /= 10.;
823  i++;
824  }
825  }
826 
827  if (cstr[i] == 'e' || cstr[i] == 'E') {
828  i++;
829 
830  int exponent = 0;
831  bool expminus = false;
832  if (cstr[i] == '-') {
833  expminus = true;
834  i++;
835  } else if (cstr[i] == '+')
836  i++;
837 
838  while (i < len) {
839  if (cstr[i] < '0' || cstr[i] > '9') {
840  XMLString::release(&cstr);
841  throw cms::Exception("XMLException") << errmessage.str();
842  }
843 
844  exponent *= 10;
845  exponent += cstr[i] - '0';
846  i++;
847  }
848 
849  if (expminus)
850  exponent *= -1;
851 
852  output *= pow(10., exponent);
853  }
854 
855  if (minus)
856  output *= -1.;
857 
858  XMLString::release(&cstr);
859  return output;
860 }
Definition: output.py:1
#define str(s)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ recursiveGetId()

void MuonAlignmentInputXML::recursiveGetId ( std::map< unsigned int, Alignable *> &  alignableNavigator,
const align::Alignables alignables 
) const
private

Definition at line 249 of file MuonAlignmentInputXML.cc.

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

Referenced by newAlignableMuon().

250  {
251  for (align::Alignables::const_iterator ali = alignables.begin(); ali != alignables.end(); ++ali) {
252  if ((*ali)->alignableObjectId() == align::AlignableDetUnit || (*ali)->alignableObjectId() == align::AlignableDet ||
253  (*ali)->alignableObjectId() == align::AlignableDTChamber ||
254  (*ali)->alignableObjectId() == align::AlignableDTSuperLayer ||
255  (*ali)->alignableObjectId() == align::AlignableDTLayer ||
256  (*ali)->alignableObjectId() == align::AlignableCSCChamber ||
257  (*ali)->alignableObjectId() == align::AlignableCSCLayer ||
258  (*ali)->alignableObjectId() == align::AlignableGEMSuperChamber ||
259  (*ali)->alignableObjectId() == align::AlignableGEMChamber ||
260  (*ali)->alignableObjectId() == align::AlignableGEMEtaPartition) {
261  alignableNavigator[(*ali)->geomDetId().rawId()] = *ali;
262  }
263  recursiveGetId(alignableNavigator, (*ali)->components());
264  }
265 }
void recursiveGetId(std::map< unsigned int, Alignable *> &alignableNavigator, const align::Alignables &alignables) const

◆ set_one_position()

void MuonAlignmentInputXML::set_one_position ( Alignable ali,
const align::PositionType pos,
const align::RotationType rot 
) const
private

Definition at line 1025 of file MuonAlignmentInputXML.cc.

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

Referenced by do_setposition().

1027  {
1028  const align::PositionType &oldpos = ali->globalPosition();
1029  const align::RotationType &oldrot = ali->globalRotation();
1030 
1031  // shift needed to move from current to new position
1032  align::GlobalVector posDiff = pos - oldpos;
1033  align::RotationType rotDiff = oldrot.multiplyInverse(rot);
1034  align::rectify(rotDiff); // correct for rounding errors
1035  ali->move(posDiff);
1036  ali->rotateInGlobalFrame(rotDiff);
1037 
1038  // // check for consistency
1039  // const align::PositionType& newpos = ali->globalPosition();
1040  // const align::RotationType& newrot = ali->globalRotation();
1041  // align::GlobalVector posDiff2 = pos - newpos;
1042  // align::RotationType rotDiff2 = newrot.multiplyInverse(rot);
1043  // align::rectify(rotDiff2); // correct for rounding errors
1044 
1045  // if (fabs(posDiff2.x()) > 1e-6 || fabs(posDiff2.y()) > 1e-6 || fabs(posDiff2.z()) > 1e-6) {
1046  // std::cout << "zeropos " << posDiff2 << std::endl;
1047  // }
1048  // if (fabs(rotDiff2.xx() - 1.) > 1e-4 ||
1049  // fabs(rotDiff2.yy() - 1.) > 1e-4 ||
1050  // fabs(rotDiff2.zz() - 1.) > 1e-4 ||
1051  // fabs(rotDiff2.xy()) > 1e-8 ||
1052  // fabs(rotDiff2.xz()) > 1e-8 ||
1053  // fabs(rotDiff2.yz()) > 1e-8) {
1054  // std::cout << "zerorot " << rotDiff2 << std::endl;
1055  // }
1056 
1057  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1058  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1059 
1060  const SurveyDet *survey = ali->survey();
1061  if (survey != nullptr) {
1062  matrix6x6 = survey->errors(); // save the constraint information
1063  }
1064  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1065 }
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:185
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

Member Data Documentation

◆ cscGeometry_

const CSCGeometry* MuonAlignmentInputXML::cscGeometry_
private

Definition at line 112 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ cscGeometryIdeal_

const CSCGeometry* MuonAlignmentInputXML::cscGeometryIdeal_
private

Definition at line 115 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ dtGeometry_

const DTGeometry* MuonAlignmentInputXML::dtGeometry_
private

Definition at line 111 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ dtGeometryIdeal_

const DTGeometry* MuonAlignmentInputXML::dtGeometryIdeal_
private

Definition at line 114 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ gemGeometry_

const GEMGeometry* MuonAlignmentInputXML::gemGeometry_
private

Definition at line 113 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ gemGeometryIdeal_

const GEMGeometry* MuonAlignmentInputXML::gemGeometryIdeal_
private

Definition at line 116 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ m_fileName

std::string MuonAlignmentInputXML::m_fileName
private

Definition at line 109 of file MuonAlignmentInputXML.h.

Referenced by newAlignableMuon().

◆ str_aa

XMLCh* MuonAlignmentInputXML::str_aa
private

◆ str_ab

XMLCh* MuonAlignmentInputXML::str_ab
private

◆ str_ac

XMLCh* MuonAlignmentInputXML::str_ac
private

◆ str_alpha

XMLCh* MuonAlignmentInputXML::str_alpha
private

◆ str_angle

XMLCh* MuonAlignmentInputXML::str_angle
private

◆ str_axisx

XMLCh* MuonAlignmentInputXML::str_axisx
private

◆ str_axisy

XMLCh* MuonAlignmentInputXML::str_axisy
private

◆ str_axisz

XMLCh* MuonAlignmentInputXML::str_axisz
private

◆ str_bb

XMLCh* MuonAlignmentInputXML::str_bb
private

◆ str_bc

XMLCh* MuonAlignmentInputXML::str_bc
private

◆ str_beta

XMLCh* MuonAlignmentInputXML::str_beta
private

◆ str_cc

XMLCh* MuonAlignmentInputXML::str_cc
private

◆ str_chamber

XMLCh* MuonAlignmentInputXML::str_chamber
private

◆ str_collection

XMLCh* MuonAlignmentInputXML::str_collection
private

◆ str_container

XMLCh* MuonAlignmentInputXML::str_container
private

◆ str_CSCChamber

XMLCh* MuonAlignmentInputXML::str_CSCChamber
private

Definition at line 130 of file MuonAlignmentInputXML.h.

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

◆ str_CSCEndcap

XMLCh* MuonAlignmentInputXML::str_CSCEndcap
private

Definition at line 127 of file MuonAlignmentInputXML.h.

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

◆ str_CSCLayer

XMLCh* MuonAlignmentInputXML::str_CSCLayer
private

Definition at line 131 of file MuonAlignmentInputXML.h.

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

◆ str_CSCRing

XMLCh* MuonAlignmentInputXML::str_CSCRing
private

Definition at line 129 of file MuonAlignmentInputXML.h.

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

◆ str_CSCStation

XMLCh* MuonAlignmentInputXML::str_CSCStation
private

Definition at line 128 of file MuonAlignmentInputXML.h.

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

◆ str_DTBarrel

XMLCh* MuonAlignmentInputXML::str_DTBarrel
private

Definition at line 121 of file MuonAlignmentInputXML.h.

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

◆ str_DTChamber

XMLCh* MuonAlignmentInputXML::str_DTChamber
private

Definition at line 124 of file MuonAlignmentInputXML.h.

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

◆ str_DTLayer

XMLCh* MuonAlignmentInputXML::str_DTLayer
private

Definition at line 126 of file MuonAlignmentInputXML.h.

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

◆ str_DTStation

XMLCh* MuonAlignmentInputXML::str_DTStation
private

Definition at line 123 of file MuonAlignmentInputXML.h.

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

◆ str_DTSuperLayer

XMLCh* MuonAlignmentInputXML::str_DTSuperLayer
private

Definition at line 125 of file MuonAlignmentInputXML.h.

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

◆ str_DTWheel

XMLCh* MuonAlignmentInputXML::str_DTWheel
private

Definition at line 122 of file MuonAlignmentInputXML.h.

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

◆ str_endcap

XMLCh* MuonAlignmentInputXML::str_endcap
private

◆ str_etaPartition

XMLCh* MuonAlignmentInputXML::str_etaPartition
private

Definition at line 157 of file MuonAlignmentInputXML.h.

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

◆ str_gamma

XMLCh* MuonAlignmentInputXML::str_gamma
private

◆ str_GEMChamber

XMLCh* MuonAlignmentInputXML::str_GEMChamber
private

Definition at line 136 of file MuonAlignmentInputXML.h.

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

◆ str_GEMEndcap

XMLCh* MuonAlignmentInputXML::str_GEMEndcap
private

Definition at line 132 of file MuonAlignmentInputXML.h.

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

◆ str_GEMEtaPartition

XMLCh* MuonAlignmentInputXML::str_GEMEtaPartition
private

Definition at line 137 of file MuonAlignmentInputXML.h.

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

◆ str_GEMRing

XMLCh* MuonAlignmentInputXML::str_GEMRing
private

Definition at line 134 of file MuonAlignmentInputXML.h.

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

◆ str_GEMStation

XMLCh* MuonAlignmentInputXML::str_GEMStation
private

Definition at line 133 of file MuonAlignmentInputXML.h.

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

◆ str_GEMSuperChamber

XMLCh* MuonAlignmentInputXML::str_GEMSuperChamber
private

Definition at line 135 of file MuonAlignmentInputXML.h.

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

◆ str_ideal

XMLCh* MuonAlignmentInputXML::str_ideal
private

◆ str_layer

XMLCh* MuonAlignmentInputXML::str_layer
private

◆ str_moveglobal

XMLCh* MuonAlignmentInputXML::str_moveglobal
private

◆ str_movelocal

XMLCh* MuonAlignmentInputXML::str_movelocal
private

◆ str_name

XMLCh* MuonAlignmentInputXML::str_name
private

◆ str_none

XMLCh* MuonAlignmentInputXML::str_none
private

◆ str_operation

XMLCh* MuonAlignmentInputXML::str_operation
private

◆ str_phi

XMLCh* MuonAlignmentInputXML::str_phi
private

◆ str_phix

XMLCh* MuonAlignmentInputXML::str_phix
private

◆ str_phiy

XMLCh* MuonAlignmentInputXML::str_phiy
private

◆ str_phiz

XMLCh* MuonAlignmentInputXML::str_phiz
private

◆ str_rawId

XMLCh* MuonAlignmentInputXML::str_rawId
private

◆ str_relativeto

XMLCh* MuonAlignmentInputXML::str_relativeto
private

◆ str_ring

XMLCh* MuonAlignmentInputXML::str_ring
private

◆ str_rotatebeamline

XMLCh* MuonAlignmentInputXML::str_rotatebeamline
private

◆ str_rotateglobalaxis

XMLCh* MuonAlignmentInputXML::str_rotateglobalaxis
private

◆ str_rotatelocal

XMLCh* MuonAlignmentInputXML::str_rotatelocal
private

◆ str_rphi

XMLCh* MuonAlignmentInputXML::str_rphi
private

◆ str_sector

XMLCh* MuonAlignmentInputXML::str_sector
private

◆ str_setape

XMLCh* MuonAlignmentInputXML::str_setape
private

◆ str_setposition

XMLCh* MuonAlignmentInputXML::str_setposition
private

◆ str_setsurveyerr

XMLCh* MuonAlignmentInputXML::str_setsurveyerr
private

◆ str_station

XMLCh* MuonAlignmentInputXML::str_station
private

◆ str_superChamber

XMLCh* MuonAlignmentInputXML::str_superChamber
private

Definition at line 156 of file MuonAlignmentInputXML.h.

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

◆ str_superlayer

XMLCh* MuonAlignmentInputXML::str_superlayer
private

◆ str_wheel

XMLCh* MuonAlignmentInputXML::str_wheel
private

◆ str_x

XMLCh* MuonAlignmentInputXML::str_x
private

◆ str_xa

XMLCh* MuonAlignmentInputXML::str_xa
private

◆ str_xb

XMLCh* MuonAlignmentInputXML::str_xb
private

◆ str_xc

XMLCh* MuonAlignmentInputXML::str_xc
private

◆ str_xx

XMLCh* MuonAlignmentInputXML::str_xx
private

◆ str_xy

XMLCh* MuonAlignmentInputXML::str_xy
private

◆ str_xz

XMLCh* MuonAlignmentInputXML::str_xz
private

◆ str_y

XMLCh* MuonAlignmentInputXML::str_y
private

◆ str_ya

XMLCh* MuonAlignmentInputXML::str_ya
private

◆ str_yb

XMLCh* MuonAlignmentInputXML::str_yb
private

◆ str_yc

XMLCh* MuonAlignmentInputXML::str_yc
private

◆ str_yy

XMLCh* MuonAlignmentInputXML::str_yy
private

◆ str_yz

XMLCh* MuonAlignmentInputXML::str_yz
private

◆ str_z

XMLCh* MuonAlignmentInputXML::str_z
private

◆ str_za

XMLCh* MuonAlignmentInputXML::str_za
private

◆ str_zb

XMLCh* MuonAlignmentInputXML::str_zb
private

◆ str_zc

XMLCh* MuonAlignmentInputXML::str_zc
private

◆ str_zz

XMLCh* MuonAlignmentInputXML::str_zz
private