Echo object at mouse position.
Example of macro called when a pad is redrawn one must create a TExec object in the following way
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
this macro prints the bin number and the bin content when one clicks on the histogram contour of any histogram in a pad
void exec1()
{
Error(
"exec1",
"gPad is null, you are not supposed to run this macro");
return;
}
int event =
gPad->GetEvent();
if (event != 11) return;
int px =
gPad->GetEventX();
if (!select) return;
printf(
"event=%d, hist:%s, bin=%d, content=%f\n",event,
h->GetName(),binx,
h->GetBinContent(binx));
}
}
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
TH1 is the base class of all histogram classes in ROOT.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
- Author
- Rene Brun
Definition in file exec1.C.