Show the slice of a TH2 following the mouse position.
void DynamicSlice()
{
c1 =
new TCanvas(
"c1",
"Dynamic Slice Example",10,10,700,500);
for (
Int_t i = 0; i < 50000; i++) {
}
c1->
AddExec(
"dynamic",
"DynamicExec()");
}
void DynamicExec()
{
if(!select) return;
int pyold =
gPad->GetUniqueID();
int px =
gPad->GetEventX();
int py =
gPad->GetEventY();
float uxmin =
gPad->GetUxmin();
float uxmax =
gPad->GetUxmax();
int pxmin =
gPad->XtoAbsPixel(uxmin);
int pxmax =
gPad->XtoAbsPixel(uxmax);
if(pyold)
gVirtualX->DrawLine(pxmin,pyold,pxmax,pyold);
else c2 =
new TCanvas(
"c2",
"Projection Canvas",710,10,700,500);
char title[80];
sprintf(title,"Projection of biny=%d",biny);
}
- Author
- Rene Brun
Definition in file DynamicSlice.C.