The EventStatus facility invokes the member function GetObjectInfo
for the object identified with the mouse.
Root provides a default TObject::GetObjectInfo (see below).
This method can be redefined by all classes derived from TObject.
Rene Brun
//_______________________________________________________________
Text_t *TObject::GetObjectInfo(Int_t px, Int_t py)
{
// Returns string containing info about the object at (px,py).
// This method is typically overridden by classes of which the
objects
// can report peculiarities for different positions.
if (!gPad) return "";
static char info[64];
Float_t x = gPad->AbsPixeltoX(px);
Float_t y = gPad->AbsPixeltoY(py);
sprintf(info,"x=%.3g, y=%.3g",gPad->PadtoX(x),gPad->PadtoY(y));
return info;
}
Another example:
//______________________________________________________________
Text_t *TH1::GetObjectInfo(Int_t px, Int_t py)
{
// Redefines TObject::GetObjectInfo.
// Displays the histogram info (bin number, contents, integral
// corresponding to cursor position px,py
//
if (!gPad) return "";
static char info[64];
Float_t x = gPad->PadtoX(gPad->AbsPixeltoX(px));
Float_t y = gPad->PadtoY(gPad->AbsPixeltoY(py));
Int_t binx,biny;
binx = fXaxis.FindBin(x);
if (GetDimension() == 1) {
Double_t integ = 0;
for (Int_t bin=0;bin<binx;bin++) {integ += GetBinContent(bin+1);}
sprintf(info,"(x=%g, y=%g, binx=%d, binc=%g,
Sum=%g)",x,y,binx,GetBinContent(binx),integ);
} else {
biny = fYaxis.FindBin(y);
sprintf(info,"(x=%g, y=%g, binx=%d, biny=%d,
binc=%g)",x,y,binx,biny,GetCellContent(binx,biny));
}
return info;
}