[ROOT] porting of one entry to other process

From: Ryosuke Itoh (itoh@balpha03.kek.jp)
Date: Wed Apr 23 2003 - 03:56:45 MEST


Dear ROOTers,

  I'm now working on the migration of ROOT I/O into our analysis
framework BASF for Belle experiment. This framework has a special
feature of parallel processing on an SMP server based on event data
distribution to multiple UNIX processes via shared mem. To utilize this
mechanism with ROOT, we need a scheme to cut out a serialized stream of 
single "entry" (=event) on a TBranch, put it on the shared mem,  
and migrate it into a TBranch on a separate UNIX process. 
Does anyone know how to "cut out" a seriarized stream of single entry? 

I tried following code (by mimicing the code in TBranch), however, 
it did not work at all. Any idea on this?

Actually, I'm quite new to ROOT and the following code is my first
attempt to understand the internal structure of ROOT. So the code
might be completely stupid one. If so, I'm sorry for my too
superficial understanding.

Thanks in advance,
- R.Itoh, KEK

...... TBranch::Fill() should be called before this code
   TBranch* branch = ..... branch containing event data
   int entry = (int)branch->GetEntries();
   entry--;  // minus 1 to point last entry
   int* entrylist = branch->GetBasketEntry();
   int basketid = branch->GetWriteBasket();
   TBasket* basket = branch->GetBasket ( basketid );
   int first = entrylist[basketid];
   printf ( "entry = %d, basketid = %d, first = %d basketadrs = %x\n", 
            entry, basketid, first, basket );
   
   TBuffer *buf = basket->GetBufferRef();
   int bufbegin = basket->GetEntryPointer ( entry-first );
   int* displacement = basket->GetDisplacement();
   if ( displacement ) 
     buf->SetBufferDisplacement(displacement[entry-first]);
   else
     buf->SetBufferDisplacement();

   printf ( "bufbegin = %d, length = %d\n", bufbegin, buf->Length() );
   m_nbytes = buf->Length() - bufbegin;
// this buffer should contain serialized whole "one event"
   m_buf = (char*) malloc ( m_nbytes ); 
   buf->WriteBuf ( m_buf, m_nbytes );
   
-----------------------------------------------------------------------
					Ryosuke Itoh / 伊藤 領介
			     Insutitute of Particle and Nuclear Studies
			  High Energy Accelerator Research Organization
			                   e-mail : ryosuke.itoh@kek.jp
-----------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET