Iterable Multidimensional Array Class for FPGATrackSimGenScanTool.
- Author
- Elliot Lipeles
- Date
- Sept 10th, 2024 Declarations in this file:
Description of purpose/function:
- In order to efficiently navigate and iterate over the 5d bins in FPGATrackSimGenScanTool, a dedicated array class has been developed. Multidimensional arrays in stl don't appear until c++23 at the earliest and have not been evaluated for appropriateness.
- This array can have an arbitrary number of dimensions set by an std:vector (dims) with the size of the number of demensions and the size in each dimension set in the constructor or later by the "setsize" method.
- The implemenatation uses an std::vector to avoid an direct memory management. The requried size is calcuated from the m_dims vector.
- For accessing elements, it converts a index std::vector<unsigned> of length Ndim (idx) into a single int index into the 1d std::vector.
- It has a standard iterator so you can iterate with "for (auto &bin : myArray)" where bin would be an iterator with two accessors bin.idx() gives the size N-dim std:vector<unsigned> which is N-dim index the iterator is on and bin.data() which is a reference to the content of the array for that index
Definition in file FPGATrackSimGenScanArray.h.