Saving Histogram in a Tree

I am trying to create a root file with a tree and save a generated histogram in there. It is not working. Here is my code. Thank you.

void TFileCreate()
  4 {
  5         TFile *filename = new TFile("filename.root", "RECREATE");
  6         TTree *treename = new TTree("treename", "treetitle");
  7 
  8         TH1F *histname = new TH1F("histname", "histtitle", 100, 0, 10); 
  9         histname->FillRandom("gaus",1000);
 10 //      histname->Draw();
 11 
 12         treename->Get(histname);
 13         treename->Write();
 14 
 15         filename->Close();

Why do you want to save the histogram “in the tree”? why don’t you simply save it in the file “filename.root” ?

I have 128 plots for each event so I am trying to create a tree for each event and fill it with associated plots. Right now, my root file has this format.
image
e0chn0 - e78chn16 means Event 0, chn 0 to Event 78 chn16
image