I am trying to build a function returning a TPad.
The idea is to fill the TPad with the objects I need to draw and then plot the TPad into a TCanvas.
The problem I have is that the resulting TCanvas seems not to contain the TPad I wanted to plot.
This is a simple working example of my problem:
TPad *getPad() {
TPad *pad= new TPad("pad","pad",0.,0.,1.,1.);
TH1D *h = new TH1D("h","h",20,-5.,5.);
h->FillRandom("gaus");
pad->cd();
h->Draw();
return pad;
}
int padFunc()
{
TCanvas *c = new TCanvas("c","c",500,500);
c->cd();
TPad *pad =getPad();
pad->Draw();
c->Update();
}