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  * CartesianGridXYStaggered.h
0013  *
0014  *  Created on: September 15, 2023
0015  *      Author: Sebouh J. Paul, UCR
0016  */
0017 
0018 #ifndef DDSEGMENTATION_CARTESIANGRIDXYSTAGGERED_H
0019 #define DDSEGMENTATION_CARTESIANGRIDXYSTAGGERED_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 CartesianGridXYStaggered: public CartesianGrid {
0028     public:
0029       /// Default constructor passing the encoding string
0030       CartesianGridXYStaggered(const std::string& cellEncoding = "");
0031       /// Default constructor used by derived classes passing an existing decoder
0032       CartesianGridXYStaggered(const BitFieldCoder* decoder);
0033       /// destructor
0034       virtual ~CartesianGridXYStaggered();
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       /// access the staggering option in X
0065       int staggerX() const {
0066         return _staggerX;
0067       }
0068       /// access the staggering option in Y
0069       int staggerY() const {
0070         return _staggerY;
0071       }
0072       /// access the keyword used to determine which volumes to stagger
0073       const std::string& staggerKeyword() const {
0074         return _staggerKeyword;
0075       }
0076       /// set the grid size in X
0077       void setGridSizeX(double cellSize) {
0078         _gridSizeX = cellSize;
0079       }
0080       /// set the grid size in Y
0081       void setGridSizeY(double cellSize) {
0082         _gridSizeY = cellSize;
0083       }
0084       /// set the coordinate offset in X
0085       void setOffsetX(double offset) {
0086         _offsetX = offset;
0087       }
0088       /// set the coordinate offset in Y
0089       void setOffsetY(double offset) {
0090         _offsetY = offset;
0091       }
0092       /// set the field name used for X
0093       void setFieldNameX(const std::string& fieldName) {
0094         _xId = fieldName;
0095       }
0096       /// set the field name used for Y
0097       void setFieldNameY(const std::string& fieldName) {
0098         _yId = fieldName;
0099       }
0100       /// set the staggering option in X
0101       void setStaggerX(int staggerX) {
0102         _staggerX = staggerX;
0103       }
0104       /// set the staggering option in Y
0105       void setStaggerY(int staggerY) {
0106         _staggerY = staggerY;
0107       }
0108       /// set the keyword used to determine which volumes to stagger
0109       void setStaggerKeyword(const std::string& staggerKeyword) {
0110         _staggerKeyword = staggerKeyword;
0111       }
0112       /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0113           in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0114 
0115           Returns a vector of the cellDimensions of the given cell ID
0116           \param cellID is ignored as all cells have the same dimension
0117           \return std::vector<double> size 2:
0118           -# size in x
0119           -# size in y
0120       */
0121       virtual std::vector<double> cellDimensions(const CellID& cellID) const;
0122 
0123     protected:
0124       /// the grid size in X
0125       double _gridSizeX;
0126       /// the coordinate offset in X
0127       double _offsetX;
0128       /// staggering option in X.  0 = no staggering.  1 = stagger by _gridSizeX/2.0 in odd layers
0129       int _staggerX;
0130       /// the grid size in Y
0131       double _gridSizeY;
0132       /// the coordinate offset in Y
0133       double _offsetY;
0134       /// staggering option in Y.  0 = no staggering.  1 = stagger by _gridSizeY/2.0 in odd layers
0135       int _staggerY;
0136       /// the field name used for X
0137       std::string _xId;
0138       /// the field name used for Y
0139       std::string _yId;
0140       /// the keyword used to determine which volumes to stagger
0141       std::string _staggerKeyword;
0142     };
0143 
0144   } /* namespace DDSegmentation */
0145 } /* namespace dd4hep */
0146 #endif // DDSEGMENTATION_CARTESIANGRIDXYSTAGGERED_H