Pad coordinates conversions


Is there a way to convert between NDC and user coordinates x,y back and forth?

In TPad I see there is NDC -> Pixel -> User , but there seems to be no conversion Pixel -> NDC nor User->NDC. It looks like also there are no getters for conversion parameters, so I cannot implement it myself without dirty hacks of the form
#define protected public
Inheriting from TPad to use gPad cannot work, because that would require calling TPad copy constructor, which is private.

Another issue is, that conversion paths that are available lose information when they go through Pixels, as there input / output parameters are integer…


It seems it is possible without hacking TPad and without using its conversion factors.

For those interested I attached a header file with conversion functions and a test suit. Use below snippet in BASH to compile and run the test.

g++ $(root-config --cflags --libs) -o testPadCoordinatesConversion
./testPadCoordinatesConversion (2.77 KB)
PadCoordinatesConversion.h (4.15 KB)