ROOT Version: Not Provided Platform: Not Provided Compiler: Not Provided
Hi experts, I’m using TChain to channel multiple .root files at once. The problem occurs when I try and plot.
If I do the normal
TChain ch(“TreeName”);
ch.(“file/path/*.root”)
Then try to plot using the following divided canvas:
TCanvas *c1 = new TCanvas(“c1”,“c1”,1000,1000);
c1-> Divide(1,2);
c1->cd(1);
ch.Draw(Plot1)
c1->cd(2);
ch.Draw(Plot2)
This method will allow me to plot2 on the second half canvas, but the first half of the canvas comes out blank? I feel like the ‘ch.Draw’ on the second half is overwriting the first, but I’m not sure how to fix it. I need to be able to plot both on the same canvas.
I’m guessing that Plot1 and Plot2 are your plot commands (maybe you could post them)? Are you creating two different histograms in these commands or are you using two histograms that have been created before?
It seems to me like you are either using the same histogram name in both plot commands or you are not using a histogram name at all (which causes the default htemp to be used twice). This causes the second plot command to overwrite the first one.
You need to use two different names for the histograms, otherwise your second command overwrites the histogram h you’ve created with the first command. Something like this should work: