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;
259  iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, dtGeometry);
260  iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, cscGeometry);
261 
262  AlignableMuon *alignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
263  std::map<unsigned int, Alignable *> alignableNavigator; // real AlignableNavigators don't have const methods
264  recursiveGetId(alignableNavigator, alignableMuon->DTBarrel());
265  recursiveGetId(alignableNavigator, alignableMuon->CSCEndcaps());
266 
267  AlignableMuon *ideal_alignableMuon = new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
268  std::map<unsigned int, Alignable *> ideal_alignableNavigator; // real AlignableNavigators don't have const methods
269  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->DTBarrel());
270  recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());
271 
272  try {
274  } catch (const XMLException &toCatch) {
275  throw cms::Exception("XMLException") << "Xerces XML parser threw an exception on initialization." << std::endl;
276  }
277 
278  XercesDOMParser *parser = new XercesDOMParser();
279  parser->setValidationScheme(XercesDOMParser::Val_Always);
280 
281  XERCES_CPP_NAMESPACE::ErrorHandler *errHandler = (XERCES_CPP_NAMESPACE::ErrorHandler *)(new HandlerBase());
282  parser->setErrorHandler(errHandler);
283 
284  try {
285  parser->parse(m_fileName.c_str());
286  } catch (const XMLException &toCatch) {
287  char *message = XMLString::transcode(toCatch.getMessage());
288  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
289  } catch (const DOMException &toCatch) {
290  char *message = XMLString::transcode(toCatch.msg);
291  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
292  } catch (const SAXException &toCatch) {
293  char *message = XMLString::transcode(toCatch.getMessage());
294  throw cms::Exception("XMLException") << "Xerces XML parser threw this exception: " << message << std::endl;
295  }
296 
297  DOMDocument *doc = parser->getDocument();
298  DOMElement *node_MuonAlignment = doc->getDocumentElement();
299  DOMNodeList *collections = doc->getElementsByTagName(str_collection);
300  DOMNodeList *operations = doc->getElementsByTagName(str_operation);
301 
302  std::map<Alignable *, Alignable *> alitoideal;
303  fillAliToIdeal(alitoideal, alignableMuon->DTBarrel(), ideal_alignableMuon->DTBarrel());
304  fillAliToIdeal(alitoideal, alignableMuon->CSCEndcaps(), ideal_alignableMuon->CSCEndcaps());
305 
306  const auto &alignableObjectId = alignableMuon->objectIdProvider();
307  std::map<std::string, std::map<Alignable *, bool> > alicollections;
308  for (unsigned int i = 0; i < collections->getLength(); i++) {
309  DOMElement *collection = (DOMElement *)(collections->item(i));
310  if (collection->getParentNode() == node_MuonAlignment) {
311  DOMNodeList *children = collection->getChildNodes();
312 
313  DOMAttr *node_name = collection->getAttributeNode(str_name);
314  if (node_name == nullptr) {
315  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
316  }
317  char *ascii_name = XMLString::transcode(node_name->getValue());
318  std::string name(ascii_name);
319  XMLString::release(&ascii_name);
320 
321  std::map<Alignable *, bool> aliset;
322  for (unsigned int j = 0; j < children->getLength(); j++) {
323  DOMNode *node = children->item(j);
324 
325  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
326  Alignable *ali = getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
327  if (ali == nullptr) {
328  throw cms::Exception("XMLException") << "<collection> must contain only alignables" << std::endl;
329  }
330 
331  aliset[ali] = true;
332  } // end if this node is an element
333  } // end loop over collection's children
334 
335  alicollections[name] = aliset;
336  } // end if this is a top-level collection
337  } // end loop over collections
338 
339  for (unsigned int i = 0; i < operations->getLength(); i++) {
340  DOMElement *operation = (DOMElement *)(operations->item(i));
341  if (operation->getParentNode() != node_MuonAlignment) {
342  throw cms::Exception("XMLException") << "All operations must be top-level elements" << std::endl;
343  }
344 
345  DOMNodeList *children = operation->getChildNodes();
346 
347  std::map<Alignable *, bool> aliset;
348  std::vector<DOMNode *> nodesToRemove;
349  for (unsigned int j = 0; j < children->getLength(); j++) {
350  DOMNode *node = children->item(j);
351 
352  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
353  Alignable *ali = getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
354  if (ali != nullptr) {
355  aliset[ali] = true;
356  nodesToRemove.push_back(node);
357  } // end if this node is an alignable
358 
359  else if (XMLString::equals(node->getNodeName(), str_collection)) {
360  DOMAttr *node_name = ((DOMElement *)(node))->getAttributeNode(str_name);
361  if (node_name == nullptr) {
362  throw cms::Exception("XMLException") << "<collection> requires a name attribute" << std::endl;
363  }
364  char *ascii_name = XMLString::transcode(node_name->getValue());
365  std::string name(ascii_name);
366  XMLString::release(&ascii_name);
367 
368  std::map<std::string, std::map<Alignable *, bool> >::const_iterator alicollections_iter =
369  alicollections.find(name);
370  if (alicollections_iter == alicollections.end()) {
371  throw cms::Exception("XMLException")
372  << "<collection name=\"" << name << "\"> hasn't been defined" << std::endl;
373  }
374 
375  for (std::map<Alignable *, bool>::const_iterator aliiter = alicollections_iter->second.begin();
376  aliiter != alicollections_iter->second.end();
377  ++aliiter) {
378  aliset[aliiter->first] = true;
379  } // end loop over alignables in this collection
380 
381  nodesToRemove.push_back(node);
382  } // end if this node is a collection
383 
384  else {
385  } // anything else? assume it's a position/rotation directive
386 
387  } // end if node is node is an element
388  } // end first loop over operation's children
389 
390  // from now on, we only want to see position/rotation directives
391  for (std::vector<DOMNode *>::const_iterator node = nodesToRemove.begin(); node != nodesToRemove.end(); ++node) {
392  operation->removeChild(*node);
393  }
394  children = operation->getChildNodes();
395 
396  for (unsigned int j = 0; j < children->getLength(); j++) {
397  DOMNode *node = children->item(j);
398  if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
399  if (XMLString::equals(node->getNodeName(), str_setposition)) {
400  do_setposition((DOMElement *)(node), aliset, alitoideal);
401  }
402 
403  else if (XMLString::equals(node->getNodeName(), str_setape)) {
404  do_setape((DOMElement *)(node), aliset, alitoideal);
405  }
406 
407  else if (XMLString::equals(node->getNodeName(), str_setsurveyerr)) {
408  do_setsurveyerr((DOMElement *)(node), aliset, alitoideal);
409  }
410 
411  else if (XMLString::equals(node->getNodeName(), str_moveglobal)) {
412  do_moveglobal((DOMElement *)(node), aliset, alitoideal);
413  }
414 
415  else if (XMLString::equals(node->getNodeName(), str_movelocal)) {
416  do_movelocal((DOMElement *)(node), aliset, alitoideal);
417  }
418 
419  else if (XMLString::equals(node->getNodeName(), str_rotatelocal)) {
420  do_rotatelocal((DOMElement *)(node), aliset, alitoideal);
421  }
422 
423  else if (XMLString::equals(node->getNodeName(), str_rotatebeamline)) {
424  do_rotatebeamline((DOMElement *)(node), aliset, alitoideal);
425  }
426 
427  else if (XMLString::equals(node->getNodeName(), str_rotateglobalaxis)) {
428  do_rotateglobalaxis((DOMElement *)(node), aliset, alitoideal);
429  }
430 
431  else {
432  char *message = XMLString::transcode(node->getNodeName());
433  throw cms::Exception("XMLException") << "Unrecognized operation: \"" << message << "\"" << std::endl;
434  }
435 
436  } // end if node is an element
437  } // end second loop over operation's children
438  } // end loop over operations
439 
440  delete parser;
441  delete errHandler;
442 
444 
445  delete ideal_alignableMuon;
446  return alignableMuon;
447 }
448 
449 Alignable *MuonAlignmentInputXML::getNode(std::map<unsigned int, Alignable *> &alignableNavigator,
450  const XERCES_CPP_NAMESPACE::DOMElement *node,
451  const AlignableObjectId &alignableObjectId) const {
452  if (XMLString::equals(node->getNodeName(), str_DTBarrel))
453  return getDTnode(align::AlignableDTBarrel, alignableNavigator, node, alignableObjectId);
454  else if (XMLString::equals(node->getNodeName(), str_DTWheel))
455  return getDTnode(align::AlignableDTWheel, alignableNavigator, node, alignableObjectId);
456  else if (XMLString::equals(node->getNodeName(), str_DTStation))
457  return getDTnode(align::AlignableDTStation, alignableNavigator, node, alignableObjectId);
458  else if (XMLString::equals(node->getNodeName(), str_DTChamber))
459  return getDTnode(align::AlignableDTChamber, alignableNavigator, node, alignableObjectId);
460  else if (XMLString::equals(node->getNodeName(), str_DTSuperLayer))
461  return getDTnode(align::AlignableDTSuperLayer, alignableNavigator, node, alignableObjectId);
462  else if (XMLString::equals(node->getNodeName(), str_DTLayer))
463  return getDTnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
464  else if (XMLString::equals(node->getNodeName(), str_CSCEndcap))
465  return getCSCnode(align::AlignableCSCEndcap, alignableNavigator, node, alignableObjectId);
466  else if (XMLString::equals(node->getNodeName(), str_CSCStation))
467  return getCSCnode(align::AlignableCSCStation, alignableNavigator, node, alignableObjectId);
468  else if (XMLString::equals(node->getNodeName(), str_CSCRing))
469  return getCSCnode(align::AlignableCSCRing, alignableNavigator, node, alignableObjectId);
470  else if (XMLString::equals(node->getNodeName(), str_CSCChamber))
471  return getCSCnode(align::AlignableCSCChamber, alignableNavigator, node, alignableObjectId);
472  else if (XMLString::equals(node->getNodeName(), str_CSCLayer))
473  return getCSCnode(align::AlignableDetUnit, alignableNavigator, node, alignableObjectId);
474  else
475  return nullptr;
476 }
477 
479  std::map<unsigned int, Alignable *> &alignableNavigator,
480  const XERCES_CPP_NAMESPACE::DOMElement *node,
481  const AlignableObjectId &alignableObjectId) const {
482  unsigned int rawId = 0;
483 
484  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
485  if (node_rawId != nullptr) {
486  try {
487  rawId = XMLString::parseInt(node_rawId->getValue());
488  } catch (const XMLException &toCatch) {
489  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
490  }
491  } else {
492  int wheel, station, sector, superlayer, layer;
493  wheel = station = sector = superlayer = layer = 1;
494 
495  if (structureType != align::AlignableDTBarrel) {
496  DOMAttr *node_wheel = node->getAttributeNode(str_wheel);
497  if (node_wheel == nullptr)
498  throw cms::Exception("XMLException") << "DT node is missing required \"wheel\" attribute" << std::endl;
499  try {
500  wheel = XMLString::parseInt(node_wheel->getValue());
501  } catch (const XMLException &toCatch) {
502  throw cms::Exception("XMLException") << "Value of \"wheel\" must be an integer" << std::endl;
503  }
504 
505  if (structureType != align::AlignableDTWheel) {
506  DOMAttr *node_station = node->getAttributeNode(str_station);
507  if (node_station == nullptr)
508  throw cms::Exception("XMLException") << "DT node is missing required \"station\" attribute" << std::endl;
509  try {
510  station = XMLString::parseInt(node_station->getValue());
511  } catch (const XMLException &toCatch) {
512  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
513  }
514 
515  if (structureType != align::AlignableDTStation) {
516  DOMAttr *node_sector = node->getAttributeNode(str_sector);
517  if (node_sector == nullptr)
518  throw cms::Exception("XMLException") << "DT node is missing required \"sector\" attribute" << std::endl;
519  try {
520  sector = XMLString::parseInt(node_sector->getValue());
521  } catch (const XMLException &toCatch) {
522  throw cms::Exception("XMLException") << "Value of \"sector\" must be an integer" << std::endl;
523  }
524 
525  if (structureType != align::AlignableDTChamber) {
526  DOMAttr *node_superlayer = node->getAttributeNode(str_superlayer);
527  if (node_superlayer == nullptr)
528  throw cms::Exception("XMLException")
529  << "DT node is missing required \"superlayer\" attribute" << std::endl;
530  try {
531  superlayer = XMLString::parseInt(node_superlayer->getValue());
532  } catch (const XMLException &toCatch) {
533  throw cms::Exception("XMLException") << "Value of \"superlayer\" must be an integer" << std::endl;
534  }
535 
536  if (structureType != align::AlignableDTSuperLayer) {
537  DOMAttr *node_layer = node->getAttributeNode(str_layer);
538  if (node_layer == nullptr)
539  throw cms::Exception("XMLException") << "DT node is missing required \"layer\" attribute" << std::endl;
540  try {
541  layer = XMLString::parseInt(node_layer->getValue());
542  } catch (const XMLException &toCatch) {
543  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
544  }
545 
546  } // end if we need a layer number
547  } // end if we need a superlayer number
548  } // end if we need a sector number
549  } // end if we need a station number
550  } // end if we need a wheel number
551 
552  DTLayerId layerId(wheel, station, sector, superlayer, layer);
553  rawId = layerId.rawId();
554  } // end if it's specified by wheel, station, sector, superlayer, layer
555 
556  Alignable *ali = alignableNavigator[rawId];
557  if (ali == nullptr)
558  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
559 
560  while (ali->alignableObjectId() != structureType) {
561  ali = ali->mother();
562 
563  if (ali == nullptr) {
564  throw cms::Exception("XMLException")
565  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
566  }
567  }
568  return ali;
569 }
570 
572  std::map<unsigned int, Alignable *> &alignableNavigator,
573  const XERCES_CPP_NAMESPACE::DOMElement *node,
574  const AlignableObjectId &alignableObjectId) const {
575  unsigned int rawId;
576 
577  DOMAttr *node_rawId = node->getAttributeNode(str_rawId);
578  if (node_rawId != nullptr) {
579  try {
580  rawId = XMLString::parseInt(node_rawId->getValue());
581  } catch (const XMLException &toCatch) {
582  throw cms::Exception("XMLException") << "Value of \"rawId\" must be an integer" << std::endl;
583  }
584  } else {
585  int endcap, station, ring, chamber, layer;
586  endcap = station = ring = chamber = layer = 1;
587 
588  DOMAttr *node_endcap = node->getAttributeNode(str_endcap);
589  if (node_endcap == nullptr)
590  throw cms::Exception("XMLException") << "CSC node is missing required \"endcap\" attribute" << std::endl;
591  try {
592  endcap = XMLString::parseInt(node_endcap->getValue());
593  } catch (const XMLException &toCatch) {
594  throw cms::Exception("XMLException") << "Value of \"endcap\" must be an integer" << std::endl;
595  }
596  if (endcap == -1)
597  endcap = 2;
598 
599  if (structureType != align::AlignableCSCEndcap) {
600  DOMAttr *node_station = node->getAttributeNode(str_station);
601  if (node_station == nullptr)
602  throw cms::Exception("XMLException") << "CSC node is missing required \"station\" attribute" << std::endl;
603  try {
604  station = XMLString::parseInt(node_station->getValue());
605  } catch (const XMLException &toCatch) {
606  throw cms::Exception("XMLException") << "Value of \"station\" must be an integer" << std::endl;
607  }
608 
609  if (structureType != align::AlignableCSCStation) {
610  DOMAttr *node_ring = node->getAttributeNode(str_ring);
611  if (node_ring == nullptr)
612  throw cms::Exception("XMLException") << "CSC node is missing required \"ring\" attribute" << std::endl;
613  try {
614  ring = XMLString::parseInt(node_ring->getValue());
615  } catch (const XMLException &toCatch) {
616  throw cms::Exception("XMLException") << "Value of \"ring\" must be an integer" << std::endl;
617  }
618 
619  if (structureType != align::AlignableCSCRing) {
620  DOMAttr *node_chamber = node->getAttributeNode(str_chamber);
621  if (node_chamber == nullptr)
622  throw cms::Exception("XMLException") << "CSC node is missing required \"chamber\" attribute" << std::endl;
623  try {
624  chamber = XMLString::parseInt(node_chamber->getValue());
625  } catch (const XMLException &toCatch) {
626  throw cms::Exception("XMLException") << "Value of \"chamber\" must be an integer" << std::endl;
627  }
628 
629  if (structureType != align::AlignableCSCChamber) {
630  DOMAttr *node_layer = node->getAttributeNode(str_layer);
631  if (node_layer == nullptr)
632  throw cms::Exception("XMLException") << "CSC node is missing required \"layer\" attribute" << std::endl;
633  try {
634  layer = XMLString::parseInt(node_layer->getValue());
635  } catch (const XMLException &toCatch) {
636  throw cms::Exception("XMLException") << "Value of \"layer\" must be an integer" << std::endl;
637  }
638 
639  } // end if we need a layer number
640  } // end if we need a chamber number
641  } // end if we need a ring number
642  } // end if we need a station number
643 
644  CSCDetId layerId(endcap, station, ring, chamber, layer);
645  rawId = layerId.rawId();
646  } // end if it's specified by endcap, station, ring, chamber, layer
647 
648  Alignable *ali = alignableNavigator[rawId];
649  if (ali == nullptr)
650  throw cms::Exception("XMLException") << "rawId \"" << rawId << "\" is not recognized" << std::endl;
651 
652  while (ali->alignableObjectId() != structureType) {
653  ali = ali->mother();
654 
655  if (ali == nullptr) {
656  throw cms::Exception("XMLException")
657  << "rawId \"" << rawId << "\" is not a " << alignableObjectId.idToString(structureType) << std::endl;
658  }
659  }
660  return ali;
661 }
662 
663 double MuonAlignmentInputXML::parseDouble(const XMLCh *str, const char *attribute) const {
664  unsigned int len = XMLString::stringLen(str);
665  char *cstr = XMLString::transcode(str);
666  std::stringstream errmessage;
667  errmessage << "Value of \"" << attribute << "\" must be a double, not \"" << cstr << "\"" << std::endl;
668 
669  unsigned int i = 0;
670 
671  bool minus = false;
672  if (cstr[i] == '-') {
673  minus = true;
674  i++;
675  } else if (cstr[i] == '+')
676  i++;
677 
678  double output = 0.;
679 
680  while (cstr[i] != '.' && cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
681  if (cstr[i] < '0' || cstr[i] > '9') {
682  XMLString::release(&cstr);
683  throw cms::Exception("XMLException") << errmessage.str();
684  }
685 
686  output *= 10;
687  output += cstr[i] - '0';
688  i++;
689  }
690 
691  if (cstr[i] == '.') {
692  double place = 0.1;
693  i++;
694 
695  while (cstr[i] != 'e' && cstr[i] != 'E' && i < len) {
696  if (cstr[i] < '0' || cstr[i] > '9') {
697  XMLString::release(&cstr);
698  throw cms::Exception("XMLException") << errmessage.str();
699  }
700 
701  output += (cstr[i] - '0') * place;
702  place /= 10.;
703  i++;
704  }
705  }
706 
707  if (cstr[i] == 'e' || cstr[i] == 'E') {
708  i++;
709 
710  int exponent = 0;
711  bool expminus = false;
712  if (cstr[i] == '-') {
713  expminus = true;
714  i++;
715  } else if (cstr[i] == '+')
716  i++;
717 
718  while (i < len) {
719  if (cstr[i] < '0' || cstr[i] > '9') {
720  XMLString::release(&cstr);
721  throw cms::Exception("XMLException") << errmessage.str();
722  }
723 
724  exponent *= 10;
725  exponent += cstr[i] - '0';
726  i++;
727  }
728 
729  if (expminus)
730  exponent *= -1;
731 
732  output *= pow(10., exponent);
733  }
734 
735  if (minus)
736  output *= -1.;
737 
738  XMLString::release(&cstr);
739  return output;
740 }
741 
742 void MuonAlignmentInputXML::do_setposition(const XERCES_CPP_NAMESPACE::DOMElement *node,
743  std::map<Alignable *, bool> &aliset,
744  std::map<Alignable *, Alignable *> &alitoideal) const {
745  DOMAttr *node_relativeto = node->getAttributeNode(str_relativeto);
746  if (node_relativeto == nullptr)
747  throw cms::Exception("XMLException") << "<setposition> is missing required \"relativeto\" attribute" << std::endl;
748 
749  int relativeto = 0;
750  if (XMLString::equals(node_relativeto->getValue(), str_none)) {
751  relativeto = 0;
752  } else if (XMLString::equals(node_relativeto->getValue(), str_ideal)) {
753  relativeto = 1;
754  } else if (XMLString::equals(node_relativeto->getValue(), str_container)) {
755  relativeto = 2;
756  } else {
757  char *message = XMLString::transcode(node_relativeto->getValue());
758  throw cms::Exception("XMLException") << "relativeto must be \"none\", \"ideal\", or \"container\", not \""
759  << message << "\"" << std::endl;
760  }
761 
762  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
763  // first reconstruct the old position: how it would look in this coordinate system
764 
765  Alignable *ali = aliiter->first;
766  Alignable *ideal = alitoideal[ali];
767 
768  align::PositionType oldpos = ali->globalPosition();
769  align::RotationType oldrot = ali->globalRotation();
770 
771  if (relativeto == 0) {
772  }
773 
774  else if (relativeto == 1) {
775  const align::PositionType &idealPosition = ideal->globalPosition();
776  align::RotationType idealRotation = ideal->globalRotation();
777 
778  oldpos = align::PositionType(idealRotation * (oldpos.basicVector() - idealPosition.basicVector()));
779  oldrot = oldrot * idealRotation.transposed();
780  }
781 
782  else if (relativeto == 2 && ali->mother() != nullptr) {
783  align::PositionType globalPosition = ali->mother()->globalPosition();
784  align::RotationType globalRotation = ali->mother()->globalRotation();
785 
786  oldpos = align::PositionType(globalRotation * (oldpos.basicVector() - globalPosition.basicVector()));
787  oldrot = oldrot * globalRotation.transposed();
788  }
789 
790  double x = oldpos.x();
791  double y = oldpos.y();
792  double z = oldpos.z();
793 
794  double phix = atan2(oldrot.yz(), oldrot.zz());
795  double phiy = asin(-oldrot.xz());
796  double phiz = atan2(oldrot.xy(), oldrot.xx());
797 
798  align::EulerAngles oldEulerAngles = align::toAngles(oldrot);
799  double alpha = oldEulerAngles(1);
800  double beta = oldEulerAngles(2);
801  double gamma = oldEulerAngles(3);
802 
803  // now get the new information; if it's incomplete, use the old position for those coordinates
804 
805  DOMAttr *node_x = node->getAttributeNode(str_x);
806  DOMAttr *node_y = node->getAttributeNode(str_y);
807  DOMAttr *node_z = node->getAttributeNode(str_z);
808 
809  if (node_x != nullptr)
810  x = parseDouble(node_x->getValue(), "x");
811  if (node_y != nullptr)
812  y = parseDouble(node_y->getValue(), "y");
813  if (node_z != nullptr)
814  z = parseDouble(node_z->getValue(), "z");
816 
817  DOMAttr *node_phix = node->getAttributeNode(str_phix);
818  DOMAttr *node_phiy = node->getAttributeNode(str_phiy);
819  DOMAttr *node_phiz = node->getAttributeNode(str_phiz);
820  DOMAttr *node_alpha = node->getAttributeNode(str_alpha);
821  DOMAttr *node_beta = node->getAttributeNode(str_beta);
822  DOMAttr *node_gamma = node->getAttributeNode(str_gamma);
824 
825  bool phixyz = (node_phix != nullptr || node_phiy != nullptr || node_phiz != nullptr);
826  bool alphabetagamma = (node_alpha != nullptr || node_beta != nullptr || node_gamma != nullptr);
827  if (phixyz && alphabetagamma)
828  throw cms::Exception("XMLException")
829  << "<setposition> must either have phix, phiy, and phiz or alpha, beta, and gamma, but not both" << std::endl;
830  if (!phixyz && !alphabetagamma)
831  alphabetagamma = true;
832 
833  if (phixyz) {
834  if (node_phix != nullptr)
835  phix = parseDouble(node_phix->getValue(), "phix");
836  if (node_phiy != nullptr)
837  phiy = parseDouble(node_phiy->getValue(), "phiy");
838  if (node_phiz != nullptr)
839  phiz = parseDouble(node_phiz->getValue(), "phiz");
840 
841  // the angle convention originally used in alignment, also known as "non-standard Euler angles with a Z-Y-X convention"
842  // this also gets the sign convention right
843  align::RotationType rotX(1., 0., 0., 0., cos(phix), sin(phix), 0., -sin(phix), cos(phix));
844  align::RotationType rotY(cos(phiy), 0., -sin(phiy), 0., 1., 0., sin(phiy), 0., cos(phiy));
845  align::RotationType rotZ(cos(phiz), sin(phiz), 0., -sin(phiz), cos(phiz), 0., 0., 0., 1.);
846 
847  rot = rotX * rotY * rotZ;
848  }
849 
850  else if (alphabetagamma) {
851  if (node_alpha != nullptr)
852  alpha = parseDouble(node_alpha->getValue(), "alpha");
853  if (node_beta != nullptr)
854  beta = parseDouble(node_beta->getValue(), "beta");
855  if (node_gamma != nullptr)
856  gamma = parseDouble(node_gamma->getValue(), "gamma");
857 
858  // standard Euler angles (how they're internally stored in the database)
859  align::EulerAngles eulerAngles(3);
860  eulerAngles(1) = alpha;
861  eulerAngles(2) = beta;
862  eulerAngles(3) = gamma;
863  rot = align::RotationType(align::toMatrix(eulerAngles));
864  }
865 
866  else
867  assert(false); // see above
868 
869  if (relativeto == 0) {
870  set_one_position(aliiter->first, pos, rot);
871  } // end relativeto="none"
872 
873  else if (relativeto == 1) {
874  Alignable *ali = aliiter->first;
875  Alignable *ideal = alitoideal[ali];
876 
877  const align::PositionType &idealPosition = ideal->globalPosition();
878  align::RotationType idealRotation = ideal->globalRotation();
879  align::PositionType newpos =
880  align::PositionType(idealRotation.transposed() * pos.basicVector() + idealPosition.basicVector());
881  align::RotationType newrot = rot * idealRotation;
882 
883  set_one_position(ali, newpos, newrot);
884  } // end relativeto="ideal"
885 
886  else if (relativeto == 2) {
887  Alignable *ali = aliiter->first;
888  Alignable *container = ali->mother();
889 
890  if (container != nullptr) {
891  const align::PositionType &globalPosition = container->globalPosition();
892  align::RotationType globalRotation = container->globalRotation();
893  align::PositionType newpos =
894  align::PositionType(globalRotation.transposed() * pos.basicVector() + globalPosition.basicVector());
895  align::RotationType newrot = rot * globalRotation;
896  set_one_position(ali, newpos, newrot);
897  } else {
898  set_one_position(ali, pos, rot);
899  }
900  } // end relativeto="container"
901 
902  } // end loop over alignables
903 }
904 
906  const align::PositionType &pos,
907  const align::RotationType &rot) const {
908  const align::PositionType &oldpos = ali->globalPosition();
909  const align::RotationType &oldrot = ali->globalRotation();
910 
911  // shift needed to move from current to new position
912  align::GlobalVector posDiff = pos - oldpos;
913  align::RotationType rotDiff = oldrot.multiplyInverse(rot);
914  align::rectify(rotDiff); // correct for rounding errors
915  ali->move(posDiff);
916  ali->rotateInGlobalFrame(rotDiff);
917 
918  // // check for consistency
919  // const align::PositionType& newpos = ali->globalPosition();
920  // const align::RotationType& newrot = ali->globalRotation();
921  // align::GlobalVector posDiff2 = pos - newpos;
922  // align::RotationType rotDiff2 = newrot.multiplyInverse(rot);
923  // align::rectify(rotDiff2); // correct for rounding errors
924 
925  // if (fabs(posDiff2.x()) > 1e-6 || fabs(posDiff2.y()) > 1e-6 || fabs(posDiff2.z()) > 1e-6) {
926  // std::cout << "zeropos " << posDiff2 << std::endl;
927  // }
928  // if (fabs(rotDiff2.xx() - 1.) > 1e-4 ||
929  // fabs(rotDiff2.yy() - 1.) > 1e-4 ||
930  // fabs(rotDiff2.zz() - 1.) > 1e-4 ||
931  // fabs(rotDiff2.xy()) > 1e-8 ||
932  // fabs(rotDiff2.xz()) > 1e-8 ||
933  // fabs(rotDiff2.yz()) > 1e-8) {
934  // std::cout << "zerorot " << rotDiff2 << std::endl;
935  // }
936 
937  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
938  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
939 
940  const SurveyDet *survey = ali->survey();
941  if (survey != nullptr) {
942  matrix6x6 = survey->errors(); // save the constraint information
943  }
944  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
945 }
946 
947 void MuonAlignmentInputXML::do_setape(const XERCES_CPP_NAMESPACE::DOMElement *node,
948  std::map<Alignable *, bool> &aliset,
949  std::map<Alignable *, Alignable *> &alitoideal) const {
950  DOMAttr *node_xx = node->getAttributeNode(str_xx);
951  DOMAttr *node_xy = node->getAttributeNode(str_xy);
952  DOMAttr *node_xz = node->getAttributeNode(str_xz);
953  DOMAttr *node_xa = node->getAttributeNode(str_xa);
954  DOMAttr *node_xb = node->getAttributeNode(str_xb);
955  DOMAttr *node_xc = node->getAttributeNode(str_xc);
956  DOMAttr *node_yy = node->getAttributeNode(str_yy);
957  DOMAttr *node_yz = node->getAttributeNode(str_yz);
958  DOMAttr *node_ya = node->getAttributeNode(str_ya);
959  DOMAttr *node_yb = node->getAttributeNode(str_yb);
960  DOMAttr *node_yc = node->getAttributeNode(str_yc);
961  DOMAttr *node_zz = node->getAttributeNode(str_zz);
962  DOMAttr *node_za = node->getAttributeNode(str_za);
963  DOMAttr *node_zb = node->getAttributeNode(str_zb);
964  DOMAttr *node_zc = node->getAttributeNode(str_zc);
965  DOMAttr *node_aa = node->getAttributeNode(str_aa);
966  DOMAttr *node_ab = node->getAttributeNode(str_ab);
967  DOMAttr *node_ac = node->getAttributeNode(str_ac);
968  DOMAttr *node_bb = node->getAttributeNode(str_bb);
969  DOMAttr *node_bc = node->getAttributeNode(str_bc);
970  DOMAttr *node_cc = node->getAttributeNode(str_cc);
971 
972  if (node_xx == nullptr)
973  throw cms::Exception("XMLException") << "<setape> is missing required \"xx\" attribute" << std::endl;
974  if (node_xy == nullptr)
975  throw cms::Exception("XMLException") << "<setape> is missing required \"xy\" attribute" << std::endl;
976  if (node_xz == nullptr)
977  throw cms::Exception("XMLException") << "<setape> is missing required \"xz\" attribute" << std::endl;
978  if (node_xa == nullptr)
979  throw cms::Exception("XMLException") << "<setape> is missing required \"xa\" attribute" << std::endl;
980  if (node_xb == nullptr)
981  throw cms::Exception("XMLException") << "<setape> is missing required \"xb\" attribute" << std::endl;
982  if (node_xc == nullptr)
983  throw cms::Exception("XMLException") << "<setape> is missing required \"xc\" attribute" << std::endl;
984  if (node_yy == nullptr)
985  throw cms::Exception("XMLException") << "<setape> is missing required \"yy\" attribute" << std::endl;
986  if (node_yz == nullptr)
987  throw cms::Exception("XMLException") << "<setape> is missing required \"yz\" attribute" << std::endl;
988  if (node_ya == nullptr)
989  throw cms::Exception("XMLException") << "<setape> is missing required \"ya\" attribute" << std::endl;
990  if (node_yb == nullptr)
991  throw cms::Exception("XMLException") << "<setape> is missing required \"yb\" attribute" << std::endl;
992  if (node_yc == nullptr)
993  throw cms::Exception("XMLException") << "<setape> is missing required \"yc\" attribute" << std::endl;
994  if (node_zz == nullptr)
995  throw cms::Exception("XMLException") << "<setape> is missing required \"zz\" attribute" << std::endl;
996  if (node_za == nullptr)
997  throw cms::Exception("XMLException") << "<setape> is missing required \"za\" attribute" << std::endl;
998  if (node_zb == nullptr)
999  throw cms::Exception("XMLException") << "<setape> is missing required \"zb\" attribute" << std::endl;
1000  if (node_zc == nullptr)
1001  throw cms::Exception("XMLException") << "<setape> is missing required \"zc\" attribute" << std::endl;
1002  if (node_aa == nullptr)
1003  throw cms::Exception("XMLException") << "<setape> is missing required \"aa\" attribute" << std::endl;
1004  if (node_ab == nullptr)
1005  throw cms::Exception("XMLException") << "<setape> is missing required \"ab\" attribute" << std::endl;
1006  if (node_ac == nullptr)
1007  throw cms::Exception("XMLException") << "<setape> is missing required \"ac\" attribute" << std::endl;
1008  if (node_bb == nullptr)
1009  throw cms::Exception("XMLException") << "<setape> is missing required \"bb\" attribute" << std::endl;
1010  if (node_bc == nullptr)
1011  throw cms::Exception("XMLException") << "<setape> is missing required \"bc\" attribute" << std::endl;
1012  if (node_cc == nullptr)
1013  throw cms::Exception("XMLException") << "<setape> is missing required \"cc\" attribute" << std::endl;
1014 
1015  align::ErrorMatrix matrix6x6;
1016  matrix6x6(0, 0) = parseDouble(node_xx->getValue(), "xx");
1017  matrix6x6(0, 1) = parseDouble(node_xy->getValue(), "xy");
1018  matrix6x6(0, 2) = parseDouble(node_xz->getValue(), "xz");
1019  matrix6x6(0, 3) = parseDouble(node_xa->getValue(), "xa");
1020  matrix6x6(0, 4) = parseDouble(node_xb->getValue(), "xb");
1021  matrix6x6(0, 5) = parseDouble(node_xc->getValue(), "xc");
1022  matrix6x6(1, 1) = parseDouble(node_yy->getValue(), "yy");
1023  matrix6x6(1, 2) = parseDouble(node_yz->getValue(), "yz");
1024  matrix6x6(1, 3) = parseDouble(node_ya->getValue(), "ya");
1025  matrix6x6(1, 4) = parseDouble(node_yb->getValue(), "yb");
1026  matrix6x6(1, 5) = parseDouble(node_yc->getValue(), "yc");
1027  matrix6x6(2, 2) = parseDouble(node_zz->getValue(), "zz");
1028  matrix6x6(2, 3) = parseDouble(node_za->getValue(), "za");
1029  matrix6x6(2, 4) = parseDouble(node_zb->getValue(), "zb");
1030  matrix6x6(2, 5) = parseDouble(node_zc->getValue(), "zc");
1031  matrix6x6(3, 3) = parseDouble(node_aa->getValue(), "aa");
1032  matrix6x6(3, 4) = parseDouble(node_ab->getValue(), "ab");
1033  matrix6x6(3, 5) = parseDouble(node_ac->getValue(), "ac");
1034  matrix6x6(4, 4) = parseDouble(node_bb->getValue(), "bb");
1035  matrix6x6(4, 5) = parseDouble(node_bc->getValue(), "bc");
1036  matrix6x6(5, 5) = parseDouble(node_cc->getValue(), "cc");
1037 
1038  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1039  // this sets APEs at this level and (since 2nd argument is true) all lower levels
1040  aliiter->first->setAlignmentPositionError(AlignmentPositionError(matrix6x6), true);
1041  }
1042 }
1043 
1044 void MuonAlignmentInputXML::do_setsurveyerr(const XERCES_CPP_NAMESPACE::DOMElement *node,
1045  std::map<Alignable *, bool> &aliset,
1046  std::map<Alignable *, Alignable *> &alitoideal) const {
1047  DOMAttr *node_xx = node->getAttributeNode(str_xx);
1048  DOMAttr *node_xy = node->getAttributeNode(str_xy);
1049  DOMAttr *node_xz = node->getAttributeNode(str_xz);
1050  DOMAttr *node_xa = node->getAttributeNode(str_xa);
1051  DOMAttr *node_xb = node->getAttributeNode(str_xb);
1052  DOMAttr *node_xc = node->getAttributeNode(str_xc);
1053  DOMAttr *node_yy = node->getAttributeNode(str_yy);
1054  DOMAttr *node_yz = node->getAttributeNode(str_yz);
1055  DOMAttr *node_ya = node->getAttributeNode(str_ya);
1056  DOMAttr *node_yb = node->getAttributeNode(str_yb);
1057  DOMAttr *node_yc = node->getAttributeNode(str_yc);
1058  DOMAttr *node_zz = node->getAttributeNode(str_zz);
1059  DOMAttr *node_za = node->getAttributeNode(str_za);
1060  DOMAttr *node_zb = node->getAttributeNode(str_zb);
1061  DOMAttr *node_zc = node->getAttributeNode(str_zc);
1062  DOMAttr *node_aa = node->getAttributeNode(str_aa);
1063  DOMAttr *node_ab = node->getAttributeNode(str_ab);
1064  DOMAttr *node_ac = node->getAttributeNode(str_ac);
1065  DOMAttr *node_bb = node->getAttributeNode(str_bb);
1066  DOMAttr *node_bc = node->getAttributeNode(str_bc);
1067  DOMAttr *node_cc = node->getAttributeNode(str_cc);
1068 
1069  if (node_xx == nullptr)
1070  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
1071  if (node_xy == nullptr)
1072  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
1073  if (node_xz == nullptr)
1074  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
1075  if (node_xa == nullptr)
1076  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
1077  if (node_xb == nullptr)
1078  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
1079  if (node_xc == nullptr)
1080  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
1081  if (node_yy == nullptr)
1082  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
1083  if (node_yz == nullptr)
1084  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
1085  if (node_ya == nullptr)
1086  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
1087  if (node_yb == nullptr)
1088  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
1089  if (node_yc == nullptr)
1090  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
1091  if (node_zz == nullptr)
1092  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
1093  if (node_za == nullptr)
1094  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"za\" attribute" << std::endl;
1095  if (node_zb == nullptr)
1096  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
1097  if (node_zc == nullptr)
1098  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
1099  if (node_aa == nullptr)
1100  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
1101  if (node_ab == nullptr)
1102  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
1103  if (node_ac == nullptr)
1104  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
1105  if (node_bb == nullptr)
1106  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
1107  if (node_bc == nullptr)
1108  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
1109  if (node_cc == nullptr)
1110  throw cms::Exception("XMLException") << "<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
1111 
1112  align::ErrorMatrix matrix6x6;
1113  matrix6x6(0, 0) = parseDouble(node_xx->getValue(), "xx");
1114  matrix6x6(0, 1) = parseDouble(node_xy->getValue(), "xy");
1115  matrix6x6(0, 2) = parseDouble(node_xz->getValue(), "xz");
1116  matrix6x6(0, 3) = parseDouble(node_xa->getValue(), "xa");
1117  matrix6x6(0, 4) = parseDouble(node_xb->getValue(), "xb");
1118  matrix6x6(0, 5) = parseDouble(node_xc->getValue(), "xc");
1119  matrix6x6(1, 1) = parseDouble(node_yy->getValue(), "yy");
1120  matrix6x6(1, 2) = parseDouble(node_yz->getValue(), "yz");
1121  matrix6x6(1, 3) = parseDouble(node_ya->getValue(), "ya");
1122  matrix6x6(1, 4) = parseDouble(node_yb->getValue(), "yb");
1123  matrix6x6(1, 5) = parseDouble(node_yc->getValue(), "yc");
1124  matrix6x6(2, 2) = parseDouble(node_zz->getValue(), "zz");
1125  matrix6x6(2, 3) = parseDouble(node_za->getValue(), "za");
1126  matrix6x6(2, 4) = parseDouble(node_zb->getValue(), "zb");
1127  matrix6x6(2, 5) = parseDouble(node_zc->getValue(), "zc");
1128  matrix6x6(3, 3) = parseDouble(node_aa->getValue(), "aa");
1129  matrix6x6(3, 4) = parseDouble(node_ab->getValue(), "ab");
1130  matrix6x6(3, 5) = parseDouble(node_ac->getValue(), "ac");
1131  matrix6x6(4, 4) = parseDouble(node_bb->getValue(), "bb");
1132  matrix6x6(4, 5) = parseDouble(node_bc->getValue(), "bc");
1133  matrix6x6(5, 5) = parseDouble(node_cc->getValue(), "cc");
1134 
1135  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1136  Alignable *ali = aliiter->first;
1137  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1138  }
1139 }
1140 
1141 void MuonAlignmentInputXML::do_moveglobal(const XERCES_CPP_NAMESPACE::DOMElement *node,
1142  std::map<Alignable *, bool> &aliset,
1143  std::map<Alignable *, Alignable *> &alitoideal) const {
1144  DOMAttr *node_x = node->getAttributeNode(str_x);
1145  DOMAttr *node_y = node->getAttributeNode(str_y);
1146  DOMAttr *node_z = node->getAttributeNode(str_z);
1147  if (node_x == nullptr)
1148  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"x\" attribute" << std::endl;
1149  if (node_y == nullptr)
1150  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"y\" attribute" << std::endl;
1151  if (node_z == nullptr)
1152  throw cms::Exception("XMLException") << "<moveglobal> is missing required \"z\" attribute" << std::endl;
1153 
1154  double x = parseDouble(node_x->getValue(), "x");
1155  double y = parseDouble(node_y->getValue(), "y");
1156  double z = parseDouble(node_z->getValue(), "z");
1157  align::GlobalVector vect(x, y, z);
1158 
1159  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1160  Alignable *ali = aliiter->first;
1161 
1162  ali->move(vect);
1163 
1164  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1165  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1166 
1167  const SurveyDet *survey = ali->survey();
1168  if (survey != nullptr) {
1169  matrix6x6 = survey->errors(); // save the constraint information
1170  }
1171  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1172  } // end loop over alignables
1173 }
1174 
1175 void MuonAlignmentInputXML::do_movelocal(const XERCES_CPP_NAMESPACE::DOMElement *node,
1176  std::map<Alignable *, bool> &aliset,
1177  std::map<Alignable *, Alignable *> &alitoideal) const {
1178  DOMAttr *node_x = node->getAttributeNode(str_x);
1179  DOMAttr *node_y = node->getAttributeNode(str_y);
1180  DOMAttr *node_z = node->getAttributeNode(str_z);
1181  if (node_x == nullptr)
1182  throw cms::Exception("XMLException") << "<movelocal> is missing required \"x\" attribute" << std::endl;
1183  if (node_y == nullptr)
1184  throw cms::Exception("XMLException") << "<movelocal> is missing required \"y\" attribute" << std::endl;
1185  if (node_z == nullptr)
1186  throw cms::Exception("XMLException") << "<movelocal> is missing required \"z\" attribute" << std::endl;
1187 
1188  double x = parseDouble(node_x->getValue(), "x");
1189  double y = parseDouble(node_y->getValue(), "y");
1190  double z = parseDouble(node_z->getValue(), "z");
1191  align::LocalVector vect(x, y, z);
1192 
1193  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1194  Alignable *ali = aliiter->first;
1195 
1196  align::GlobalVector globalVector = ali->surface().toGlobal(vect);
1197  ali->move(globalVector);
1198 
1199  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1200  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1201 
1202  const SurveyDet *survey = ali->survey();
1203  if (survey != nullptr) {
1204  matrix6x6 = survey->errors(); // save the constraint information
1205  }
1206  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1207  } // end loop over alignables
1208 }
1209 
1210 void MuonAlignmentInputXML::do_rotatelocal(const XERCES_CPP_NAMESPACE::DOMElement *node,
1211  std::map<Alignable *, bool> &aliset,
1212  std::map<Alignable *, Alignable *> &alitoideal) const {
1213  DOMAttr *node_axisx = node->getAttributeNode(str_axisx);
1214  DOMAttr *node_axisy = node->getAttributeNode(str_axisy);
1215  DOMAttr *node_axisz = node->getAttributeNode(str_axisz);
1216  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1217  if (node_axisx == nullptr)
1218  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1219  if (node_axisy == nullptr)
1220  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1221  if (node_axisz == nullptr)
1222  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1223  if (node_angle == nullptr)
1224  throw cms::Exception("XMLException") << "<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1225 
1226  double x = parseDouble(node_axisx->getValue(), "x");
1227  double y = parseDouble(node_axisy->getValue(), "y");
1228  double z = parseDouble(node_axisz->getValue(), "z");
1229  double angle = parseDouble(node_angle->getValue(), "angle");
1230  align::LocalVector vect(x, y, z);
1231 
1232  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1233  Alignable *ali = aliiter->first;
1234 
1235  ali->rotateAroundLocalAxis(vect, angle);
1236 
1237  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1238  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1239 
1240  const SurveyDet *survey = ali->survey();
1241  if (survey != nullptr) {
1242  matrix6x6 = survey->errors(); // save the constraint information
1243  }
1244  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1245  } // end loop over alignables
1246 }
1247 
1248 void MuonAlignmentInputXML::do_rotatebeamline(const XERCES_CPP_NAMESPACE::DOMElement *node,
1249  std::map<Alignable *, bool> &aliset,
1250  std::map<Alignable *, Alignable *> &alitoideal) const {
1251  DOMAttr *node_rphi = node->getAttributeNode(str_rphi);
1252  DOMAttr *node_phi = node->getAttributeNode(str_phi);
1253  if (node_rphi == nullptr && node_phi == nullptr)
1254  throw cms::Exception("XMLException") << "<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1255  if (node_rphi != nullptr && node_phi != nullptr)
1256  throw cms::Exception("XMLException") << "<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute"
1257  << std::endl;
1258 
1259  double value;
1260  if (node_rphi != nullptr) {
1261  value = parseDouble(node_rphi->getValue(), "rphi");
1262  } else {
1263  value = parseDouble(node_phi->getValue(), "phi");
1264  }
1265 
1266  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1267  Alignable *ali = aliiter->first;
1268 
1270 
1271  double radius = pos.perp();
1272  double phi0 = pos.phi();
1273  double deltaphi = value;
1274  if (node_rphi != nullptr)
1275  deltaphi = value / radius;
1276 
1277  ali->rotateAroundGlobalZ(deltaphi);
1279  radius * (cos(phi0 + deltaphi) - cos(phi0)), radius * (sin(phi0 + deltaphi) - sin(phi0)), 0.));
1280 
1281  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1282  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1283 
1284  const SurveyDet *survey = ali->survey();
1285  if (survey != nullptr) {
1286  matrix6x6 = survey->errors(); // save the constraint information
1287  }
1288  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1289  } // end loop over alignables
1290 }
1291 
1292 void MuonAlignmentInputXML::do_rotateglobalaxis(const XERCES_CPP_NAMESPACE::DOMElement *node,
1293  std::map<Alignable *, bool> &aliset,
1294  std::map<Alignable *, Alignable *> &alitoideal) const {
1295  DOMAttr *node_x = node->getAttributeNode(str_x);
1296  DOMAttr *node_y = node->getAttributeNode(str_y);
1297  DOMAttr *node_z = node->getAttributeNode(str_z);
1298  DOMAttr *node_angle = node->getAttributeNode(str_angle);
1299  if (node_x == nullptr)
1300  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1301  if (node_y == nullptr)
1302  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1303  if (node_z == nullptr)
1304  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1305  if (node_angle == nullptr)
1306  throw cms::Exception("XMLException") << "<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
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  double angle = parseDouble(node_angle->getValue(), "angle");
1312 
1313  for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1314  Alignable *ali = aliiter->first;
1316 
1318 
1319  double aprime = x / sqrt(x * x + y * y + z * z);
1320  double bprime = y / sqrt(x * x + y * y + z * z);
1321  double cprime = z / sqrt(x * x + y * y + z * z);
1322  double q0 = cos(angle / 2.);
1323  double q1 = sin(angle / 2.) * aprime;
1324  double q2 = sin(angle / 2.) * bprime;
1325  double q3 = sin(angle / 2.) * cprime;
1326 
1327  double pos2x = (q0 * q0 + q1 * q1 - q2 * q2 - q3 * q3) * pos.x() + 2. * (q1 * q2 - q0 * q3) * pos.y() +
1328  2. * (q1 * q3 + q0 * q2) * pos.z();
1329  double pos2y = 2. * (q2 * q1 + q0 * q3) * pos.x() + (q0 * q0 - q1 * q1 + q2 * q2 - q3 * q3) * pos.y() +
1330  2. * (q2 * q3 - q0 * q1) * pos.z();
1331  double pos2z = 2. * (q3 * q1 - q0 * q2) * pos.x() + 2. * (q3 * q2 + q0 * q1) * pos.y() +
1332  (q0 * q0 - q1 * q1 - q2 * q2 + q3 * q3) * pos.z();
1333 
1334  double movex = pos2x - pos.x();
1335  double movey = pos2y - pos.y();
1336  double movez = pos2z - pos.z();
1337  ali->move(align::GlobalVector(movex, movey, movez));
1338 
1339  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
1340  matrix6x6 *= 1000.; // initial assumption: infinitely weak constraint
1341 
1342  const SurveyDet *survey = ali->survey();
1343  if (survey != nullptr) {
1344  matrix6x6 = survey->errors(); // save the constraint information
1345  }
1346  ali->setSurvey(new SurveyDet(ali->surface(), matrix6x6));
1347  } // end loop over alignables
1348 }
1349 
1350 //
1351 // const member functions
1352 //
1353 
1354 //
1355 // static member functions
1356 //
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:12
MuonAlignmentInputXML::str_setsurveyerr
XMLCh * str_setsurveyerr
Definition: MuonAlignmentInputXML.h:117
DDAxes::y
common_cff.doc
doc
Definition: common_cff.py:54
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:449
ESHandle.h
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
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
SurveyDet::errors
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
relativeConstraints.station
station
Definition: relativeConstraints.py:67
Alignable::rotateInGlobalFrame
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
class-composition.children
children
Definition: class-composition.py:88
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:478
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
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:1141
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:663
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:84
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:1175
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:1248
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:1044
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
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:52854
str
#define str(s)
Definition: TestProcessor.cc:51
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:326
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:77
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:571
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:742
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:33
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:947
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:57
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
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:1210
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:369
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:246
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:1292
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
AlignableObjectId::idToString
const char * idToString(align::StructureType type) const
Definition: AlignableObjectId.cc:259
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:905
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