# Graphing Large TTrees

Hi all,
Ive build a tree that stores a decently large amount of data, around 150000 points. I am trying to figure out a way to monitor this data as it comes in to watch for general trends. The data comes in at about .5 sec intervals.
originally I thought i could simply call the TTree::Draw() function a every interval and this works for a few hours and then the delay in graphing becomes very noticable.
Is there a good way to do this within TTree or TGraph using dynamic arrays?

any help or advice would be appreciated.

thanks

John

You should consider

• use a cumulative TTree::Draw call instead of recreating the graph from scratch every time
• use a TH1 or 2 instead of TGraph (still using the cumulative call) [This will reduce the effective number of point to be plotted on the screen.

Cheers,
Philippe

Could you explain VERY PRECISELY what you want?
Do you want to draw
-a histogram
-a TGraph
-a scatter plot
-???
-What is the tree.Draw command that you execute?

Rene

I am looking to draw essentially a TGraph. I have time as branch and a data set corresponding to that time on another branch.
the TTree::Draw command that i am using right now is:
tree->Draw(“dataset:time”,"", “CP”);

This gets very slow as the hours go by. I need to monitor this data on this graph with a large amount of data for a long period of time. I need to either be able to add points on this graph one at a time or be able to graph only every x number of points from the tree. This would be okay since im trying to see a long term trend.
even if i did the cumulative draw, which i take to mean graphing everything at the end when im done with filling the tree, it still seems to take close to a minute to graph 150000 points.

sorry to have been unprecise.

thanks

Hi,

assuming you always want to see about 1000 points, no matter how many entries your tree has:

```Int_t everyNth = int(tree->GetEntries()/1000.)+1; tree->Draw("data:time", Form("(Entry\$%%%d)==0", everyNth), "CP");```

Is that what you’re looking for?

Cheers, Axel.