Color Information from TPaletteAxis

Hello,

I am currently using ROOT to make an event display for a detector. The Items of Interest are 89 Photomultplier tubes that I have modeled using pads. In order to produce a color palette axis for this plot I have to first make a 2D histogram and copy the color axis from the contour plot. Is there a way to get the z-information and corresponding color from the palette so that I can fill the correct pads with the correct color. I have attached a pdf file of the current output. As can be seen there is no correlation between the colors in the pads and the colors on the scale.

Does anyone have any hints on how to do this?

Sincerely

Roman Gomez
PMTarrayswbar.pdf (17.5 KB)

This function does not exist in TPaletteAxis. For the time being you should do something similar to what is done in THistPainter::PaintColorLevels. The relevant part in this function is:

[...]
         Int_t theColor = Int_t((color+0.99)*Float_t(ncolors)/Float_t(ndivz));
         if (theColor > ncolors-1) theColor = ncolors-1;
         fH->SetFillColor(gStyle->GetColorPalette(theColor));
[...]

An example of such a function can be found here: TH2, col above lego (ztest.cpp)
Cheers,
Z