Echo object at mouse position.
Example of macro called when a pad is redrawn one must create a TExec object in the following way
gPad->AddExec(
"ex1",
".x hist057_TExec_th1.C");
this macro prints the bin number and the bin content when one clicks on the histogram contour of any histogram in a pad
void hist057_TExec_th1()
{
Error(
"hist057_TExec_th1",
"gPad is null, you are not supposed to run this macro");
return;
}
int px =
gPad->GetEventX();
if (select && select->InheritsFrom(
TH1::Class())) {
Int_t binx =
h->GetXaxis()->FindBin(
x);
printf(
"event=%d, hist:%s, bin=%d, content=%f\n", event,
h->GetName(), binx,
h->GetBinContent(binx));
}
}
int Int_t
Signed integer 4 bytes (int).
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
TH1 is the base class of all histogram classes in ROOT.
Mother of all ROOT objects.
- Date
- November 2022
- Authors
- Rene Brun, Sergey Linev
Definition in file hist057_TExec_th1.C.