Linking loops in separate codes

Hello,

I have two scripts, one to analyse raw data and one to manipulate a simulation. I need to divide a histogram generated by one by a histogram generated the other script. I have tried the syntax:

Loop(TH1* hist1, TH1* hist2);
TTree* plot()
jdata-> Loop(hist1data, hist2data);
jsimu-> Loop(hist1simu, hist2simu);
hist2simu-> Divide(hist2data);

and then to run the code I type

into the terminal. However I get the error message:

Error: Symbol TH1 is not defined in current scope (tmpfile):1: Error: Symbol hist1 is not defined in current scope (tmpfile):1: Error: Symbol TH1 is not defined in current scope (tmpfile):1: Error: * Illegal operator for pointer 3 (tmpfile):1:

If I only type

then I get this error message:

Does anyone know how to rectify this problem? Thanks.

I have divided the histogram from the data by the histogram from the simulations.

I changed the code to:

and
I found that it works if:
[ul]
[li] I first run the script controlling the simulation[/li]
[li] then declare the histogram that the data will be contained in, in the terminal. [/li]
[li] run it using t.Loop(TH1*hist1) for the script controlling the data from experiment[/li]
[li] in the terminal Divide histograms then make a canvas a draw a canvas.[/li][/ul]

ROOT User’s Guide - Chapter 6. A Little C++
ROOT User’s Guide - Chapter 7. CINT the C++ Interpreter