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  * CartesianGridXY.h
0013  *
0014  *  Created on: Jun 28, 2013
0015  *      Author: Christian Grefe, CERN
0016  */
0017 
0018 #ifndef DDSEGMENTATION_CARTESIANGRIDXY_H
0019 #define DDSEGMENTATION_CARTESIANGRIDXY_H
0020 
0021 #include <DDSegmentation/CartesianGrid.h>
0022 
0023 namespace dd4hep {
0024   namespace DDSegmentation {
0025 
0026     /// Segmentation base class describing cartesian grid segmentation in the X-Y plane
0027     class CartesianGridXY: public CartesianGrid {
0028     public:
0029       /// Default constructor passing the encoding string
0030       CartesianGridXY(const std::string& cellEncoding = "");
0031       /// Default constructor used by derived classes passing an existing decoder
0032       CartesianGridXY(const BitFieldCoder* decoder);
0033       /// destructor
0034       virtual ~CartesianGridXY();
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 X
0041       double gridSizeX() const {
0042         return _gridSizeX;
0043       }
0044       /// access the grid size in Y
0045       double gridSizeY() const {
0046         return _gridSizeY;
0047       }
0048       /// access the coordinate offset in X
0049       double offsetX() const {
0050         return _offsetX;
0051       }
0052       /// access the coordinate offset in Y
0053       double offsetY() const {
0054         return _offsetY;
0055       }
0056       /// access the field name used for X
0057       const std::string& fieldNameX() const {
0058         return _xId;
0059       }
0060       /// access the field name used for Y
0061       const std::string& fieldNameY() const {
0062         return _yId;
0063       }
0064       /// set the grid size in X
0065       void setGridSizeX(double cellSize) {
0066         _gridSizeX = cellSize;
0067       }
0068       /// set the grid size in Y
0069       void setGridSizeY(double cellSize) {
0070         _gridSizeY = cellSize;
0071       }
0072       /// set the coordinate offset in X
0073       void setOffsetX(double offset) {
0074         _offsetX = offset;
0075       }
0076       /// set the coordinate offset in Y
0077       void setOffsetY(double offset) {
0078         _offsetY = offset;
0079       }
0080       /// set the field name used for X
0081       void setFieldNameX(const std::string& fieldName) {
0082         _xId = fieldName;
0083       }
0084       /// set the field name used for Y
0085       void setFieldNameY(const std::string& fieldName) {
0086         _yId = fieldName;
0087       }
0088       /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0089           in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0090 
0091           Returns a vector of the cellDimensions of the given cell ID
0092           \param cellID is ignored as all cells have the same dimension
0093           \return std::vector<double> size 2:
0094           -# size in x
0095           -# size in y
0096       */
0097       virtual std::vector<double> cellDimensions(const CellID& cellID) const;
0098 
0099     protected:
0100       /// the grid size in X
0101       double _gridSizeX;
0102       /// the coordinate offset in X
0103       double _offsetX;
0104       /// the grid size in Y
0105       double _gridSizeY;
0106       /// the coordinate offset in Y
0107       double _offsetY;
0108       /// the field name used for X
0109       std::string _xId;
0110       /// the field name used for Y
0111       std::string _yId;
0112     };
0113 
0114   } /* namespace DDSegmentation */
0115 } /* namespace dd4hep */
0116 #endif // DDSEGMENTATION_CARTESIANGRIDXY_H