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  * WaferGridXY.h
0014  *
0015  *  Created on: April 19, 2016
0016  *      Author: S. Lu, DESY
0017  */
0018 
0019 #ifndef DDSEGMENTATION_WAFERGRIDXY_H
0020 #define DDSEGMENTATION_WAFERGRIDXY_H
0021 
0022 #include <DDSegmentation/CartesianGrid.h>
0023 
0024 #define MAX_GROUPS 100
0025 #define MAX_WAFERS 100
0026 
0027 namespace dd4hep {
0028   namespace DDSegmentation {
0029 
0030     /// A segmentation class to describe wafer grids in X-Y
0031     class WaferGridXY: public CartesianGrid {
0032     public:
0033       /// Default constructor passing the encoding string
0034       WaferGridXY(const std::string& cellEncoding = "");
0035       /// Default constructor used by derived classes passing an existing decoder
0036       WaferGridXY(const BitFieldCoder* decoder);
0037       /// destructor
0038       virtual ~WaferGridXY();
0039 
0040       /// determine the position based on the cell ID
0041       virtual Vector3D position(const CellID& cellID) const;
0042       /// determine the cell ID based on the position
0043       virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
0044       /// access the grid size in X
0045       double gridSizeX() const {
0046         return _gridSizeX;
0047       }
0048       /// access the grid size in Y
0049       double gridSizeY() const {
0050         return _gridSizeY;
0051       }
0052       /// access the coordinate offset in X
0053       double offsetX() const {
0054         return _offsetX;
0055       }
0056       /// access the coordinate offset in Y
0057       double offsetY() const {
0058         return _offsetY;
0059       }
0060       /// access the coordinate waferOffset for inGroup in X
0061       double waferOffsetX(int inGroup, int inWafer) const {
0062         return  _waferOffsetX[inGroup][inWafer];
0063       }
0064       /// access the coordinate waferOffset for inGroup in Y
0065       double waferOffsetY(int inGroup, int inWafer) const {
0066         return  _waferOffsetY[inGroup][inWafer];
0067       }
0068 
0069       /// access the field name used for X
0070       const std::string& fieldNameX() const {
0071         return _xId;
0072       }
0073       /// access the field name used for Y
0074       const std::string& fieldNameY() const {
0075         return _yId;
0076       }
0077       /// set the grid size in X
0078       void setGridSizeX(double cellSize) {
0079         _gridSizeX = cellSize;
0080       }
0081       /// set the grid size in Y
0082       void setGridSizeY(double cellSize) {
0083         _gridSizeY = cellSize;
0084       }
0085       /// set the coordinate offset in X
0086       void setOffsetX(double offset) {
0087         _offsetX = offset;
0088       }
0089       /// set the coordinate offset in Y
0090       void setOffsetY(double offset) {
0091         _offsetY = offset;
0092       }
0093       /// set the coordinate waferOffset for inlayer in X
0094       void setWaferOffsetX(int inGroup,int inWafer, double offset) {
0095         _waferOffsetX[inGroup][inWafer] = offset;
0096       }
0097       /// set the coordinate waferOffset for inGroup in Y
0098       void setWaferOffsetY(int inGroup,int inWafer, double offset) {
0099         _waferOffsetY[inGroup][inWafer] = offset;
0100       }
0101 
0102       /// set the field name used for X
0103       void setFieldNameX(const std::string& fieldName) {
0104         _xId = fieldName;
0105       }
0106       /// set the field name used for Y
0107       void setFieldNameY(const std::string& fieldName) {
0108         _yId = fieldName;
0109       }
0110       /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0111           in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0112 
0113           Returns a vector of the cellDimensions of the given cell ID
0114           \param cellID is ignored as all cells have the same dimension
0115           \return std::vector<double> size 2:
0116           -# size in x
0117           -# size in y
0118       */
0119       virtual std::vector<double> cellDimensions(const CellID& cellID) const;
0120 
0121     protected:
0122       /// the grid size in X
0123       double _gridSizeX;
0124       /// the coordinate offset in X
0125       double _offsetX;
0126       /// the grid size in Y
0127       double _gridSizeY;
0128       /// the coordinate offset in Y
0129       double _offsetY;
0130       /// list of wafer x offset for each group
0131       double _waferOffsetX[MAX_GROUPS][MAX_WAFERS];
0132       /// list of wafer y offset for each group
0133       double _waferOffsetY[MAX_GROUPS][MAX_WAFERS];
0134       /// the field name used for X
0135       std::string _xId;
0136       /// the field name used for Y
0137       std::string _yId;
0138       /// encoding field used for the Magic Wafer group
0139       std::string _identifierMGWaferGroup; 
0140       /// encoding field used for the wafer
0141       std::string _identifierWafer; 
0142     };
0143 
0144   } /* namespace DDSegmentation */
0145 } /* namespace dd4hep */
0146 #endif // DDSEGMENTATION_WAFERGRIDXY_H