DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
MegatileLayerGridXY.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 //==========================================================================
11 
12 /*
13  * MegatileLayerGridXY.h
14  *
15  * Created on: April 19, 2016
16  * Author: S. Lu, DESY
17  */
18 
19 #ifndef DDSEGMENTATION_MEGATILELAYERGRIDXY_H
20 #define DDSEGMENTATION_MEGATILELAYERGRIDXY_H
21 
23 
24 #include <cassert>
25 
26 
27 namespace dd4hep {
28  namespace DDSegmentation {
29 
31 
49  public:
51  MegatileLayerGridXY(const std::string& cellEncoding = "");
52 
55 
57  virtual ~MegatileLayerGridXY();
58 
59  void setup();
60 
62  virtual Vector3D position(const CellID& cellID) const;
64  virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
65 
66  // set size of megatile in X,Y
67  void setMegaTileSizeXY(double x, double y) {
68  _megaTileSizeX = x;
69  _megaTileSizeY = y;
70  }
71 
73  void setMegaTileOffsetXY( double x, double y) {
74  _megaTileOffsetX = x;
75  _megaTileOffsetY = y;
76  }
77 
78  void setMegaTileCellsXY( unsigned int layer, int ix, int iy ) {
79  while ( _nCellsX.size()<=layer ) {
80  _nCellsX.emplace_back(0);
81  _nCellsY.emplace_back(0);
82  }
83  _nCellsX[layer] = ix;
84  _nCellsY[layer] = iy;
85 
86  }
87 
88  void setSpecialMegaTile( unsigned int layer, unsigned int tile,
89  double sizex, double sizey,
90  double offsetx, double offsety,
91  unsigned int ncellsx, unsigned int ncellsy );
92 
94  const std::string& fieldNameX() const {
95  return _xId;
96  }
98  const std::string& fieldNameY() const {
99  return _yId;
100  }
101 
103  void setFieldNameX(const std::string& fieldName) {
104  _xId = fieldName;
105  }
107  void setFieldNameY(const std::string& fieldName) {
108  _yId = fieldName;
109  }
110 
111  virtual std::vector<double> cellDimensions(const CellID& cellID) const;
112  virtual std::vector<double> cellDimensions(const unsigned int ilayer, const unsigned int iwafer) const;
113 
116 
118  struct segInfo {
119  double megaTileSizeX = 0;
120  double megaTileSizeY = 0;
121  double megaTileOffsetX = 0;
122  double megaTileOffsetY = 0;
123  unsigned int nCellsX = 0;
124  unsigned int nCellsY = 0;
125  segInfo() = default;
126  };
127 
128  protected:
129 
130 
132 
133  void getSegInfo( unsigned int layerIndex, unsigned int waferIndex) const;
134 
135  // the "usual" megatiles
136  // megatile size and offset is constant in all layers
137  // the segmentation may change layer-to-layer (e.g. orthogonal strips)
138 
139  // total size of surface in X,Y
140  double _megaTileSizeX = 0; // [MAX_LAYERS][MAX_WAFERS];
141  double _megaTileSizeY = 0; //[MAX_LAYERS][MAX_WAFERS];
142 
143  double _megaTileOffsetX = 0;
144  double _megaTileOffsetY = 0;
145 
146  // number of cells per megatile in X, Y
147  std::vector < int > _nCellsX;
148  std::vector < int > _nCellsY;
149 
152 
153  std::map < std::pair < unsigned int, unsigned int > , segInfo > specialMegaTiles_layerWafer;
154 
155 
157  std::string _xId;
159  std::string _yId;
161  std::string _identifierLayer;
163  std::string _identifierWafer;
164 
165  std::string _layerConfig;
166 
167  std::string _identifierModule;
168 
169  };
170 
171  } /* namespace DDSegmentation */
172 } /* namespace dd4hep */
173 #endif // DDSEGMENTATION_MEGATILELAYERGRIDXY_H
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::segInfo
segInfo()=default
dd4hep::DDSegmentation::VolumeID
uint64_t VolumeID
Definition: BitFieldCoder.h:27
dd4hep::DDSegmentation::MegatileLayerGridXY::_megaTileSizeX
double _megaTileSizeX
Definition: MegatileLayerGridXY.h:140
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::megaTileOffsetX
double megaTileOffsetX
Definition: MegatileLayerGridXY.h:121
dd4hep::DDSegmentation::MegatileLayerGridXY::setSpecialMegaTile
void setSpecialMegaTile(unsigned int layer, unsigned int tile, double sizex, double sizey, double offsetx, double offsety, unsigned int ncellsx, unsigned int ncellsy)
Definition: MegatileLayerGridXY.cpp:138
dd4hep::DDSegmentation::MegatileLayerGridXY::setMegaTileSizeXY
void setMegaTileSizeXY(double x, double y)
Definition: MegatileLayerGridXY.h:67
dd4hep::DDSegmentation::Vector3D
Simple container for a physics vector.
Definition: Segmentation.h:48
dd4hep::DDSegmentation::BitFieldCoder
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
Definition: BitFieldCoder.h:114
dd4hep::DDSegmentation::MegatileLayerGridXY::_layerConfig
std::string _layerConfig
Definition: MegatileLayerGridXY.h:165
dd4hep::DDSegmentation::MegatileLayerGridXY::fieldNameY
const std::string & fieldNameY() const
access the field name used for Y
Definition: MegatileLayerGridXY.h:98
dd4hep::DDSegmentation::MegatileLayerGridXY::_nCellsY
std::vector< int > _nCellsY
Definition: MegatileLayerGridXY.h:148
dd4hep::DDSegmentation::MegatileLayerGridXY::_identifierWafer
std::string _identifierWafer
encoding field used for the wafer
Definition: MegatileLayerGridXY.h:163
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::nCellsY
unsigned int nCellsY
Definition: MegatileLayerGridXY.h:124
dd4hep::DDSegmentation::MegatileLayerGridXY::setup
void setup()
Definition: MegatileLayerGridXY.cpp:47
dd4hep::DDSegmentation::MegatileLayerGridXY::~MegatileLayerGridXY
virtual ~MegatileLayerGridXY()
destructor
Definition: MegatileLayerGridXY.cpp:43
dd4hep::DDSegmentation::MegatileLayerGridXY::position
virtual Vector3D position(const CellID &cellID) const
determine the position based on the cell ID
Definition: MegatileLayerGridXY.cpp:73
dd4hep::DDSegmentation::MegatileLayerGridXY::setMegaTileOffsetXY
void setMegaTileOffsetXY(double x, double y)
set the coordinate offset in X, Y
Definition: MegatileLayerGridXY.h:73
dd4hep::DDSegmentation::MegatileLayerGridXY::_identifierModule
std::string _identifierModule
Definition: MegatileLayerGridXY.h:167
dd4hep::DDSegmentation::MegatileLayerGridXY::_identifierLayer
std::string _identifierLayer
encoding field used for the layer
Definition: MegatileLayerGridXY.h:161
dd4hep::DDSegmentation::MegatileLayerGridXY::MegatileLayerGridXY
MegatileLayerGridXY(const std::string &cellEncoding="")
Default constructor passing the encoding string.
Definition: MegatileLayerGridXY.cpp:31
dd4hep::DDSegmentation::MegatileLayerGridXY::getUnifNCellsX
int getUnifNCellsX()
Definition: MegatileLayerGridXY.h:114
dd4hep::DDSegmentation::MegatileLayerGridXY::cellID
virtual CellID cellID(const Vector3D &localPosition, const Vector3D &globalPosition, const VolumeID &volumeID) const
determine the cell ID based on the position
Definition: MegatileLayerGridXY.cpp:100
dd4hep::DDSegmentation::MegatileLayerGridXY::_unif_nCellsY
int _unif_nCellsY
Definition: MegatileLayerGridXY.h:151
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::megaTileSizeY
double megaTileSizeY
Definition: MegatileLayerGridXY.h:120
dd4hep::DDSegmentation::MegatileLayerGridXY::_unif_nCellsX
int _unif_nCellsX
Definition: MegatileLayerGridXY.h:150
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::megaTileSizeX
double megaTileSizeX
Definition: MegatileLayerGridXY.h:119
dd4hep::DDSegmentation::MegatileLayerGridXY::_megaTileSizeY
double _megaTileSizeY
Definition: MegatileLayerGridXY.h:141
CartesianGrid.h
dd4hep::DDSegmentation::MegatileLayerGridXY::fieldNameX
const std::string & fieldNameX() const
access the field name used for X
Definition: MegatileLayerGridXY.h:94
dd4hep::DDSegmentation::MegatileLayerGridXY
a megatile is a rectangule in x-y, split into a grid along x and y, with an exactly integer number of...
Definition: MegatileLayerGridXY.h:48
dd4hep::DDSegmentation::Segmentation::decoder
virtual const BitFieldCoder * decoder() const
Access the underlying decoder.
Definition: Segmentation.h:112
dd4hep::DDSegmentation::MegatileLayerGridXY::getUnifNCellsY
int getUnifNCellsY()
Definition: MegatileLayerGridXY.h:115
dd4hep::DDSegmentation::CellID
uint64_t CellID
Definition: BitFieldCoder.h:26
dd4hep::DDSegmentation::MegatileLayerGridXY::_currentSegInfo
segInfo _currentSegInfo
Definition: MegatileLayerGridXY.h:131
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo
Helper structure.
Definition: MegatileLayerGridXY.h:118
dd4hep::DDSegmentation::MegatileLayerGridXY::_megaTileOffsetX
double _megaTileOffsetX
Definition: MegatileLayerGridXY.h:143
dd4hep::DDSegmentation::MegatileLayerGridXY::_xId
std::string _xId
the field name used for X
Definition: MegatileLayerGridXY.h:157
dd4hep::DDSegmentation::MegatileLayerGridXY::_megaTileOffsetY
double _megaTileOffsetY
Definition: MegatileLayerGridXY.h:144
dd4hep::DDSegmentation::Segmentation::volumeID
virtual VolumeID volumeID(const CellID &cellID) const
Determine the volume ID from the full cell ID by removing all local fields.
Definition: Segmentation.cpp:66
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::nCellsX
unsigned int nCellsX
Definition: MegatileLayerGridXY.h:123
dd4hep::DDSegmentation::MegatileLayerGridXY::cellDimensions
virtual std::vector< double > cellDimensions(const CellID &cellID) const
Returns a vector<double> of the cellDimensions of the given cell ID in natural order of dimensions,...
Definition: MegatileLayerGridXY.cpp:132
dd4hep::DDSegmentation::MegatileLayerGridXY::setFieldNameX
void setFieldNameX(const std::string &fieldName)
set the field name used for X
Definition: MegatileLayerGridXY.h:103
dd4hep::DDSegmentation::MegatileLayerGridXY::segInfo::megaTileOffsetY
double megaTileOffsetY
Definition: MegatileLayerGridXY.h:122
dd4hep::DDSegmentation::MegatileLayerGridXY::getSegInfo
void getSegInfo(unsigned int layerIndex, unsigned int waferIndex) const
Definition: MegatileLayerGridXY.cpp:155
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::DDSegmentation::MegatileLayerGridXY::_nCellsX
std::vector< int > _nCellsX
Definition: MegatileLayerGridXY.h:147
dd4hep::DDSegmentation::MegatileLayerGridXY::setFieldNameY
void setFieldNameY(const std::string &fieldName)
set the field name used for Y
Definition: MegatileLayerGridXY.h:107
dd4hep::DDSegmentation::MegatileLayerGridXY::_yId
std::string _yId
the field name used for Y
Definition: MegatileLayerGridXY.h:159
dd4hep::DDSegmentation::MegatileLayerGridXY::setMegaTileCellsXY
void setMegaTileCellsXY(unsigned int layer, int ix, int iy)
Definition: MegatileLayerGridXY.h:78
dd4hep::DDSegmentation::MegatileLayerGridXY::specialMegaTiles_layerWafer
std::map< std::pair< unsigned int, unsigned int >, segInfo > specialMegaTiles_layerWafer
Definition: MegatileLayerGridXY.h:153
dd4hep::DDSegmentation::CartesianGrid
Segmentation base class describing cartesian grid segmentation.
Definition: CartesianGrid.h:28