27 #include "TGeoMatrix.h"
34 using namespace DD4hep::Alignments;
35 using namespace DD4hep;
54 string path = element.placementPath();
63 for(vector<GlobalAlignment>::const_iterator i=va.begin(); i!=va.end();++i) {
65 e.setAttr(
_ALU(path),(*i)->GetName());
74 TGeoNode* n = a->GetNode();
75 TGeoHMatrix mat(a->GetOriginalMatrix()->Inverse());
76 mat.Multiply(n->GetMatrix());
77 const Double_t* t = mat.GetTranslation();
82 printout(
INFO,
"GlobalAlignmentWriter",
"Write Delta constants for %s",a->GetName());
84 if ( fabs(t[0]) > numeric_limits<double>::epsilon() ||
85 fabs(t[1]) > numeric_limits<double>::epsilon() ||
86 fabs(t[2]) > numeric_limits<double>::epsilon() ) {
93 if ( mat.IsRotation() ) {
95 if ( fabs(rot.X()) > numeric_limits<double>::epsilon() ||
96 fabs(rot.Y()) > numeric_limits<double>::epsilon() ||
97 fabs(rot.Z()) > numeric_limits<double>::epsilon() ) {
113 if ( element.isValid() ) {
117 for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) {
120 (elt ? (elt) : (elt=
createElement(doc,element))).append(daughter);
129 const char comment[] =
"\n"
130 " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
131 " ++++ DD4hep generated alignment file using the ++++\n"
132 " ++++ DD4hep Detector description XML generator. ++++\n"
138 " ++++ M.Frank CERN/LHCb ++++\n"
139 " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n ";
145 if ( (elt=
scan(doc,top)) ) elements.append(elt);
153 return docH.
output(doc, output);
Document create(const char *tag, const char *comment=0) const
Create new XML document by parsing empty xml buffer.
virtual int output(Document doc, const std::string &fname) const
Write xml document to output file (stdout if file name empty)
bool isValid() const
Check the validity of the object held by the handle.
Main handle class to hold a TGeo alignment object of type TGeoPhysicalNode.
GlobalDetectorAlignment. DetElement Handle supporting alignment operations.
virtual ~GlobalAlignmentWriter()
Standard destructor.
void append(Handle_t handle) const
Append a new element to the existing tree.
User abstraction class to manipulate XML elements within a document.
GlobalAlignmentWriter(LCDD &lcdd)
Initializing Constructor.
Handle_t root() const
Access the ROOT eleemnt of the DOM document.
XYZAngles _XYZangles(const double *matrix)
Convert a 3x3 rotation matrix to XYZAngles
DD4hep::Geometry::DetElement DetElement
#define XML_IMPLEMENTATION_TYPE
long write(XML::Document doc, const std::string &output) const
Write the XML document structure to a file.
XML::Element scan(XML::Document doc, DetElement element) const
Scan one DetElement structure and return an XML element containing the alignment in this subtree...
int addRef()
Add reference count.
ROOT::Math::XYZVector Position
GlobalAlignmentCache * m_cache
Reference to the alignment cache.
int release()
Release object. If reference count goes to NULL, automatic deletion is triggered. ...
Document document() const
Access the hosting document handle of this DOM element.
Class caching all known alignment operations for one LCDD instance.
Attribute setAttr(const XmlChar *nam, const T &val) const
Set single attribute.
ROOT::Math::Translation3D Translation3D
Class supporting the basic functionality of an XML document.
void addNode(XML::Element elt, GlobalAlignment a) const
Add single alignment node to the XML document.
std::map< std::string, DetElement > Children
XML::Element createElement(XML::Document doc, DetElement element) const
Create the element corresponding to one single detector element without children. ...
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Class supporting to read and parse XML documents.
std::vector< GlobalAlignment > & volumeAlignments()
Alignment entries for lower level volumes, which are NOT attached to daughter DetElements.
XML::Document dump(DetElement element, bool enable_transactions=false) const
Dump one full DetElement subtree into a newly created document.