Back to home page

EIC code displayed by LXR

 
 

    


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

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  * CartesianGridUV.h
0013  *
0014  *  Created on: December 5, 2024
0015  *      Author: Yann Bedfer, ePIC/Saclay
0016  */
0017 
0018 #ifndef DDSEGMENTATION_CARTESIANGRIDUV_H
0019 #define DDSEGMENTATION_CARTESIANGRIDUV_H
0020 
0021 #include <DDSegmentation/CartesianGrid.h>
0022 
0023 namespace dd4hep {
0024   namespace DDSegmentation {
0025 
0026     /// Segmentation base class describing cartesian grid segmentation in along U,V rotated some angle from local X,Y axes
0027     class CartesianGridUV: public CartesianGrid {
0028     public:
0029       /// Default constructor passing the encoding string
0030       CartesianGridUV(const std::string& cellEncoding = "");
0031       /// Default constructor used by derived classes passing an existing decoder
0032       CartesianGridUV(const BitFieldCoder* decoder);
0033       /// destructor
0034       virtual ~CartesianGridUV();
0035 
0036       /// determine the position based on the cell ID
0037       virtual Vector3D position(const CellID& cellID) const;
0038       /// determine the cell ID based on the position
0039       virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
0040       /// access the grid size in U
0041       double gridSizeU() const {
0042         return _gridSizeU;
0043       }
0044       /// access the grid size in V
0045       double gridSizeV() const {
0046         return _gridSizeV;
0047       }
0048       /// access the coordinate offset in U
0049       double offsetU() const {
0050         return _offsetU;
0051       }
0052       /// access the coordinate offset in V
0053       double offsetV() const {
0054         return _offsetV;
0055       }
0056       /// access the rotation angle
0057       double gridAngle() const {
0058         return _gridAngle;
0059       }
0060       /// access the field name used for U
0061       const std::string& fieldNameU() const {
0062         return _uId;
0063       }
0064       /// access the field name used for V
0065       const std::string& fieldNameV() const {
0066         return _vId;
0067       }
0068       /// set the grid size in U
0069       void setGridSizeU(double cellSize) {
0070         _gridSizeU = cellSize;
0071       }
0072       /// set the grid size in V
0073       void setGridSizeV(double cellSize) {
0074         _gridSizeV = cellSize;
0075       }
0076       /// set the coordinate offset in U
0077       void setOffsetU(double offset) {
0078         _offsetU = offset;
0079       }
0080       /// set the coordinate offset in V
0081       void setOffsetV(double offset) {
0082         _offsetV = offset;
0083       }
0084       /// set the rotation angle
0085       void setGridAngle(double angle) {
0086         _gridAngle = angle;
0087       }
0088       /// set the field name used for U
0089       void setFieldNameU(const std::string& fieldName) {
0090         _uId = fieldName;
0091       }
0092       /// set the field name used for V
0093       void setFieldNameV(const std::string& fieldName) {
0094         _vId = fieldName;
0095       }
0096       /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0097           in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0098 
0099           Returns a vector of the cellDimensions of the given cell ID
0100           \param cellID is ignored as all cells have the same dimension
0101           \return std::vector<double> size 2:
0102           -# size in U
0103           -# size in V
0104       */
0105       virtual std::vector<double> cellDimensions(const CellID& cellID) const;
0106 
0107     protected:
0108       /// the grid size in U
0109       double _gridSizeU;
0110       /// the coordinate offset in U
0111       double _offsetU;
0112       /// the grid size in V
0113       double _gridSizeV;
0114       /// the coordinate offset in V
0115       double _offsetV;
0116       /// the field name used for U
0117       std::string _uId;
0118       /// the field name used for V
0119       std::string _vId;
0120       /// the U grid angle
0121       double _gridAngle;
0122     };
0123 
0124   } /* namespace DDSegmentation */
0125 } /* namespace dd4hep */
0126 #endif // DDSEGMENTATION_CARTESIANGRIDUV_H