diff --git a/DDCore/include/DD4hep/FieldTypes.h b/DDCore/include/DD4hep/FieldTypes.h index 4a9ba7e5de0349a9ae694f5e737ed8073dd3598e..9706f3970b5eaf5dfbaf3665e014506c38086b1c 100644 --- a/DDCore/include/DD4hep/FieldTypes.h +++ b/DDCore/include/DD4hep/FieldTypes.h @@ -89,7 +89,7 @@ namespace DD4hep { virtual void fieldComponents(const double* pos, double* field); }; - /// Implementation object of a dipole magnetic field. + /// Implementation object of a Multipole magnetic field. /** * Generic multipole magnetic field using the * Multipole approach. The dipole is assumed to be horizontal diff --git a/DDCore/include/DD4hep/Fields.h b/DDCore/include/DD4hep/Fields.h index ea5589841e4050ff34d05a77a3c1b5fbe8129ca1..f101bc0f0137a0b5c9e789ad410cd64002830563 100644 --- a/DDCore/include/DD4hep/Fields.h +++ b/DDCore/include/DD4hep/Fields.h @@ -122,7 +122,11 @@ namespace DD4hep { * with field components in Cartesian coordinates. * * The actual behaviour is solely implemented in the underlying object - * class. + * classes. The overlay field is the sum of several magnetic of electric + * field components. + * + * The resulting field vectors are computed by the vector addition + * of the individual components. * * \author M.Frank * \version 1.0 diff --git a/DDCore/include/XML/XMLDetector.h b/DDCore/include/XML/XMLDetector.h index f96a77947d8e200179d0713543dd31fcfead8f82..f276dea6c61ccc10b1b40bf9b0c3ad79105e16aa 100644 --- a/DDCore/include/XML/XMLDetector.h +++ b/DDCore/include/XML/XMLDetector.h @@ -15,6 +15,9 @@ /// Namespace for the AIDA detector description toolkit namespace DD4hep { + // Forward declarations + class NamedObject; + /// Namespace for the AIDA detector description toolkit supporting XML utilities namespace XML { @@ -40,6 +43,8 @@ namespace DD4hep { bool isSensitive() const; /// Access material attribute as STL string std::string materialStr() const; + /// Create a shape using the plugin mechanism from an XML element + NamedObject* createShape() const; }; /// XML Handle class extending the XML handle Dimension diff --git a/DDCore/include/XML/XMLDimension.h b/DDCore/include/XML/XMLDimension.h index 0390645d4f67e254f92bfbfe1f3bc6b2221d4868..027c2f5c737883a2a98dde52b907e4b757e80f14 100644 --- a/DDCore/include/XML/XMLDimension.h +++ b/DDCore/include/XML/XMLDimension.h @@ -133,6 +133,10 @@ namespace DD4hep { double deltaphi() const; /// Access Tube parameters: deltaphi double deltaphi(double default_value) const; + /// Access rotation constants: startphi + double startphi() const; + /// Access rotation constants: startphi + double startphi(double default_value) const; /// Access parameters: b double b() const; diff --git a/DDCore/src/XML/XMLDetector.cpp b/DDCore/src/XML/XMLDetector.cpp index 4d68e56be268eb760a260da2b364bbae5c9a7799..82b52014f6b2fd6758d54a140dda61631b6d6bc3 100644 --- a/DDCore/src/XML/XMLDetector.cpp +++ b/DDCore/src/XML/XMLDetector.cpp @@ -8,10 +8,14 @@ //==================================================================== // Framework include files #include "XML/XMLDetector.h" +#include "DD4hep/Plugins.h" +#include "DD4hep/LCDD.h" using namespace std; using namespace DD4hep::XML; +namespace Geometry { class LCDD; } + string Component::materialStr() const { return m_element.attr < string > (_U(material)); } @@ -22,6 +26,22 @@ bool Component::isSensitive() const { return val == 'T' || val == 'Y'; } +DD4hep::NamedObject* Component::createShape() const { + using namespace DD4hep::Geometry; + Dimension child(m_element); + string type = child.typeStr(); + string fac = type + "__shape_constructor"; + Handle_t solid_elt = m_element; + LCDD* lcdd = 0; + NamedObject* solid = PluginService::Create<NamedObject*>(fac, lcdd, &solid_elt); + if ( !solid ) { + PluginDebug dbg; + PluginService::Create<NamedObject*>(type, lcdd, &solid_elt); + throw runtime_error("Failed to create solid of type " + type + ". " + dbg.missingFactory(type)); + } + return solid; +} + int DetElement::id() const { return m_element.hasAttr(_U(id)) ? m_element.attr<int>(_U(id)) : -1; } diff --git a/DDCore/src/XML/XMLDimension.cpp b/DDCore/src/XML/XMLDimension.cpp index d9ed8f069f86a33ee7f19d3b2fc4800f377c44af..47b057bd33f11a7e799e39a1fbd6d710dc755efd 100644 --- a/DDCore/src/XML/XMLDimension.cpp +++ b/DDCore/src/XML/XMLDimension.cpp @@ -109,6 +109,7 @@ XML_ATTR_ACCESSOR(int, phiBins) XML_ATTR_ACCESSOR_DOUBLE(phi0) XML_ATTR_ACCESSOR_DOUBLE(phi1) XML_ATTR_ACCESSOR_DOUBLE(deltaphi) +XML_ATTR_ACCESSOR_DOUBLE(startphi) XML_ATTR_ACCESSOR(double, length) XML_ATTR_ACCESSOR(double, width) diff --git a/DDCore/src/plugins/ShapePlugins.cpp b/DDCore/src/plugins/ShapePlugins.cpp index d726089f147c824ce43471ea0e27f9ba93fa03c6..b16f2c4c1e9c12ff774b4a6039a88a6b5693d1c1 100644 --- a/DDCore/src/plugins/ShapePlugins.cpp +++ b/DDCore/src/plugins/ShapePlugins.cpp @@ -26,7 +26,7 @@ static Ref_t create_Polycone(lcdd_t&, xml_h element) { xml_dim_t e(element); int num = 0; vector<double> rmin,rmax,z; - double start = e.start(0e0), deltaphi = e.deltaphi(2*M_PI); + double start = e.startphi(0e0), deltaphi = e.deltaphi(2*M_PI); for(xml_coll_t c(e,_U(zplane)); c; ++c, ++num) { xml_comp_t plane(c); rmin.push_back(plane.rmin()); @@ -42,13 +42,13 @@ DECLARE_XMLELEMENT(Polycone__shape_constructor,create_Polycone) static Ref_t create_ConeSegment(lcdd_t&, xml_h element) { xml_dim_t e(element); - return ConeSegment(e.rmin(0.0),e.rmax(),e.z(0.0),e.start(0.0),e.deltaphi(2*M_PI)); + return ConeSegment(e.rmin(0.0),e.rmax(),e.z(0.0),e.startphi(0.0),e.deltaphi(2*M_PI)); } DECLARE_XMLELEMENT(ConeSegment__shape_constructor,create_ConeSegment) static Ref_t create_Tube(lcdd_t&, xml_h element) { xml_dim_t e(element); - return Tube(e.rmin(0.0),e.rmax(),e.z(0.0),e.start(0.0),e.deltaphi(2*M_PI)); + return Tube(e.rmin(0.0),e.rmax(),e.z(0.0),e.startphi(0.0),e.deltaphi(2*M_PI)); } DECLARE_XMLELEMENT(Tube__shape_constructor,create_Tube) diff --git a/doc/DD4hepManual.pdf b/doc/DD4hepManual.pdf index 1a295f8753f02e9327514cd222ffcbc4e7397955..46004f1b06f0f0b88f0505a2e119f7d49752d90d 100644 Binary files a/doc/DD4hepManual.pdf and b/doc/DD4hepManual.pdf differ