Declaring a 2-d Histogram

I figured out why the histogram wasn’t declared in this scope. There’s a separate program for declaring histograms that runs first. I just declared the histogram in that program. Thanks anyway!

/* Portion of program:
x1 = new TH1D(“x1”, “title 1”, 100, 0.0, 2.0);
x2 = new TH1D(“x2”, “title 2”, 100, 0.0, 3.0);
x3 = new TH1D(“x3”, “title 3”, 100, 0.0, 3.0);
x4 = new TH2D(“x4”, “title 4”, 100, 0.0, 3.0, 100, 0.0, 3.0);

The code for x1,x2,x3 was written and the program worked just fine. However, when I just tried to add a 2-D Histogram to the mix, I got the error message [‘x4’ was not declared in this scope]. The error occurred when I was compiling the program with the command ‘make’.

As a side note, the top of the program contained
#include"TH1D.h" and I added
#include"TH2D.h". I still received the same error.

How can I eliminate this error?

Thanks */

Please post a complete script that we can use to invesrigate your problem. Meanwhile declare your histograms with:

TH1D *x1 = new TH1D("x1", "title 1", 100, 0.0, 2.0); TH1D *x2 = new TH1D("x2", "title 2", 100, 0.0, 3.0); TH1D *x3 = new TH1D("x3", "title 3", 100, 0.0, 3.0); TH2D *x4 = new TH2D("x4", "title 4", 100, 0.0, 3.0, 100, 0.0, 3.0);
Rene