Just wondering if there’s a particular reason why using getPixelIndex() with a certain detector model returns virtual std::pair< int, int > whilst if one already has an instance of a Pixel and then applies pixel.getIndex() then it returns Pixel::Index instead?
Hello @farrencc ,
The reason is just convenience. From the detector model, you get the pixel index corresponding to a given position, whereas a Pixel object returns its own index, so they do not have so much to do with each other. An important note is that getPixelIndex can also return indices that are outside of the matrix, if it corresponds to the position given in the argument. If you want to find all pixels within the matrix, getPixels() on the detector model will return a set of all the Pixel::Index values of those pixels.
A std::pair can be neat when using e.g. structured bindings to unpack it into sensible variable names directly, which is what is done in the framework every time getPixelIndex is called.
The getIndex() method of the Pixel object returns a ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<int>>, which has different conveniences.
In the end either would be replaceable with the other though!
Kind regards,
Håkan