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 /*
0013  * PolarGridRPhi.h
0014  *
0015  *  Created on: Sept 13, 2014
0016  *      Author: Marko Petric
0017  */
0018 
0019 #ifndef DDSEGMENTATION_POLARGRIDRPHI_H
0020 #define DDSEGMENTATION_POLARGRIDRPHI_H
0021 
0022 #include <DDSegmentation/PolarGrid.h>
0023 #include <math.h>
0024 
0025 namespace dd4hep {
0026   namespace DDSegmentation {
0027 
0028     /// A segmentation for arbitrary sizes in R and R-dependent sizes in Phi
0029     class PolarGridRPhi: public PolarGrid {
0030     public:
0031       /// Default constructor passing the encoding string
0032       PolarGridRPhi(const std::string& cellEncoding = "");
0033       /// Default constructor used by derived classes passing an existing decoder
0034       PolarGridRPhi(const BitFieldCoder* decoder);
0035       /// destructor
0036       virtual ~PolarGridRPhi();
0037 
0038       /// determine the position based on the cell ID
0039       virtual Vector3D position(const CellID& cellID) const;
0040       /// determine the cell ID based on the position
0041       virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
0042       /// access the grid size in R
0043       double gridSizeR() const {
0044         return _gridSizeR;
0045       }
0046       /// access the grid size in Phi
0047       double gridSizePhi() const {
0048         return _gridSizePhi;
0049       }
0050       /// access the coordinate offset in R
0051       double offsetR() const {
0052         return _offsetR;
0053       }
0054       /// access the coordinate offset in Phi
0055       double offsetPhi() const {
0056         return _offsetPhi;
0057       }
0058       /// access the field name used for R
0059       const std::string& fieldNameR() const {
0060         return _rId;
0061       }
0062       /// access the field name used for Phi
0063       const std::string& fieldNamePhi() const {
0064         return _phiId;
0065       }
0066       /// set the grid size in R
0067       void setGridSizeR(double cellSize) {
0068         _gridSizeR = cellSize;
0069       }
0070       /// set the grid size in Phi
0071       void setGridSizePhi(double cellSize) {
0072         _gridSizePhi = cellSize;
0073       }
0074       /// set the coordinate offset in R
0075       void setOffsetR(double offset) {
0076         _offsetR = offset;
0077       }
0078       /// set the coordinate offset in Phi
0079       void setOffsetPhi(double offset) {
0080         _offsetPhi = offset;
0081       }
0082       /// set the field name used for X
0083       void setFieldNameR(const std::string& fieldName) {
0084         _rId = fieldName;
0085       }
0086       /// set the field name used for Y
0087       void setFieldNamePhi(const std::string& fieldName) {
0088         _phiId = fieldName;
0089       }
0090       /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0091           in natural order of dimensions: dr, r*dPhi
0092 
0093           Returns a vector of the cellDimensions of the given cell ID
0094           \param cID cellID
0095           \return std::vector<double> size 2:
0096           -# size in r
0097           -# size of r*dPhi at the radial centre of the pad
0098       */
0099       virtual std::vector<double> cellDimensions(const CellID& cID) const;
0100 
0101     protected:
0102       /// the grid size in R
0103       double _gridSizeR;
0104       /// the coordinate offset in R
0105       double _offsetR;
0106       /// the grid size in Phi
0107       double _gridSizePhi;
0108       /// the coordinate offset in Phi
0109       double _offsetPhi;
0110       /// the field name used for R
0111       std::string _rId;
0112       /// the field name used for Phi
0113       std::string _phiId;
0114     };
0115 
0116   } /* namespace DDSegmentation */
0117 } /* namespace dd4hep */
0118 #endif // DDSEGMENTATION_POLARGRIDRPHI_H