Setting title of a histogram on gpad

Please look into this question

Following script produces the attached image, but I cant figure out a way to change the title of the canvas. The title is oSNR[0]/iSNR[0] along with whatever is stored in io_cuts(its not visible in image as its quite long)

TCanvas *c_io_dist = new TCanvas(“c_io_dist”,“c_io_dist”, 3, 47, 1200, 800);
c_io_dist->Divide(1,1);
TH1 *h_io_dist = new TH1F(“h_io_cuts”,“h_io_cuts”, 200, 10, 1000);

c_io_dist->cd(1);
t1->Draw(“oSNR[0]/iSNR[0]>>h_io_dist”,io_cuts,“hist”);
h_io_dist->SetTitle(h_title);

the last line doesn’t work. I was wondering how to change title of the histogram to h_title.

regards,
Vaibhav


I cannot reproduce this. I did:

root [0] TH1F *h=new TH1F("h","h",100,-10,10)
root [1] ntuple->Draw("px>>h","py>0","hist")
root [2] h->SetTitle("new title")

Which gives me the following image:


I had the same issue but I went to “options” on the histogram and then clicked “Histogram title” (I know this was asked 9 years ago but just answering incase someone else has this issue)