How to open multiple root files at once?

Hi Root users,

I have two root files that contain a histogram named h9.

Is it possible to open them once and access both histograms at once in the CLI session?

Currently doing

-L file.root file2.root 

only stores root2 itseems, same seems to be the issue with using

TFIle f(file1.root")

Thanks a lot

{
   auto f1 = new TFile("file1.root");
   auto f2 = new TFile("file2.root");
   TH1F* h9v1 = (TH1F*)f1->Get("h9");
   TH1F* h9v2 = (TH1F*)f2->Get("h9");
}
1 Like

Thanks a lot!