tree merging (Friend)

From: Nicolas Produit <Nicolas.Produit_at_unige.ch>
Date: Thu, 10 Nov 2011 17:43:38 +0100


Hi,

I have very often following situation:

I have a daq taking events and another asynchronous daq taking another stream (for example temperature readout).

I need then to reconcile this two trees in one tree assigning for each event its temperature. The two tree don't have same number of events and are not rate synchronized.

So in general we have
one (master) tree containing a sorted and increasing branch (for example a time)
another (slave) tree containing also similar branch (sorted and increasing)

I want a tree containing all branch of tree 1 and all branch of tree 2 with matching on a specific branch. Matching could be: closest match or time2 is the lowest time > time1 or time2 is the biggest time < time1
The number of entries of the output tree is equal to the number of entries in tree 1

Some entries of tree2 can be absent in the output tree and some entries can be seen many times, this is not a problem.

so signature like:

TTree* merge(TTree* t1,TTree* t2,const char* colname1,const char* colname2,char algorithm)

algorithm could be '=' '<' or '>' or we can think of other matching algorithm

I try to write this routine but code to copy Tree without knowing what are the branches is very complex. I tried to look into TTree::CloneTree and find a lot of things I don't understand and I don't feel that I will succeed to write this without help.

I think this routine could be useful to other people.

Any help?

-- 
Nicolas Produit
ISDC, Data Centre for Astrophysics   Phone:+41 22 379 2140
16, Chemin d'Ecogia                  Fax:  +41 22 379 2133
CH-1290 Versoix                      www:  http://isdc.unige.ch/~produit
Received on Thu Nov 10 2011 - 17:43:46 CET

This archive was generated by hypermail 2.2.0 : Thu Nov 10 2011 - 23:50:01 CET