Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:14

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 //  \author   Markus Frank
0011 //  \date     2016-10-18
0012 //  \version  1.0
0013 //
0014 //==========================================================================
0015 #ifndef DD4HEP_CARTESIANGRIDXYZ_H
0016 #define DD4HEP_CARTESIANGRIDXYZ_H 1
0017 
0018 // Framework include files
0019 #include <DD4hep/Segmentations.h>
0020 
0021 /// Namespace for the AIDA detector description toolkit
0022 namespace dd4hep {
0023 
0024   /// Namespace for base segmentations
0025   namespace DDSegmentation  {    class CartesianGridXYZ;  }
0026   
0027   /// We need some abbreviation to make the code more readable.
0028   typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXYZ> > CartesianGridXYZHandle;
0029   
0030   /// Implementation class for the grid XYZ segmentation.
0031   /**
0032    *  Concrete user handle to serve specific needs of client code
0033    *  which requires access to the base functionality not served
0034    *  by the super-class Segmentation.
0035    *
0036    *  Note:
0037    *  We only check the validity of the underlying handle.
0038    *  If for whatever reason the implementation object is not valid
0039    *  This is not checked.
0040    *  In principle this CANNOT happen unless some brain-dead has
0041    *  fiddled with the handled object directly.....
0042    *
0043    *  Note:
0044    *  The handle base corresponding to this object in for
0045    *  conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
0046    *
0047    *  \author  M.Frank
0048    *  \version 1.0
0049    *  \ingroup DD4HEP_CORE
0050    */
0051   class CartesianGridXYZ : public CartesianGridXYZHandle {
0052   public:
0053     /// Default constructor
0054     CartesianGridXYZ() = default;
0055     /// Copy constructor
0056     CartesianGridXYZ(const CartesianGridXYZ& e) = default;
0057     /// Copy Constructor from segmentation base object
0058     CartesianGridXYZ(const Segmentation& e) : Handle<Object>(e) {}
0059     /// Copy constructor from handle
0060     CartesianGridXYZ(const Handle<Object>& e) : Handle<Object>(e) {}
0061     /// Copy constructor from other polymorph/equivalent handle
0062     template <typename Q>
0063     CartesianGridXYZ(const Handle<Q>& e) : Handle<Object>(e) {}
0064     /// Assignment operator
0065     CartesianGridXYZ& operator=(const CartesianGridXYZ& seg) = default;
0066     /// Equality operator
0067     bool operator==(const CartesianGridXYZ& seg) const
0068     {  return m_element == seg.m_element;    }
0069     /// determine the position based on the cell ID
0070     Position position(const CellID& cellID) const;
0071     /// determine the cell ID based on the position
0072     CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const;
0073     /// access the grid size in X
0074     double gridSizeX() const;
0075     /// access the grid size in Y
0076     double gridSizeY() const;
0077     /// access the grid size in Z
0078     double gridSizeZ() const;
0079     /// set the grid size in X
0080     void setGridSizeX(double cellSize) const;
0081     /// set the grid size in Y
0082     void setGridSizeY(double cellSize) const;
0083     /// set the grid size in Z
0084     void setGridSizeZ(double cellSize) const;
0085     /// access the coordinate offset in X
0086     double offsetX() const;
0087     /// access the coordinate offset in Y
0088     double offsetY() const;
0089     /// access the coordinate offset in Z
0090     double offsetZ() const;
0091     /// set the coordinate offset in X
0092     void setOffsetX(double offset) const;
0093     /// set the coordinate offset in Y
0094     void setOffsetY(double offset) const;
0095     /// set the coordinate offset in Z
0096     void setOffsetZ(double offset) const;
0097     /// access the field name used for X
0098     const std::string& fieldNameX() const;
0099     /// access the field name used for Y
0100     const std::string& fieldNameY() const;
0101     /// access the field name used for Z
0102     const std::string& fieldNameZ() const;
0103     /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0104         in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0105 
0106         Returns a vector of the cellDimensions of the given cell ID
0107         \param cellID is ignored as all cells have the same dimension
0108         \return std::vector<double> size 3:
0109         -# size in x
0110         -# size in y
0111         -# size in z
0112     */
0113     std::vector<double> cellDimensions(const CellID& cellID) const;
0114   };
0115 }       /* End namespace dd4hep                */
0116 #endif // DD4HEP_CARTESIANGRIDXYZ_H