This tutorial demonstrates how the highlight mechanism can be used on an histogram. 
A 2D histogram is booked an filled with a random gaussian distribution and drawn with the "col" option. Then an highlight method is connected to the histogram. Moving the mouse on the histogram open a new canvas displaying the two X and Y projections at the highlighted bin.
 
 
{
   auto h2 = 
dynamic_cast<TH2F *
>(obj);
 
   if(!h2) return;
   if (!h2->IsHighlight()) { 
      if (CanvasProj) delete CanvasProj;
      h2->SetTitle("Disable highlight");
      return;
   }
 
 
   auto px = h2->ProjectionX("_px", yhb, yhb);
   auto py = h2->ProjectionY("_py", xhb, xhb);
 
   if (!CanvasProj) {
      CanvasProj = 
new TCanvas(
"CanvasProj", 
"CanvasProj", 505, 0, 600, 600);
 
      CanvasProj->Divide(1, 2);
      CanvasProj->cd(1);
      px->Draw();
      CanvasProj->cd(2);
      py->Draw();
   }
 
   h2->SetTitle(
TString::Format(
"Highlight bin [%02d, %02d]", xhb, yhb).Data());
 
 
   CanvasProj->GetPad(1)->Modified();
   CanvasProj->GetPad(2)->Modified();
   CanvasProj->Update();
}
 
void hlHisto2()
{
   auto c1 = 
new TCanvas(
"Canvas", 
"Canvas", 0, 0, 500, 500);
 
   c1->HighlightConnect(
"Highlight2(TVirtualPad*,TObject*,Int_t,Int_t)");
 
 
   auto h2 = 
new TH2F(
"h2", 
"", 50, -5.0, 5.0, 50, -5.0, 5.0);
 
   h2->Draw("col");
 
   info = 
new TText(0.0, -4.0, 
"please move the mouse over the frame");
 
 
   h2->SetHighlight();
}
 
R__EXTERN TRandom * gRandom
 
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
 
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
 
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
 
TObject * FindObject(const char *name) const override
Search object named name in the list of functions.
 
2-D histogram with a float per channel (see TH1 documentation)}
 
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
 
Mother of all ROOT objects.
 
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
 
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
 
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
Base class for several text objects.
 
TVirtualPad is an abstract base class for the Pad and Canvas classes.
 
virtual void Modified(Bool_t flag=1)=0