How superimpose histograms made by repeat run of script?

I have a script that reads a TTree from an input file and uses it to create and fill a histogram. I have several different input files produced under various conditions, any one of which could be used with this script.

What is the easiest way of superimposing the histograms produced by repeatedly running the script on all of these input files ?

With a PAW kumac, this was easy. I just ran the .kumac once. Then edited the script to change the input file and use an “s” option for drawing the histogram. And then ran the script again and again.

With ROOT, it seems to be much more painful. The histograms are deleted when the script exits. So I must put the loop over the input files inside the script (meaning that it can no longer be used for looking at individual input files). Furthermore, when I book the histograms inside this loop, I believe I am required to give each one a seperate “name”. So I must generate the histogram names from the index of the loop, which is also rather painful.

Am I missing a simple trick ?

                                     Ian Tomalin

Your PAW macro must have been rather simple and using always the same histogram ID. In ROOT you can also superimpose histograms using the option SAME. But if you change the histogram pointed by a given histogram pointer of course the plot will change also. It is a bit difficult to give you a more complete answer without an example showing what you are doing. You should create all the histograms you need from the tree, plot the first one wihtout option SAME and all the others with option SAME.