TClonesArray::Streamer expecting class

From: Dmitry V.Naumov <naumov_at_lapp.in2p3.fr>
Date: Wed, 10 Aug 2005 15:47:46 +0200


Dear rooters,

I have the following problem which I can not figure out myself. As the output of VMC+G4 code I save the root file with TTree containg NEvent as a branch. The structure of this event is very simple:

class NEvent: public TObject {
public:
<skip>
private:

NEventHeader *fHeader; // Event header
TClonesArray *fDetResponse; // -> detector response with hits, etc TObjArray *fTracks; // -> tracks
};

In the code I have the pointer of type NEvent which I fill with needed information. For example I use methods like: void NEvent::SetDetectorResponse(TClonesArray* copy) { fDetResponse = (TClonesArray*)copy->Clone(); <skip>
}

in order to delete consequently copy from the main body of the code. Finally the tree is saved with usual TTree::Fill() method. What I get sometimes (and this is what I do not understand) that reading back
the output from the root file reading of some events gives: TClonesArray::Streamer expecting class

To be more precise:

Reading 2 event
Reading 3 event
Reading 4 event
TClonesArray::Streamer expecting class 4Ø}` Reading 5 event
TClonesArray::Streamer expecting class
Error in <TBuffer::CheckByteCount>: object of class TClonesArray read too few bytes: 15 instead of 625760311
Error in <TBuffer::CheckByteCount>: Byte count probably corrupted around buffer position 6807:
625760311 for a possible maximum of 25174

I was checking in the core of the code that the pointer I pass to my NEvent is
not empty, some slots of TClonesArray are always filled. Doing TTree::Print() before
closing the file looks also OK:


*Tree :nuclon : nuclon tree *
*Entries : 6 : Total = 242395 bytes File Size = 74081 *

*Branch :fEvent *
*Entries : 6 : BranchElement (see below) *
*............................................................................*

*Br 0 :fUniqueID : *
*Entries : 6 : Total Size= 682 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*

*Br 1 :fBits : *
*Entries : 6 : Total Size= 658 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*

*Br 2 :fHeader : *
*Entries : 6 : Total Size= 1400 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*

*Br 3 :fDetResponse : *
*Entries : 6 : Total Size= 237055 bytes File Size = 74081 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 2.98 *
*............................................................................*

*Br 4 :fTracks : *
*Entries : 6 : Total Size= 824 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*

On the root website I found some references for the similar problems from which
I did not figure out the solution or diagnosis like: http://root.cern.ch/root/roottalk/roottalk02/4747.html

The tar ball with the code can be found at : dnaumov_at_lxplus.cern.ch:~/public/nuc.tar.gz The variables are set with source source_me. The problem can be reproduced running run_g4.C and then
root[].x EventAnalysis.C
click "next" 5-6 times to see it.

Thanks in advance, Dmitry Received on Wed Aug 10 2005 - 13:47:46 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:11 MET