Dear root experts
After implementing a member function of a class (ATEventDrawTask) that yields the coordinates of each bin of a TH2Poly by clicking on the pad plane, I find that, since the AddExec function is static, non-static members cannot be accessed (in principle).
What I want to do is to use the bin number provided by my AddExec function as argument of another non-static member of this class which belongs to a different class, called ATPad. This ATPad member is also used in other member functions of the class. This ATPad has in turn a member to find the correspondence between bin and real pad and then find an array containing the information (stored in a std::vector member of TPad) I want to plot into a TH1 histogram, that is placed into a TCanvas managed by a TEveEventManager.
Everything is working except the part where I have to make the “connection” between the AddExec result and the ATPad member call. Is there any way to do this?
Add Exec function:
void
ATEventDrawTask::SelectPad()
{
int event = gPad->GetEvent();
if (event != 11) return; //may be comment this line
TObject *select = gPad->GetSelected();
if (!select) return;
if (select->InheritsFrom(TH2Poly::Class())) {
TH2Poly *h = (TH2Poly*)select;
gPad->GetCanvas()->FeedbackMode(kTRUE);
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);
gVirtualX->DrawLine(pxmin,py,pxmax,py);
gPad->SetUniqueID(py);
Float_t upx = gPad->AbsPixeltoX(px);
Float_t upy = gPad->AbsPixeltoY(py);
Double_t x = gPad->PadtoX(upx);
Double_t y = gPad->PadtoY(upy);
Int_t bin = h->FindBin(x,y);
const char *bin_name = h->GetBinName(bin);
std::cout<<" Bin number selected : "<<bin<<" Bin name :"<<bin_name<<std::endl;
}
AddExec call (fEventManager is the pointer to the TEveEventMAnager derived class)
fCvsPadPlane = fEventManager->GetCvsPadPlane();/
fCvsPadPlane->AddExec("ex","ATEventDrawTask::SelectPad()");
Another question is, how to put arguments into the AddExec function when this one is called foo->AddExec(“ex”,"MyClass::MyExec)).
Thank you very much in advance.
Best regards