diff --git a/DDCond/include/DDCond/ConditionsTags.h b/DDCond/include/DDCond/ConditionsTags.h index a0253a212f2b3f3e477aa46a37891bca201b6ba0..704c856c9d2a1de59e546f49c270fa89c3b215d1 100644 --- a/DDCond/include/DDCond/ConditionsTags.h +++ b/DDCond/include/DDCond/ConditionsTags.h @@ -1,4 +1,3 @@ -// $Id: $ //========================================================================== // AIDA Detector description implementation for LCD //-------------------------------------------------------------------------- diff --git a/DDCond/src/plugins/ConditionsRepositoryParser.cpp b/DDCond/src/plugins/ConditionsRepositoryParser.cpp index 5750f425de483d4d1060078263115a5f7f7c37a1..8e0126197f542468bc1053cfa95a6b8f2aac4493 100644 --- a/DDCond/src/plugins/ConditionsRepositoryParser.cpp +++ b/DDCond/src/plugins/ConditionsRepositoryParser.cpp @@ -234,7 +234,7 @@ namespace DD4hep { Converter<conditions>(lcdd,param,optional)(doc.root()); return; } - xml_coll_t(e,_UC(detelement)).for_each(Converter<arbitrary>(lcdd,param,optional)); + xml_coll_t(e,_U(detelement)).for_each(Converter<arbitrary>(lcdd,param,optional)); } /// Convert manager repository objects @@ -249,16 +249,18 @@ namespace DD4hep { XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); Converter<arbitrary>(lcdd,param,optional)(doc.root()); } - for( xml_coll_t c(element,_UC(property)); c; ++c) { + for( xml_coll_t c(element,_U(property)); c; ++c) { xml_dim_t d = c; string nam = d.nameStr(); string val = d.valueStr(); try { - printout(s_parseLevel,"XMLConditions","++ Setup conditions Manager[%s] = %s",nam.c_str(),val.c_str()); + printout(s_parseLevel,"XMLConditions","++ Setup conditions Manager[%s] = %s", + nam.c_str(),val.c_str()); arg->manager[nam].str(val); } catch(const std::exception& e) { - printout(ERROR,"XMLConditions","++ FAILED: conditions Manager[%s] = %s [%s]",nam.c_str(),val.c_str(),e.what()); + printout(ERROR,"XMLConditions","++ FAILED: conditions Manager[%s] = %s [%s]", + nam.c_str(),val.c_str(),e.what()); } } arg->manager.initialize(); @@ -369,12 +371,12 @@ namespace DD4hep { (*this)(doc.root()); } xml_coll_t(e,_U(value)).for_each(Converter<value>(lcdd,param,optional)); - xml_coll_t(e,_UC(mapping)).for_each(Converter<mapping>(lcdd,param,optional)); - xml_coll_t(e,_UC(sequence)).for_each(Converter<sequence>(lcdd,param,optional)); - xml_coll_t(e,_UC(pressure)).for_each(Converter<pressure>(lcdd,param,optional)); - xml_coll_t(e,_UC(alignment)).for_each(Converter<alignment>(lcdd,param,optional)); - xml_coll_t(e,_UC(temperature)).for_each(Converter<temperature>(lcdd,param,optional)); - xml_coll_t(e,_UC(detelement)).for_each(Converter<detelement>(lcdd,param,optional)); + xml_coll_t(e,_U(mapping)).for_each(Converter<mapping>(lcdd,param,optional)); + xml_coll_t(e,_U(sequence)).for_each(Converter<sequence>(lcdd,param,optional)); + xml_coll_t(e,_U(pressure)).for_each(Converter<pressure>(lcdd,param,optional)); + xml_coll_t(e,_U(alignment)).for_each(Converter<alignment>(lcdd,param,optional)); + xml_coll_t(e,_U(temperature)).for_each(Converter<temperature>(lcdd,param,optional)); + xml_coll_t(e,_U(detelement)).for_each(Converter<detelement>(lcdd,param,optional)); } /// Convert repository objects @@ -384,9 +386,9 @@ namespace DD4hep { * \date 01/04/2014 */ template <> void Converter<repository>::operator()(xml_h element) const { - xml_coll_t(element,_UC(manager)).for_each(Converter<manager>(lcdd,param,optional)); - xml_coll_t(element,_UC(iov_type)).for_each(Converter<iov_type>(lcdd,param,optional)); - xml_coll_t(element,_UC(iov)).for_each(Converter<iov>(lcdd,param,optional)); + xml_coll_t(element,_U(manager)).for_each(Converter<manager>(lcdd,param,optional)); + xml_coll_t(element,_U(iov_type)).for_each(Converter<iov_type>(lcdd,param,optional)); + xml_coll_t(element,_U(iov)).for_each(Converter<iov>(lcdd,param,optional)); } /// Convert any top level tag in the XML file diff --git a/DDCore/include/DD4hep/ComponentProperties.h b/DDCore/include/DD4hep/ComponentProperties.h index bfb150e89adb900a705d74a47979b69603aa1343..ef9d151a39ffc12776c6e9a15cbe4c0f202d76c1 100644 --- a/DDCore/include/DD4hep/ComponentProperties.h +++ b/DDCore/include/DD4hep/ComponentProperties.h @@ -118,6 +118,8 @@ namespace DD4hep { std::string str() const; /// Conversion from string value Property& str(const std::string& input); + /// Conversion from string value + const Property& str(const std::string& input) const; /// Assignment operator Property& operator=(const Property& p) = default; /// Assignment operator / set new balue diff --git a/DDCore/include/DD4hep/Volumes.h b/DDCore/include/DD4hep/Volumes.h index c7c210c75cbe267278d79562b949dfb18ac42044..6d72ade60ae90e419f50ec2dd1d151777cd8f255 100644 --- a/DDCore/include/DD4hep/Volumes.h +++ b/DDCore/include/DD4hep/Volumes.h @@ -126,11 +126,11 @@ namespace DD4hep { return *this; } /// TGeoExtension overload: Method called whenever requiring a pointer to the extension - virtual TGeoExtension *Grab(); + virtual TGeoExtension *Grab() override; /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore - virtual void Release() const; + virtual void Release() const override; /// Enable ROOT persistency - ClassDef(PlacedVolumeExtension,1); + ClassDefOverride(PlacedVolumeExtension,1); }; /// Handle class holding a placed volume (also called physical volume) @@ -226,11 +226,11 @@ namespace DD4hep { referenced = c.referenced; } /// TGeoExtension overload: Method called whenever requiring a pointer to the extension - virtual TGeoExtension *Grab(); + virtual TGeoExtension *Grab() override; /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore - virtual void Release() const; + virtual void Release() const override; /// Enable ROOT persistency - ClassDef(VolumeExtension,1); + ClassDefOverride(VolumeExtension,1); }; /// Handle class holding a placed volume (also called physical volume) diff --git a/DDCore/src/ComponentProperties.cpp b/DDCore/src/ComponentProperties.cpp index 954849e2a1b2819f4eb2386ef251de27d4e27f38..55bec55c7736f9331e1352ba06021f8d576e5aa6 100644 --- a/DDCore/src/ComponentProperties.cpp +++ b/DDCore/src/ComponentProperties.cpp @@ -95,7 +95,16 @@ string Property::str() const { } /// Conversion from string value -Property& Property::str(const std::string& input) { +const Property& Property::str(const std::string& input) const { + if (m_hdl && m_par ) { + m_hdl->fromString(m_par,input); + return *this; + } + throw runtime_error("Attempt to access property grammar from invalid object."); +} + +/// Conversion from string value +Property& Property::str(const std::string& input) { if (m_hdl && m_par ) { m_hdl->fromString(m_par,input); return *this; diff --git a/DetSegmentation/CMakeLists.txt b/DetSegmentation/CMakeLists.txt deleted file mode 100644 index e34497a4ca4a142cd4180824997d439b26e15820..0000000000000000000000000000000000000000 --- a/DetSegmentation/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -#================================================================================= -# -# AIDA Detector description implementation for LCD -#--------------------------------------------------------------------------------- -# Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -# All rights reserved. -# -# For the licensing terms see $DD4hepINSTALL/LICENSE. -# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -# -#================================================================================= -dd4hep_package( DetSegmentation - USES [ROOT REQUIRED COMPONENTS Geom GenVector] - DDSegmentation - DDCore - INCLUDE_DIRS include - INSTALL_INCLUDES include/DetSegmentation) - -#dd4hep_add_package_library ( DetSegmentation -# INCLUDE_DIRS -# LINK_LIBRARIES -# SOURCES src/*.cpp -# ) - -dd4hep_add_plugin(DetSegmentation SOURCES src/*.cpp ) diff --git a/DetSegmentation/include/DetSegmentation/GridPhiEta.h b/DetSegmentation/include/DetSegmentation/GridPhiEta.h deleted file mode 100644 index 4720dcc55c179d4d07b63910c1becd31a1c76fe2..0000000000000000000000000000000000000000 --- a/DetSegmentation/include/DetSegmentation/GridPhiEta.h +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef DETSEGMENTATION_GRIDPHIETA_H -#define DETSEGMENTATION_GRIDPHIETA_H - -#include "DDSegmentation/Segmentation.h" - -/* #include "DDSegmentation/SegmentationUtil.h" */ -#include "TVector3.h" -#include <cmath> - -/** GridPhiEta Detector/DetSegmentation/DetSegmentation/GridPhiEta.h GridPhiEta.h - * - * Segmentation in eta and phi. - * It requires 'export LD_PRELOAD_PATH=$LD_PRELOAD_PATH:build.$BINARY_TAG/lib/libDetSegmentation.so' - * - * @author Anna Zaborowska - */ - -namespace DD4hep { -namespace DDSegmentation { -class GridPhiEta: public Segmentation { -public: - /// default constructor using an arbitrary type - GridPhiEta(BitField64* decoder); - /// default constructor using an arbitrary type - GridPhiEta(const std::string& aCellEncoding); - /// destructor - virtual ~GridPhiEta(); - - /** Determine the global position based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Position. - */ - virtual Vector3D position(const CellID& aCellID) const; - /** Determine the cell ID based on the position. - * @param[in] aLocalPosition (not used). - * @param[in] aGlobalPosition position in the global coordinates. - * @param[in] aVolumeId ID of a volume. - * return Cell ID. - */ - virtual CellID cellID(const Vector3D& aLocalPosition, const Vector3D& aGlobalPosition, const VolumeID& aVolumeID) const; - /** Determine the pseudorapidity based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Pseudorapidity. - */ - double eta(const CellID& aCellID) const; - /** Determine the azimuthal angle based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Phi. - */ - double phi(const CellID& aCellID) const; - /** Get the grid size in pseudorapidity. - * return Grid size in eta. - */ - inline double gridSizeEta() const { - return m_gridSizeEta; - } - /** Get the number of bins in azimuthal angle. - * return Number of bins in phi. - */ - inline int phiBins() const { - return m_phiBins; - } - /** Get the coordinate offset in pseudorapidity. - * return The offset in eta. - */ - inline double offsetEta() const { - return m_offsetEta; - } - /** Get the coordinate offset in azimuthal angle. - * return The offset in phi. - */ - inline double offsetPhi() const { - return m_offsetPhi; - } - /** Get the field name used for pseudorapidity - * return The field name for eta. - */ - inline std::string fieldNameEta() const { - return m_etaID; - } - /** Get the field name for azimuthal angle. - * return The field name for phi. - */ - inline std::string fieldNamePhi() const { - return m_phiID; - } - /** Set the grid size in pseudorapidity. - * @param[in] aCellSize Cell size in eta. - */ - void setGridSizeEta(double aCellSize) { - m_gridSizeEta = aCellSize; - } - /** Set the number of bins in azimuthal angle. - * @param[in] aNumberBins Number of bins in phi. - */ - inline void setPhiBins(int bins) { - m_phiBins = bins; - } - /** Set the coordinate offset in pseudorapidity. - * @param[in] aOffset Offset in eta. - */ - inline void setOffsetEta(double offset) { - m_offsetEta = offset; - } - /** Set the coordinate offset in azimuthal angle. - * @param[in] aOffset Offset in phi. - */ - inline void setOffsetPhi(double offset) { - m_offsetPhi = offset; - } - /** Set the field name used for pseudorapidity. - * @param[in] aFieldName Field name for eta. - */ - inline void setFieldNameEta(const std::string& fieldName) { - m_etaID = fieldName; - } - /** Set the field name used for azimuthal angle. - * @param[in] aFieldName Field name for phi. - */ - inline void setFieldNamePhi(const std::string& fieldName) { - m_phiID = fieldName; - } - /// calculates the Cartesian position from spherical coordinates (r, phi, eta) - inline Vector3D positionFromREtaPhi(double ar, double aeta, double aphi) const { - return Vector3D(ar * std::cos(aphi), ar * std::sin(aphi), ar * std::sinh(aeta)); - } - /// calculates the pseudorapidity from Cartesian coordinates - inline double etaFromXYZ(const Vector3D& aposition) const { - TVector3 vec(aposition.X, aposition.Y, aposition.Z); - return vec.Eta(); - } - /// from SegmentationUtil - /// to be removed once SegmentationUtil can be included w/o linker error - /// calculates the azimuthal angle phi from Cartesian coordinates - inline double phiFromXYZ(const Vector3D& aposition) const { - return std::atan2(aposition.Y, aposition.X); - } - /// from SegmentationUtil - /// to be removed once SegmentationUtil can be included w/o linker error - /// calculates the radius in the xy-plane from Cartesian coordinates - inline double radiusFromXYZ(const Vector3D& aposition) const { - return std::sqrt(aposition.X * aposition.X + aposition.Y * aposition.Y); - } - -private: - /// determine the pseudorapidity based on the current cell ID - double eta() const; - /// determine the azimuthal angle phi based on the current cell ID - double phi() const; - - /// the grid size in eta - double m_gridSizeEta; - /// the number of bins in phi - int m_phiBins; - /// the coordinate offset in eta - double m_offsetEta; - /// the coordinate offset in phi - double m_offsetPhi; - /// the field name used for eta - std::string m_etaID; - /// the field name used for phi - std::string m_phiID; -}; -} -} -#endif /* DETSEGMENTATION_GRIDPHIETA_H */ diff --git a/DetSegmentation/include/DetSegmentation/GridPhiEtaHandle.h b/DetSegmentation/include/DetSegmentation/GridPhiEtaHandle.h deleted file mode 100644 index ba5481cb8412e8882218663357e9430e38612a71..0000000000000000000000000000000000000000 --- a/DetSegmentation/include/DetSegmentation/GridPhiEtaHandle.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef DD4HEP_DDCORE_GRIDPHIETA_H -#define DD4HEP_DDCORE_GRIDPHIETA_H 1 - -// Framework include files -#include "DD4hep/Segmentations.h" - -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for base segmentations - namespace DDSegmentation { class GridPhiEta; } - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::GridPhiEta> > GridPhiEtaHandle; - - /// Implementation class for the grid XZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class GridPhiEta : public GridPhiEtaHandle { - public: - /// Defintiion of the basic handled object - typedef GridPhiEtaHandle::Implementation Object; - - public: - /// Default constructor - GridPhiEta() = default; - /// Copy constructor - GridPhiEta(const GridPhiEta& e) = default; - /// Copy Constructor from segmentation base object - GridPhiEta(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - GridPhiEta(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> GridPhiEta(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - GridPhiEta& operator=(const GridPhiEta& seg) = default; - /// Equality operator - bool operator==(const GridPhiEta& seg) const - { return m_element == seg.m_element; } - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in R - double gridSizeEta() const; - /// access the grid size in Phi - int phiBins() const; - /// set the grid size in R - void setGridSizeEta(double cellSize) const; - /// set the grid size in Phi - void setPhiBins(int cellSize) const; - /// access the coordinate offset in R - double offsetEta() const; - /// access the coordinate offset in Phi - double offsetPhi() const; - /// set the coordinate offset in R - void setOffsetEta(double offset) const; - /// set the coordinate offset in Phi - void setOffsetPhi(double offset) const; - /// access the field name used for R - const std::string& fieldNameEta() const; - /// access the field name used for Phi - const std::string& fieldNamePhi() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_POLARGRIDRPHI_H diff --git a/DetSegmentation/include/DetSegmentation/GridRPhiEta.h b/DetSegmentation/include/DetSegmentation/GridRPhiEta.h deleted file mode 100644 index 79b898fbf4b9b265ed74f2cd9be01196479ad3af..0000000000000000000000000000000000000000 --- a/DetSegmentation/include/DetSegmentation/GridRPhiEta.h +++ /dev/null @@ -1,213 +0,0 @@ -#ifndef DETSEGMENTATION_GRIDRPHIETA_H -#define DETSEGMENTATION_GRIDRPHIETA_H - -#include "DDSegmentation/Segmentation.h" - -/* #include "DDSegmentation/SegmentationUtil.h" */ -#include "TVector3.h" -#include <cmath> - -/** GridRPhiEta Detector/DetSegmentation/DetSegmentation/GridRPhiEta.h GridRPhiEta.h - * - * Segmentation in eta and phi. - * It requires 'export LD_PRELOAD_PATH=$LD_PRELOAD_PATH:build.$BINARY_TAG/lib/libDetSegmentation.so' - * - * @author Anna Zaborowska - */ - -namespace DD4hep { -namespace DDSegmentation { -class GridRPhiEta: public Segmentation { -public: - /// default constructor using an arbitrary type - GridRPhiEta(const std::string& aCellEncoding); - /// destructor - virtual ~GridRPhiEta(); - - /** Determine the global position based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Position. - */ - virtual Vector3D position(const CellID& aCellID) const; - /** Determine the cell ID based on the position. - * @param[in] aLocalPosition (not used). - * @param[in] aGlobalPosition position in the global coordinates. - * @param[in] aVolumeId ID of a volume. - * return Cell ID. - */ - virtual CellID cellID(const Vector3D& aLocalPosition, const Vector3D& aGlobalPosition, const VolumeID& aVolumeID) const; - /** Determine the pseudorapidity based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Pseudorapidity. - */ - double eta(const CellID& aCellID) const; - /** Determine the azimuthal angle based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Phi. - */ - double phi(const CellID& aCellID) const; - /** Determine the radius based on the cell ID. - * @param[in] aCellId ID of a cell. - * return Radius. - */ - double r(const CellID& aCellID) const; - /** Get the grid size in pseudorapidity. - * return Grid size in eta. - */ - inline double gridSizeEta() const { - return m_gridSizeEta; - } - /** Get the grid size in radial distance from the detector centre. - * return Grid size in radial distance. - */ - inline double gridSizeR() const { - return m_gridSizeR; - } - /** Get the number of bins in azimuthal angle. - * return Number of bins in phi. - */ - inline int phiBins() const { - return m_phiBins; - } - /** Get the coordinate offset in pseudorapidity. - * return The offset in eta. - */ - inline double offsetEta() const { - return m_offsetEta; - } - /** Get the coordinate offset in azimuthal angle. - * return The offset in phi. - */ - inline double offsetPhi() const { - return m_offsetPhi; - } - /** Get the coordinate offset in radial distance. - * return The offset in R. - */ - inline double offsetR() const { - return m_offsetR; - } - /** Get the field name used for pseudorapidity - * return The field name for eta. - */ - inline std::string fieldNameEta() const { - return m_etaID; - } - /** Get the field name for azimuthal angle. - * return The field name for phi. - */ - inline std::string fieldNamePhi() const { - return m_phiID; - } - /** Get the field name for radial distance. - * return The field name for radial distance. - */ - inline std::string fieldNameR() const { - return m_rID; - } - /** Set the grid size in pseudorapidity. - * @param[in] aCellSize Cell size in eta. - */ - void setGridSizeEta(double aCellSize) { - m_gridSizeEta = aCellSize; - } - /** Set the number of bins in azimuthal angle. - * @param[in] aNumberBins Number of bins in phi. - */ - inline void setPhiBins(int bins) { - m_phiBins = bins; - } - /** Set the grid size in radial distance. - * @param[in] aCellSize Cell size in radial distance. - */ - void setGridSizeR(double aCellSize) { - m_gridSizeR = aCellSize; - } - /** Set the coordinate offset in pseudorapidity. - * @param[in] aOffset Offset in eta. - */ - inline void setOffsetEta(double offset) { - m_offsetEta = offset; - } - /** Set the coordinate offset in azimuthal angle. - * @param[in] aOffset Offset in phi. - */ - inline void setOffsetPhi(double offset) { - m_offsetPhi = offset; - } - /** Set the coordinate offset in radial distance. - * @param[in] aOffset Offset in radial distance. - */ - inline void setOffsetR(double offset) { - m_offsetR = offset; - } - /** Set the field name used for pseudorapidity. - * @param[in] aFieldName Field name for eta. - */ - inline void setFieldNameEta(const std::string& fieldName) { - m_etaID = fieldName; - } - /** Set the field name used for azimuthal angle. - * @param[in] aFieldName Field name for phi. - */ - inline void setFieldNamePhi(const std::string& fieldName) { - m_phiID = fieldName; - } - /** Set the field name used for radial distance. - * @param[in] aFieldName Field name for R. - */ - inline void setFieldNameR(const std::string& fieldName) { - m_rID = fieldName; - } - /// calculates the Cartesian position from spherical coordinates (r, phi, eta) - inline Vector3D positionFromREtaPhi(double ar, double aeta, double aphi) const { - return Vector3D(ar * std::cos(aphi), ar * std::sin(aphi), ar * std::sinh(aeta)); - } - /// calculates the pseudorapidity from Cartesian coordinates - inline double etaFromXYZ(const Vector3D& aposition) const { - TVector3 vec(aposition.X, aposition.Y, aposition.Z); - return vec.Eta(); - } - /// from SegmentationUtil - /// to be removed once SegmentationUtil can be included w/o linker error - /// calculates the azimuthal angle phi from Cartesian coordinates - inline double phiFromXYZ(const Vector3D& aposition) const { - return std::atan2(aposition.Y, aposition.X); - } - /// from SegmentationUtil - /// to be removed once SegmentationUtil can be included w/o linker error - /// calculates the radius in the xy-plane from Cartesian coordinates - inline double radiusFromXYZ(const Vector3D& aposition) const { - return std::sqrt(aposition.X * aposition.X + aposition.Y * aposition.Y); - } - -private: - /// determine the pseudorapidity based on the current cell ID - double eta() const; - /// determine the azimuthal angle phi based on the current cell ID - double phi() const; - /// determine the radial distance R based on the current cell ID - double r() const; - - /// the grid size in eta - double m_gridSizeEta; - /// the number of bins in phi - int m_phiBins; - /// the grid size in r - double m_gridSizeR; - /// the coordinate offset in eta - double m_offsetEta; - /// the coordinate offset in phi - double m_offsetPhi; - /// the coordinate offset in r - double m_offsetR; - /// the field name used for eta - std::string m_etaID; - /// the field name used for phi - std::string m_phiID; - /// the field name used for r - std::string m_rID; -}; -} -} -#endif /* DETSEGMENTATION_GRIDRPHIETA_H */ diff --git a/DetSegmentation/include/DetSegmentation/LinkDef.h b/DetSegmentation/include/DetSegmentation/LinkDef.h deleted file mode 100644 index b6dda562f73fa976d05f21f4f5f19c1fd28fd053..0000000000000000000000000000000000000000 --- a/DetSegmentation/include/DetSegmentation/LinkDef.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "DDSegmentation/Segmentation.h" -#include "DetSegmentation/GridPhiEta.h" -/* #pragma link off all globals; */ -/* #pragma link off all classes; */ -/* #pragma link off all functions; */ -#pragma link C++ class DD4hep::DDSegmentation::GridPhiEta+; diff --git a/DetSegmentation/src/Factories.cpp b/DetSegmentation/src/Factories.cpp deleted file mode 100644 index 8f4ea20824507461693e6d5ae4a13f82d5bc3d62..0000000000000000000000000000000000000000 --- a/DetSegmentation/src/Factories.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -// Framework includes -#include "DD4hep/objects/SegmentationsInterna.h" -#include "DD4hep/Factories.h" - -using namespace DD4hep::Geometry; -using namespace DD4hep::DDSegmentation; - -namespace { - template<typename T> DD4hep::Geometry::SegmentationObject* - create_segmentation(DD4hep::Geometry::BitField64* decoder) { - return new DD4hep::Geometry::SegmentationWrapper<T>(decoder); - } -} - -#include "DetSegmentation/GridPhiEta.h" -DECLARE_SEGMENTATION(GridPhiEta,create_segmentation<DD4hep::DDSegmentation::GridPhiEta>) diff --git a/DetSegmentation/src/GridPhiEta.cpp b/DetSegmentation/src/GridPhiEta.cpp deleted file mode 100644 index ba7b5e90d6d2d216bf0a3f601ba509ee24abd420..0000000000000000000000000000000000000000 --- a/DetSegmentation/src/GridPhiEta.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "DetSegmentation/GridPhiEta.h" - -namespace DD4hep { -namespace DDSegmentation { - - /// Default constructor used by derived classes passing an existing decoder - GridPhiEta::GridPhiEta(BitField64* decode) : Segmentation(decode) { - // define type and description - _type = "GridPhiEta"; - _description = "Projective segmentation in the global coordinates"; - - // register all necessary parameters - registerParameter("grid_size_eta", "Cell size in Eta", m_gridSizeEta, 1., SegmentationParameter::LengthUnit); - registerParameter("phi_bins", "Number of bins phi", m_phiBins, 1); - registerParameter("offset_eta", "Angular offset in eta", m_offsetEta, 0., SegmentationParameter::AngleUnit, true); - registerParameter("offset_phi", "Angular offset in phi", m_offsetPhi, 0., SegmentationParameter::AngleUnit, true); - registerIdentifier("identifier_eta", "Cell ID identifier for eta", m_etaID, "eta"); - registerIdentifier("identifier_phi", "Cell ID identifier for phi", m_phiID, "phi"); - } - -/// default constructor using an encoding string -GridPhiEta::GridPhiEta(const std::string& cellEncoding) : - Segmentation(cellEncoding) { - // define type and description - _type = "GridPhiEta"; - _description = "Projective segmentation in the global coordinates"; - - // register all necessary parameters - registerParameter("grid_size_eta", "Cell size in Eta", m_gridSizeEta, 1., SegmentationParameter::LengthUnit); - registerParameter("phi_bins", "Number of bins phi", m_phiBins, 1); - registerParameter("offset_eta", "Angular offset in eta", m_offsetEta, 0., SegmentationParameter::AngleUnit, true); - registerParameter("offset_phi", "Angular offset in phi", m_offsetPhi, 0., SegmentationParameter::AngleUnit, true); - registerIdentifier("identifier_eta", "Cell ID identifier for eta", m_etaID, "eta"); - registerIdentifier("identifier_phi", "Cell ID identifier for phi", m_phiID, "phi"); -} - -/// destructor -GridPhiEta::~GridPhiEta() { - -} - -/// determine the local based on the cell ID -Vector3D GridPhiEta::position(const CellID& cID) const { - _decoder->setValue(cID); - return positionFromREtaPhi(1.0, eta(), phi()); -} - -/// determine the cell ID based on the position -CellID GridPhiEta::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, const VolumeID& vID) const { - _decoder->setValue(vID); - double lEta = etaFromXYZ(globalPosition); - double lPhi = phiFromXYZ(globalPosition); - (*_decoder)[m_etaID] = positionToBin(lEta, m_gridSizeEta, m_offsetEta); - (*_decoder)[m_phiID] = positionToBin(lPhi, 2 * M_PI / (double) m_phiBins, m_offsetPhi); - return _decoder->getValue(); -} - -/// determine the pseudorapidity based on the current cell ID -double GridPhiEta::eta() const { - CellID etaValue = (*_decoder)[m_etaID].value(); - return binToPosition(etaValue, m_gridSizeEta, m_offsetEta); -} -/// determine the azimuthal angle phi based on the current cell ID -double GridPhiEta::phi() const { - CellID phiValue = (*_decoder)[m_phiID].value(); - return binToPosition(phiValue, 2.*M_PI/(double)m_phiBins, m_offsetPhi); -} - -/// determine the polar angle theta based on the cell ID -double GridPhiEta::eta(const CellID& cID) const { - _decoder->setValue(cID); - CellID etaValue = (*_decoder)[m_etaID].value(); - return binToPosition(etaValue, m_gridSizeEta, m_offsetEta); -} -/// determine the azimuthal angle phi based on the cell ID -double GridPhiEta::phi(const CellID& cID) const { - _decoder->setValue(cID); - CellID phiValue = (*_decoder)[m_phiID].value(); - return binToPosition(phiValue, 2.*M_PI/(double)m_phiBins, m_offsetPhi); -} -REGISTER_SEGMENTATION(GridPhiEta) -} -} - diff --git a/DetSegmentation/src/GridPhiEtaHandle.cpp b/DetSegmentation/src/GridPhiEtaHandle.cpp deleted file mode 100644 index 36f60b9599498205438ff6068ec9943bac867087..0000000000000000000000000000000000000000 --- a/DetSegmentation/src/GridPhiEtaHandle.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// Framework include files -#include "DetSegmentation/GridPhiEtaHandle.h" -#include "DD4hep/objects/SegmentationsInterna.h" -#include "DetSegmentation/GridPhiEta.h" -#include "DD4hep/Handle.inl" - -using namespace std; -using namespace DD4hep::Geometry; - -/// determine the position based on the cell ID -Position GridPhiEta::position(const CellID& id) const { - return Position(access()->implementation->position(id)); -} - -/// determine the cell ID based on the position -DD4hep::CellID GridPhiEta::cellID(const Position& local, - const Position& global, - const VolumeID& volID) const -{ - return access()->implementation->cellID(local, global, volID); -} - -/// access the grid size in R -double GridPhiEta::gridSizeEta() const { - return access()->implementation->gridSizeEta(); -} - -/// access the grid size in Phi -int GridPhiEta::phiBins() const { - return access()->implementation->phiBins(); -} - -/// access the coordinate offset in R -double GridPhiEta::offsetEta() const { - return access()->implementation->offsetEta(); -} - -/// access the coordinate offset in Phi -double GridPhiEta::offsetPhi() const { - return access()->implementation->offsetPhi(); -} - -/// set the coordinate offset in R -void GridPhiEta::setOffsetEta(double offset) const { - access()->implementation->setOffsetEta(offset); -} - -/// set the coordinate offset in Phi -void GridPhiEta::setOffsetPhi(double offset) const { - access()->implementation->setOffsetPhi(offset); -} - -/// set the grid size in R -void GridPhiEta::setGridSizeEta(double cellSize) const { - access()->implementation->setGridSizeEta(cellSize); -} - -/// set the grid size in Phi -void GridPhiEta::setPhiBins(int cellSize) const { - access()->implementation->setPhiBins(cellSize); -} - -/// access the field name used for R -const string& GridPhiEta::fieldNameEta() const { - return access()->implementation->fieldNameEta(); -} - -/// access the field name used for Phi -const string& GridPhiEta::fieldNamePhi() const { - return access()->implementation->fieldNamePhi(); -} - -/** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return vector<double> size 2: - -# size in x - -# size in z -*/ -vector<double> GridPhiEta::cellDimensions(const CellID& id) const { - return {0};// access()->implementation->cellDimensions(id); -} - -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridPhiEta); diff --git a/DetSegmentation/src/GridRPhiEta.cpp b/DetSegmentation/src/GridRPhiEta.cpp deleted file mode 100644 index e4221e47990a3c11ac6f1b2f48827ef26b0ea505..0000000000000000000000000000000000000000 --- a/DetSegmentation/src/GridRPhiEta.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "DetSegmentation/GridRPhiEta.h" - -namespace DD4hep { -namespace DDSegmentation { - -/// default constructor using an encoding string -GridRPhiEta::GridRPhiEta(const std::string& cellEncoding) : - Segmentation(cellEncoding) { - // define type and description - _type = "GridRPhiEta"; - _description = "Projective segmentation in the global coordinates"; - - // register all necessary parameters - registerParameter("grid_size_eta", "Cell size in eta", m_gridSizeEta, 1., SegmentationParameter::LengthUnit); - registerParameter("phi_bins", "Number of bins phi", m_phiBins, 1); - registerParameter("grid_size_r", "Cell size in radial distance", m_gridSizeR, 1., SegmentationParameter::LengthUnit); - registerParameter("offset_eta", "Angular offset in eta", m_offsetEta, 0., SegmentationParameter::AngleUnit, true); - registerParameter("offset_phi", "Angular offset in phi", m_offsetPhi, 0., SegmentationParameter::AngleUnit, true); - registerParameter("offset_r", "Angular offset in radial distance", m_offsetR, 0., SegmentationParameter::LengthUnit, true); - registerIdentifier("identifier_eta", "Cell ID identifier for eta", m_etaID, "eta"); - registerIdentifier("identifier_phi", "Cell ID identifier for phi", m_phiID, "phi"); - registerIdentifier("identifier_r", "Cell ID identifier for R", m_rID, "r"); -} - -/// destructor -GridRPhiEta::~GridRPhiEta() {} - -/// determine the local based on the cell ID -Vector3D GridRPhiEta::position(const CellID& cID) const { - _decoder->setValue(cID); - return positionFromREtaPhi(r(), eta(), phi()); -} - -/// determine the cell ID based on the position -CellID GridRPhiEta::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, const VolumeID& vID) const { - _decoder->setValue(vID); - double lRadius = radiusFromXYZ(globalPosition); - double lEta = etaFromXYZ(globalPosition); - double lPhi = phiFromXYZ(globalPosition); - (*_decoder)[m_etaID] = positionToBin(lEta, m_gridSizeEta, m_offsetEta); - (*_decoder)[m_phiID] = positionToBin(lPhi, 2 * M_PI / (double) m_phiBins, m_offsetPhi); - (*_decoder)[m_rID] = positionToBin(lRadius, m_gridSizeR, m_offsetR); - if ( (*_decoder)[m_rID] != (*_decoder)["active_layer"] ) { - std::cout <<" Position = ( " << globalPosition.x() << " , " << globalPosition.y() << " , " << globalPosition.z() << " )\t "; - std::cout << "Radius: " << lRadius << " \tcellsize: " << m_gridSizeR << " \toffset: " << m_offsetR << " -> " << (*_decoder)[m_rID] << " != " << (*_decoder)["active_layer"] << std::endl; - } - return _decoder->getValue(); -} - -/// determine the pseudorapidity based on the current cell ID -double GridRPhiEta::eta() const { - CellID etaValue = (*_decoder)[m_etaID].value(); - return binToPosition(etaValue, m_gridSizeEta, m_offsetEta); -} -/// determine the azimuthal angle phi based on the current cell ID -double GridRPhiEta::phi() const { - CellID phiValue = (*_decoder)[m_phiID].value(); - return binToPosition(phiValue, 2.*M_PI/(double)m_phiBins, m_offsetPhi); -} -/// determine the radial distance R based on the current cell ID -double GridRPhiEta::r() const { - CellID rValue = (*_decoder)[m_rID].value(); - return binToPosition(rValue, m_gridSizeR, m_offsetR); -} - -/// determine the polar angle theta based on the cell ID -double GridRPhiEta::eta(const CellID& cID) const { - _decoder->setValue(cID); - CellID etaValue = (*_decoder)[m_etaID].value(); - return binToPosition(etaValue, m_gridSizeEta, m_offsetEta); -} -/// determine the azimuthal angle phi based on the cell ID -double GridRPhiEta::phi(const CellID& cID) const { - _decoder->setValue(cID); - CellID phiValue = (*_decoder)[m_phiID].value(); - return binToPosition(phiValue, 2.*M_PI/(double)m_phiBins, m_offsetPhi); -} -/// determine the radial distance R based on the cell ID -double GridRPhiEta::r(const CellID& cID) const { - _decoder->setValue(cID); - CellID rValue = (*_decoder)[m_rID].value(); - return binToPosition(rValue, m_gridSizeR, m_offsetR); -} -REGISTER_SEGMENTATION(GridRPhiEta) -} -} - diff --git a/doc/externalize/ExtraProperties.cpp b/doc/externalize/ExtraProperties.cpp index a813fd502db4bebaa529b588035655080f901494..c28d2e67112515abc9e014261a978de18f1b8580 100644 --- a/doc/externalize/ExtraProperties.cpp +++ b/doc/externalize/ExtraProperties.cpp @@ -32,12 +32,20 @@ PARSERS_DECL_FOR_SINGLE(long long) PARSERS_DECL_FOR_SINGLE(unsigned long long) #endif +typedef std::map<std::string, std::vector<std::string> > map_vector_t; +typedef std::map<std::string, std::map<std::string,std::string> > map_map_t; +PARSERS_DECL_FOR_SINGLE(map_map_t) + #include "DD4hep/BasicGrammar_inl.h" #include "DD4hep/ComponentProperties_inl.h" -typedef std::map<std::string, std::vector<std::string> > map_t; -DD4HEP_DEFINE_PARSER_GRAMMAR(map_t,eval_obj) -DD4HEP_DEFINE_PROPERTY_TYPE(map_t) +#include "parsers/ParsersFactory.h" +DD4HEP_DEFINE_PARSER_GRAMMAR(map_vector_t,eval_obj) +DD4HEP_DEFINE_PROPERTY_TYPE(map_vector_t) + +PARSERS_DEF_FOR_SINGLE(map_map_t) +DD4HEP_DEFINE_PARSER_GRAMMAR(map_map_t,eval_obj) +DD4HEP_DEFINE_PROPERTY_TYPE(map_map_t) #if !defined(DD4HEP_HAVE_ALL_PARSERS) DD4HEP_DEFINE_PARSER_GRAMMAR(unsigned int,eval_item)