# How to open multiple root files at once?

**URL:** <https://root-forum.cern.ch/t/how-to-open-multiple-root-files-at-once/57549>\
**Category:** Newbie\
**Created:** [December 14, 2023, 3:35pm UTC](https://root-forum.cern.ch/t/how-to-open-multiple-root-files-at-once/57549 "2023-12-14T15:35:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [December 14, 2023, 3:35pm UTC](https://root-forum.cern.ch/t/how-to-open-multiple-root-files-at-once/57549/1 "2023-12-14T15:35:14Z")

</div>

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

```auto
-L file.root file2.root 

```

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

```auto
TFIle f(file1.root")

```

Thanks a lot

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 14, 2023, 4:08pm UTC](https://root-forum.cern.ch/t/how-to-open-multiple-root-files-at-once/57549/2 "2023-12-14T16:08:46Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [December 14, 2023, 4:09pm UTC](https://root-forum.cern.ch/t/how-to-open-multiple-root-files-at-once/57549/3 "2023-12-14T16:09:53Z")

</div>

Thanks a lot!
