File indexing completed on 2025-01-18 09:55:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef DDSEGMENTATION_MEGATILELAYERGRIDXY_H
0020 #define DDSEGMENTATION_MEGATILELAYERGRIDXY_H
0021
0022 #include <DDSegmentation/CartesianGrid.h>
0023
0024 #include <cassert>
0025
0026
0027 namespace dd4hep {
0028 namespace DDSegmentation {
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class MegatileLayerGridXY: public CartesianGrid {
0049 public:
0050
0051 MegatileLayerGridXY(const std::string& cellEncoding = "");
0052
0053
0054 MegatileLayerGridXY(const BitFieldCoder* decoder);
0055
0056
0057 virtual ~MegatileLayerGridXY();
0058
0059 void setup();
0060
0061
0062 virtual Vector3D position(const CellID& cellID) const;
0063
0064 virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
0065
0066
0067 void setMegaTileSizeXY(double x, double y) {
0068 _megaTileSizeX = x;
0069 _megaTileSizeY = y;
0070 }
0071
0072
0073 void setMegaTileOffsetXY( double x, double y) {
0074 _megaTileOffsetX = x;
0075 _megaTileOffsetY = y;
0076 }
0077
0078 void setMegaTileCellsXY( unsigned int layer, int ix, int iy ) {
0079 while ( _nCellsX.size()<=layer ) {
0080 _nCellsX.emplace_back(0);
0081 _nCellsY.emplace_back(0);
0082 }
0083 _nCellsX[layer] = ix;
0084 _nCellsY[layer] = iy;
0085
0086 }
0087
0088 void setSpecialMegaTile( unsigned int layer, unsigned int tile,
0089 double sizex, double sizey,
0090 double offsetx, double offsety,
0091 unsigned int ncellsx, unsigned int ncellsy );
0092
0093
0094 const std::string& fieldNameX() const {
0095 return _xId;
0096 }
0097
0098 const std::string& fieldNameY() const {
0099 return _yId;
0100 }
0101
0102
0103 void setFieldNameX(const std::string& fieldName) {
0104 _xId = fieldName;
0105 }
0106
0107 void setFieldNameY(const std::string& fieldName) {
0108 _yId = fieldName;
0109 }
0110
0111 virtual std::vector<double> cellDimensions(const CellID& cellID) const;
0112 virtual std::vector<double> cellDimensions(const unsigned int ilayer, const unsigned int iwafer) const;
0113
0114 int getUnifNCellsX() {return _unif_nCellsX;}
0115 int getUnifNCellsY() {return _unif_nCellsY;}
0116
0117
0118 struct segInfo {
0119 double megaTileSizeX = 0;
0120 double megaTileSizeY = 0;
0121 double megaTileOffsetX = 0;
0122 double megaTileOffsetY = 0;
0123 unsigned int nCellsX = 0;
0124 unsigned int nCellsY = 0;
0125 segInfo() = default;
0126 };
0127
0128 protected:
0129
0130
0131 mutable segInfo _currentSegInfo;
0132
0133 void getSegInfo( unsigned int layerIndex, unsigned int waferIndex) const;
0134
0135
0136
0137
0138
0139
0140 double _megaTileSizeX = 0;
0141 double _megaTileSizeY = 0;
0142
0143 double _megaTileOffsetX = 0;
0144 double _megaTileOffsetY = 0;
0145
0146
0147 std::vector < int > _nCellsX;
0148 std::vector < int > _nCellsY;
0149
0150 int _unif_nCellsX;
0151 int _unif_nCellsY;
0152
0153 std::map < std::pair < unsigned int, unsigned int > , segInfo > specialMegaTiles_layerWafer;
0154
0155
0156
0157 std::string _xId;
0158
0159 std::string _yId;
0160
0161 std::string _identifierLayer;
0162
0163 std::string _identifierWafer;
0164
0165 std::string _layerConfig;
0166
0167 std::string _identifierModule;
0168
0169 };
0170
0171 }
0172 }
0173 #endif