Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:58:02

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_POLARGRIDRPHI2_H
0016 #define DD4HEP_POLARGRIDRPHI2_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 PolarGridRPhi2;  }
0026   
0027   /// We need some abbreviation to make the code more readable.
0028   typedef Handle<SegmentationWrapper<DDSegmentation::PolarGridRPhi2> > PolarGridRPhi2Handle;
0029 
0030   /// Implementation class for the grid XZ 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 PolarGridRPhi2 : public PolarGridRPhi2Handle  {
0052   public:
0053     /// Default constructor
0054     PolarGridRPhi2() = default;
0055     /// Copy constructor
0056     PolarGridRPhi2(const PolarGridRPhi2& e) = default;
0057     /// Copy Constructor from segmentation base object
0058     PolarGridRPhi2(const Segmentation& e) : Handle<Object>(e) {}
0059     /// Copy constructor from handle
0060     PolarGridRPhi2(const Handle<Object>& e) : Handle<Object>(e) {}
0061     /// Copy constructor from other polymorph/equivalent handle
0062     template <typename Q> PolarGridRPhi2(const Handle<Q>& e) : Handle<Object>(e) {}
0063     /// Assignment operator
0064     PolarGridRPhi2& operator=(const PolarGridRPhi2& seg) = default;
0065     /// Equality operator
0066     bool operator==(const PolarGridRPhi2& seg) const
0067     {  return m_element == seg.m_element;      }
0068     /// determine the position based on the cell ID
0069     Position position(const CellID& cellID) const;
0070     /// determine the cell ID based on the position
0071     CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const;
0072     /// access the grid size in R
0073     double gridSizeR() const;
0074     /// access the grid size in Phi
0075     double gridSizePhi() const;
0076     /// access the coordinate offset in R
0077     double offsetR() const;
0078     /// access the coordinate offset in Phi
0079     double offsetPhi() const;
0080     /// set the coordinate offset in R
0081     void setOffsetR(double offset) const;
0082     /// set the coordinate offset in Phi
0083     void setOffsetPhi(double offset) const;
0084     /// access the grid size in R
0085     std::vector<double> gridRValues() const;
0086     /// access the grid size in Phi
0087     std::vector<double>  gridPhiValues() const;
0088     /// set the grid Boundaries in R
0089     void setGridSizeR(double cellSize, int rID) const;
0090     /// set the grid size in Phi
0091     void setGridSizePhi(double cellSize, int phiID) const;
0092     /// set the grid boundaries for R
0093     /** @param rValues The boundaries of the segments in radius,
0094      *                 the first value is the lower boundary of the first bin, 
0095      *                 the highest value is the upper boundary of the last bin
0096      */
0097     void setGridRValues(std::vector<double> const& rValues) const;
0098     /// set the grid size in Phi for each bin in R
0099     /** @param phiValues The size in phi for each bin in R, 
0100      *                   this vector is one smaller than the vector 
0101      *                   for PolarGridRPhi2::setGridRValues
0102      */
0103     void setGridPhiValues(std::vector<double> const& phiValues) const;
0104 
0105     /// access the field name used for R
0106     const std::string& fieldNameR() const;
0107     /// access the field name used for Phi
0108     const std::string& fieldNamePhi() const;
0109     /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0110         in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0111 
0112         Returns a vector of the cellDimensions of the given cell ID
0113         \param cellID is ignored as all cells have the same dimension
0114         \return std::vector<double> size 2:
0115         -# size in x
0116         -# size in z
0117     */
0118     std::vector<double> cellDimensions(const CellID& cellID) const;
0119   };
0120 }      /* End namespace dd4hep                */
0121 #endif // DD4HEP_POLARGRIDRPHI2_H