Load existing cut files and plot the TCutg on existing 2d hists in diff sub-canvas

Hi everyone, I am having trouble plotting the previously created TCutG files (filenames: x2vsx1_0_0.C, x2_x1_0_1.C, etc., and TCutG of the form TCutG *cutx_0_0, and so on, inside a directory) on top of the existing 2D histograms on each sub-canvas, i.e., attempting to overplot cutx_0_0 on cd(1), cutx_0_1 on cd(2), and so on.

This is a summary of what the macro does.

Open the ROOT file: The file contains a tree of data that I need to plot.
Create canvas and sub-canvases: Multiple canvases are created to display the plots.
Draw Data: For each canvas, specific data points are plotted from the tree.

upto this point it works fine. the problem begins in the next step loading and plotting the cuts.

To load, I’m doing the following:

TString cutFileName = Form(“%sX2vsX1_%d_%d.C”, cutDir.Data(), j, i);
gROOT->LoadMacro(Form(“%s”, cutFileName.Data()));

My question is basically how to draw the cut in the same sub-canvas using the Draw (same") command or something similar so that it overplots on the existing hists.

this is how the cut files look

{
//========= Macro generated from object: cutx_0_0/Graph
//========= by ROOT version 6.10/04

TCutG *cutx_0_0 = new TCutG(“cutx_0_0”,10);
cutx_0_0->SetVarY(“X2[0][0]”);
cutx_0_0->SetVarX(“X1[0][0]”);
cutx_0_0->SetTitle(“Graph”);
cutx_0_0->SetFillColor(1);
cutx_0_0->SetPoint(0,42.5,53.1579);
cutx_0_0->SetPoint(1,43.7,51.7571);
cutx_0_0->SetPoint(2,47.3667,46.3542);
cutx_0_0->SetPoint(3,53.3667,41.1513);
cutx_0_0->SetPoint(4,55.5667,44.153);
cutx_0_0->SetPoint(5,55.1,47.5548);
cutx_0_0->SetPoint(6,53.3,50.7566);
cutx_0_0->SetPoint(7,49.0333,54.7588);
cutx_0_0->SetPoint(8,46.3667,55.7593);
cutx_0_0->SetPoint(9,42.5,53.1579);
//cutx_0_0->Draw(“”);
}

Thanks for your time and consideration.

Hi,

Adding in the loop @couet.

Cheers,
D

TCutG is TGraph. The macro you post builds it. At the end of the macro simply do:

cutx_0_0->Draw(“L”)

If you want to draw it on top of an exiting canvas

(sorry for the late reply, I was off end of last week).