diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..dea352a11557df37d1d6ea8207a371ba0f50ffb1
--- /dev/null
+++ b/DDCore/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
+
+project(DDCore)
+
+find_package(ROOT)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR})
+
+file(GLOB detdesc_sources src/*.cpp src/Evaluator/*.cpp)
+file(GLOB detdesc_headers include/*.h)
+list(REMOVE_ITEM detdesc_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/LinkDef.h)
+
+ROOT_GENERATE_DICTIONARY( G__DetDesc ${detdesc_headers} LINKDEF include/LinkDef.h)
+
+add_library(DetDesc SHARED ${detdesc_sources} G__DetDesc.cxx)
+target_link_libraries(DetDesc ${ROOT_LIBRARIES} Geom)
+
diff --git a/DDCore/include/Elements.h b/DDCore/include/Elements.h
new file mode 100644
index 0000000000000000000000000000000000000000..37eee99cac1fbd614e5e831de418d35043035143
--- /dev/null
+++ b/DDCore/include/Elements.h
@@ -0,0 +1,89 @@
+#ifndef DETDESC_ELEMENTS_H
+#define DETDESC_ELEMENTS_H
+
+#include <string>
+#include <stdexcept>
+
+class TObject;
+class TObjArray;
+class TGeoManager;
+
+/*
+ *   Gaudi namespace declaration
+ */
+namespace DetDesc {
+
+  namespace Geometry  {
+    struct  LCDD;
+    struct  Element;
+    struct  RefElement;
+    struct  Document;
+    struct  Handle_t;
+    struct  Collection_t;
+
+    typedef TObject     Element_t;
+    typedef TObjArray   NodeList_t;
+    typedef TGeoManager Document_t;
+
+    bool           _toBool  (const std::string& value);
+    int            _toInt   (const std::string& value);
+    float          _toFloat (const std::string& value);
+    double         _toDouble(const std::string& value);
+
+    inline bool    _toBool(bool value)       {  return value; }
+    inline int     _toInt(int value)         {  return value; }
+    inline float   _toFloat(float value)     {  return value; }
+    inline double  _toDouble(double value)   {  return value; }
+
+    std::string    _toString(bool value);
+    std::string    _toString(int value);
+    std::string    _toString(float value);
+    std::string    _toString(double value);
+
+    void _toDictionary(const std::string& name, const std::string& value);
+
+    template<class T> inline void deletePtr(T*& p) { if(p) delete p; p=0; }
+
+    struct Handle_t  {
+      Element_t* m_node;
+      Handle_t(const Handle_t& c) : m_node(c.m_node) {}
+      Handle_t(Element_t* e=0) : m_node(e)        {                                        }
+      ~Handle_t()                                 {                                        }
+      //Element_t* operator->() const               { return m_node;                         }
+      //operator Element_t* () const                { return m_node;                         }
+      bool isValid() const                        { return 0 != m_node;                    }
+      Element_t* ptr() const                      { return m_node;                         }
+      template <typename T> T* _ptr() const       { return (T*)m_node;                     }
+    };
+
+    struct Document  {
+      Document_t* m_doc;
+      Document(Document_t* d) : m_doc(d) {}
+      operator Document_t*() const   {  return m_doc; }
+      Document_t* operator->() const {  return m_doc; }
+      Element_t*  createElt(const std::string& tag) const;
+    };
+
+    struct Element  {
+      Handle_t m_element;
+      Element(const Handle_t&  e) : m_element(e) {                            }
+      Element(const Document& document, const std::string& type);
+      Element_t* ptr() const                  {  return m_element.ptr();      }
+      bool isValid() const                    {  return 0 != m_element.ptr(); }
+      bool operator!() const                  {  return 0 == m_element.ptr(); }
+      //operator Handle_t () const              {  return m_element;            }
+      //operator Element_t*() const             {  return m_element;            }
+    };
+
+    struct RefElement : public Element  {
+      RefElement() : Element(0) {}
+      RefElement(const Handle_t& e);
+      RefElement(const Document& d, const std::string& type, const std::string& name);
+      const char* name() const;
+      const char* refName() const;
+      void setName(const std::string& new_name);
+    };
+
+  }       /* End namespace Geometry  */
+}         /* End namespace DetDesc   */
+#endif    /* DETDESC_ELEMENTS_H      */
diff --git a/DDCore/include/Evaluator.h b/DDCore/include/Evaluator.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d7b3143550a0f4f941984deb42d9e1c445d3fca
--- /dev/null
+++ b/DDCore/include/Evaluator.h
@@ -0,0 +1,261 @@
+// -*- C++ -*-
+// $Id: Evaluator.h,v 1.1 2005-12-07 15:08:51 jpalac Exp $
+// ---------------------------------------------------------------------------
+
+#ifndef XMLTOOLS_EVALUATOR_H
+#define XMLTOOLS_EVALUATOR_H
+
+namespace XmlTools {
+
+/**
+ * Evaluator of arithmetic expressions with an extendable dictionary.
+ *
+ * Taken from CLHEP 1.9.2.1
+ *
+ * Example:
+ * @code
+ *   #include "XmlTools/Evaluator.h"
+ *   XmlTools::Evaluator eval;
+ *   eval.setStdMath();
+ *   double res = eval.evaluate("sin(30*degree)");
+ *   if (eval.status() != XmlTools::Evaluator::OK) eval.print_error();
+ * @endcode
+ *
+ * @author Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch>
+ * @ingroup evaluator
+ */
+class Evaluator {
+ public: 
+
+  /**
+   * List of possible statuses.
+   * Status of the last operation can be obtained with status().
+   * In case if status() is an ERROR the corresponding error message
+   * can be printed with print_error().
+   * 
+   * @see status
+   * @see error_position
+   * @see print_error
+   */
+  enum {
+    OK,                         /**< Everything OK */
+    WARNING_EXISTING_VARIABLE,  /**< Redefinition of existing variable */
+    WARNING_EXISTING_FUNCTION,  /**< Redefinition of existing function */
+    WARNING_BLANK_STRING,       /**< Empty input string */
+    ERROR_NOT_A_NAME,           /**< Not allowed sysmbol in the name of variable or function */
+    ERROR_SYNTAX_ERROR,         /**< Systax error */
+    ERROR_UNPAIRED_PARENTHESIS, /**< Unpaired parenthesis */
+    ERROR_UNEXPECTED_SYMBOL,    /**< Unexpected sysbol */
+    ERROR_UNKNOWN_VARIABLE,     /**< Non-existing variable */
+    ERROR_UNKNOWN_FUNCTION,     /**< Non-existing function */
+    ERROR_EMPTY_PARAMETER,      /**< Function call has empty parameter */
+    ERROR_CALCULATION_ERROR     /**< Error during calculation */
+  };
+
+  /**
+   * Constructor.
+   */
+  Evaluator();
+
+  /**
+   * Destructor.
+   */
+  ~Evaluator(); 
+
+  /**
+   * Evaluates the arithmetic expression given as character string. 
+   * The expression may consist of numbers, variables and functions
+   * separated by arithmetic (+, - , /, *, ^, **) and logical
+   * operators (==, !=, >, >=, <, <=, &&, ||).
+   *
+   * @param  expression input expression.
+   * @return result of the evaluation.
+   * @see status
+   * @see error_position
+   * @see print_error
+   */
+  double evaluate(const char * expression);
+
+  /**
+   * Returns status of the last operation with the evaluator.
+   */
+  int status() const;
+
+  /**
+   * Returns position in the input string where the problem occured.
+   */
+  int error_position() const; 
+
+  /**
+   * Prints error message if status() is an ERROR.
+   */
+  void print_error() const;
+
+  /**
+   * Adds to the dictionary a variable with given value. 
+   * If a variable with such a name already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_VARIABLE.
+   *
+   * @param name name of the variable.
+   * @param value value assigned to the variable.
+   */
+  void setVariable(const char * name, double value);
+
+  /**
+   * Adds to the dictionary a variable with an arithmetic expression
+   * assigned to it.
+   * If a variable with such a name already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_VARIABLE.
+   *
+   * @param name name of the variable.
+   * @param expression arithmetic expression.
+   */
+  void setVariable(const char * name, const char * expression);
+
+  /**
+   * Adds to the dictionary a function without parameters.
+   * If such a function already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_FUNCTION.
+   *
+   * @param name function name.
+   * @param fun pointer to the real function in the user code. 
+   */
+  void setFunction(const char * name, double (*fun)());
+
+  /**
+   * Adds to the dictionary a function with one parameter.
+   * If such a function already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_FUNCTION.
+   *
+   * @param name function name.
+   * @param fun pointer to the real function in the user code. 
+   */
+  void setFunction(const char * name, double (*fun)(double));
+
+  /**
+   * Adds to the dictionary a function with two parameters.
+   * If such a function already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_FUNCTION.
+   *
+   * @param name function name.
+   * @param fun pointer to the real function in the user code. 
+   */
+  void setFunction(const char * name, double (*fun)(double,double));
+
+  /**
+   * Adds to the dictionary a function with three parameters.
+   * If such a function already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_FUNCTION.
+   *
+   * @param name function name.
+   * @param fun pointer to the real function in the user code. 
+   */
+  void setFunction(const char * name, double (*fun)(double,double,double));
+
+  /**
+   * Adds to the dictionary a function with four parameters.
+   * If such a function already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_FUNCTION.
+   *
+   * @param name function name.
+   * @param fun pointer to the real function in the user code. 
+   */
+  void setFunction(const char * name,
+		   double (*fun)(double,double,double,double));
+
+  /**
+   * Adds to the dictionary a function with five parameters.
+   * If such a function already exist in the dictionary,
+   * then status will be set to WARNING_EXISTING_FUNCTION.
+   *
+   * @param name function name.
+   * @param fun pointer to the real function in the user code. 
+   */
+  void setFunction(const char * name,
+                   double (*fun)(double,double,double,double,double));
+
+  /**
+   * Finds the variable in the dictionary.
+   * 
+   * @param  name name of the variable.
+   * @return true if such a variable exists, false otherwise.
+   */
+  bool findVariable(const char * name) const;
+
+  /**
+   * Finds the function in the dictionary.
+   * 
+   * @param  name name of the function to be unset.
+   * @param  npar number of parameters of the function.  
+   * @return true if such a function exists, false otherwise.
+   */
+  bool findFunction(const char * name, int npar) const;
+
+  /**
+   * Removes the variable from the dictionary.
+   * 
+   * @param name name of the variable.
+   */
+  void removeVariable(const char * name);
+
+  /**
+   * Removes the function from the dictionary.
+   * 
+   * @param name name of the function to be unset.
+   * @param npar number of parameters of the function.  
+   */
+  void removeFunction(const char * name, int npar);
+
+  /**
+   * Clear all settings.
+   */
+  void clear();
+
+  /**
+   * Sets standard mathematical functions and constants.
+   */
+  void setStdMath();
+
+  /**
+   * Sets system of units. Default is the SI system of units.
+   * To set the CGS (Centimeter-Gram-Second) system of units
+   * one should call:
+   *   setSystemOfUnits(100., 1000., 1.0, 1.0, 1.0, 1.0, 1.0);
+   *
+   * To set system of units accepted in the GEANT4 simulation toolkit
+   * one should call:
+   * @code
+   *   setSystemOfUnits(1.e+3, 1./1.60217733e-25, 1.e+9, 1./1.60217733e-10,
+   *                    1.0, 1.0, 1.0);
+   * @endcode
+   *
+   * The basic units in GEANT4 are:
+   * @code
+   *   millimeter              (millimeter = 1.)
+   *   nanosecond              (nanosecond = 1.)
+   *   Mega electron Volt      (MeV        = 1.)
+   *   positron charge         (eplus      = 1.)
+   *   degree Kelvin           (kelvin     = 1.)
+   *   the amount of substance (mole       = 1.)
+   *   luminous intensity      (candela    = 1.)
+   *   radian                  (radian     = 1.)
+   *   steradian               (steradian  = 1.)
+   * @endcode
+   */
+  void setSystemOfUnits(double meter    = 1.0,
+                        double kilogram = 1.0,
+                        double second   = 1.0,
+                        double ampere   = 1.0,
+                        double kelvin   = 1.0,
+                        double mole     = 1.0,
+                        double candela  = 1.0);
+
+private: 
+  void * p;                                 // private data 
+  Evaluator(const Evaluator &);             // copy constructor is not allowed
+  Evaluator & operator=(const Evaluator &); // assignment is not allowed
+};
+
+} // namespace XmlTools
+
+#endif /* XMLTOOLS_EVALUATOR_H */
diff --git a/DDCore/include/IDDescriptor.h b/DDCore/include/IDDescriptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb2695346d33d4037ad3721e95347d1f4694789d
--- /dev/null
+++ b/DDCore/include/IDDescriptor.h
@@ -0,0 +1,36 @@
+#ifndef DETDESC_IDDESCRIPTOR_H
+#define DETDESC_IDDESCRIPTOR_H
+
+#include <string>
+#include <vector>
+#include <map>
+
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  void split(const std::string& str, char delim, std::vector<std::string>& result);
+
+  class IDDescriptor  {
+  public:
+    typedef std::pair<int,int>          Field;
+    typedef std::map<std::string,Field> FieldMap;
+    typedef std::map<int,std::string>   FieldIDs;
+  protected:
+    FieldMap    m_fieldMap;
+    FieldIDs    m_fieldIDs;
+    int         m_maxBit;
+  public:
+    IDDescriptor();
+    IDDescriptor(const std::string& description);
+    virtual ~IDDescriptor();
+    void construct(const std::string& description);
+    int maxBit() const { return m_maxBit; }
+    const FieldIDs& ids() const    { return m_fieldIDs; }
+    const FieldMap& fields() const { return m_fieldMap; }
+  };
+
+}         /* End namespace DetDesc   */
+#endif    /* DETDESC_IDDESCRIPTOR_H     */
diff --git a/DDCore/include/LCDD.h b/DDCore/include/LCDD.h
new file mode 100644
index 0000000000000000000000000000000000000000..455b02e754ad93f464957e4a42e9527c7ed12799
--- /dev/null
+++ b/DDCore/include/LCDD.h
@@ -0,0 +1,109 @@
+#ifndef DETDESC_LCDDGEO_H
+#define DETDESC_LCDDGEO_H
+
+// Framework includes
+#include "Elements.h"
+#include "Objects.h"
+#include "Shapes.h"
+#include "Readout.h"
+#include "SubDetector.h"
+
+// C/C++ include files
+#include <map>
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  /*
+  *   XML namespace declaration
+  */
+  namespace Geometry  {
+
+    struct Subdetector;
+    struct Readout;
+    struct Document;
+    struct Solid;
+    struct Constant;
+    struct Volume;
+    struct Region;
+    struct Material;
+    struct Materials;
+    struct Position;
+    struct Rotation;
+    struct LimitSet;
+    struct VisAttr;
+    struct Compact;
+    struct LCDD;
+
+    struct LCDD {
+      typedef std::map<std::string,Handle_t> HandleMap;
+
+      virtual ~LCDD() {}
+
+      virtual Document document() const = 0;
+      virtual Document create() = 0;
+      virtual Document init() = 0;
+      virtual void endDocument() = 0;
+      virtual void addStdMaterials() = 0;
+
+      virtual Volume   worldVolume() const = 0;
+      virtual Volume   trackingVolume() const = 0;
+      virtual Rotation reflection() const = 0;
+      virtual Matrix   identity() const = 0;
+
+      virtual const HandleMap& header()  const = 0;
+      virtual const HandleMap& constants()  const = 0;
+      virtual const HandleMap& regions() const = 0;
+      virtual const HandleMap& structure()  const = 0;
+      virtual const HandleMap& solids()  const = 0;
+      virtual const HandleMap& positions() const = 0;
+      virtual const HandleMap& rotations() const = 0;
+      virtual const HandleMap& materials()  const = 0;
+      virtual const HandleMap& detectors()  const = 0;
+      virtual const HandleMap& readouts() const = 0;
+      virtual const HandleMap& visAttributes() const = 0;
+      virtual const HandleMap& limitsets()  const = 0;
+
+      virtual Region      region(const std::string& name)  const = 0;
+      virtual VisAttr     visAttributes(const std::string& name) const = 0;
+      virtual LimitSet    limitSet(const std::string& name)  const = 0;
+      virtual Material    material(const std::string& name)  const = 0;
+      virtual Readout     readout(const std::string& name)  const = 0;
+      virtual RefElement  idSpec(const std::string& name)  const = 0;
+      virtual Volume      pickMotherVolume(const Subdetector& sd) const = 0;
+      virtual Constant    constant(const std::string& name) const = 0;
+      virtual Position    position(const std::string& name) const = 0;
+      virtual Rotation    rotation(const std::string& name) const = 0;
+      virtual Solid       solid(const std::string& name) const = 0;
+      virtual Subdetector detector(const std::string& name) const = 0;
+
+      virtual LCDD& add(const Constant& constant) = 0;
+      virtual LCDD& add(const Solid& solid) = 0;
+      virtual LCDD& add(const Region& region) = 0;
+      virtual LCDD& add(const Volume& vol) = 0;
+      virtual LCDD& add(const Material& mat) = 0;
+      virtual LCDD& add(const VisAttr& attr) = 0;
+      virtual LCDD& add(const Position& pos) = 0;
+      virtual LCDD& add(const Rotation& rot) = 0;
+      virtual LCDD& add(const LimitSet& limset) = 0;
+      virtual LCDD& add(const Subdetector& detector) = 0;
+
+      virtual LCDD& addIDSpec(const RefElement& element) = 0;
+      virtual LCDD& addConstant(const RefElement& element) = 0;
+      virtual LCDD& addMaterial(const RefElement& element) = 0;
+      virtual LCDD& addVisAttribute(const RefElement& element) = 0;
+      virtual LCDD& addSensitiveDetector(const RefElement& e) = 0;
+      virtual LCDD& addLimitSet(const RefElement& limset) = 0;
+      virtual LCDD& addRegion(const RefElement& region) = 0;
+      virtual LCDD& addReadout(const RefElement& readout) = 0;
+      virtual LCDD& addDetector(const RefElement& detector) = 0;
+      //---Factory method-------
+      static LCDD& getInstance(void);
+      virtual void dump() const = 0;
+      
+    };
+  }       /* End namespace Geometry  */
+}         /* End namespace DetDesc   */
+#endif    /* DETDESC_LCDDGEO_H       */
diff --git a/DDCore/include/LinkDef.h b/DDCore/include/LinkDef.h
new file mode 100644
index 0000000000000000000000000000000000000000..50ead6370c2ca366a29e8fd15f8c87bb21f9519e
--- /dev/null
+++ b/DDCore/include/LinkDef.h
@@ -0,0 +1,32 @@
+//
+//  LinkDef.h
+//  
+//
+//  Created by Pere Mato on 22/1/12.
+//  Copyright 2012 __MyCompanyName__. All rights reserved.
+//
+
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class DetDesc::Geometry::LCDD;
+#pragma link C++ class DetDesc::Geometry::Document;
+#pragma link C++ class DetDesc::Geometry::Constant;
+#pragma link C++ class DetDesc::Geometry::Material;
+#pragma link C++ class DetDesc::Geometry::Volume;
+#pragma link C++ class DetDesc::Geometry::VisAttr;
+#pragma link C++ class DetDesc::Geometry::Subdetector;
+#pragma link C++ class DetDesc::Geometry::Box;
+#pragma link C++ class DetDesc::Geometry::Tube;
+#pragma link C++ class DetDesc::Geometry::Volume;
+#pragma link C++ class DetDesc::Geometry::PhysVol;
+#pragma link C++ class DetDesc::Geometry::Position;
+#pragma link C++ class DetDesc::Geometry::Rotation;
+#pragma link C++ class DetDesc::Geometry::Handle_t;
+#pragma link C++ namespace DetDesc::Geometry;
+#pragma link C++ function DetDesc::Geometry::_toDictionary(const std::string&, const std::string&);
+
+#endif
diff --git a/DDCore/include/Material.h b/DDCore/include/Material.h
new file mode 100644
index 0000000000000000000000000000000000000000..4bf631a7bb7b235927ee5be812d6b1531ff65e39
--- /dev/null
+++ b/DDCore/include/Material.h
@@ -0,0 +1,86 @@
+#ifndef DETDESC_MATERIAL_H
+#define DETDESC_MATERIAL_H
+#include <string>
+
+/*
+ *   Gaudi namespace declaration
+ */
+namespace DetDesc {
+
+  /** @class Material
+    *
+    *
+    */
+  struct Atom  {
+  protected:
+    /// Default constructor
+    Atom() : N(0), Z(0), A(0) {}
+  public:
+    int N;
+    int Z;
+    double A;
+    std::string name;
+    /// Initializing constructor: Create a Material entity
+    Atom(int n, int z, double a, const std::string& nam) : N(n), Z(z), A(a), name(nam) {}
+    /// Copy constructor: Create a Material entity
+    Atom(const Atom& c) : N(c.N), Z(c.Z), A(c.A), name(c.name) {}
+    /// Destructor,
+    ~Atom()   {}
+  };
+
+  struct Density  {
+    double      value;
+    std::string unit;
+    Density() : value(0.) {}
+    Density(double d, const std::string& u) : value(d), unit(u) {}
+    Density(const Density& c) : value(c.value), unit(c.unit) {}
+  };
+
+  struct Material  {
+  protected:
+    /// Default constructor
+    Material() {}
+  public:
+    struct Composite {
+      double fraction;
+      std::string element;
+      Composite(double f, const std::string& e) : fraction(f), element(e) {}
+      Composite(const Composite& c) : fraction(c.fraction), element(c.element) {}
+    };
+
+    Density D;
+    std::string name;
+    std::vector<Composite> composition;
+    /// Initializing constructor: Create a Material entity
+    Material(const Density& d, const std::string& nam) : D(d), name(nam) {}
+    /// Copy constructor: Create a Material entity
+    Material(const Material& c) : D(c.D), name(c.name), composition(c.composition) {}
+    /// Destructor,
+    virtual ~Material()   {}
+  };
+
+  struct Constant  {
+  public:
+    std::string name, value;
+    /// Default constructor
+    Constant() {}
+    /// Initializing constructor
+    Constant(const std::string& nam, const std::string& val) : name(nam), value(val) {}
+    /// Copy constructor: Create a Material entity
+    Constant(const Constant& c) : name(c.name), value(c.value) {}
+  };
+
+  struct Visualization   {
+  public:
+    enum DrawingStyle { WIREFRAME };
+    std::string name;
+    float alpha;
+    unsigned int rgb;
+    DrawingStyle drawingStyle;
+    bool showDaughters, visible;
+    /// Default constructor
+    Visualization() : alpha(0.), rgb(0), drawingStyle(WIREFRAME), showDaughters(false), visible(true)  {}
+  };
+
+}         /* End namespace DetDesc   */
+#endif    /* DETDESC_MATERIAL_H      */
diff --git a/DDCore/include/Objects.h b/DDCore/include/Objects.h
new file mode 100644
index 0000000000000000000000000000000000000000..aed8f3b23aa1ce772aac55dba59f9279c2ed06fd
--- /dev/null
+++ b/DDCore/include/Objects.h
@@ -0,0 +1,172 @@
+#ifndef DETDESC_GEOMETRY_OBJECTS_H
+#define DETDESC_GEOMETRY_OBJECTS_H
+
+// Framework include files
+#include "Elements.h"
+class TMap;
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  // Forward declarations
+  class IDDescriptor;
+
+  /*
+  *   XML namespace declaration
+  */
+  namespace Geometry  {
+
+    // Forward declarations
+    struct Document;
+
+    struct Author : public RefElement  {
+      /// Constructor to be used when reading the already parsed DOM tree
+      Author(Handle_t e) : RefElement(e)  {}
+      /// Constructor to be used when creating a new DOM tree
+      Author(const Document& doc) : RefElement(doc,"author","") {}
+      //void setAuthorName(const char* nam)    {  setAttr("name",nam); }
+      //void setAuthorEmail(const char* addr)  {  setAttr("email",addr); }
+    };
+
+    struct Header : public Element  {
+      /// Constructor to be used when reading the already parsed DOM tree
+      Header(Handle_t e=0) : Element(e)  {}
+      /// Constructor to be used when creating a new DOM tree
+      Header(const Document& doc) : Element(doc,"header") {}
+      //Header& fromCompact(Document doc, Handle_t element, const std::string& fname);
+    };
+
+    struct Constant : public RefElement  {
+      /// Constructor to be used when reading the already parsed DOM tree
+      Constant(Handle_t e) : RefElement(e)  {}
+      /// Constructor to be used when creating a new DOM tree
+      Constant(const Document& doc, const std::string& name);
+      /// Constructor to be used when creating a new DOM tree
+      Constant(const Document& doc, const std::string& name, const std::string& val);
+    };
+
+    struct Matrix : public RefElement  {
+      /// Constructor to be used RefElement reading the already parsed DOM tree
+      Matrix(Handle_t e) : RefElement(e) {}
+      /// Constructor to be used when creating a new DOM tree
+      Matrix(const Document& doc, const std::string& type, const std::string& name) 
+        : RefElement(doc,type,name) {}
+    };
+
+    struct Position : public Matrix  {
+      /// Constructor to be used when reading the already parsed DOM tree
+      Position(Handle_t e) : Matrix(e) {}
+      /// Constructor to be used when creating a new DOM tree
+      Position(const Document& doc, const std::string& name) 
+        : Matrix(doc,"position",name) {}
+      /// Constructor to be used when creating a new DOM tree. Automatically sets attributes
+      Position(const Document& doc, const std::string& name, double x, double y, double z);
+    };
+
+    struct Rotation : public Matrix  {
+      /// Constructor to be used RefElement reading the already parsed DOM tree
+      Rotation(Handle_t e) : Matrix(e) {}
+      /// Constructor to be used when creating a new DOM tree
+      Rotation(const Document& doc, const std::string& name) 
+        : Matrix(doc,"rotation",name) {}
+      /// Constructor to be used when creating a new DOM tree. Automatically sets attributes
+      Rotation(const Document& doc, const std::string& name, double x, double y, double z);
+    };
+
+    struct Atom : public RefElement  {
+      /// Constructor to be used when creating a new DOM tree
+      Atom(Handle_t e) : RefElement(e) {}
+      /// Constructor to be used when reading the already parsed DOM tree
+      Atom(const Document& doc, const std::string& name);
+    };
+
+    struct Material : public RefElement  {
+      /// Constructor to be used when creating a new DOM tree
+      Material(Handle_t e) : RefElement(e) {}
+      /// Constructor to be used when reading the already parsed DOM tree
+      Material(const Document& doc, const std::string& name);
+    };
+
+    struct VisAttr : public RefElement  {
+      struct Object  {
+        int           color;
+        unsigned char drawingStyle, lineStyle, showDaughters, visible;
+        Object() : color(0), drawingStyle(true), showDaughters(true), visible(true)  {}
+      };
+      enum DrawingStyle { 
+        WIREFRAME=0x1,
+        LAST_DRAWING_STYLE
+      };
+      enum LineStyle  {
+        SOLID=0x1,
+        DASHED=0x2,
+        LAST_LINE_STYLE
+      };
+      /// Constructor to be used when reading the already parsed DOM tree
+      VisAttr(Handle_t e) : RefElement(e) {}
+      /// Constructor to be used when creating a new DOM tree
+      VisAttr(const Document& doc, const std::string& name);
+      /// Set Flag to show/hide daughter elements
+      void setShowDaughters(bool value);
+      /// Set line style
+      void setLineStyle(LineStyle style);
+      /// Set drawing style
+      void setDrawingStyle(DrawingStyle style);
+      /// Set visibility flag
+      void setVisible(bool value);
+      /// Set alpha value
+      void setAlpha(float value);
+      /// Set object color
+      void setColor(float red, float green, float blue);
+    };
+
+    struct Limit : public RefElement  {
+      typedef std::pair<std::string,double> Object;
+
+      /// Constructor to be used when creating a new DOM tree
+      Limit(const Document& doc, const std::string& name);
+      void setParticles(const std::string& particleNames);
+      void setValue(double value);
+      void setUnit(const std::string& unit);
+    };
+
+    struct LimitSet : public RefElement  {
+      typedef TMap Object;
+      /// Constructor to be used when reading the already parsed DOM tree
+      LimitSet(Handle_t h) : RefElement(h) {}
+      /// Constructor to be used when creating a new DOM tree
+      LimitSet(const Document& doc, const std::string& name);
+      void addLimit(const RefElement& limit);
+    };
+
+    struct Region : public RefElement  {
+      struct Object  {
+        double      Attr_threshold;
+        double      Attr_cut;
+        bool        Attr_store_secondaries;
+        std::string Attr_lunit, Attr_eunit;
+      };
+      /// Constructor to be used when reading the already parsed DOM tree
+      Region(Handle_t h) : RefElement(h) {}
+      /// Constructor to be used when creating a new DOM tree
+      Region(const Document& doc, const std::string& name);
+      Region& setStoreSecondaries(bool value);
+      Region& setThreshold(double value);
+      Region& setCut(double value);
+      Region& setLengthUnit(const std::string& unit);
+      Region& setEnergyUnit(const std::string& unit);
+    };
+
+    struct IDSpec : public RefElement   {
+      /// Constructor to be used when reading the already parsed DOM tree
+      IDSpec(Handle_t h) : RefElement(h) {}
+      /// Constructor to be used when creating a new DOM tree
+      IDSpec(const Document& doc, const std::string& name, const IDDescriptor& dsc);
+      void addField(const std::string& name, const std::pair<int,int>& field);
+    };
+
+  }       /* End namespace Geometry           */
+}         /* End namespace DetDesc            */
+#endif    /* DETDESC_GEOMETRY_OBJECTS_H       */
diff --git a/DDCore/include/Readout.h b/DDCore/include/Readout.h
new file mode 100644
index 0000000000000000000000000000000000000000..8816d0fc295fc427cb491bc059dcf1567c6611a4
--- /dev/null
+++ b/DDCore/include/Readout.h
@@ -0,0 +1,43 @@
+#ifndef DETDESC_GEOMETRY_READOUT_H
+#define DETDESC_GEOMETRY_READOUT_H
+
+// Framework include files
+#include "Elements.h"
+#include "IDDescriptor.h"
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+  /*
+  *   Geometry namespace declaration
+  */
+  namespace Geometry  {
+
+    /**@class Readout  Readout.h DetDesc/lcdd/Readout.h
+      *
+      * @author  M.Frank
+      * @version 1.0
+      */
+    struct Readout : public RefElement {
+      struct Object {
+        Element     segmentation;
+        RefElement  id;
+        Object() : segmentation(0) {}
+      };
+      /// Constructor to be used when reading the already parsed object
+      Readout(Handle_t e);
+      /// Initializing constructor
+      Readout(const Document& doc, const std::string& name);
+      /// Access IDDescription structure
+      RefElement idSpec() const;
+      /// Access segmentation structure
+      Element segmentation()  const;
+      /// Assign IDDescription to readout structure
+      void setIDDescriptor(RefElement spec)   const;
+      /// Assign segmentation structure to readout
+      void setSegmentation(Element segment) const;
+    };
+  }       /* End namespace Geometry               */
+}         /* End namespace DetDesc                */
+#endif    /* DETDESC_GEOMETRY_READOUT_H           */
diff --git a/DDCore/include/Segmentations.h b/DDCore/include/Segmentations.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7927afd041d9d85d15ac8bdcc680c1df2f8491a
--- /dev/null
+++ b/DDCore/include/Segmentations.h
@@ -0,0 +1,142 @@
+#ifndef DETDESC_GEOMETRY_SEGMENTATIONS_H
+#define DETDESC_GEOMETRY_SEGMENTATIONS_H
+#include "Elements.h"
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  /*
+  *   XML namespace declaration
+  */
+  namespace Geometry  {
+
+    struct Segmentation : public Element   {
+      struct Object  {
+        unsigned char Attr_useForHitPosition;
+        union {
+          double values[10];
+          struct {
+            int Attr_nx;
+            int Attr_ny;
+            int Attr_nz;
+          } cartesian;
+          struct {
+            double Attr_grid_size_x;
+            double Attr_grid_size_y;
+            double Attr_grid_size_z;
+          } cartesian_grid;
+          struct {
+            int Attr_nphi;
+            int Attr_ntheta;
+            int Attr_nz;
+          } cylindrical_binning;
+          struct {
+            double Attr_grid_size_phi;
+            double Attr_grid_size_theta;
+            double Attr_grid_size_z;
+          } cylindrical_grid;        
+        } data;
+        Object() : Attr_useForHitPosition(0) {
+          data.cartesian_grid.Attr_grid_size_x = 0e0;
+          data.cartesian_grid.Attr_grid_size_y = 0e0;
+          data.cartesian_grid.Attr_grid_size_z = 0e0;
+        }
+      };
+      /// Constructor to be used when reading the already parsed object
+      Segmentation(Handle_t e);
+      /// Constructor to be used when reading the already parsed object
+      Segmentation(const Element& e);
+      /// Constructor to create a new segmentation object (to be called by super class only)
+      Segmentation(const Document& doc, const std::string& type);
+      bool useForHitPosition() const;
+      const std::string type() const;
+    };
+
+    struct ProjectiveCylinder : public Segmentation  {
+      /// Constructor to be used when reading the already parsed object
+      ProjectiveCylinder(const Element& e) : Segmentation(e) {}
+      /// Constructor to create a new segmentation object
+      ProjectiveCylinder(const Document& doc);
+      /// Accessors: get number of bins in theta
+      int thetaBins() const;
+      /// Accessors: get number of bins in phi
+      int phiBins() const;
+      /// Accessors: set number of bins in theta
+      void setThetaBins(int value);
+      /// Accessors: set grid size in Y
+      void setPhiBins(int value);
+    };
+
+    struct NonProjectiveCylinder : public Segmentation  {
+      /// Constructor to be used when reading the already parsed object
+      NonProjectiveCylinder(const Element& e) : Segmentation(e) {}
+      /// Constructor to create a new segmentation object
+      NonProjectiveCylinder(const Document& doc);
+      /// Accessors: get size of bins in Z
+      double gridSizeZ() const;
+      /// Accessors: get size of bins in phi
+      double gridSizePhi() const;
+      /// Accessors: set number of bins in theta
+      void setThetaBinSize(double value);
+      /// Accessors: set grid size in Y
+      void setPhiBinSize(double value);
+    };
+
+    struct ProjectiveZPlane : public Segmentation  {
+      /// Constructor to be used when reading the already parsed object
+      ProjectiveZPlane(const Element& e);
+      /// Constructor to create a new segmentation object
+      ProjectiveZPlane(const Document& doc);
+      /// Accessors: get number of bins in theta
+      int thetaBins() const;
+      /// Accessors: get number of bins in phi
+      int phiBins() const;
+      /// Accessors: set number of bins in theta
+      void setThetaBins(int value);
+      /// Accessors: set grid size in Y
+      void setPhiBins(int value);
+    };
+
+    struct GridXY : public Segmentation   {
+      /// Constructor to be used when reading the already parsed object
+      GridXY(const Element& h) : Segmentation(h) {}
+      /// Constructor to be used when creating a new object. Data are taken from the input handle
+      GridXY(const Document& doc, const std::string& tag);
+      /// Constructor to be used when creating a new object.
+      GridXY(const Document& doc, const std::string& tag, double size_x, double size_y);
+      /// Accessors: set grid size in X
+      void setGridSizeX(double value);
+      /// Accessors: set grid size in Y
+      void setGridSizeY(double value);
+    };
+
+    struct GridXYZ : public GridXY  {
+      /// Constructor to be used when reading the already parsed object
+      GridXYZ(const Element& h) : GridXY(h) {}
+      /// Constructor to be used when creating a new object.
+      GridXYZ(const Document& doc);
+      /// Constructor to be used when creating a new object.
+      GridXYZ(const Document& doc, double size_x, double size_y, double size_z);
+      /// Accessors: set grid size in Z
+      void setGridSizeZ(double value);
+    };
+
+    struct CartesianGridXY : public GridXY   {
+      /// Constructor to be used when reading the already parsed object
+      CartesianGridXY(const Element& element) : GridXY(element) {}
+      /// Constructor to be used when creating a new object. Data are taken from the input handle
+      CartesianGridXY(const Document& doc) : GridXY(doc,"cartesian_grid_xy") {}
+    };
+
+    struct GlobalGridXY : public GridXY   {
+      /// Constructor to be used when reading the already parsed object
+      GlobalGridXY(const Element& element) : GridXY(element) {}
+      /// Constructor to be used when creating a new object. Data are taken from the input handle
+      GlobalGridXY(const Document& doc) : GridXY(doc,"global_grid_xy") {}
+    };
+
+  }
+}         /* End namespace DetDesc                */
+#endif    /* DETDESC_GEOMETRY_SEGMENTATIONS_H     */
diff --git a/DDCore/include/Shapes.h b/DDCore/include/Shapes.h
new file mode 100644
index 0000000000000000000000000000000000000000..68460b9496b1519ab39568dcb3fde5f24bbf30b4
--- /dev/null
+++ b/DDCore/include/Shapes.h
@@ -0,0 +1,208 @@
+#ifndef DETDESC_GEOMETRY_SOLIDS_H
+#define DETDESC_GEOMETRY_SOLIDS_H
+
+// Framework include files
+#include "Elements.h"
+
+// C/C++ include files
+#define _USE_MATH_DEFINES
+#include <cmath>
+#ifndef M_PI
+  #define M_PI 3.14159265358979323846
+#endif
+#include <vector>
+
+// Forward declarations
+class TGeoShape;
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  /*
+  *   Geometry namespace declaration
+  */
+  namespace Geometry  {
+
+    // Forward declarations
+    struct Position;
+    struct Rotation;
+
+    /**@class ZPlane
+    *  Not identifyable object - no RefElement
+    *
+    *   @author  M.Frank
+    *   @version 1.0
+    */
+    struct ZPlane  {
+      double m_rmin, m_rmax, m_z;
+      /// Constructor to be used when creating a new object
+      ZPlane(double rmin, double rmax, double z);
+      /// Set values
+      ZPlane& setRmin(double value);
+      ZPlane& setRmax(double value);
+      ZPlane& setZ(double value);
+      double rmin() const { return m_rmin; }
+      double rmax() const { return m_rmax; }
+      double z()    const { return m_z;    }
+    };
+
+    struct Solid : public RefElement  {
+      /// Constructor to be used when reading the already parsed object
+      Solid(Handle_t e) : RefElement(e) {}
+      /// Constructor to be used when creating a new object
+      Solid(const Document& doc, const std::string& type, const std::string& name) : RefElement(doc,type,name) {}
+      /// Access to the shape pointer
+      TGeoShape& shape()  const;
+      /// Set dimensions and update bounding box
+      void setDimensions(double values[]);
+    };
+
+    struct Box : public Solid  {
+      /// Constructor to be used when reading the already parsed box object
+      Box(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new box object
+      Box(const Document& doc, const std::string& name);
+      /// Constructor to be used when creating a new box object
+      Box(const Document& doc, const std::string& name, double x, double y, double z);
+      /// Constructor to be used when creating a new box object
+      template<class X, class Y, class Z>
+      Box(const Document& doc, const std::string& name, const X& x, const Y& y, const Z& z)
+      : Solid(doc,"box",name)
+      {
+        setDimensions(_toDouble(x),_toDouble(y),_toDouble(z));
+      }
+      /// Set the box dimensions
+      Box& setDimensions(double x, double y, double z);
+    };
+
+    struct Polycone : public Solid {
+      /// Constructor to be used when reading the already parsed polycone object
+      Polycone(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new polycone object
+      Polycone(const Document& doc, const std::string& name);
+      /// Constructor to be used when creating a new polycone object
+      Polycone(const Document& doc, const std::string& name, double start, double delta);
+      /// Constructor to be used when creating a new polycone object. Add at the same time all Z planes
+      Polycone(const Document& doc, const std::string& name, double start, double delta, const std::vector<double>& rmin, const std::vector<double>& rmax, const std::vector<double>& z);
+      /// Add Z-planes to the Polycone
+      void addZPlanes(const std::vector<double>& rmin, const std::vector<double>& rmax, const std::vector<double>& z);
+    };
+
+    struct Tube : public Solid  {
+      /// Constructor to be used when reading the already parsed object
+      Tube(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new tube object
+      Tube(const Document& doc, const std::string& name);
+      /// Constructor to be used when creating a new tube object with attribute initialization
+      Tube(const Document& doc, const std::string& name, double rmin, double rmax, double z, double deltaPhi=2*M_PI);
+      /// Constructor to be used when creating a new tube object with attribute initialization
+#if 0
+      template<class RMIN, class RMAX, class Z, class DELTAPHI>
+      Tube(const Document& doc, const std::string& name, const RMIN& rmin, const RMAX& rmax, const Z& z, const DELTAPHI& deltaPhi)  
+      : Solid(doc,"tube",name)
+      {
+        setDimensions(_toDouble(rmin),_toDouble(rmax),_toDouble(z),_toDouble(deltaPhi));
+      }
+#endif
+      /// Set the box dimensions
+      Tube& setDimensions(double rmin, double rmax, double z, double deltaPhi=2*M_PI);
+    };
+
+    struct Cone : public Solid  {
+      /// Constructor to be used when reading the already parsed object
+      Cone(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new object
+      Cone(const Document& doc, const std::string& name);
+      /// Constructor to be used when creating a new object with attribute initialization
+      Cone(const Document& doc, const std::string& name,
+           double z,
+           double rmin1,
+           double rmax1,
+           double rmin2,
+           double rmax2);
+      template<typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2>
+      Cone(const Document& doc, const std::string& name, const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2)
+      : Solid(doc,"Cone",name)
+      {
+        setDimensions(_toDouble(z),_toDouble(rmin1),_toDouble(rmax1),_toDouble(rmin2),_toDouble(rmax2));
+      }
+      /// Set the box dimensions
+      Cone& setDimensions(double z,double rmin1,double rmax1,double rmin2,double rmax2);
+    };
+
+    struct Trap : public Solid   {
+      /// Constructor to be used when reading the already parsed object
+      Trap( Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new object with attribute initialization
+      Trap( const Document& doc, const std::string& name,
+            double z,
+            double theta,
+            double phi,
+            double y1,
+            double x1,
+            double x2,
+            double alpha1,
+            double y2,
+            double x3,
+            double x4,
+            double alpha2);
+      /// Set the trap dimensions
+      Trap& setDimensions(double z,double theta,double phi,
+                          double y1,double x1,double x2,double alpha1,
+                          double y2,double x3,double x4,double alpha2);
+    };
+
+    struct Trapezoid : public Solid {
+      /// Constructor to be used when reading the already parsed object
+      Trapezoid(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new object
+      Trapezoid(const Document& doc, const std::string& name);
+      /// Constructor to be used when creating a new object with attribute initialization
+      Trapezoid(const Document& doc, const std::string& name, double x1, double x2, double y1, double y2, double z);
+      /// Set the Trapezoid dimensions
+      Trapezoid& setDimensions(double x1, double x2, double y1, double y2, double z);
+      Trapezoid& setX1(double value);
+      Trapezoid& setX2(double value);
+      Trapezoid& setY1(double value);
+      Trapezoid& setY2(double value);
+      Trapezoid& setZ(double value);
+      double x1() const;
+      double x2() const;
+      double y1() const;
+      double y2() const;
+      double z() const;
+    };
+
+    struct PolyhedraRegular : public Solid {
+      /// Constructor to be used when reading the already parsed object
+      PolyhedraRegular(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new object
+      PolyhedraRegular(const Document& doc, const std::string& name, int nsides, double rmin, double rmax, double zlen);
+    };
+
+    struct BooleanSolid : public Solid  {
+      /// Constructor to be used when reading the already parsed object
+      BooleanSolid(Handle_t e) : Solid(e) {}
+      /// Constructor to be used when creating a new object
+      BooleanSolid(const Document& doc, const std::string& type, const std::string& name);
+      //BooleanSolid& setSolids(const Solid& s1, const Solid& s2);
+      //BooleanSolid& setPosition(const Position& pos);
+      //BooleanSolid& setRotation(const Rotation& rot);
+    };
+
+    struct SubtractionSolid : public BooleanSolid  {
+      /// Constructor to be used when reading the already parsed object
+      SubtractionSolid(Handle_t e) : BooleanSolid(e) {}
+      /// Constructor to be used when creating a new object
+      SubtractionSolid(const Document& doc, const std::string& name, const std::string& expr);
+      /// Constructor to be used when creating a new object
+      SubtractionSolid(const Document& doc, const std::string& name, const Solid& shape1, const Solid& shape2);
+      /// Constructor to be used when creating a new object
+      SubtractionSolid(const Document& doc, const std::string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot);
+    };
+
+  }       /* End namespace Geometry           */
+}         /* End namespace DetDesc            */
+#endif    /* DETDESC_GEOMETRY_SOLIDS_H        */
diff --git a/DDCore/include/SubDetector.h b/DDCore/include/SubDetector.h
new file mode 100644
index 0000000000000000000000000000000000000000..e49f52794c62a742e385189b4fa1d752e0b2d127
--- /dev/null
+++ b/DDCore/include/SubDetector.h
@@ -0,0 +1,103 @@
+#ifndef DETDESC_LCDD_DETECTOR_H
+#define DETDESC_LCDD_DETECTOR_H
+
+// Framework include files
+#include "Elements.h"
+#include "Objects.h"
+#include "Volumes.h"
+#include "Readout.h"
+
+// C/C++ include files
+#include <map>
+
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  /*
+  *   Geometry namespace declaration
+  */
+  namespace Geometry  {
+
+    struct SensitiveDetector;
+    struct Detector;
+    struct PhysVol;
+    struct Volume;
+    struct Solid;
+    struct LCDD;
+
+    struct SensitiveDetector : public RefElement  {
+      struct Object  {
+        int         Attr_verbose;
+        int         Attr_combine_hits;
+        double      Attr_ecut;
+        std::string Attr_eunit;
+        std::string Attr_hits_collection;
+        Element     Attr_segmentation;
+        RefElement  Attr_id;
+        Object() : Attr_verbose(0), Attr_segmentation(0) {}
+      };
+      SensitiveDetector() : RefElement(Handle_t(0)) {}
+      SensitiveDetector(Handle_t e) : RefElement(e) {}
+      SensitiveDetector(const RefElement& e) : RefElement(e) {}
+      SensitiveDetector(const Document& doc, const std::string& type, const std::string& name);
+      /// Access the type of the sensitive detector
+      std::string type() const;
+      SensitiveDetector& setCombineHits(bool value);
+      /// Assign the name of the hits collection
+      SensitiveDetector& setHitsCollection(const std::string& spec);
+      /// Assign the IDDescriptor reference
+      SensitiveDetector& setIDSpec(const RefElement& spec);
+      /// Assign the readout segmentation reference
+      SensitiveDetector& setSegmentation(Element seg);
+    };
+
+    struct Subdetector : public RefElement  {
+      typedef std::map<std::string,Subdetector> Children;
+      struct Object  {
+        int               Attr_id;
+        int               Attr_combine_hits;
+        Solid             Attr_envelope;
+        Volume            Attr_volume;
+        Material          Attr_material;
+        VisAttr           Attr_visualization;
+        Readout           Attr_readout;
+        Children          Attr_children;
+        Object();
+      };
+      void check(bool condition, const std::string& msg) const;
+
+      Subdetector(Handle_t e) : RefElement(e)  {}
+      Subdetector(const RefElement& e) : RefElement(e)  {}
+      /// Constructor for a new subdetector element
+      Subdetector(const Document& doc, const std::string& name, const std::string& type, int id);
+      Subdetector& setVisAttributes(const LCDD& lcdd, const std::string& solid, const Volume& volume);
+      Subdetector& setRegion(const LCDD& lcdd, const std::string& name, const Volume& volume);
+      Subdetector& setLimitSet(const LCDD& lcdd, const std::string& name, const Volume& volume);
+      Subdetector& setAttributes(const LCDD& lcdd, const Volume& volume,
+        const std::string& region, const std::string& limits, const std::string& vis);
+
+      Subdetector& setCombineHits(bool value, SensitiveDetector& sens);
+      Subdetector& add(const Subdetector& sub_element);
+      int             id() const;
+      std::string     type() const;
+      bool            isTracker() const;
+      bool            isCalorimeter() const;
+      bool            isInsideTrackingVolume() const;
+      bool            combineHits() const;
+      Material        material() const;
+      VisAttr         visAttr() const;
+      Readout         readout() const;
+      Subdetector&    setReadout(const Readout& readout);
+      Volume          volume() const;
+      Subdetector&    setVolume(const Volume& volume);
+      Solid           envelope() const;
+      Subdetector&    setEnvelope(const Solid& solid);
+      const Children& children() const;
+    };
+
+  }       /* End namespace Geometry      */
+}         /* End namespace DetDesc       */
+#endif    /* DETDESC_LCDD_DETECTOR_H     */
diff --git a/DDCore/include/Volumes.h b/DDCore/include/Volumes.h
new file mode 100644
index 0000000000000000000000000000000000000000..ec6ce84d6523d8027e03e40e77141d66f360ba81
--- /dev/null
+++ b/DDCore/include/Volumes.h
@@ -0,0 +1,101 @@
+#ifndef DETDESC_GEOMETRY_VOLUMES_H
+#define DETDESC_GEOMETRY_VOLUMES_H
+
+// Framework include files
+#include "Elements.h"
+#include "Shapes.h"
+#include "Objects.h"
+
+// C/C++ include files
+#include <map>
+
+// Forward declarations
+class TGeoVolume;
+
+/*
+ *   DetDesc namespace declaration
+ */
+namespace DetDesc {
+
+  class IDDescriptor;
+
+  /*
+  *   XML namespace declaration
+  */
+  namespace Geometry  {
+
+    // Forward declarations
+    struct Document;
+    struct Solid;
+    struct Region;
+    struct LimitSet;
+    struct Material;
+    struct Volume;
+    struct PhysVol;
+    struct Position;
+    struct Rotation;
+    struct VisAttr;
+    struct SensitiveDetector;
+  
+    struct Volume : public RefElement  {
+      struct Object  {
+        Region            Attr_region;
+        LimitSet          Attr_limits;
+        VisAttr           Attr_vis;
+        RefElement        Attr_sens_det;
+        Object() : Attr_region(0), Attr_limits(0), Attr_vis(0), Attr_sens_det(0) {}
+      };
+      /// Constructor to be used when reading the already parsed DOM tree
+      Volume(Handle_t e);
+      /// Copy from RefElement
+      Volume(const RefElement& v) : RefElement(v) {}
+      /// Copy from handle
+      Volume(const Volume& v) : RefElement(v) {}
+      /// Constructor to be used when creating a new geometry tree.
+      Volume(const Document& document, const std::string& name);
+      /// Constructor to be used when creating a new geometry tree. Also sets materuial and solid attributes
+      Volume(const Document& document, const std::string& name, const Solid& s, const Material& m);
+      void setSolid(const Solid& s)  const;
+      void setMaterial(const Material& m)  const;
+      //No. not for WIN32!! void addPhysVol(const PhysVol& vol)  const;
+      void addPhysVol(const PhysVol& vol, const Matrix& pos)  const;
+      void addPhysVol(const PhysVol& vol, const Position& pos, const Rotation& rot)  const;
+      //void addPhysVol(const Volume& vol, const Matrix& pos)  const;
+      //void addPhysVol(const Volume& vol, const Position& pos, const Rotation& rot)  const;
+      void setRegion(const Region& obj)  const;
+      void setLimitSet(const LimitSet& obj)  const;
+      void setSensitiveDetector(const SensitiveDetector& obj) const;
+      void setVisAttributes(const VisAttr& obj) const;
+      Solid solid() const;
+      Material material() const;
+      VisAttr  visAttributes() const;
+      RefElement sensitiveDetector() const;
+      Region region() const;
+      const TGeoVolume* volume() const;
+    };
+#if 0
+    struct PhysVol : RefElement {
+      struct Object  {
+        std::map<std::string,int> Attr_ids;
+        Volume                    Attr_volume;
+        Object() : Attr_volume(0) {}
+      };
+      /// Constructor to be used when reading the already parsed DOM tree
+      //PhysVol(Handle_t e);
+      /// Constructor to be used when creating a new DOM tree
+      PhysVol(const Document& document, const Volume& vol, const std::string& name);
+      /// Constructor to be used when creating a new DOM tree
+      PhysVol(const Document& document, const Volume& vol);
+      PhysVol& addPhysVolID(const std::string& name, int value);
+      Volume logVolume() const;
+      TGeoVolume* volume() const;
+    };
+#endif
+    struct PhysVol : RefElement {
+      /// Constructor to be used when reading the already parsed DOM tree
+      PhysVol(const RefElement& e) : RefElement(e) {}
+      PhysVol& addPhysVolID(const std::string& name, int value);
+    };
+  }       /* End namespace Geometry           */
+}         /* End namespace DetDesc            */
+#endif    /* DETDESC_GEOMETRY_VOLUMES_H       */
diff --git a/DDCore/python/SystemOfUnits.py b/DDCore/python/SystemOfUnits.py
new file mode 100644
index 0000000000000000000000000000000000000000..95f6954733b0e81ccacadea61eace6f6a6c234bb
--- /dev/null
+++ b/DDCore/python/SystemOfUnits.py
@@ -0,0 +1,278 @@
+# File: AthenaCommon/share/SystemOfUnits.py
+# Author: Wim Lavrijsen (LBNL, WLavrijsen@lbl.gov)
+# Created: 01/21/04
+# Last: 01/21/04
+
+# This script is a direct adaptation of CLHEP/Units/SystemOfUnits.h
+# and the following is the originial CLHEP comment:
+#
+# -----
+# HEP coherent system of Units
+#
+# This file has been provided to CLHEP by Geant4 (simulation toolkit for HEP).
+#
+# The basic units are :
+#  		millimeter              (millimeter)
+# 		nanosecond              (nanosecond)
+# 		Mega electron Volt      (MeV)
+# 		positron charge         (eplus)
+# 		degree Kelvin           (kelvin)
+#              the amount of substance (mole)
+#              luminous intensity      (candela)
+# 		radian                  (radian)
+#              steradian               (steradian)
+#
+# Below is a non exhaustive list of derived and pratical units
+# (i.e. mostly the SI units).
+# You can add your own units.
+#
+# The SI numerical value of the positron charge is defined here,
+# as it is needed for conversion factor : positron charge = e_SI (coulomb)
+#
+# The others physical constants are defined in the header file :
+#			PhysicalConstants.h
+#
+# Authors: M.Maire, S.Giani
+#
+# History:
+#
+# 06.02.96   Created.
+# 28.03.96   Added miscellaneous constants.
+# 05.12.97   E.Tcherniaev: Redefined pascal (to avoid warnings on WinNT)
+# 20.05.98   names: meter, second, gram, radian, degree
+#            (from Brian.Lasiuk@yale.edu (STAR)). Added luminous units.
+# 05.08.98   angstrom, picobarn, microsecond, picosecond, petaelectronvolt
+# 01.03.01   parsec    
+# -----
+
+# 
+# Length [L]
+#
+millimeter  = 1.                        
+millimeter2 = millimeter*millimeter
+millimeter3 = millimeter*millimeter*millimeter
+
+centimeter  = 10.*millimeter   
+centimeter2 = centimeter*centimeter
+centimeter3 = centimeter*centimeter*centimeter
+
+meter  = 1000.*millimeter                  
+meter2 = meter*meter
+meter3 = meter*meter*meter
+
+kilometer = 1000.*meter                   
+kilometer2 = kilometer*kilometer
+kilometer3 = kilometer*kilometer*kilometer
+
+parsec = 3.0856775807e+16*meter
+
+micrometer = 1.e-6 *meter             
+nanometer  = 1.e-9 *meter
+angstrom   = 1.e-10*meter
+fermi      = 1.e-15*meter
+
+barn       = 1.e-28*meter2
+millibarn  = 1.e-3 *barn
+microbarn  = 1.e-6 *barn
+nanobarn   = 1.e-9 *barn
+picobarn   = 1.e-12*barn
+
+# symbols
+mm  = millimeter                        
+mm2 = millimeter2
+mm3 = millimeter3
+
+cm  = centimeter   
+cm2 = centimeter2
+cm3 = centimeter3
+
+m  = meter                  
+m2 = meter2
+m3 = meter3
+
+km  = kilometer                   
+km2 = kilometer2
+km3 = kilometer3
+
+pc = parsec
+
+#
+# Angle
+#
+radian      = 1.                  
+milliradian = 1.e-3*radian
+degree = (3.14159265358979323846/180.0)*radian
+
+steradian   = 1.
+	
+# symbols
+rad  = radian	
+mrad = milliradian
+sr   = steradian
+deg  = degree
+
+#
+# Time [T]
+#
+nanosecond  = 1.
+second      = 1.e+9 *nanosecond
+millisecond = 1.e-3 *second
+microsecond = 1.e-6 *second
+picosecond  = 1.e-12*second
+femtosecond = 1.e-15*second
+
+hertz = 1./second
+kilohertz = 1.e+3*hertz
+megahertz = 1.e+6*hertz
+
+# symbols
+ns = nanosecond			
+s  = second
+ms = millisecond
+
+#
+# Electric charge [Q]
+#
+eplus = 1.                                   # positron charge
+e_SI  = 1.60217733e-19                       # positron charge in coulomb
+coulomb = eplus/e_SI                         # coulomb = 6.24150 e+18 * eplus
+
+#
+# Energy [E]
+#
+megaelectronvolt = 1. 
+electronvolt     = 1.e-6*megaelectronvolt
+kiloelectronvolt = 1.e-3*megaelectronvolt
+gigaelectronvolt = 1.e+3*megaelectronvolt
+teraelectronvolt = 1.e+6*megaelectronvolt
+petaelectronvolt = 1.e+9*megaelectronvolt
+
+joule = electronvolt/e_SI                    # joule = 6.24150 e+12 * MeV
+
+# symbols
+MeV = megaelectronvolt
+eV  = electronvolt
+keV = kiloelectronvolt
+GeV = gigaelectronvolt
+TeV = teraelectronvolt
+PeV = petaelectronvolt
+
+#
+# Mass [E][T^2][L^-2]
+#
+kilogram  = joule*second*second/(meter*meter)   
+gram      = 1.e-3*kilogram
+milligram = 1.e-3*gram
+
+# symbols
+kg = kilogram
+g  = gram
+mg = milligram
+
+#
+# Power [E][T^-1]
+#
+watt = joule/second                          # watt = 6.24150 e+3 * MeV/ns
+
+#
+# Force [E][L^-1]
+#
+newton = joule/meter                         # newton = 6.24150 e+9 * MeV/mm
+
+#
+# Pressure [E][L^-3]
+#
+hep_pascal = newton/m2	                     # pascal = 6.24150 e+3 * MeV/mm3
+pascal     = hep_pascal                      # a trick to avoid warnings 
+bar        = 100000*pascal                   # bar    = 6.24150 e+8 * MeV/mm3
+atmosphere = 101325*pascal                   # atm    = 6.32420 e+8 * MeV/mm3
+
+#
+# Electric current [Q][T^-1]
+#
+ampere      = coulomb/second                 # ampere = 6.24150 e+9 * eplus/ns
+milliampere = 1.e-3*ampere
+microampere = 1.e-6*ampere
+nanoampere  = 1.e-9*ampere
+
+#
+# Electric potential [E][Q^-1]
+#
+megavolt = megaelectronvolt/eplus
+kilovolt = 1.e-3*megavolt
+volt = 1.e-6*megavolt
+
+#
+# Electric resistance [E][T][Q^-2]
+#
+ohm = volt/ampere                            # ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns)
+
+#
+# Electric capacitance [Q^2][E^-1]
+#
+farad = coulomb/volt                         # farad = 6.24150e+24 * eplus/Megavolt
+millifarad = 1.e-3*farad
+microfarad = 1.e-6*farad
+nanofarad = 1.e-9*farad
+picofarad = 1.e-12*farad
+
+#
+# Magnetic Flux [T][E][Q^-1]
+#
+weber = volt*second                          # weber = 1000*megavolt*ns
+
+#
+# Magnetic Field [T][E][Q^-1][L^-2]
+#
+tesla     = volt*second/meter2               # tesla =0.001*megavolt*ns/mm2
+
+gauss     = 1.e-4*tesla
+kilogauss = 1.e-1*tesla
+
+#
+# Inductance [T^2][E][Q^-2]
+#
+henry = weber/ampere                         # henry = 1.60217e-7*MeV*(ns/eplus)**2
+
+#
+# Temperature
+#
+kelvin = 1.
+
+#
+# Amount of substance
+#
+mole = 1.
+
+#
+# Activity [T^-1]
+#
+becquerel = 1./second 
+curie = 3.7e+10 * becquerel
+
+#
+# Absorbed dose [L^2][T^-2]
+#
+gray = joule/kilogram 
+
+#
+# Luminous intensity [I]
+#
+candela = 1.
+
+#
+# Luminous flux [I]
+#
+lumen = candela*steradian
+
+#
+# Illuminance [I][L^-2]
+#
+lux = lumen/meter2
+
+#
+# Miscellaneous
+#
+perCent     = 0.01 
+perThousand = 0.001
+perMillion  = 0.000001
diff --git a/DDCore/python/lcdd.py b/DDCore/python/lcdd.py
new file mode 100644
index 0000000000000000000000000000000000000000..adb278dde7b970ea2af5d1b413f9c4cc7a85cd39
--- /dev/null
+++ b/DDCore/python/lcdd.py
@@ -0,0 +1,164 @@
+from math import cos, sin, pi, tan
+from os import path, listdir
+import SystemOfUnits
+import math
+from ROOT import SetOwnership, DetDesc, TGeoMixture, TGeoMedium
+
+LCDD     = DetDesc.Geometry.LCDD
+Constant = DetDesc.Geometry.Constant
+Material = DetDesc.Geometry.Material
+VisAttr  = DetDesc.Geometry.VisAttr
+Subdetector = DetDesc.Geometry.Subdetector
+Box = DetDesc.Geometry.Box
+Tube = DetDesc.Geometry.Tube
+Volume = DetDesc.Geometry.Volume
+PhysVol = DetDesc.Geometry.PhysVol
+Position = DetDesc.Geometry.Position
+Rotation = DetDesc.Geometry.Rotation
+Handle_t = DetDesc.Geometry.Handle_t
+_toDictionary = DetDesc.Geometry._toDictionary
+
+import xml.etree.ElementTree as xml
+unique_mat_id = 0x7FFEFEED
+
+constants = {}
+constants.update(SystemOfUnits.__dict__)
+drivers = {}
+drivers.update(math.__dict__)
+drivers.update(DetDesc.Geometry.__dict__)
+
+
+#---Enhancing the Element class with dedicated accessors--------------------------
+def _getInt(self,attrib):
+  return int(eval(self.get(attrib),constants))
+def _getFloat(self,attrib):
+  return float(eval(self.get(attrib),constants))
+def _getBool(self,attrib):
+  return bool(self.get(attrib))
+
+xml._ElementInterface.getI = _getInt
+xml._ElementInterface.getF = _getFloat
+xml._ElementInterface.getB = _getBool
+
+#---------------------------------------------------------------------------------
+def loadDrivers(*args):
+  if not args:
+    args = [path.join(path.dirname(__file__),'drivers')]
+  
+  for arg in args:
+    if path.exists(arg):
+      if path.isfile(arg):
+        print "Loading driver file ... %s" % arg
+        execfile(arg, drivers)
+      elif path.isdir(arg):
+        for f in listdir(arg) : 
+          if path.splitext(f)[1] == '.py':
+            print "Loading driver file ... %s" % path.join(arg,f)
+            execfile(path.join(arg,f), drivers)
+      else: raise "Path '%s' is not a directory or file" % arg 
+    else: raise "Path '%s' does not exists" % arg
+
+
+#---------------------------------------------------------------------------------
+def process_xmlfile(lcdd, file):
+  root = xml.parse(file).getroot()
+  for e in root :
+    if e.tag == 'detectors' : 
+      lcdd.init() # call init before processing 'detectors' (need world volume)
+    procs = globals().get('process_%s'% e.tag, None)
+    if not procs : 
+      procs = drivers.get('process_%s'% e.tag, None)
+    if procs : 
+      apply(procs,(lcdd, e))
+    else : print 'XML tag %s not processed!!! No function found.' % e.tag
+
+#--------------------------------------------------------------------------------
+def fromCompact(xmlfile):
+  print 'Converting Compact file: ', xmlfile
+  lcdd = LCDD.getInstance()
+  lcdd.create()
+  dname = path.dirname(xmlfile)
+  process_xmlfile(lcdd, dname+path.sep+'elements.xml')
+  process_xmlfile(lcdd, dname+path.sep+'materials.xml')
+  process_xmlfile(lcdd, xmlfile)
+  return lcdd
+
+#---------------------------------------------------------------------------------
+def process_define(lcdd, elem):
+  for c in elem.findall('constant'):
+    #print 'Adding constant ...', c.get('name')
+    lcdd.addConstant(Constant(lcdd.document(), c.get('name'),c.get('value')))
+    _toDictionary(c.get('name'),c.get('value')) #-- Make it known to the evaluator
+    constants[c.get('name')] = c.getF('value')
+
+#---------------------------------------------------------------------------------
+def process_element(lcdd, elem):
+  #print 'Adding element ...', elem.get('name')
+  doc = lcdd.document()
+  ename = elem.get('name')
+  tab = doc.GetElementTable()
+  element = tab.FindElement(ename)
+  if not element:
+    atom = elem.find('atom')
+    table.AddElement(atom.get('name'), atom.get('formula'), atom.getI('Z'), atom.getI('value'))
+
+#---------------------------------------------------------------------------------
+def process_materials(lcdd, elem):
+  for m in elem.findall('material'):
+    process_material(lcdd, m)
+
+#---------------------------------------------------------------------------------
+def process_material(lcdd, m):
+  #print 'Adding material ...', m.get('name')
+  doc     = lcdd.document()
+  matname = m.get('name')
+  density = m.find('D')
+  composites = m.findall('fraction')
+  table = doc.GetElementTable()
+  mat = doc.GetMaterial(matname)
+  if not mat:
+    mat = TGeoMixture(matname, len(composites), density.getF('value'))
+    SetOwnership( mat, False )
+  elts = [mat.GetElement(i).GetName() for i in range(mat.GetNelements())]
+  for c in composites:
+    nam = c.get('ref')
+    if nam not in elts:
+      fraction = c.getF('n')
+      if table.FindElement(nam):
+        mat.AddElement(table.FindElement(nam), fraction)
+      elif doc.GetMaterial(nam):
+        mat.AddElement(doc.GetMaterial(nam), fraction)
+      else:
+        raise 'Something going very wrong. Undefined material:' + nam
+  medium = doc.GetMedium(matname)
+  if not medium:
+    global unique_mat_id
+    unique_mat_id = unique_mat_id - 1
+    medium = TGeoMedium(matname, unique_mat_id, mat)
+    SetOwnership(medium, False)
+    medium.SetTitle('material')
+    medium.SetUniqueID(unique_mat_id)
+  lcdd.addMaterial(Handle_t(medium))
+
+
+#----------------------------------------------------------------------------------
+def process_display(lcdd, elem):
+  for v in elem.findall('vis'):
+    #print 'Adding vis ...', v.get('name')
+    visattr = VisAttr(lcdd.document(),v.get('name'))
+    if 'showDaughters' in v.keys() : visattr.setShowDaughters(v.getB('showDaughters'))
+    if 'visible' in v.keys() : visattr.setVisible(v.getB('visible'))
+    if 'alpha' in v.keys() : visattr.setAlpha(v.getF('alpha'))
+    if 'r' in v.keys() and 'g' in v.keys() and 'b' in v.keys() : visattr.setColor(v.getF('r'),v.getF('g'),v.getF('b'))
+    lcdd.addVisAttribute(visattr)
+
+#-----------------------------------------------------------------------------------
+def process_detectors(lcdd, elem):
+  for d in elem.findall('detector'):
+    procs = drivers.get('detector_%s'% d.get('type'), None)
+    if procs : 
+      detector = apply(procs,(lcdd, d))
+      lcdd.addDetector(detector)
+    else : 
+      print 'Detector type %s not found' % d.get('type')
+
diff --git a/DDCore/src/Elements.cpp b/DDCore/src/Elements.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4732b21c490c308e580b6f01fa7fb37653908fe3
--- /dev/null
+++ b/DDCore/src/Elements.cpp
@@ -0,0 +1,221 @@
+#include "Elements.h"
+#include "Internals.h"
+#include "TGeoManager.h"
+#include "TNamed.h"
+#include <iostream>
+#include <stdexcept>
+
+#include "TMap.h"
+#include "TColor.h"
+#include "TGeoBBox.h"
+#include "TGeoPcon.h"
+#include "TGeoPgon.h"
+#include "TGeoTube.h"
+#include "TGeoCone.h"
+#include "TGeoArb8.h"
+#include "TGeoTrd2.h"
+#include "TGeoBoolNode.h"
+#include "TGeoElement.h"
+#include "TGeoMatrix.h"
+#include "TGeoCompositeShape.h"
+#include "Evaluator.h"
+
+#include "LCDD.h"
+
+namespace DetDesc  {
+  XmlTools::Evaluator& evaluator();
+}
+
+namespace {
+  XmlTools::Evaluator& eval(DetDesc::evaluator());
+}
+
+using namespace std;
+using namespace DetDesc;
+using namespace DetDesc::Geometry;
+
+int DetDesc::Geometry::_toInt(const string& value)  {
+  string s(value);
+  size_t idx = s.find("(int)");
+  if ( idx != string::npos ) 
+    s.erase(idx,5);
+  while(s[0]==' ')s.erase(0,1);
+  double result = eval.evaluate(s.c_str());
+  if (eval.status() != XmlTools::Evaluator::OK) {
+    cerr << value << ": ";
+    eval.print_error();
+  }
+  return (int)result;
+}
+
+bool   DetDesc::Geometry::_toBool(const string& value)   {
+  return value == "true";
+}
+
+float DetDesc::Geometry::_toFloat(const string& value)   {
+  double result = eval.evaluate(value.c_str());
+  if (eval.status() != XmlTools::Evaluator::OK) {
+    cerr << value << ": ";
+    eval.print_error();
+  }
+  return (float)result;
+}
+
+double DetDesc::Geometry::_toDouble(const string& value)   {
+  double result = eval.evaluate(value.c_str());
+  if (eval.status() != XmlTools::Evaluator::OK) {
+    cerr << value << ": ";
+    eval.print_error();
+  }
+  return result;
+}
+
+void DetDesc::Geometry::_toDictionary(const string& name, const string& value)  {
+  string n=name, v=value;
+  size_t idx = v.find("(int)");
+  if ( idx != string::npos ) 
+    v.erase(idx,5);
+  idx = v.find("(float)");
+  if ( idx != string::npos ) 
+    v.erase(idx,7);
+  while(v[0]==' ')v.erase(0,1);
+  double result = eval.evaluate(v.c_str());
+  if (eval.status() != XmlTools::Evaluator::OK) {
+    cerr << value << ": ";
+    eval.print_error();
+  }
+  eval.setVariable(n.c_str(),result);
+}
+
+string DetDesc::Geometry::_toString(bool value)    {
+  char text[32];
+  ::sprintf(text,"%s",value ? "true" : "false");
+  return text;
+}
+
+string DetDesc::Geometry::_toString(int value)   {
+  char text[32];
+  ::sprintf(text,"%d",value);
+  return text;
+}
+
+string DetDesc::Geometry::_toString(float value)   {
+  char text[32];
+  ::sprintf(text,"%f",value);
+  return text;
+}
+
+string DetDesc::Geometry::_toString(double value)   {
+  char text[32];
+  ::sprintf(text,"%f",value);
+  return text;
+}
+
+
+#include "Volumes.h"
+#include "Objects.h"
+#include "Readout.h"
+#include "SubDetector.h"
+#include "Segmentations.h"
+Element_t* Document::createElt(const string& tag)  const {
+  TNamed* object = 0;
+  if ( tag == "box" )
+    object = new TGeoBBox();
+  else if ( tag == "polycone" )
+    object = new TGeoPcon();
+#if 0
+  else if ( tag == "tube" )
+    object = new TGeoTubeSeg();
+#endif
+  else if ( tag == "cone" )
+    object = new TGeoCone();
+  else if ( tag == "trap" )
+    object = new TGeoTrap();
+  else if ( tag == "trd2" )
+    object = new TGeoTrd2();
+  else if ( tag == "polyhedra" )
+    object = new TGeoPgon();
+  else if ( tag == "subtraction" )
+    object = 0;
+    //object = new TGeoCompositeShape();
+  else if ( tag == "element" )
+    object = new TGeoElement();
+  else if ( tag == "material" )
+    object = new TGeoMedium();
+  else if ( tag == "rotation" )
+    object = new TGeoRotation();
+  else if ( tag == "position" )
+    object = new TGeoTranslation();
+  else if ( tag == "identity" )
+    object = new TGeoIdentity();
+  else if ( tag == "constant" )
+    object = new TNamed();
+#if 0
+  else if ( tag == "volume" )
+    object = new Value<TGeoVolume,Volume::Object>();
+  else if ( tag == "physvol" )
+    object = new Value<TGeoVolume,PhysVol::Object>();
+#endif
+  else if ( tag == "limitset" )
+    object = new Value<TNamed,TMap>();
+  else if ( tag == "limit" )
+    object = new Value<TNamed,Limit::Object>();
+  else if ( tag == "vis" )
+    object = new Value<TNamed,VisAttr::Object>();
+  else if ( tag == "readout" )
+    object = new Value<TNamed,Readout::Object>();
+  else if ( tag == "region" )
+    object = new Value<TNamed,Region::Object>();
+  else if ( tag == "grid_xyz" )
+    object = new Value<TNamed,Segmentation::Object>();
+  else if ( tag == "global_grid_xy" )
+    object = new Value<TNamed,Segmentation::Object>();
+  else if ( tag == "cartesian_grid_xy" )
+    object = new Value<TNamed,Segmentation::Object>();
+  else if ( tag == "projective_cylinder" )
+    object = new Value<TNamed,Segmentation::Object>();
+  else if ( tag == "nonprojective_cylinder" )
+    object = new Value<TNamed,Segmentation::Object>();
+  else if ( tag == "projective_zplane" )
+    object = new Value<TNamed,Segmentation::Object>();
+  else if ( tag == "subdetector" )
+    object = new Value<TNamed,Subdetector::Object>();
+  else if ( tag == "sensitive_detector" )
+    object = new Value<TNamed,SensitiveDetector::Object>();
+
+  if ( object )  {
+    object->SetTitle(tag.c_str());
+    return object;
+  }
+  return 0;//m_doc->createElement(tag);
+}
+
+Element::Element(const Document& document, const std::string& type) 
+: m_element(document.createElt(type))
+{ }
+
+RefElement::RefElement(const Document& document, const std::string& type, const std::string& name)  
+: Element(document, type)
+{
+  setName(name);
+}
+
+RefElement::RefElement(const Handle_t& e) : Element(e)
+{
+  //TNamed *p = m_element._ptr<TNamed>();
+}
+
+const char* RefElement::name() const  {
+  TNamed *p = m_element._ptr<TNamed>();
+  return p ? p->GetName() : "";
+}
+
+const char* RefElement::refName() const  {
+  TNamed *p = m_element._ptr<TNamed>();
+  return p ? p->GetName() : "";
+}
+
+void RefElement::setName(const std::string& new_name)  {
+  TNamed *p = m_element._ptr<TNamed>();
+  if ( p ) p->SetName(new_name.c_str());
+}
diff --git a/ILDEx/CMakeLists.txt b/ILDEx/CMakeLists.txt
index aa841d2cc5a0c16afde27c17c9d4ee6431a1adb7..f9da59c4730b71724e900a20497b3a8ee5557b41 100644
--- a/ILDEx/CMakeLists.txt
+++ b/ILDEx/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
 project(ILDExample)
  
 
-SET( Geant4_CONFIG_DEBUG TRUE )
+set( Geant4_CONFIG_DEBUG TRUE )
 find_package(Geant4 REQUIRED COMPONENTS gdml qt )
 include(${Geant4_USE_FILE})