Echo object at mouse position and show a graphics line.
Example of macro called when a mouse event occurs in a pad.
Example:
gPad->AddExec(
"ex2",
".x exec2.C");
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
When moving the mouse in the canvas, a second canvas shows the projection along X of the bin corresponding to the Y position of the mouse. The resulting histogram is fitted with a gaussian. A "dynamic" line shows the current bin position in Y. This more elaborated example can be used as a starting point to develop more powerful interactive applications exploiting CLING as a development engine.
{
Error(
"exec2",
"gPad is null, you are not supposed to run this macro");
return;
}
int px =
gPad->GetEventX();
int py =
gPad->GetEventY();
}
if(
c2)
delete c2->GetPrimitive(
"Projection");
else c2 =
new TCanvas(
"c2",
"Projection Canvas",710,10,700,500);
hp->SetName(
"Projection");
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
1-D histogram with a double per channel (see TH1 documentation)
Service class for 2-D histogram classes.
Mother of all ROOT objects.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
- Authors
- Rene Brun, Sergey Linev
Definition in file exec2.C.