[Frost] root Trees
Michael Dugger
dugger at jlab.org
Tue May 11 18:51:29 EDT 2010
HI,
I should have written:
"...type definitions."
instead of:
"...particle definitions"
-Michael
On Tue, 11 May 2010, Michael Dugger wrote:
>
> Hi,
>
> It appears that we have the problem fixed ->
> We have to let the tree "know" how big the vectors are. We can do this by
> using brackets in the particle definitions. For example:
> gpid_tree->Branch("Ngpid",&Ngpid,"gpidN/I:pid[7]/I:x[7]/F");
>
> If anyone knows how we can use dynamic vectors within a tree branch,
> please let us know. We would like to have the smallest files
> possible. Perhaps the ROOT tree compression makes this a moot point?
>
> -Michael
>
> On Tue, 11 May 2010, Brian Morrison wrote:
>
>> Hey All,
>>
>> Just wondering if anyone has any experience working with ROOT Trees. I'm
>> currently trying to make a branch for the GPID bank and fill it with
>> arrays of each of the bank values for each event (as shown below):
>>
>> #define MAX_PARTICLES 20
>>
>> typedef struct{
>> int gpidN;
>> int pid[MAX_PARTICLES];
>> float x[MAX_PARTICLES];
>> float y[MAX_PARTICLES];
>> float z[MAX_PARTICLES];
>> .
>> .
>> .
>> int Ngrf[MAX_PARTICLES];
>> } Ngpid_t;
>>
>> static Ngpid_t Ngpid;
>> TTree *gpid_tree = new TTree("T","test");
>> gpid_tree->Branch("Ngpid",&Ngpid,"gpidN/i:pid/i:x/F:y/F:...Ngrf/i");
>>
>>
>> (in the event loop now)
>> Ngpid.gpidN = GPID_NH;
>> for(int n=0;n<GPID_NH;n++){
>> Ngpid.pid[n] = GPID[n].pid;
>> Ngpid.x[n] = GPID[n].x;
>> .
>> .
>> .
>> Ngpid.Ngrf[n] = GPID[n].ngrf;
>> }
>>
>> gpid_tree->Fill();
>>
>> I've tested and shown that the Ngpid.x[n] and GPID[n].x are identicle for
>> all itterations, however when it goes to fill I get just a bunch of
>> garbage once past the pid bank. I can't seem to find many good examples
>> of this online so I was hoping that one of you may have some experience
>> with this and be able to point out where I'm going wrong. Thanks.
>>
>> -Brian
>>
>> _______________________________________________
>> Frost mailing list
>> Frost at jlab.org
>> https://mailman.jlab.org/mailman/listinfo/frost
>>
> _______________________________________________
> Frost mailing list
> Frost at jlab.org
> https://mailman.jlab.org/mailman/listinfo/frost
>
More information about the Frost
mailing list