[ROOT] what is the difference ?

From: HP Wei (hp@rentec.com)
Date: Wed Dec 11 2002 - 19:52:28 MET


hi,
   I am thinking of two different structures, outlined in
   (1) and (2) below, to store some data.  
   Since I have not implemented (2) yet because of the 
   BIG class definition, I'd like to know, theoretically, 
   the difference in terms of low level processing by ROOT,
   and most importantly the accessing speed.
   
   (1) one branch (br) with 10000 entries.
       Each entry is a fixed array A[100].
       
       --> to read through all the data
           we do: 
              double A[100];
              br.SetBranchAddress("BRANCH", &A[0]);
              for(Int_t i=0; i< 10000; ++i) 
                 br.GetEntries(i);
                 
   (2) one branch with 1 entry.
       The entry contains one object of this class:
       class Data {
       public:
           double f1[100];
           double f2[100];
           ...
           double f10000[100];
       };
       --> Let's forget for the moment how we are going to type in this
           class definition.
           
       To read through these data,
       we do:
           Data d;
           br.SetBranchAddress("BR", &d);
           br.GetEntries(0);
     
       I guess at run time, ROOT will need to create 10000 buffers
       for each of the class memeber.  So, the buffer_size for this
       branch cannot be set too large at the time of creation.
     
       The reason for having 10000 members in this class is that
       the split will be set to 1 so that each member has its own
       branch and the compression will be better because the data
       WITHIN each vaiable f1, f2, .... are similar.
       
       Alternative class:
       class Data {
       public:
          double f[10000][100];
       }
       I am not sure if this will compress better than (2).
  
  ------------------------------
  If you think (2) will be faster than (1),
  then what is the best way to 'implement' (2).      
   
thanks,
HP
                     



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:23 MET