# Working with folders inside ROOT files :::{note} As you worked with the TBrowser, you may have realized that ROOT organizes its internal resources in the form of "folders," which are conceptually similar to the hierarchy of directories on a disk. You can also have folders within a single ROOT file, to {ref}`organize objects within a file `.[^hdf5] ::: [^hdf5]: You may already be familiar with [HDF5](https://www.hdfgroup.org/solutions/hdf5/), which is conceptually similar to the approach that ROOT takes for its files: containers for a mixed set of different types of data within a hierarchy of directories. I haven't worked with HDF5 (yet) so it's hard for me to compare the two. Copy the file `folders.root` from my `root-class` directory into your own, and use the ROOT TBrowser to examine its contents. :::{note} You'll see three folders within the file: `example1`, `example2`, and `example3`. Each of these folders will be the basis of the next three exercises. All three of the subsequent exercises will require you to make a plot of data points with error bars. You'll want to use the [`TGraphErrors`](https://root.cern/doc/master/classTGraphErrors.html) class for this.[^f129] ::: Go to the description of the `TGraphErrors` class. To create a `TGraphErrors` object, you need to supply some arguments. :::{note} These are all different ways to construct a plot with error bars: - `TGraphErrors()` -- This is used internally by ROOT when reading a `TGraphErrors` object from a file. You won't use this method directly. - `TGraphErrors(Int_t n)` -- You use this when you just want to supply `TGraphErrors` with the number of points that will be in the graph, then use the `SetPoint()` and `SetPointError()` methods to assign values and errors to the points. - `TGraphErrors(const TGraphErrors& gr)` -- This is called a "copy constructor" in C++, and is used when you copy a `TGraphErrors` object. You can ignore this. - `TGraphErrors(const TH1* h)` -- You use this to create a `TGraphErrors` plot based on values in a histogram. Now that I've given you a guide to four ways to construct a TGraphErrors object, you can probably figure out what the others are: to create a graph from the contents of a file, and to create plots from either float or double-precision... somethings. Those somethings are containers. We'll learn about those in the {ref}`next section `. ::: [^f129]: For Python programmers: Because I have a generous soul, I'll permit you to use matplotlib instead of `TGraphErrors` for your x-y plots. The fact that I have no way to stop you has nothing to do with it. :::{figure-md} self_description-fig :class: align-center xkcd self_description by Randall Munroe :::