Problem with hadd and TH2F

try this simple script:

{
  TH1F h1;
  h1.SetName("h1");
  h1.Fill("10", 1);
  TFile f1("f1.root", "RECREATE");
  h1.Write();
  
  h1.Reset();
  h1.Fill("20", 1);
  TFile f2("f2.root", "RECREATE");
  h1.Write();
}

now:

hadd f.root f1.root f2.root 

everythigs works, the new histograms has 2 bins, the first is labelled “10”, the second “20” and the entries are 2.

Now use TH2F instead:

{
  TH2F h1;
  h1.SetName("h1");
  h1.Fill("10", "a", 1);
  TFile f1("f1.root", "RECREATE");
  h1.Write();
  
  TH2F h2;  // Reset doesn't work!!! I need to use another variable
  h2.SetName("h1");
  h2.Fill("20", "a", 1);
  TFile f2("f2.root", "RECREATE");
  h2.Write();
}

now add the to files, but the final histograms has only one bin on the x axis labelled as “10” and 2 entries. I think this is wrong.