Hi everyone, I’m trying to get a canvas divided in 20 pads containing each one a TH1D; I’m doing it by iteration inside a c++ program.
When I run the program, the result is an undivided canvas with only the last TH1D displayed (I suppose the other ones get overwritten).
These are my ROOT includes and declaration:
#include "TCanvas.h"
#include "TH1D.h"
#include "TPad.h"
#include "TApplication.h"
TApplication app("app",NULL,NULL);
In main() I first create a divided canvas:
TCanvas *c1 = new TCanvas("c1","Name");
c1->Divide(5,4);
then I fill the pads in the following loop:
for(int i=0;i<20;i++){
test = analysis(name_file[i]+ ".dat", &chi, &dn, &dt);
//HIST
c1->cd(i);
TH1D *h = new TH1D("h", name.c_str(), 2, 0, 1);
h->Fill(0.0, dn);
h->Fill(1.0, dt);
h->Draw("HIST");
gPad->Update();
}
app.Run(true);
where analysis() is a routine that calculates the weights of the channels.
Where did I mess up?
Thank you!
_ROOT Version:_6.16/00
_Platform: Ubuntu on WSL