Back to home page

EIC code displayed by LXR

 
 

    


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

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 /*
0013  * TiledLayerGridXY.h
0014  *
0015  *  Created on: November 12, 2015
0016  *      Author: Shaojun Lu, DESY
0017  */
0018 
0019 #ifndef DDSEGMENTATION_TILEDLAYERGRIDXY_H
0020 #define DDSEGMENTATION_TILEDLAYERGRIDXY_H
0021 
0022 #include <DDSegmentation/CartesianGrid.h>
0023 
0024 // C/C++ includes
0025 #include <string>
0026 #include <vector>
0027 
0028 namespace dd4hep {
0029   namespace DDSegmentation {
0030 
0031     /// A segmentation class to describe tiled layers
0032     class TiledLayerGridXY: public CartesianGrid {
0033     public:
0034       /// Default constructor passing the encoding string
0035       TiledLayerGridXY(const std::string& cellEncoding = "");
0036       /// Default constructor used by derived classes passing an existing decoder
0037       TiledLayerGridXY(const BitFieldCoder* decoder);
0038       /// destructor
0039       virtual ~TiledLayerGridXY();
0040 
0041       /// determine the position based on the cell ID
0042       virtual Vector3D position(const CellID& cellID) const;
0043       /// determine the cell ID based on the position
0044       virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
0045       /// access the grid size in X
0046       double gridSizeX() const {
0047         return _gridSizeX;
0048       }
0049       /// access the grid size in Y
0050       double gridSizeY() const {
0051         return _gridSizeY;
0052       }
0053       /// access the coordinate offset in X
0054       double offsetX() const {
0055         return _offsetX;
0056       }
0057       /// access the coordinate offset in Y
0058       double offsetY() const {
0059         return _offsetY;
0060       }
0061       /// access the coordinate layerOffset in X
0062       std::vector<double> layerOffsetX() const {
0063         return  _layerOffsetX;
0064       }
0065       /// access the coordinate layerOffset in Y
0066       std::vector<double> layerOffsetY() const {
0067         return  _layerOffsetY;
0068       }
0069       /// access the boundary dimension in X
0070       std::vector<double> boundaryLayerX() const {
0071         return _layerDimX;
0072       }
0073       /// access the fraction cell size in X
0074       std::vector<double> FractCellSizeXPerLayer() const {
0075         return _fractCellSizeXPerLayer;
0076       }
0077       /// access the field name used for X
0078       const std::string& fieldNameX() const {
0079         return _xId;
0080       }
0081       /// access the field name used for Y
0082       const std::string& fieldNameY() const {
0083         return _yId;
0084       }
0085       /// access the field name used for Layer
0086       const std::string& fieldNameLayer() const {
0087         return _identifierLayer;
0088       }
0089       /// set the grid size in X
0090       void setGridSizeX(double cellSize) {
0091         _gridSizeX = cellSize;
0092       }
0093       /// set the grid size in Y
0094       void setGridSizeY(double cellSize) {
0095         _gridSizeY = cellSize;
0096       }
0097       /// set the coordinate offset in X
0098       void setOffsetX(double offset) {
0099         _offsetX = offset;
0100       }
0101       /// set the coordinate offset in Y
0102       void setOffsetY(double offset) {
0103         _offsetY = offset;
0104       }
0105       /// set the coordinate layerOffset in X
0106       void setLayerOffsetX(double offset) {
0107         _layerOffsetX.emplace_back(offset);
0108       }
0109       /// set the coordinate layerOffset in Y
0110       void setLayerOffsetY(double offset) {
0111         _layerOffsetY.emplace_back(offset);
0112       }
0113       /// set the field name used for X
0114       void setFieldNameX(const std::string& fieldName) {
0115         _xId = fieldName;
0116       }
0117       /// set the field name used for Y
0118       void setFieldNameY(const std::string& fieldName) {
0119         _yId = fieldName;
0120       }
0121       /// set the field name used for Y
0122       void setFieldNameLayer(const std::string& fieldName) {
0123         _identifierLayer= fieldName;
0124       }
0125       /// set the layer boundary dimension for X
0126       void setBoundaryLayerX(double halfX)
0127       {
0128         _layerDimX.emplace_back(halfX);
0129       };
0130       /// set the layer fraction cell size for X
0131       void setFractCellSizeXPerLayer(double newFractCellSizeX)
0132       {
0133         _fractCellSizeXPerLayer.emplace_back(newFractCellSizeX);
0134       }
0135       /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0136           in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0137 
0138           Returns a vector of the cellDimensions of the given cell ID
0139           \param cellID is ignored as all cells have the same dimension
0140           \return std::vector<double> size 2:
0141           -# size in x
0142           -# size in y
0143       */
0144       virtual std::vector<double> cellDimensions(const CellID& cellID) const;
0145 
0146     protected:
0147       /// the grid size in X
0148       double _gridSizeX;
0149       /// the coordinate offset in X
0150       double _offsetX;
0151       /// the grid size in Y
0152       double _gridSizeY;
0153       /// the coordinate offset in Y
0154       double _offsetY;
0155       /// the field name used for X
0156       std::string _xId;
0157       /// the field name used for Y
0158       std::string _yId;
0159       /// encoding field used for the layer
0160       std::string _identifierLayer; 
0161       /// list of layer x offset
0162       std::vector<double> _layerOffsetX;
0163       /// list of layer y offset
0164       std::vector<double> _layerOffsetY;
0165       /// list of layer boundary dimension for X
0166       std::vector<double> _layerDimX;
0167       /// list of the layer fraction cell size for X
0168       std::vector<double> _fractCellSizeXPerLayer;
0169     };
0170 
0171   } /* namespace DDSegmentation */
0172 } /* namespace dd4hep */
0173 #endif // DDSEGMENTATION_TILEDLAYERGRIDXY_H