Change histogram name dynamically

Dear rooters,
I need to call a function which returns a TH1F like
TH1F *h=f()
I need to change the name of the histogram f returned as I cannot access function f.
is there way to do this?
best,

h->SetName(“newname”);

Rene

sorry, i forgot to check that th1f derives from tnamed.
thanks