Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:36

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 //==========================================================================
0011 
0012 #ifndef DDSEGMENTATION_GRIDPHIETA_H
0013 #define DDSEGMENTATION_GRIDPHIETA_H
0014 
0015 #include <DDSegmentation/Segmentation.h>
0016 
0017 #include <cmath>
0018 
0019 /** GridPhiEta DDSegmentation/include/DDSegmentation/GridPhiEta.h GridPhiEta.h
0020  *
0021  *  Segmentation in eta and phi.
0022  *
0023  *  @author    Anna Zaborowska
0024  */
0025 
0026 namespace dd4hep {
0027   namespace DDSegmentation {
0028 
0029     /// Segmentation class describing segmentation in Phi-Eta
0030     class GridPhiEta : public Segmentation {
0031     public:
0032       /// default constructor using an arbitrary type
0033       GridPhiEta(const std::string& aCellEncoding);
0034       /// Default constructor used by derived classes passing an existing decoder
0035       GridPhiEta(const BitFieldCoder* decoder);
0036 
0037       /// destructor
0038       virtual ~GridPhiEta() = default;
0039 
0040       /**  Determine the global position based on the cell ID.
0041        *   @warning This segmentation has no knowledge of radius, so radius = 1 is taken into calculations.
0042        *   @param[in] aCellId ID of a cell.
0043        *   return Position (radius = 1).
0044        */
0045       virtual Vector3D position(const CellID& aCellID) const;
0046       /**  Determine the cell ID based on the position.
0047        *   @param[in] aLocalPosition (not used).
0048        *   @param[in] aGlobalPosition position in the global coordinates.
0049        *   @param[in] aVolumeId ID of a volume.
0050        *   return Cell ID.
0051        */
0052       virtual CellID cellID(const Vector3D& aLocalPosition, const Vector3D& aGlobalPosition, const VolumeID& aVolumeID) const;
0053       /**  Determine the pseudorapidity based on the cell ID.
0054        *   @param[in] aCellId ID of a cell.
0055        *   return Pseudorapidity.
0056        */
0057       double eta(const CellID& aCellID) const;
0058       /**  Determine the azimuthal angle based on the cell ID.
0059        *   @param[in] aCellId ID of a cell.
0060        *   return Phi.
0061        */
0062       double phi(const CellID& aCellID) const;
0063       /**  Get the grid size in pseudorapidity.
0064        *   return Grid size in eta.
0065        */
0066       inline double gridSizeEta() const {
0067         return m_gridSizeEta;
0068       }
0069       /**  Get the grid size in phi.
0070        *   return Grid size in phi.
0071        */
0072       inline double gridSizePhi() const {
0073         return 2 * M_PI / static_cast<double>(m_phiBins);
0074       }
0075       /**  Get the number of bins in azimuthal angle.
0076        *   return Number of bins in phi.
0077        */
0078       inline int phiBins() const {
0079         return m_phiBins;
0080       }
0081       /**  Get the coordinate offset in pseudorapidity.
0082        *   return The offset in eta.
0083        */
0084       inline double offsetEta() const {
0085         return m_offsetEta;
0086       }
0087       /**  Get the coordinate offset in azimuthal angle.
0088        *   return The offset in phi.
0089        */
0090       inline double offsetPhi() const {
0091         return m_offsetPhi;
0092       }
0093       /**  Get the field name used for pseudorapidity
0094        *   return The field name for eta.
0095        */
0096       inline const std::string& fieldNameEta() const {
0097         return m_etaID;
0098       }
0099       /**  Get the field name for azimuthal angle.
0100        *   return The field name for phi.
0101        */
0102       inline const std::string& fieldNamePhi() const {
0103         return m_phiID;
0104       }
0105       /**  Set the grid size in pseudorapidity.
0106        *   @param[in] aCellSize Cell size in eta.
0107        */
0108       void setGridSizeEta(double aCellSize) {
0109         m_gridSizeEta = aCellSize;
0110       }
0111       /**  Set the number of bins in azimuthal angle.
0112        *   @param[in] aNumberBins Number of bins in phi.
0113        */
0114       inline void setPhiBins(int bins) {
0115         m_phiBins = bins;
0116       }
0117       /**  Set the coordinate offset in pseudorapidity.
0118        *   @param[in] aOffset Offset in eta.
0119        */
0120       inline void setOffsetEta(double offset) {
0121         m_offsetEta = offset;
0122       }
0123       /**  Set the coordinate offset in azimuthal angle.
0124        *   @param[in] aOffset Offset in phi.
0125        */
0126       inline void setOffsetPhi(double offset) {
0127         m_offsetPhi = offset;
0128       }
0129       /**  Set the field name used for pseudorapidity.
0130        *   @param[in] aFieldName Field name for eta.
0131        */
0132       inline void setFieldNameEta(const std::string& fieldName) {
0133         m_etaID = fieldName;
0134       }
0135       /**  Set the field name used for azimuthal angle.
0136        *   @param[in] aFieldName Field name for phi.
0137        */
0138       inline void setFieldNamePhi(const std::string& fieldName) {
0139         m_phiID = fieldName;
0140       }
0141 
0142     protected:
0143 
0144       /// the grid size in eta
0145       double m_gridSizeEta;
0146       /// the number of bins in phi
0147       int m_phiBins;
0148       /// the coordinate offset in eta
0149       double m_offsetEta;
0150       /// the coordinate offset in phi
0151       double m_offsetPhi;
0152       /// the field name used for eta
0153       std::string m_etaID;
0154       /// the field name used for phi
0155       std::string m_phiID;
0156     };
0157   }
0158 }
0159 #endif // DDSEGMENTATION_GRIDPHIETA_H