CMS 3D CMS Logo

MuonAlignmentInputXML.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonAlignment
4 // Class : MuonAlignmentInputXML
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Jim Pivarski
10 // Created: Mon Mar 10 16:37:40 CDT 2008
11 //$Id: MuonAlignmentInputXML.cc,v 1.16 2011/03/22 09:49:50 innocent Exp $
12 //
13 
14 // system include files
17 
18 // Xerces include files
19 #include "xercesc/parsers/XercesDOMParser.hpp"
20 #include "xercesc/dom/DOM.hpp"
21 #include "xercesc/sax/HandlerBase.hpp"
22 #include "xercesc/util/XMLString.hpp"
23 #include "xercesc/util/PlatformUtils.hpp"
24 #include "xercesc/util/XercesDefs.hpp"
26 
27 // user include files
36 
37 //
38 // constants, enums and typedefs
39 //
40 
41 //
42 // static data member definitions
43 //
44 
45 //
46 // constructors and destructor
47 //
49  : m_fileName(fileName), idealGeometryLabel(idealLabel) {
51  str_operation = XMLString::transcode("operation");
52  str_collection = XMLString::transcode("collection");
53  str_name = XMLString::transcode("name");
54  str_DTBarrel = XMLString::transcode("DTBarrel");
55  str_DTWheel = XMLString::transcode("DTWheel");
56  str_DTStation = XMLString::transcode("DTStation");
57  str_DTChamber = XMLString::transcode("DTChamber");
58  str_DTSuperLayer = XMLString::transcode("DTSuperLayer");
59  str_DTLayer = XMLString::transcode("DTLayer");
60  str_CSCEndcap = XMLString::transcode("CSCEndcap");
61  str_CSCStation = XMLString::transcode("CSCStation");
62  str_CSCRing = XMLString::transcode("CSCRing");
63  str_CSCChamber = XMLString::transcode("CSCChamber");
64  str_CSCLayer = XMLString::transcode("CSCLayer");
65  str_setposition = XMLString::transcode("setposition");
66  str_setape = XMLString::transcode("setape");
67  str_setsurveyerr = XMLString::transcode("setsurveyerr");
68  str_moveglobal = XMLString::transcode("moveglobal");
69  str_movelocal = XMLString::transcode("movelocal");
70  str_rotatelocal = XMLString::transcode("rotatelocal");
71  str_rotatebeamline = XMLString::transcode("rotatebeamline");
72  str_rotateglobalaxis = XMLString::transcode("rotateglobalaxis");
73  str_relativeto = XMLString::transcode("relativeto");
74  str_rawId = XMLString::transcode("rawId");
75  str_wheel = XMLString::transcode("wheel");
76  str_station = XMLString::transcode("station");
77  str_sector = XMLString::transcode("sector");
78  str_superlayer = XMLString::transcode("superlayer");
79  str_layer = XMLString::transcode("layer");
80  str_endcap = XMLString::transcode("endcap");
81  str_ring = XMLString::transcode("ring");
82  str_chamber = XMLString::transcode("chamber");
83  str_axisx = XMLString::transcode("axisx");
84  str_axisy = XMLString::transcode("axisy");
85  str_axisz = XMLString::transcode("axisz");
86  str_angle = XMLString::transcode("angle");
87  str_x = XMLString::transcode("x");
88  str_y = XMLString::transcode("y");
89  str_z = XMLString::transcode("z");
90  str_phix = XMLString::transcode("phix");
91  str_phiy = XMLString::transcode("phiy");
92  str_phiz = XMLString::transcode("phiz");
93  str_alpha = XMLString::transcode("alpha");
94  str_beta = XMLString::transcode("beta");
95  str_gamma = XMLString::transcode("gamma");
96  str_rphi = XMLString::transcode("rphi");
97  str_phi = XMLString::transcode("phi");
98  str_xx = XMLString::transcode("xx");
99  str_xy = XMLString::transcode("xy");
100  str_xz = XMLString::transcode("xz");
101  str_xa = XMLString::transcode("xa");
102  str_xb = XMLString::transcode("xb");
103  str_xc = XMLString::transcode("xc");
104  str_yy = XMLString::transcode("yy");
105  str_yz = XMLString::transcode("yz");
106  str_ya = XMLString::transcode("ya");
107  str_yb = XMLString::transcode("yb");
108  str_yc = XMLString::transcode("yc");
109  str_zz = XMLString::transcode("zz");
110  str_za = XMLString::transcode("za");
111  str_zb = XMLString::transcode("zb");
112  str_zc = XMLString::transcode("zc");
113  str_aa = XMLString::transcode("aa");
114  str_ab = XMLString::transcode("ab");
115  str_ac = XMLString::transcode("ac");
116  str_bb = XMLString::transcode("bb");
117  str_bc = XMLString::transcode("bc");
118  str_cc = XMLString::transcode("cc");
119  str_none = XMLString::transcode("none");
120  str_ideal = XMLString::transcode("ideal");
121  str_container = XMLString::transcode("container");
122 }
123 
124 // MuonAlignmentInputXML::MuonAlignmentInputXML(const MuonAlignmentInputXML& rhs)
125 // {
126 // // do actual copying here;
127 // }
128 
202 }
203 
204 //
205 // assignment operators
206 //
207 // const MuonAlignmentInputXML& MuonAlignmentInputXML::operator=(const MuonAlignmentInputXML& rhs)
208 // {
209 // //An exception safe implementation is
210 // MuonAlignmentInputXML temp(rhs);
211 // swap(rhs);
212 //
213 // return *this;
214 // }
215 
216 //
217 // member functions
218 //
219 
220 void MuonAlignmentInputXML::recursiveGetId(std::map<unsigned int, Alignable *> &alignableNavigator,
221  const align::Alignables &alignables) const {
222  for (align::Alignables::const_iterator ali = alignables.begin(); ali != alignables.end(); ++ali) {
223  if ((*ali)->alignableObjectId() == align::AlignableDetUnit || (*ali)->alignableObjectId() == align::AlignableDet ||
224  (*ali)->alignableObjectId() == align::AlignableDTChamber ||
225  (*ali)->alignableObjectId() == align::AlignableDTSuperLayer ||
226  (*ali)->alignableObjectId() == align::AlignableDTLayer ||
227  (*ali)->alignableObjectId() == align::AlignableCSCChamber ||
228  (*ali)->alignableObjectId() == align::AlignableCSCLayer) {
229  alignableNavigator[(*ali)->geomDetId().rawId()] = *ali;
230  }
231  recursiveGetId(alignableNavigator, (*ali)->components());
232  }
233 }
234 
235 void MuonAlignmentInputXML::fillAliToIdeal(std::map<Alignable *, Alignable *> &alitoideal,
236  const align::Alignables &alignables,
237  const align::Alignables &ideals) const {
238  align::Alignables::const_iterator alignable = alignables.begin();
239  align::Alignables::const_iterator ideal = ideals.begin();
240 
241  while (alignable != alignables.end() && ideal != ideals.end()) {
242  alitoideal[*alignable] = *ideal;
243 
244  fillAliToIdeal(alitoideal, (*alignable)->components(), (*ideal)->components());
245 
246  ++alignable;
247  ++ideal;
248  }
249 
250  if (alignable != alignables.end() || ideal != ideals.end()) {
251  throw cms::Exception("Alignment")
252  << "alignable and ideal-alignable trees are out of sync (this should never happen)";
253  }
254 }
255 
257  edm::ESHandle<DTGeometry> dtGeometry;
258  edm::ESHandle<CSCGeometry> cscGeometry;
260  iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, dtGeometry);
261  iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, cscGeometry);
263 
264  AlignableMuon *alignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry));
265  std::map<unsigned int, Alignable *> alignableNavigator; // real AlignableNavigators don't have const methods
266  recursiveGetId(alignableNavigator, alignableMuon->DTBarrel());
267  recursiveGetId(alignableNavigator, alignableMuon->CSCEndcaps());
268 
269  AlignableMuon *ideal_alignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry));
270  std::map<unsigned int, Alignable *> ideal_alignableNavigator; // real AlignableNavigators don't have const methods
271  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->DTBarrel());
272  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());
273 
274  try {
276  } catch (const XMLException &toCatch) {
277  throw cms::Exception("XMLException") << "Xerces XML parser threw an exception on initialization." << std::endl;
278  }
279 
280  XercesDOMParser *parser = new XercesDOMParser();
281  parser->setValidationScheme(XercesDOMParser::Val_Always);
282 
283  XERCES_CPP_NAMESPACE::ErrorHandler *errHandler = (XERCES_CPP_NAMESPACE::ErrorHandler *)(new HandlerBase());
284  parser->setErrorHandler(errHandler);
285 
286  try {
287  parser->parse(m_fileName.c_str());
288  } catch (const XMLException &toCatch) {
289  char *message = XMLString::transcode(toCatch.getMessage());
290  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
291  } catch (const DOMException &toCatch) {
292  char *message = XMLString::transcode(toCatch.msg);
293  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
294  } catch (const SAXException &toCatch) {
295  char *message = XMLString::transcode(toCatch.getMessage());
296  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
297  }
298 
299  DOMDocument *doc = parser->getDocument();
300  DOMElement *node_MuonAlignment = doc->getDocumentElement();
301  DOMNodeList *collections = doc->getElementsByTagName(str_collection);
302  DOMNodeList *operations = doc->getElementsByTagName(str_operation);
303 
304  std::map<Alignable *, Alignable *> alitoideal;
305  fillAliToIdeal(alitoideal, alignableMuon->DTBarrel(), ideal_alignableMuon->DTBarrel());
306  fillAliToIdeal(alitoideal, alignableMuon->CSCEndcaps(), ideal_alignableMuon->CSCEndcaps());
307 
308  const auto &alignableObjectId = alignableMuon->objectIdProvider();
309  std::map<std::string, std::map<Alignable *, bool> > alicollections;
310  for (unsigned int i = 0; i < collections->getLength(); i++) {
311  DOMElement *collection = (DOMElement *)(collections->item(i));
312  if (collection->getParentNode() == node_MuonAlignment) {
313  DOMNodeList *children = collection->getChildNodes();
314 
315  DOMAttr *node_name = collection->getAttributeNode(str_name);
316  if (node_name == nullptr) {
317  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
318  }
319  char *ascii_name = XMLString::transcode(node_name->getValue());
320  std::string name(ascii_name);
321  XMLString::release(&ascii_name);
322 
323  std::map<Alignable *, bool> aliset;
324  for (unsigned int j = 0; j < children->getLength(); j++) {
325  DOMNode *node = children->item(j);
326 
327  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
328  Alignable *ali = getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
329  if (ali == nullptr) {
330  throw cms::Exception("XMLException") << "<collection> must contain only alignables" << std::endl;
331  }
332 
333  aliset[ali] = true;
334  } // end if this node is an element
335  } // end loop over collection's children
336 
337  alicollections[name] = aliset;
338  } // end if this is a top-level collection
339  } // end loop over collections
340 
341  for (unsigned int i = 0; i < operations->getLength(); i++) {
342  DOMElement *operation = (DOMElement *)(operations->item(i));
343  if (operation->getParentNode() != node_MuonAlignment) {
344  throw cms::Exception("XMLException") << "All operations must be top-level elements" << std::endl;
345  }
346 
347  DOMNodeList *children = operation->getChildNodes();
348 
349  std::map<Alignable *, bool> aliset;
350  std::vector<DOMNode *> nodesToRemove;
351  for (unsigned int j = 0; j < children->getLength(); j++) {
352  DOMNode *node = children->item(j);
353 
354  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
355  Alignable *ali = getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
356  if (ali != nullptr) {
357  aliset[ali] = true;
358  nodesToRemove.push_back(node);
359  } // end if this node is an alignable
360 
361  else if (XMLString::equals(node->getNodeName(), str_collection)) {
362  DOMAttr *node_name = ((DOMElement *)(node))->getAttributeNode(str_name);
363  if (node_name == nullptr) {
364  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
365  }
366  char *ascii_name = XMLString::transcode(node_name->getValue());
367  std::string name(ascii_name);
368  XMLString::release(&ascii_name);
369 
370  std::map<std::string, std::map<Alignable *, bool> >::const_iterator alicollections_iter =
371  alicollections.find(name);
372  if (alicollections_iter == alicollections.end()) {
373  throw cms::Exception("XMLException")
374  << "<collection name=\"" << name << "\"> hasn't been defined" << std::endl;
375  }
376 
377  for (std::map<Alignable *, bool>::const_iterator aliiter = alicollections_iter->second.begin();
378  aliiter != alicollections_iter->second.end();
379  ++aliiter) {
380  aliset[aliiter->first] = true;
381  } // end loop over alignables in this collection
382 
383  nodesToRemove.push_back(node);
384  } // end if this node is a collection
385 
386  else {
387  } // anything else? assume it's a position/rotation directive
388 
389  } // end if node is node is an element
390  } // end first loop over operation's children
391 
392  // from now on, we only want to see position/rotation directives
393  for (std::vector<DOMNode *>::const_iterator node = nodesToRemove.begin(); node != nodesToRemove.end(); ++node) {
394  operation->removeChild(*node);
395  }
396  children = operation->getChildNodes();
397 
398  for (unsigned int j = 0; j < children->getLength(); j++) {
399  DOMNode *node = children->item(j);
400  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
401  if (XMLString::equals(node->getNodeName(), str_setposition)) {
402  do_setposition((DOMElement *)(node), aliset, alitoideal);
403  }
404 
405  else if (XMLString::equals(node->getNodeName(), str_setape)) {
406  do_setape((DOMElement *)(node), aliset, alitoideal);
407  }
408 
409  else if (XMLString::equals(node->getNodeName(), str_setsurveyerr)) {
410  do_setsurveyerr((DOMElement *)(node), aliset, alitoideal);
411  }
412 
413  else if (XMLString::equals(node->getNodeName(), str_moveglobal)) {
414  do_moveglobal((DOMElement *)(node), aliset, alitoideal);
415  }
416 
417  else if (XMLString::equals(node->getNodeName(), str_movelocal)) {
418  do_movelocal((DOMElement *)(node), aliset, alitoideal);
419  }
420 
421  else if (XMLString::equals(node->getNodeName(), str_rotatelocal)) {
422  do_rotatelocal((DOMElement *)(node), aliset, alitoideal);
423  }
424 
425  else if (XMLString::equals(node->getNodeName(), str_rotatebeamline)) {
426  do_rotatebeamline((DOMElement *)(node), aliset, alitoideal);
427  }
428 
429  else if (XMLString::equals(node->getNodeName(), str_rotateglobalaxis)) {
430  do_rotateglobalaxis((DOMElement *)(node), aliset, alitoideal);
431  }
432 
433  else {
434  char *message = XMLString::transcode(node->getNodeName());
435  throw cms::Exception("XMLException") << "Unrecognized operation: \"" << message << "\"" << std::endl;
436  }
437 
438  } // end if node is an element
439  } // end second loop over operation's children
440  } // end loop over operations
441 
442  delete parser;
443  delete errHandler;
444 
446 
447  delete ideal_alignableMuon;
448  return alignableMuon;
449 }
450 
451 Alignable *MuonAlignmentInputXML::getNode(std::map<unsigned int, Alignable *> &alignableNavigator,
452  const XERCES_CPP_NAMESPACE::DOMElement *node,
453  const AlignableObjectId &alignableObjectId) const {
454  if (XMLString::equals(node->getNodeName(), str_DTBarrel))
455  return getDTnode(align::AlignableDTBarrel, alignableNavigator, node, alignableObjectId);
456  else if (XMLString::equals(node->getNodeName(), str_DTWheel))
457  return getDTnode(align::AlignableDTWheel, alignableNavigator, node, alignableObjectId);
458  else if (XMLString::equals(node->getNodeName(), str_DTStation))
459  return getDTnode(align::AlignableDTStation, alignableNavigator, node, alignableObjectId);
460  else if (XMLString::equals(node->getNodeName(), str_DTChamber))
461  return getDTnode(align::AlignableDTChamber, alignableNavigator, node, alignableObjectId);
462  else if (XMLString::equals(node->getNodeName(), str_DTSuperLayer))
463  return getDTnode(align::AlignableDTSuperLayer, alignableNavigator, node, alignableObjectId);
464  else if (XMLString::equals(node->getNodeName(), str_DTLayer))
465  return getDTnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
466  else if (XMLString::equals(node->getNodeName(), str_CSCEndcap))
467  return getCSCnode(align::AlignableCSCEndcap, alignableNavigator, node, alignableObjectId);
468  else if (XMLString::equals(node->getNodeName(), str_CSCStation))
469  return getCSCnode(align::AlignableCSCStation, alignableNavigator, node, alignableObjectId);
470  else if (XMLString::equals(node->getNodeName(), str_CSCRing))
471  return getCSCnode(align::AlignableCSCRing, alignableNavigator, node, alignableObjectId);
472  else if (XMLString::equals(node->getNodeName(), str_CSCChamber))
473  return getCSCnode(align::AlignableCSCChamber, alignableNavigator, node, alignableObjectId);
474  else if (XMLString::equals(node->getNodeName(), str_CSCLayer))
475  return getCSCnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
476  else
477  return nullptr;
478 }
479 
481  std::map<unsigned int, Alignable *> &alignableNavigator,
482  const XERCES_CPP_NAMESPACE::DOMElement *node,
483  const AlignableObjectId &alignableObjectId) const {
484  unsigned int rawId = 0;
485 
486  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
487  if (node_rawId != nullptr) {
488  try {
489  rawId = XMLString::parseInt(node_rawId->getValue());
490  } catch (const XMLException &toCatch) {
491  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
492  }
493  } else {
494  int wheel, station, sector, superlayer, layer;
495  wheel = station = sector = superlayer = layer = 1;
496 
497  if (structureType != align::AlignableDTBarrel) {
498  DOMAttr *node_wheel = node->getAttributeNode(str_wheel);
499  if (node_wheel == nullptr)
500  throw cms::Exception("XMLException") << "DT node is missing required \"wheel\" attribute" << std::endl;
501  try {
502  wheel = XMLString::parseInt(node_wheel->getValue());
503  } catch (const XMLException &toCatch) {
504  throw cms::Exception("XMLException") << "Value of \"wheel\" must be an integer" << std::endl;
505  }
506 
507  if (structureType != align::AlignableDTWheel) {
508  DOMAttr *node_station = node->getAttributeNode(str_station);
509  if (node_station == nullptr)
510  throw cms::Exception("XMLException") << "DT node is missing required \"station\" attribute" << std::endl;
511  try {
512  station = XMLString::parseInt(node_station->getValue());
513  } catch (const XMLException &toCatch) {
514  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
515  }
516 
517  if (structureType != align::AlignableDTStation) {
518  DOMAttr *node_sector = node->getAttributeNode(str_sector);
519  if (node_sector == nullptr)
520  throw cms::Exception("XMLException") << "DT node is missing required \"sector\" attribute" << std::endl;
521  try {
522  sector = XMLString::parseInt(node_sector->getValue());
523  } catch (const XMLException &toCatch) {
524  throw cms::Exception("XMLException") << "Value of \"sector\" must be an integer" << std::endl;
525  }
526 
527  if (structureType != align::AlignableDTChamber) {
528  DOMAttr *node_superlayer = node->getAttributeNode(str_superlayer);
529  if (node_superlayer == nullptr)
530  throw cms::Exception("XMLException")
531  << "DT node is missing required \"superlayer\" attribute" << std::endl;
532  try {
533  superlayer = XMLString::parseInt(node_superlayer->getValue());
534  } catch (const XMLException &toCatch) {
535  throw cms::Exception("XMLException") << "Value of \"superlayer\" must be an integer" << std::endl;
536  }
537 
538  if (structureType != align::AlignableDTSuperLayer) {
539  DOMAttr *node_layer = node->getAttributeNode(str_layer);
540  if (node_layer == nullptr)
541  throw cms::Exception("XMLException") << "DT node is missing required \"layer\" attribute" << std::endl;
542  try {
543  layer = XMLString::parseInt(node_layer->getValue());
544  } catch (const XMLException &toCatch) {
545  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
546  }
547 
548  } // end if we need a layer number
549  } // end if we need a superlayer number
550  } // end if we need a sector number
551  } // end if we need a station number
552  } // end if we need a wheel number
553 
554  DTLayerId layerId(wheel, station, sector, superlayer, layer);
555  rawId = layerId.rawId();
556  } // end if it's specified by wheel, station, sector, superlayer, layer
557 
558  Alignable *ali = alignableNavigator[rawId];
559  if (ali == nullptr)
560  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
561 
562  while (ali->alignableObjectId() != structureType) {
563  ali = ali->mother();
564 
565  if (ali == nullptr) {
566  throw cms::Exception("XMLException")
567  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
568  }
569  }
570  return ali;
571 }
572 
574  std::map<unsigned int, Alignable *> &alignableNavigator,
575  const XERCES_CPP_NAMESPACE::DOMElement *node,
576  const AlignableObjectId &alignableObjectId) const {
577  unsigned int rawId;
578 
579  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
580  if (node_rawId != nullptr) {
581  try {
582  rawId = XMLString::parseInt(node_rawId->getValue());
583  } catch (const XMLException &toCatch) {
584  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
585  }
586  } else {
587  int endcap, station, ring, chamber, layer;
588  endcap = station = ring = chamber = layer = 1;
589 
590  DOMAttr *node_endcap = node->getAttributeNode(str_endcap);
591  if (node_endcap == nullptr)
592  throw cms::Exception("XMLException") << "CSC node is missing required \"endcap\" attribute" << std::endl;
593  try {
594  endcap = XMLString::parseInt(node_endcap->getValue());
595  } catch (const XMLException &toCatch) {
596  throw cms::Exception("XMLException") << "Value of \"endcap\" must be an integer" << std::endl;
597  }
598  if (endcap == -1)
599  endcap = 2;
600 
601  if (structureType != align::AlignableCSCEndcap) {
602  DOMAttr *node_station = node->getAttributeNode(str_station);
603  if (node_station == nullptr)
604  throw cms::Exception("XMLException") << "CSC node is missing required \"station\" attribute" << std::endl;
605  try {
606  station = XMLString::parseInt(node_station->getValue());
607  } catch (const XMLException &toCatch) {
608  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
609  }
610 
611  if (structureType != align::AlignableCSCStation) {
612  DOMAttr *node_ring = node->getAttributeNode(str_ring);
613  if (node_ring == nullptr)
614  throw cms::Exception("XMLException") << "CSC node is missing required \"ring\" attribute" << std::endl;
615  try {
616  ring = XMLString::parseInt(node_ring->getValue());
617  } catch (const XMLException &toCatch) {
618  throw cms::Exception("XMLException") << "Value of \"ring\" must be an integer" << std::endl;
619  }
620 
621  if (structureType != align::AlignableCSCRing) {
622  DOMAttr *node_chamber = node->getAttributeNode(str_chamber);
623  if (node_chamber == nullptr)
624  throw cms::Exception("XMLException") << "CSC node is missing required \"chamber\" attribute" << std::endl;
625  try {
626  chamber = XMLString::parseInt(node_chamber->getValue());
627  } catch (const XMLException &toCatch) {
628  throw cms::Exception("XMLException") << "Value of \"chamber\" must be an integer" << std::endl;
629  }
630 
631  if (structureType != align::AlignableCSCChamber) {
632  DOMAttr *node_layer = node->getAttributeNode(str_layer);
633  if (node_layer == nullptr)
634  throw cms::Exception("XMLException") << "CSC node is missing required \"layer\" attribute" << std::endl;
635  try {
636  layer = XMLString::parseInt(node_layer->getValue());
637  } catch (const XMLException &toCatch) {
638  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
639  }
640 
641  } // end if we need a layer number
642  } // end if we need a chamber number
643  } // end if we need a ring number
644  } // end if we need a station number
645 
646  CSCDetId layerId(endcap, station, ring, chamber, layer);
647  rawId = layerId.rawId();
648  } // end if it's specified by endcap, station, ring, chamber, layer
649 
650  Alignable *ali = alignableNavigator[rawId];
651  if (ali == nullptr)
652  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
653 
654  while (ali->alignableObjectId() != structureType) {
655  ali = ali->mother();
656 
657  if (ali == nullptr) {
658  throw cms::Exception("XMLException")
659  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
660  }
661  }
662  return ali;
663 }
664 
665 double MuonAlignmentInputXML::parseDouble(const XMLCh *str, const char *attribute) const {
666  unsigned int len = XMLString::stringLen(str);
667  char *cstr = XMLString::transcode(str);
668  std::stringstream errmessage;
669  errmessage << "Value of \"" << attribute << "\" must be a double, not \"" << cstr << "\"" << std::endl;
670 
671  unsigned int i = 0;
672 
673  bool minus = false;
674  if (cstr[i] == '-') {
675  minus = true;
676  i++;
677  } else if (cstr[i] == '+')
678  i++;
679 
680  double output = 0.;
681 
682  while (cstr[i] != '.' && cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
683  if (cstr[i] < '0' || cstr[i] > '9') {
684  XMLString::release(&cstr);
685  throw cms::Exception("XMLException") << errmessage.str();
686  }
687 
688  output *= 10;
689  output += cstr[i] - '0';
690  i++;
691  }
692 
693  if (cstr[i] == '.') {
694  double place = 0.1;
695  i++;
696 
697  while (cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
698  if (cstr[i] < '0' || cstr[i] > '9') {
699  XMLString::release(&cstr);
700  throw cms::Exception("XMLException") << errmessage.str();
701  }
702 
703  output += (cstr[i] - '0') * place;
704  place /= 10.;
705  i++;
706  }
707  }
708 
709  if (cstr[i] == 'e' || cstr[i] == 'E') {
710  i++;
711 
712  int exponent = 0;
713  bool expminus = false;
714  if (cstr[i] == '-') {
715  expminus = true;
716  i++;
717  } else if (cstr[i] == '+')
718  i++;
719 
720  while (i < len) {
721  if (cstr[i] < '0' || cstr[i] > '9') {
722  XMLString::release(&cstr);
723  throw cms::Exception("XMLException") << errmessage.str();
724  }
725 
726  exponent *= 10;
727  exponent += cstr[i] - '0';
728  i++;
729  }
730 
731  if (expminus)
732  exponent *= -1;
733 
734  output *= pow(10., exponent);
735  }
736 
737  if (minus)
738  output *= -1.;
739 
740  XMLString::release(&cstr);
741  return output;
742 }
743 
744 void MuonAlignmentInputXML::do_setposition(const XERCES_CPP_NAMESPACE::DOMElement *node,
745  std::map<Alignable *, bool> &aliset,
746  std::map<Alignable *, Alignable *> &alitoideal) const {
747  DOMAttr *node_relativeto = node->getAttributeNode(str_relativeto);
748  if (node_relativeto == nullptr)
749  throw cms::Exception("XMLException") << "<setposition> is missing required \"relativeto\" attribute" << std::endl;
750 
751  int relativeto = 0;
752  if (XMLString::equals(node_relativeto->getValue(), str_none)) {
753  relativeto = 0;
754  } else if (XMLString::equals(node_relativeto->getValue(), str_ideal)) {
755  relativeto = 1;
756  } else if (XMLString::equals(node_relativeto->getValue(), str_container)) {
757  relativeto = 2;
758  } else {
759  char *message = XMLString::transcode(node_relativeto->getValue());
760  throw cms::Exception("XMLException") << "relativeto must be \"none\", \"ideal\", or \"container\", not \""
761  << message << "\"" << std::endl;
762  }
763 
764  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
765  // first reconstruct the old position: how it would look in this coordinate system
766 
767  Alignable *ali = aliiter->first;
768  Alignable *ideal = alitoideal[ali];
769 
770  align::PositionType oldpos = ali->globalPosition();
771  align::RotationType oldrot = ali->globalRotation();
772 
773  if (relativeto == 0) {
774  }
775 
776  else if (relativeto == 1) {
777  const align::PositionType &idealPosition = ideal->globalPosition();
778  align::RotationType idealRotation = ideal->globalRotation();
779 
780  oldpos = align::PositionType(idealRotation * (oldpos.basicVector() - idealPosition.basicVector()));
781  oldrot = oldrot * idealRotation.transposed();
782  }
783 
784  else if (relativeto == 2 && ali->mother() != nullptr) {
785  align::PositionType globalPosition = ali->mother()->globalPosition();
786  align::RotationType globalRotation = ali->mother()->globalRotation();
787 
788  oldpos = align::PositionType(globalRotation * (oldpos.basicVector() - globalPosition.basicVector()));
789  oldrot = oldrot * globalRotation.transposed();
790  }
791 
792  double x = oldpos.x();
793  double y = oldpos.y();
794  double z = oldpos.z();
795 
796  double phix = atan2(oldrot.yz(), oldrot.zz());
797  double phiy = asin(-oldrot.xz());
798  double phiz = atan2(oldrot.xy(), oldrot.xx());
799 
800  align::EulerAngles oldEulerAngles = align::toAngles(oldrot);
801  double alpha = oldEulerAngles(1);
802  double beta = oldEulerAngles(2);
803  double gamma = oldEulerAngles(3);
804 
805  // now get the new information; if it's incomplete, use the old position for those coordinates
806 
807  DOMAttr *node_x = node->getAttributeNode(str_x);
808  DOMAttr *node_y = node->getAttributeNode(str_y);
809  DOMAttr *node_z = node->getAttributeNode(str_z);
810 
811  if (node_x != nullptr)
812  x = parseDouble(node_x->getValue(), "x");
813  if (node_y != nullptr)
814  y = parseDouble(node_y->getValue(), "y");
815  if (node_z != nullptr)
816  z = parseDouble(node_z->getValue(), "z");
818 
819  DOMAttr *node_phix = node->getAttributeNode(str_phix);
820  DOMAttr *node_phiy = node->getAttributeNode(str_phiy);
821  DOMAttr *node_phiz = node->getAttributeNode(str_phiz);
822  DOMAttr *node_alpha = node->getAttributeNode(str_alpha);
823  DOMAttr *node_beta = node->getAttributeNode(str_beta);
824  DOMAttr *node_gamma = node->getAttributeNode(str_gamma);
826 
827  bool phixyz = (node_phix != nullptr || node_phiy != nullptr || node_phiz != nullptr);
828  bool alphabetagamma = (node_alpha != nullptr || node_beta != nullptr || node_gamma != nullptr);
829  if (phixyz && alphabetagamma)
830  throw cms::Exception("XMLException")
831  << "<setposition> must either have phix, phiy, and phiz or alpha, beta, and gamma, but not both" << std::endl;
832  if (!phixyz && !alphabetagamma)
833  alphabetagamma = true;
834 
835  if (phixyz) {
836  if (node_phix != nullptr)
837  phix = parseDouble(node_phix->getValue(), "phix");
838  if (node_phiy != nullptr)
839  phiy = parseDouble(node_phiy->getValue(), "phiy");
840  if (node_phiz != nullptr)
841  phiz = parseDouble(node_phiz->getValue(), "phiz");
842 
843  // the angle convention originally used in alignment, also known as "non-standard Euler angles with a Z-Y-X convention"
844  // this also gets the sign convention right
845  align::RotationType rotX(1., 0., 0., 0., cos(phix), sin(phix), 0., -sin(phix), cos(phix));
846  align::RotationType rotY(cos(phiy), 0., -sin(phiy), 0., 1., 0., sin(phiy), 0., cos(phiy));
847  align::RotationType rotZ(cos(phiz), sin(phiz), 0., -sin(phiz), cos(phiz), 0., 0., 0., 1.);
848 
849  rot = rotX * rotY * rotZ;
850  }
851 
852  else if (alphabetagamma) {
853  if (node_alpha != nullptr)
854  alpha = parseDouble(node_alpha->getValue(), "alpha");
855  if (node_beta != nullptr)
856  beta = parseDouble(node_beta->getValue(), "beta");
857  if (node_gamma != nullptr)
858  gamma = parseDouble(node_gamma->getValue(), "gamma");
859 
860  // standard Euler angles (how they're internally stored in the database)
861  align::EulerAngles eulerAngles(3);
862  eulerAngles(1) = alpha;
863  eulerAngles(2) = beta;
864  eulerAngles(3) = gamma;
865  rot = align::RotationType(align::toMatrix(eulerAngles));
866  }
867 
868  else
869  assert(false); // see above
870 
871  if (relativeto == 0) {
872  set_one_position(aliiter->first, pos, rot);
873  } // end relativeto="none"
874 
875  else if (relativeto == 1) {
876  Alignable *ali = aliiter->first;
877  Alignable *ideal = alitoideal[ali];
878 
879  const align::PositionType &idealPosition = ideal->globalPosition();
880  align::RotationType idealRotation = ideal->globalRotation();
881  align::PositionType newpos =
882  align::PositionType(idealRotation.transposed() * pos.basicVector() + idealPosition.basicVector());
883  align::RotationType newrot = rot * idealRotation;
884 
885  set_one_position(ali, newpos, newrot);
886  } // end relativeto="ideal"
887 
888  else if (relativeto == 2) {
889  Alignable *ali = aliiter->first;
890  Alignable *container = ali->mother();
891 
892  if (container != nullptr) {
893  const align::PositionType &globalPosition = container->globalPosition();
894  align::RotationType globalRotation = container->globalRotation();
895  align::PositionType newpos =
896  align::PositionType(globalRotation.transposed() * pos.basicVector() + globalPosition.basicVector());
897  align::RotationType newrot = rot * globalRotation;
898  set_one_position(ali, newpos, newrot);
899  } else {
900  set_one_position(ali, pos, rot);
901  }
902  } // end relativeto="container"
903 
904  } // end loop over alignables
905 }
906 
908  const align::PositionType &pos,
909  const align::RotationType &rot) const {
910  const align::PositionType &oldpos = ali->globalPosition();
911  const align::RotationType &oldrot = ali->globalRotation();
912 
913  // shift needed to move from current to new position
914  align::GlobalVector posDiff = pos - oldpos;
915  align::RotationType rotDiff = oldrot.multiplyInverse(rot);
916  align::rectify(rotDiff); // correct for rounding errors
917  ali->move(posDiff);
918  ali->rotateInGlobalFrame(rotDiff);
919 
920  // // check for consistency
921  // const align::PositionType& newpos = ali->globalPosition();
922  // const align::RotationType& newrot = ali->globalRotation();
923  // align::GlobalVector posDiff2 = pos - newpos;
924  // align::RotationType rotDiff2 = newrot.multiplyInverse(rot);
925  // align::rectify(rotDiff2); // correct for rounding errors
926 
927  // if (fabs(posDiff2.x()) > 1e-6 || fabs(posDiff2.y()) > 1e-6 || fabs(posDiff2.z()) > 1e-6) {
928  // std::cout << "zeropos " << posDiff2 << std::endl;
929  // }
930  // if (fabs(rotDiff2.xx() - 1.) > 1e-4 ||
931  // fabs(rotDiff2.yy() - 1.) > 1e-4 ||
932  // fabs(rotDiff2.zz() - 1.) > 1e-4 ||
933  // fabs(rotDiff2.xy()) > 1e-8 ||
934  // fabs(rotDiff2.xz()) > 1e-8 ||
935  // fabs(rotDiff2.yz()) > 1e-8) {
936  // std::cout << "zerorot " << rotDiff2 << std::endl;
937  // }
938 
939  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
940  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
941 
942  const SurveyDet *survey = ali->survey();
943  if (survey != nullptr) {
944  matrix6x6 = survey->errors(); // save the constraint information
945  }
946  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
947 }
948 
949 void MuonAlignmentInputXML::do_setape(const XERCES_CPP_NAMESPACE::DOMElement *node,
950  std::map<Alignable *, bool> &aliset,
951  std::map<Alignable *, Alignable *> &alitoideal) const {
952  DOMAttr *node_xx = node->getAttributeNode(str_xx);
953  DOMAttr *node_xy = node->getAttributeNode(str_xy);
954  DOMAttr *node_xz = node->getAttributeNode(str_xz);
955  DOMAttr *node_xa = node->getAttributeNode(str_xa);
956  DOMAttr *node_xb = node->getAttributeNode(str_xb);
957  DOMAttr *node_xc = node->getAttributeNode(str_xc);
958  DOMAttr *node_yy = node->getAttributeNode(str_yy);
959  DOMAttr *node_yz = node->getAttributeNode(str_yz);
960  DOMAttr *node_ya = node->getAttributeNode(str_ya);
961  DOMAttr *node_yb = node->getAttributeNode(str_yb);
962  DOMAttr *node_yc = node->getAttributeNode(str_yc);
963  DOMAttr *node_zz = node->getAttributeNode(str_zz);
964  DOMAttr *node_za = node->getAttributeNode(str_za);
965  DOMAttr *node_zb = node->getAttributeNode(str_zb);
966  DOMAttr *node_zc = node->getAttributeNode(str_zc);
967  DOMAttr *node_aa = node->getAttributeNode(str_aa);
968  DOMAttr *node_ab = node->getAttributeNode(str_ab);
969  DOMAttr *node_ac = node->getAttributeNode(str_ac);
970  DOMAttr *node_bb = node->getAttributeNode(str_bb);
971  DOMAttr *node_bc = node->getAttributeNode(str_bc);
972  DOMAttr *node_cc = node->getAttributeNode(str_cc);
973 
974  if (node_xx == nullptr)
975  throw cms::Exception("XMLException") << "<setape> is missing required \"xx\" attribute" << std::endl;
976  if (node_xy == nullptr)
977  throw cms::Exception("XMLException") << "<setape> is missing required \"xy\" attribute" << std::endl;
978  if (node_xz == nullptr)
979  throw cms::Exception("XMLException") << "<setape> is missing required \"xz\" attribute" << std::endl;
980  if (node_xa == nullptr)
981  throw cms::Exception("XMLException") << "<setape> is missing required \"xa\" attribute" << std::endl;
982  if (node_xb == nullptr)
983  throw cms::Exception("XMLException") << "<setape> is missing required \"xb\" attribute" << std::endl;
984  if (node_xc == nullptr)
985  throw cms::Exception("XMLException") << "<setape> is missing required \"xc\" attribute" << std::endl;
986  if (node_yy == nullptr)
987  throw cms::Exception("XMLException") << "<setape> is missing required \"yy\" attribute" << std::endl;
988  if (node_yz == nullptr)
989  throw cms::Exception("XMLException") << "<setape> is missing required \"yz\" attribute" << std::endl;
990  if (node_ya == nullptr)
991  throw cms::Exception("XMLException") << "<setape> is missing required \"ya\" attribute" << std::endl;
992  if (node_yb == nullptr)
993  throw cms::Exception("XMLException") << "<setape> is missing required \"yb\" attribute" << std::endl;
994  if (node_yc == nullptr)
995  throw cms::Exception("XMLException") << "<setape> is missing required \"yc\" attribute" << std::endl;
996  if (node_zz == nullptr)
997  throw cms::Exception("XMLException") << "<setape> is missing required \"zz\" attribute" << std::endl;
998  if (node_za == nullptr)
999  throw cms::Exception("XMLException") << "<setape> is missing required \"za\" attribute" << std::endl;
1000  if (node_zb == nullptr)
1001  throw cms::Exception("XMLException") << "<setape> is missing required \"zb\" attribute" << std::endl;
1002  if (node_zc == nullptr)
1003  throw cms::Exception("XMLException") << "<setape> is missing required \"zc\" attribute" << std::endl;
1004  if (node_aa == nullptr)
1005  throw cms::Exception("XMLException") << "<setape> is missing required \"aa\" attribute" << std::endl;
1006  if (node_ab == nullptr)
1007  throw cms::Exception("XMLException") << "<setape> is missing required \"ab\" attribute" << std::endl;
1008  if (node_ac == nullptr)
1009  throw cms::Exception("XMLException") << "<setape> is missing required \"ac\" attribute" << std::endl;
1010  if (node_bb == nullptr)
1011  throw cms::Exception("XMLException") << "<setape> is missing required \"bb\" attribute" << std::endl;
1012  if (node_bc == nullptr)
1013  throw cms::Exception("XMLException") << "<setape> is missing required \"bc\" attribute" << std::endl;
1014  if (node_cc == nullptr)
1015  throw cms::Exception("XMLException") << "<setape> is missing required \"cc\" attribute" << std::endl;
1016 
1017  align::ErrorMatrix matrix6x6;
1018  matrix6x6(0, 0) = parseDouble(node_xx->getValue(), "xx");
1019  matrix6x6(0, 1) = parseDouble(node_xy->getValue(), "xy");
1020  matrix6x6(0, 2) = parseDouble(node_xz->getValue(), "xz");
1021  matrix6x6(0, 3) = parseDouble(node_xa->getValue(), "xa");
1022  matrix6x6(0, 4) = parseDouble(node_xb->getValue(), "xb");
1023  matrix6x6(0, 5) = parseDouble(node_xc->getValue(), "xc");
1024  matrix6x6(1, 1) = parseDouble(node_yy->getValue(), "yy");
1025  matrix6x6(1, 2) = parseDouble(node_yz->getValue(), "yz");
1026  matrix6x6(1, 3) = parseDouble(node_ya->getValue(), "ya");
1027  matrix6x6(1, 4) = parseDouble(node_yb->getValue(), "yb");
1028  matrix6x6(1, 5) = parseDouble(node_yc->getValue(), "yc");
1029  matrix6x6(2, 2) = parseDouble(node_zz->getValue(), "zz");
1030  matrix6x6(2, 3) = parseDouble(node_za->getValue(), "za");
1031  matrix6x6(2, 4) = parseDouble(node_zb->getValue(), "zb");
1032  matrix6x6(2, 5) = parseDouble(node_zc->getValue(), "zc");
1033  matrix6x6(3, 3) = parseDouble(node_aa->getValue(), "aa");
1034  matrix6x6(3, 4) = parseDouble(node_ab->getValue(), "ab");
1035  matrix6x6(3, 5) = parseDouble(node_ac->getValue(), "ac");
1036  matrix6x6(4, 4) = parseDouble(node_bb->getValue(), "bb");
1037  matrix6x6(4, 5) = parseDouble(node_bc->getValue(), "bc");
1038  matrix6x6(5, 5) = parseDouble(node_cc->getValue(), "cc");
1039 
1040  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1041  // this sets APEs at this level and (since 2nd argument is true) all lower levels
1042  aliiter->first->setAlignmentPositionError(AlignmentPositionError(matrix6x6), true);
1043  }
1044 }
1045 
1046 void MuonAlignmentInputXML::do_setsurveyerr(const XERCES_CPP_NAMESPACE::DOMElement *node,
1047  std::map<Alignable *, bool> &aliset,
1048  std::map<Alignable *, Alignable *> &alitoideal) const {
1049  DOMAttr *node_xx = node->getAttributeNode(str_xx);
1050  DOMAttr *node_xy = node->getAttributeNode(str_xy);
1051  DOMAttr *node_xz = node->getAttributeNode(str_xz);
1052  DOMAttr *node_xa = node->getAttributeNode(str_xa);
1053  DOMAttr *node_xb = node->getAttributeNode(str_xb);
1054  DOMAttr *node_xc = node->getAttributeNode(str_xc);
1055  DOMAttr *node_yy = node->getAttributeNode(str_yy);
1056  DOMAttr *node_yz = node->getAttributeNode(str_yz);
1057  DOMAttr *node_ya = node->getAttributeNode(str_ya);
1058  DOMAttr *node_yb = node->getAttributeNode(str_yb);
1059  DOMAttr *node_yc = node->getAttributeNode(str_yc);
1060  DOMAttr *node_zz = node->getAttributeNode(str_zz);
1061  DOMAttr *node_za = node->getAttributeNode(str_za);
1062  DOMAttr *node_zb = node->getAttributeNode(str_zb);
1063  DOMAttr *node_zc = node->getAttributeNode(str_zc);
1064  DOMAttr *node_aa = node->getAttributeNode(str_aa);
1065  DOMAttr *node_ab = node->getAttributeNode(str_ab);
1066  DOMAttr *node_ac = node->getAttributeNode(str_ac);
1067  DOMAttr *node_bb = node->getAttributeNode(str_bb);
1068  DOMAttr *node_bc = node->getAttributeNode(str_bc);
1069  DOMAttr *node_cc = node->getAttributeNode(str_cc);
1070 
1071  if (node_xx == nullptr)
1072  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
1073  if (node_xy == nullptr)
1074  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
1075  if (node_xz == nullptr)
1076  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
1077  if (node_xa == nullptr)
1078  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
1079  if (node_xb == nullptr)
1080  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
1081  if (node_xc == nullptr)
1082  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
1083  if (node_yy == nullptr)
1084  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
1085  if (node_yz == nullptr)
1086  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
1087  if (node_ya == nullptr)
1088  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
1089  if (node_yb == nullptr)
1090  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
1091  if (node_yc == nullptr)
1092  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
1093  if (node_zz == nullptr)
1094  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
1095  if (node_za == nullptr)
1096  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"za\" attribute" << std::endl;
1097  if (node_zb == nullptr)
1098  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
1099  if (node_zc == nullptr)
1100  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
1101  if (node_aa == nullptr)
1102  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
1103  if (node_ab == nullptr)
1104  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
1105  if (node_ac == nullptr)
1106  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
1107  if (node_bb == nullptr)
1108  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
1109  if (node_bc == nullptr)
1110  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
1111  if (node_cc == nullptr)
1112  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
1113 
1114  align::ErrorMatrix matrix6x6;
1115  matrix6x6(0, 0) = parseDouble(node_xx->getValue(), "xx");
1116  matrix6x6(0, 1) = parseDouble(node_xy->getValue(), "xy");
1117  matrix6x6(0, 2) = parseDouble(node_xz->getValue(), "xz");
1118  matrix6x6(0, 3) = parseDouble(node_xa->getValue(), "xa");
1119  matrix6x6(0, 4) = parseDouble(node_xb->getValue(), "xb");
1120  matrix6x6(0, 5) = parseDouble(node_xc->getValue(), "xc");
1121  matrix6x6(1, 1) = parseDouble(node_yy->getValue(), "yy");
1122  matrix6x6(1, 2) = parseDouble(node_yz->getValue(), "yz");
1123  matrix6x6(1, 3) = parseDouble(node_ya->getValue(), "ya");
1124  matrix6x6(1, 4) = parseDouble(node_yb->getValue(), "yb");
1125  matrix6x6(1, 5) = parseDouble(node_yc->getValue(), "yc");
1126  matrix6x6(2, 2) = parseDouble(node_zz->getValue(), "zz");
1127  matrix6x6(2, 3) = parseDouble(node_za->getValue(), "za");
1128  matrix6x6(2, 4) = parseDouble(node_zb->getValue(), "zb");
1129  matrix6x6(2, 5) = parseDouble(node_zc->getValue(), "zc");
1130  matrix6x6(3, 3) = parseDouble(node_aa->getValue(), "aa");
1131  matrix6x6(3, 4) = parseDouble(node_ab->getValue(), "ab");
1132  matrix6x6(3, 5) = parseDouble(node_ac->getValue(), "ac");
1133  matrix6x6(4, 4) = parseDouble(node_bb->getValue(), "bb");
1134  matrix6x6(4, 5) = parseDouble(node_bc->getValue(), "bc");
1135  matrix6x6(5, 5) = parseDouble(node_cc->getValue(), "cc");
1136 
1137  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1138  Alignable *ali = aliiter->first;
1139  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1140  }
1141 }
1142 
1143 void MuonAlignmentInputXML::do_moveglobal(const XERCES_CPP_NAMESPACE::DOMElement *node,
1144  std::map<Alignable *, bool> &aliset,
1145  std::map<Alignable *, Alignable *> &alitoideal) const {
1146  DOMAttr *node_x = node->getAttributeNode(str_x);
1147  DOMAttr *node_y = node->getAttributeNode(str_y);
1148  DOMAttr *node_z = node->getAttributeNode(str_z);
1149  if (node_x == nullptr)
1150  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"x\" attribute" << std::endl;
1151  if (node_y == nullptr)
1152  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"y\" attribute" << std::endl;
1153  if (node_z == nullptr)
1154  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"z\" attribute" << std::endl;
1155 
1156  double x = parseDouble(node_x->getValue(), "x");
1157  double y = parseDouble(node_y->getValue(), "y");
1158  double z = parseDouble(node_z->getValue(), "z");
1159  align::GlobalVector vect(x, y, z);
1160 
1161  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1162  Alignable *ali = aliiter->first;
1163 
1164  ali->move(vect);
1165 
1166  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1167  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1168 
1169  const SurveyDet *survey = ali->survey();
1170  if (survey != nullptr) {
1171  matrix6x6 = survey->errors(); // save the constraint information
1172  }
1173  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1174  } // end loop over alignables
1175 }
1176 
1177 void MuonAlignmentInputXML::do_movelocal(const XERCES_CPP_NAMESPACE::DOMElement *node,
1178  std::map<Alignable *, bool> &aliset,
1179  std::map<Alignable *, Alignable *> &alitoideal) const {
1180  DOMAttr *node_x = node->getAttributeNode(str_x);
1181  DOMAttr *node_y = node->getAttributeNode(str_y);
1182  DOMAttr *node_z = node->getAttributeNode(str_z);
1183  if (node_x == nullptr)
1184  throw cms::Exception("XMLException") << "<movelocal> is missing required \"x\" attribute" << std::endl;
1185  if (node_y == nullptr)
1186  throw cms::Exception("XMLException") << "<movelocal> is missing required \"y\" attribute" << std::endl;
1187  if (node_z == nullptr)
1188  throw cms::Exception("XMLException") << "<movelocal> is missing required \"z\" attribute" << std::endl;
1189 
1190  double x = parseDouble(node_x->getValue(), "x");
1191  double y = parseDouble(node_y->getValue(), "y");
1192  double z = parseDouble(node_z->getValue(), "z");
1193  align::LocalVector vect(x, y, z);
1194 
1195  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1196  Alignable *ali = aliiter->first;
1197 
1198  align::GlobalVector globalVector = ali->surface().toGlobal(vect);
1199  ali->move(globalVector);
1200 
1201  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1202  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1203 
1204  const SurveyDet *survey = ali->survey();
1205  if (survey != nullptr) {
1206  matrix6x6 = survey->errors(); // save the constraint information
1207  }
1208  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1209  } // end loop over alignables
1210 }
1211 
1212 void MuonAlignmentInputXML::do_rotatelocal(const XERCES_CPP_NAMESPACE::DOMElement *node,
1213  std::map<Alignable *, bool> &aliset,
1214  std::map<Alignable *, Alignable *> &alitoideal) const {
1215  DOMAttr *node_axisx = node->getAttributeNode(str_axisx);
1216  DOMAttr *node_axisy = node->getAttributeNode(str_axisy);
1217  DOMAttr *node_axisz = node->getAttributeNode(str_axisz);
1218  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1219  if (node_axisx == nullptr)
1220  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1221  if (node_axisy == nullptr)
1222  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1223  if (node_axisz == nullptr)
1224  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1225  if (node_angle == nullptr)
1226  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1227 
1228  double x = parseDouble(node_axisx->getValue(), "x");
1229  double y = parseDouble(node_axisy->getValue(), "y");
1230  double z = parseDouble(node_axisz->getValue(), "z");
1231  double angle = parseDouble(node_angle->getValue(), "angle");
1232  align::LocalVector vect(x, y, z);
1233 
1234  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1235  Alignable *ali = aliiter->first;
1236 
1237  ali->rotateAroundLocalAxis(vect, angle);
1238 
1239  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1240  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1241 
1242  const SurveyDet *survey = ali->survey();
1243  if (survey != nullptr) {
1244  matrix6x6 = survey->errors(); // save the constraint information
1245  }
1246  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1247  } // end loop over alignables
1248 }
1249 
1250 void MuonAlignmentInputXML::do_rotatebeamline(const XERCES_CPP_NAMESPACE::DOMElement *node,
1251  std::map<Alignable *, bool> &aliset,
1252  std::map<Alignable *, Alignable *> &alitoideal) const {
1253  DOMAttr *node_rphi = node->getAttributeNode(str_rphi);
1254  DOMAttr *node_phi = node->getAttributeNode(str_phi);
1255  if (node_rphi == nullptr && node_phi == nullptr)
1256  throw cms::Exception("XMLException") << "<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1257  if (node_rphi != nullptr && node_phi != nullptr)
1258  throw cms::Exception("XMLException") << "<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute"
1259  << std::endl;
1260 
1261  double value;
1262  if (node_rphi != nullptr) {
1263  value = parseDouble(node_rphi->getValue(), "rphi");
1264  } else {
1265  value = parseDouble(node_phi->getValue(), "phi");
1266  }
1267 
1268  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1269  Alignable *ali = aliiter->first;
1270 
1272 
1273  double radius = pos.perp();
1274  double phi0 = pos.phi();
1275  double deltaphi = value;
1276  if (node_rphi != nullptr)
1277  deltaphi = value / radius;
1278 
1279  ali->rotateAroundGlobalZ(deltaphi);
1281  radius * (cos(phi0 + deltaphi) - cos(phi0)), radius * (sin(phi0 + deltaphi) - sin(phi0)), 0.));
1282 
1283  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1284  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1285 
1286  const SurveyDet *survey = ali->survey();
1287  if (survey != nullptr) {
1288  matrix6x6 = survey->errors(); // save the constraint information
1289  }
1290  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1291  } // end loop over alignables
1292 }
1293 
1294 void MuonAlignmentInputXML::do_rotateglobalaxis(const XERCES_CPP_NAMESPACE::DOMElement *node,
1295  std::map<Alignable *, bool> &aliset,
1296  std::map<Alignable *, Alignable *> &alitoideal) const {
1297  DOMAttr *node_x = node->getAttributeNode(str_x);
1298  DOMAttr *node_y = node->getAttributeNode(str_y);
1299  DOMAttr *node_z = node->getAttributeNode(str_z);
1300  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1301  if (node_x == nullptr)
1302  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1303  if (node_y == nullptr)
1304  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1305  if (node_z == nullptr)
1306  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1307  if (node_angle == nullptr)
1308  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
1309 
1310  double x = parseDouble(node_x->getValue(), "x");
1311  double y = parseDouble(node_y->getValue(), "y");
1312  double z = parseDouble(node_z->getValue(), "z");
1313  double angle = parseDouble(node_angle->getValue(), "angle");
1314 
1315  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1316  Alignable *ali = aliiter->first;
1318 
1320 
1321  double aprime = x / sqrt(x * x + y * y + z * z);
1322  double bprime = y / sqrt(x * x + y * y + z * z);
1323  double cprime = z / sqrt(x * x + y * y + z * z);
1324  double q0 = cos(angle / 2.);
1325  double q1 = sin(angle / 2.) * aprime;
1326  double q2 = sin(angle / 2.) * bprime;
1327  double q3 = sin(angle / 2.) * cprime;
1328 
1329  double pos2x = (q0 * q0 + q1 * q1 - q2 * q2 - q3 * q3) * pos.x() + 2. * (q1 * q2 - q0 * q3) * pos.y() +
1330  2. * (q1 * q3 + q0 * q2) * pos.z();
1331  double pos2y = 2. * (q2 * q1 + q0 * q3) * pos.x() + (q0 * q0 - q1 * q1 + q2 * q2 - q3 * q3) * pos.y() +
1332  2. * (q2 * q3 - q0 * q1) * pos.z();
1333  double pos2z = 2. * (q3 * q1 - q0 * q2) * pos.x() + 2. * (q3 * q2 + q0 * q1) * pos.y() +
1334  (q0 * q0 - q1 * q1 - q2 * q2 + q3 * q3) * pos.z();
1335 
1336  double movex = pos2x - pos.x();
1337  double movey = pos2y - pos.y();
1338  double movez = pos2z - pos.z();
1339  ali->move(align::GlobalVector(movex, movey, movez));
1340 
1341  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1342  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1343 
1344  const SurveyDet *survey = ali->survey();
1345  if (survey != nullptr) {
1346  matrix6x6 = survey->errors(); // save the constraint information
1347  }
1348  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1349  } // end loop over alignables
1350 }
1351 
1352 //
1353 // const member functions
1354 //
1355 
1356 //
1357 // static member functions
1358 //
Vector3DBase< Scalar, GlobalTag >
MuonAlignmentInputXML::str_ab
XMLCh * str_ab
Definition: MuonAlignmentInputXML.h:164
align::toAngles
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
TkRotation< Scalar >
AlignableObjectId
Allows conversion between type and name, and vice-versa.
Definition: AlignableObjectId.h:13
MuonAlignmentInputXML::str_setsurveyerr
XMLCh * str_setsurveyerr
Definition: MuonAlignmentInputXML.h:117
DDAxes::y
MuonAlignmentInputXML::str_CSCRing
XMLCh * str_CSCRing
Definition: MuonAlignmentInputXML.h:112
mps_fire.i
i
Definition: mps_fire.py:428
MuonAlignmentInputXML::str_DTChamber
XMLCh * str_DTChamber
Definition: MuonAlignmentInputXML.h:107
align::RotationType
TkRotation< Scalar > RotationType
Definition: Definitions.h:27
MuonAlignmentInputXML::getNode
Alignable * getNode(std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const
Definition: MuonAlignmentInputXML.cc:451
ESHandle.h
boostedTaus_cff.doc
doc
Definition: boostedTaus_cff.py:20
StructureType.h
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MuonAlignmentInputXML::str_superlayer
XMLCh * str_superlayer
Definition: MuonAlignmentInputXML.h:128
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
DTLayerId.h
SurveyDet::errors
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
HLT_FULL_cff.beta
beta
Definition: HLT_FULL_cff.py:8651
relativeConstraints.station
station
Definition: relativeConstraints.py:67
Alignable::rotateInGlobalFrame
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
class-composition.children
children
Definition: class-composition.py:98
MuonAlignmentInputXML::str_moveglobal
XMLCh * str_moveglobal
Definition: MuonAlignmentInputXML.h:118
MuonAlignmentInputXML::str_movelocal
XMLCh * str_movelocal
Definition: MuonAlignmentInputXML.h:119
MuonAlignmentInputXML::str_axisx
XMLCh * str_axisx
Definition: MuonAlignmentInputXML.h:133
MuonAlignmentInputXML::str_setape
XMLCh * str_setape
Definition: MuonAlignmentInputXML.h:116
MuonAlignmentInputXML::str_phix
XMLCh * str_phix
Definition: MuonAlignmentInputXML.h:140
Alignable
Definition: Alignable.h:27
MuonAlignmentInputXML::str_DTSuperLayer
XMLCh * str_DTSuperLayer
Definition: MuonAlignmentInputXML.h:108
pos
Definition: PixelAliasList.h:18
MuonAlignmentInputXML::str_endcap
XMLCh * str_endcap
Definition: MuonAlignmentInputXML.h:130
MuonAlignmentInputXML::recursiveGetId
void recursiveGetId(std::map< unsigned int, Alignable * > &alignableNavigator, const align::Alignables &alignables) const
Definition: MuonAlignmentInputXML.cc:220
MuonAlignmentInputXML::str_rotatelocal
XMLCh * str_rotatelocal
Definition: MuonAlignmentInputXML.h:120
align::PositionType
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:28
Alignable::rotateAroundLocalAxis
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:143
MuonAlignmentInputXML::str_phiy
XMLCh * str_phiy
Definition: MuonAlignmentInputXML.h:141
cms::cuda::assert
assert(be >=bs)
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
MuonAlignmentInputXML::getDTnode
Alignable * getDTnode(align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const
Definition: MuonAlignmentInputXML.cc:480
MuonAlignmentInputXML::str_station
XMLCh * str_station
Definition: MuonAlignmentInputXML.h:126
MuonAlignmentInputXML::str_rphi
XMLCh * str_rphi
Definition: MuonAlignmentInputXML.h:146
MuonAlignmentInputXML::str_xb
XMLCh * str_xb
Definition: MuonAlignmentInputXML.h:152
MuonAlignmentInputXML::str_alpha
XMLCh * str_alpha
Definition: MuonAlignmentInputXML.h:143
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
align::ErrorMatrix
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
alpha
float alpha
Definition: AMPTWrapper.h:105
MuonAlignmentInputXML::do_moveglobal
void do_moveglobal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:1143
MuonAlignmentInputXML::str_DTLayer
XMLCh * str_DTLayer
Definition: MuonAlignmentInputXML.h:109
MuonAlignmentInputXML::str_bb
XMLCh * str_bb
Definition: MuonAlignmentInputXML.h:166
XERCES_CPP_NAMESPACE_USE
Definition: XMLConfigWriter.cc:40
align::AlignableCSCStation
Definition: StructureType.h:80
MuonAlignmentInputXML::str_name
XMLCh * str_name
Definition: MuonAlignmentInputXML.h:103
DDAxes::x
reco::HaloData::minus
Definition: HaloData.h:14
TkRotation::multiplyInverse
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const
Definition: extTkRotation.h:178
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
MuonAlignmentInputXML::str_layer
XMLCh * str_layer
Definition: MuonAlignmentInputXML.h:129
align::AlignableDTChamber
Definition: StructureType.h:76
MuonAlignmentInputXML::str_CSCStation
XMLCh * str_CSCStation
Definition: MuonAlignmentInputXML.h:111
Alignable::rotateAroundGlobalZ
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:176
MuonAlignmentInputXML::str_yy
XMLCh * str_yy
Definition: MuonAlignmentInputXML.h:154
MuonAlignmentInputXML::str_yz
XMLCh * str_yz
Definition: MuonAlignmentInputXML.h:155
CSCDetId.h
MuonAlignmentInputXML::parseDouble
double parseDouble(const XMLCh *str, const char *attribute) const
Definition: MuonAlignmentInputXML.cc:665
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
MuonAlignmentInputXML::~MuonAlignmentInputXML
~MuonAlignmentInputXML() override
Definition: MuonAlignmentInputXML.cc:129
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
SurveyDet
Definition: SurveyDet.h:15
align::AlignableMuon
Definition: StructureType.h:90
MuonAlignmentInputXML::str_CSCEndcap
XMLCh * str_CSCEndcap
Definition: MuonAlignmentInputXML.h:110
MuonAlignmentInputXML::str_axisy
XMLCh * str_axisy
Definition: MuonAlignmentInputXML.h:134
MuonAlignmentInputXML::do_movelocal
void do_movelocal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:1177
MuonAlignmentInputXML::do_rotatebeamline
void do_rotatebeamline(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:1250
Alignable::setSurvey
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
MuonAlignmentInputXML::MuonAlignmentInputXML
MuonAlignmentInputXML(const std::string &fileName, std::string idealLabel)
Definition: MuonAlignmentInputXML.cc:48
MuonAlignmentInputXML::str_xy
XMLCh * str_xy
Definition: MuonAlignmentInputXML.h:149
align::AlignableCSCLayer
Definition: StructureType.h:83
MuonAlignmentInputXML::idealGeometryLabel
std::string idealGeometryLabel
Definition: MuonAlignmentInputXML.h:99
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MuonAlignmentInputXML::do_setsurveyerr
void do_setsurveyerr(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:1046
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
align::AlignableDTSuperLayer
Definition: StructureType.h:77
MuonAlignmentInputXML::str_angle
XMLCh * str_angle
Definition: MuonAlignmentInputXML.h:136
align::AlignableCSCEndcap
Definition: StructureType.h:79
MuonAlignmentInputXML::str_CSCLayer
XMLCh * str_CSCLayer
Definition: MuonAlignmentInputXML.h:114
MuonAlignmentInputXML::str_collection
XMLCh * str_collection
Definition: MuonAlignmentInputXML.h:102
MuonAlignmentInputXML::str_xz
XMLCh * str_xz
Definition: MuonAlignmentInputXML.h:150
MuonAlignmentInputXML::str_ac
XMLCh * str_ac
Definition: MuonAlignmentInputXML.h:165
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
TkRotation::xz
T xz() const
Definition: extTkRotation.h:253
MuonAlignmentInputXML::str_yc
XMLCh * str_yc
Definition: MuonAlignmentInputXML.h:158
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
equals
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
Definition: DeepCMVATagInfoProducer.cc:56
MuonAlignmentInputXML::m_fileName
std::string m_fileName
Definition: MuonAlignmentInputXML.h:99
DDAxes::z
HLT_FULL_cff.exponent
exponent
Definition: HLT_FULL_cff.py:52824
str
#define str(s)
Definition: TestProcessor.cc:53
edm::ESHandle< DTGeometry >
MuonAlignmentInputXML::str_zb
XMLCh * str_zb
Definition: MuonAlignmentInputXML.h:161
MuonAlignmentInputXML::str_operation
XMLCh * str_operation
Definition: MuonAlignmentInputXML.h:101
align::rectify
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:185
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
MuonAlignmentInputXML::str_phiz
XMLCh * str_phiz
Definition: MuonAlignmentInputXML.h:142
MuonAlignmentInputXML::str_xc
XMLCh * str_xc
Definition: MuonAlignmentInputXML.h:153
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Point3DBase< Scalar, GlobalTag >
AlignableMuon::DTBarrel
align::Alignables DTBarrel()
Definition: AlignableMuon.cc:396
q2
double q2[4]
Definition: TauolaWrapper.h:88
DTLayerId
Definition: DTLayerId.h:12
MuonAlignmentInputXML::str_rotateglobalaxis
XMLCh * str_rotateglobalaxis
Definition: MuonAlignmentInputXML.h:122
AlignableMuon::objectIdProvider
const AlignableObjectId & objectIdProvider() const
Return muon alignable object ID provider derived from the muon system geometry.
Definition: AlignableMuon.h:92
MuonAlignmentInputXML::getCSCnode
Alignable * getCSCnode(align::StructureType structureType, std::map< unsigned int, Alignable * > &alignableNavigator, const XERCES_CPP_NAMESPACE::DOMElement *node, const AlignableObjectId &) const
Definition: MuonAlignmentInputXML.cc:573
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
oniaPATMuonsWithTrigger_cff.collections
collections
Definition: oniaPATMuonsWithTrigger_cff.py:37
align::StructureType
StructureType
Definition: StructureType.h:16
MuonAlignmentInputXML::str_relativeto
XMLCh * str_relativeto
Definition: MuonAlignmentInputXML.h:123
MuonAlignmentInputXML::str_none
XMLCh * str_none
Definition: MuonAlignmentInputXML.h:169
MuonAlignmentInputXML::str_DTStation
XMLCh * str_DTStation
Definition: MuonAlignmentInputXML.h:106
align::AlignableDetUnit
Definition: StructureType.h:19
align::AlignableDTStation
Definition: StructureType.h:75
q1
double q1[4]
Definition: TauolaWrapper.h:87
MuonAlignmentInputXML::str_CSCChamber
XMLCh * str_CSCChamber
Definition: MuonAlignmentInputXML.h:113
TkRotation::xx
T xx() const
Definition: extTkRotation.h:251
MuonAlignmentInputXML::do_setposition
void do_setposition(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:744
MuonAlignmentInputXML::str_y
XMLCh * str_y
Definition: MuonAlignmentInputXML.h:138
Alignable::rotateAroundGlobalAxis
virtual void rotateAroundGlobalAxis(const GlobalVector &axis, Scalar radians)
Rotation around arbitratry global axis.
Definition: Alignable.cc:138
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
MuonAlignmentInputXML::str_rotatebeamline
XMLCh * str_rotatebeamline
Definition: MuonAlignmentInputXML.h:121
CSCDetId
Definition: CSCDetId.h:26
MuonAlignmentInputXML::str_phi
XMLCh * str_phi
Definition: MuonAlignmentInputXML.h:147
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
Xerces.h
MuonAlignmentInputXML::do_setape
void do_setape(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:949
MuonAlignmentInputXML::str_xx
XMLCh * str_xx
Definition: MuonAlignmentInputXML.h:148
MuonAlignmentInputXML::fillAliToIdeal
void fillAliToIdeal(std::map< Alignable *, Alignable * > &alitoideal, const align::Alignables &alignables, const align::Alignables &ideals) const
Definition: MuonAlignmentInputXML.cc:235
cms::concurrency::xercesTerminate
void xercesTerminate()
Definition: Xerces.cc:23
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
MuonAlignmentInputXML::str_za
XMLCh * str_za
Definition: MuonAlignmentInputXML.h:160
value
Definition: value.py:1
MuonAlignmentInputXML::str_zc
XMLCh * str_zc
Definition: MuonAlignmentInputXML.h:162
TkRotation::xy
T xy() const
Definition: extTkRotation.h:252
MuonAlignmentInputXML::str_wheel
XMLCh * str_wheel
Definition: MuonAlignmentInputXML.h:125
align::AlignableCSCChamber
Definition: StructureType.h:82
MuonAlignmentInputXML::str_bc
XMLCh * str_bc
Definition: MuonAlignmentInputXML.h:167
edm::EventSetup
Definition: EventSetup.h:58
TkRotation::zz
T zz() const
Definition: extTkRotation.h:259
MuonAlignmentInputXML::newAlignableMuon
AlignableMuon * newAlignableMuon(const edm::EventSetup &iSetup) const override
Definition: MuonAlignmentInputXML.cc:256
get
#define get
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonAlignmentInputXML::do_rotatelocal
void do_rotatelocal(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:1212
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
MuonAlignmentInputXML::str_gamma
XMLCh * str_gamma
Definition: MuonAlignmentInputXML.h:145
MuonAlignmentInputXML::str_container
XMLCh * str_container
Definition: MuonAlignmentInputXML.h:171
align::AlignableDTBarrel
Definition: StructureType.h:73
TkRotation::yz
T yz() const
Definition: extTkRotation.h:256
AlignableObjectId.h
align::AlignableDet
Definition: StructureType.h:20
align::AlignableDTWheel
Definition: StructureType.h:74
MuonAlignmentInputXML::str_zz
XMLCh * str_zz
Definition: MuonAlignmentInputXML.h:159
MuonAlignmentInputXML.h
MuonAlignmentInputXML::str_z
XMLCh * str_z
Definition: MuonAlignmentInputXML.h:139
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableMuon::CSCEndcaps
align::Alignables CSCEndcaps()
Definition: AlignableMuon.cc:439
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MuonAlignmentInputXML::str_xa
XMLCh * str_xa
Definition: MuonAlignmentInputXML.h:151
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
MuonAlignmentInputXML::str_ya
XMLCh * str_ya
Definition: MuonAlignmentInputXML.h:156
convertToXML_global_cfg.relativeto
relativeto
Definition: convertToXML_global_cfg.py:8
MuonAlignmentInputXML::str_aa
XMLCh * str_aa
Definition: MuonAlignmentInputXML.h:163
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
AlignmentPositionError.h
align::AlignableDTLayer
Definition: StructureType.h:78
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
MuonAlignmentInputXML::do_rotateglobalaxis
void do_rotateglobalaxis(const XERCES_CPP_NAMESPACE::DOMElement *node, std::map< Alignable *, bool > &aliset, std::map< Alignable *, Alignable * > &alitoideal) const
Definition: MuonAlignmentInputXML.cc:1294
MuonAlignmentInputXML::str_beta
XMLCh * str_beta
Definition: MuonAlignmentInputXML.h:144
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
align::toMatrix
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
TkRotation::transposed
TkRotation transposed() const
Definition: extTkRotation.h:161
gemGeometry_cff.gemGeometry
gemGeometry
Definition: gemGeometry_cff.py:5
AlignableObjectId::idToString
const char * idToString(align::StructureType type) const
Definition: AlignableObjectId.cc:273
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
MuonAlignmentInputXML::set_one_position
void set_one_position(Alignable *ali, const align::PositionType &pos, const align::RotationType &rot) const
Definition: MuonAlignmentInputXML.cc:907
MuonAlignmentInputXML::str_ring
XMLCh * str_ring
Definition: MuonAlignmentInputXML.h:131
MuonAlignmentInputXML::str_sector
XMLCh * str_sector
Definition: MuonAlignmentInputXML.h:127
MuonAlignmentInputXML::str_cc
XMLCh * str_cc
Definition: MuonAlignmentInputXML.h:168
SurveyDet.h
MuonGeometryRecord.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
align::AlignableCSCRing
Definition: StructureType.h:81
MuonAlignmentInputXML::str_DTBarrel
XMLCh * str_DTBarrel
Definition: MuonAlignmentInputXML.h:104
AlignmentPositionError
Definition: AlignmentPositionError.h:10
MuonAlignmentInputXML::str_axisz
XMLCh * str_axisz
Definition: MuonAlignmentInputXML.h:135
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18
MuonAlignmentInputXML::str_ideal
XMLCh * str_ideal
Definition: MuonAlignmentInputXML.h:170
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
MuonAlignmentInputXML::str_rawId
XMLCh * str_rawId
Definition: MuonAlignmentInputXML.h:124
Alignable::survey
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
MuonAlignmentInputXML::str_chamber
XMLCh * str_chamber
Definition: MuonAlignmentInputXML.h:132
MuonAlignmentInputXML::str_x
XMLCh * str_x
Definition: MuonAlignmentInputXML.h:137
MuonAlignmentInputXML::str_DTWheel
XMLCh * str_DTWheel
Definition: MuonAlignmentInputXML.h:105
MuonAlignmentInputXML::str_setposition
XMLCh * str_setposition
Definition: MuonAlignmentInputXML.h:115
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
SiStripMonitorCluster_cfi.q0
q0
Definition: SiStripMonitorCluster_cfi.py:241
MuonAlignmentInputXML::str_yb
XMLCh * str_yb
Definition: MuonAlignmentInputXML.h:157
Alignable::mother
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91