I am using the TTree::MakeClass() method skeleton to loop over a tree. What I want to do is show a TGraph2D with 3 arrays from each row of the tree, press next and see the arrays from the next row, etc. If I do the following in one stage of the Loop function:
[...jentry = 0, say]
Long64_t ientry = LoadTree(jentry)
TGraph2D* phits = new TGraph2D(nphotons,posX,posY,time);
Where nphotons is an integer, and the other three are arrays of doubles of max index nphotons. The result is a blank default canvas.
If I then write the TGraph2D to a root file, open it, and draw the same TGraph2D with the same options, the properly drawn TGraph2D appears. Although this solves my problem of drawing a TGraph2D at all, I need to be able to dynamically load and draw many TGraph2D’s, not save them all to file, load and draw individually.
Can anyone help me figure out what I’m doing wrong so that it does not draw in the first case, but it does in the second? Thanks in advance,