[d2n-analysis-talk] ROOT question: writing data from one file to another

Diana Parno dseymour at andrew.cmu.edu
Mon Mar 1 12:39:42 EST 2010


Hello all,

I have a fairly straightforward ROOT question that I thought I'd bring the 
experts here.

Let's say I'm in a situation where I've got some data structures in a ROOT 
file (test1.root) -- trees, histograms, whatever. I want to manipulate 
this data, maybe make a new histogram or two, and write a couple of 
histograms to a different ROOT file (test2.root). What's the best way to 
do this?

In my experience, as soon as I open test2.root, test1.root and all its 
data structures go out of scope. If I have a histogram drawn on a pad, 
then it stays in scope long enough to write it to the second file, but 
this is somewhat unwieldy, easy to mess up, and hard to do if I want to 
manipulate lots of files via a script. There's got to be a better way to 
do this! Does anyone know the secret?

Thanks,
Diana


More information about the d2n-analysis-talk mailing list