Hi, i’m trying to write a GUI to draw a histogram and then rebin it.
I don’t know how to pass arguments to the functions i use when i connect them with buttons.
it’s a modified version of the example i found on the user guide
TGTextButton *draw =new TGTextButton(hframe,"&Draw");
draw->Connect("Clicked()","Rebin",this,"DoDraw(string cosa)");
where DoDraw is
[code]void Rebin::DoDraw(string cosa)
{
int PE=0;
cout<<cosa<<endl;
TTree *oldtree =(TTree*)myfile->Get(cosa.c_str());
oldtree->SetBranchAddress("PEtotpmt1",&PE);
int nent =oldtree->GetEntries();
//*****************************************************************************
TH1F *primo =new TH1F(“pmt1”,“pmt1”,nent,0,nent);
for(int g=0; g<nent;g++)
{
oldtree->GetEntry(g);
primo->Fill(PE);
}
TCanvas *canvas2 =new TCanvas();
primo->Draw();
canvas2->Update();
}
[/code]
i get
root [1] prova("PE_totali")
Error: class,struct,union or type stringcosa not defined (tmpfile):1:
Error: class,struct,union or type stringcosa not defined (tmpfile):1:
Error: class,struct,union or type stringcosa not defined (tmpfile):1:
Error: class,struct,union or type stringcosa not defined (tmpfile):1:
Error: class,struct,union or type stringcosa not defined (tmpfile):1:
Error: class,struct,union or type stringcosa not defined (tmpfile):1:
i attach the tar file (a directory named AmirGUI)
compile with “.L Rebin.cc+”, run with “prova(“PE_totali”)”
Thank you