Separate root file

Hi all,
I simulated SPECT system in GATE, which included the acquisition of projections at 64 angular positions.
Generated root output file is composed of all data at 64 angular positions of gamma camera.

Is it possible to save any data of each angular position of gamma camera in a separate root file?
i.e.:
Save hits (or singles and …) of first angular position in test1.root.
Save hits (or singles and …) of second angular position in test2.root.
.
.
.

Thanks in advanced.

Hi,

yes. The solution changes according to the data you saved. Is it composed by TTrees or other data structures?

Cheers,
D

Thanks your response,
It is composed by TTrees consist of Hits, Singles and …

Sincerely
P

Ok,

it’s still a bit hard to propose a solution working out of the box given the lack of information but what I think it’s certain is that you’ll need to filter the right entries out.
This is how you filter with TDataFrame: I assume that your trees have a branch called ang_pos, which is an angular position which can have 64 integer values.

ROOT::Experimental::TDataFrame d("Singles", "c.root");
d.Filter("ang_pos == 0").Snapshot("Singles", "c_0.root");
d.Filter("ang_pos == 1").Snapshot("Singles", "c_1.root");
// ...
d.Filter("ang_pos == 63").Snapshot("Singles", "c_63.root");

Cheers,
D

Dear Dpiparo,
Thanks so much.
Should I copy your code in a *.C file, and then, execute it?
Or, I should run it in the my command line -root[0] -…

sincerely
P

Hi P,

this is a skeleton, the best I could put together with the information I have. I don’t even know if you have a branch called ang_pos…

D

Dear Dpiparo,
Thanks,
The simple root file is attached.
It is composed of data at 2 angular positions of gamma camera.
I want to save data of energy branch related to the each angular position of gamma camera in a separate root file.

c.root (414.1 KB)

Did you try my snippet above?

Should I copy your code in a *.C file, and then, execute it?

It’s a skeleton. You need at least to copy it and then modify it according to your needs.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.