The detector models currently implemented assume a rectangular/square pixel cells and cannot be used for devices with a hexagonal grid. I present to you the prototype for HexagonalPixelDetectorModel, a new Detector Model class that is specifically designed for hexagonal pixels. To implement this class, the calculation of the pixel index is integrated into the DetectorModel class (for rectangular devices) and overwritten by the HexagonalPixelDetectorModel (for a hexagonal grid). This class is partially based on previous work outlined here: [https://github.com/allpix-squared/allpix-squared/pull/33/files]. However, I have introduced changes that correctly gets the pixel index including the edges of the grid and applies more to general detector models.
The indices are calculated by exploiting the periodicity in the pattern of the hexagonal grid, as shown in the image above. The rectangular grid positioned at the very bottom left is repeated throughout the grid and by dividing this grid into different parts allows one to assign the indices of the grid. Some assumptions are made here:
- The pixel geometry is assumed to be a normal hexagon
- Pixel index starts at (0,0) with the origin of the local coordinate system centered at the bottom left corner pixel (see image above)
- The partial pixels at the edges of the grid is treated as being "out of grid" and assigned index (-1,-1) which will then be filtered out by the isWithinPixelGrid function.
This is still very much work in progress and a lot of work needs to be done. Here's some problems that I have noticed so far and will be addressed in the future:
- Certain indices at the edges seem to be incorrect
- There are some "terrible/spaghetti" coding for the sake of correctly compiling the code to test the output
- The code could be rendered shorter by also treating the edges within the same if statements as the inner pixels
- Running the program seem to output warning from ROOT regarding bins and others (Origin of this is unknown)
Some future work to be done:
- Making sure that the hexagonal layout works with field maps imported from TCAD
- Correct treatment of the weighting potential/transient calculation for the hexagonal layout
- Various functionality tests including comparison between rectangular and hexagonal grid
- Commenting code to make it easier to follow
As this is still work in progress, any feedback is very welcome.