How can i draw several plot in one canvas?

Hi experts!
I wanna draw several histogram in one canvas.

void CsI_Energy()
  TChain * tree = new TChain("ntp");
  char filename[300];
  for (int i=1; i<=459; i++){
  TString datadir = "/data/COSINE/WORK/islee/NaI037/data/MRGD/";

  TH1F *E = new TH1F("E","",100,0,5000);
  TFile o("CsI_0.root","RECREATE");

This is the code i was see only one plot of BCsI0.Energy.
But I wanna see 12 plot in one canvas.( BCsI0~11.Energy)
So How can i do this?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

tree->Draw("BCsI1.Energy" ,"","SAME");
tree->Draw("BCsI2.Energy" ,"","SAME");
etc ...

No. I wanna divide canvas 12 part. And Draw the 12 plot.

TCanvas *c = new TCanvas("c", "c");
gROOT->cd(); // newly created histograms should go here
for (int i = 0; i < 12; i++) {
  c->cd(i + 1);
  TH1F *h = new TH1F(TString::Format("E_%d", i), "", 100, 0., 5000.);
  tree->Project(h->GetName(), TString::Format("BCsI%d.Energy", i));

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.