I currently have a TH3 plot and I’m working on getting the X and Y projections of the TH3. The TH3 plots well, but the X and Y projections plot as a flat line. I attached related code. My program reads from a file that has three columns, each row presents a set of coordinates.
TCanvas *canvas1 = new TCanvas("canvas1", "canvas", 900, 900);
TH3F *plot = new TH3F("test", "test", 100, 0, 100, 100, 0, 100, 100, 0, 100);
while (! feof (filename))
{
fscanf (filename, "%f %f %f \n", &x, &y, &z);
plot -> Fill(x, y, z);
}
canvas1 -> Divide (2,2);
canvas1 -> cd(1);
plot -> Draw("ISO");
canvas1 -> cd(2);
plot -> ProjectionX() -> Draw();
canvas1 -> cd(3);
plot -> ProjectionY() -> Draw();