Write TTree to file after each fill


I making a TTree with TGraphs in them. This makes the TTree really big, and slows my computer to a crawl with each event Fill. I’m guessing the TTree is kept in memory until I call the Write() command. Is there a way to write the TTree to the file after each fill?


Search for “fAutoFlush” and “fMaxVirtualSize” in http://root.cern.ch/root/html/TTree.html#TTree:Fill and http://root.cern.ch/root/html/TTree.html#TTree:SetAutoFlush and http://root.cern.ch/root/html/TTree.html

[quote]I making a TTree with TGraphs in them. [/quote]humm … Are you reseting the TGraph after each event?

If you are not, they will be growing large (and this is likely the problem) and you would be storing in the file the same data many times. If you are not reseting, why? You may be better served by not storing the TGraph in the TTree but instead storing the raw data (only once instead of many time) in the TTree … and reconstruct the TGraph as needed.