Hello Rooters,
I have a class inherited from TConesArray, and I would like to store them in TTree, than read them back and use them …
So I try to store them:
Array1 = new TMyArray(“CBTParticle”, 50);
Array2 = new TMyArray(“CBTParticle”, 50);
Array3 = new TMyArray(“CBTParticle”, 50);
Array3 = new TMyArray(“CBTParticle”, 50);
tree = new TTree(“tree”, “Data buffer tree”);
tree->Branch( “Array1”, “TMyArray”, &Array1, 64000, 2);
tree->Branch( “Array2”, “TMyArray”, &Array2, 64000, 2);
tree->Branch( “Array3”, “TMyArray”, &Array3, 64000, 2);
tree->Branch( “Array4”, “TMyArray”, &Array4, 64000, 2);
It seems to be OK but when I try to read it back (using the code given by the MakeClass) after some entries it chrashes.
TMyArray *Array1;
TMyArray *Array2;
TMyArray *Array3;
TMyArray *Array4;
// List of branches
TBranch *b_Array1_TClonesArray; //!
TBranch *b_Array2_TClonesArray; //!
TBranch *b_Array3_TClonesArray; //!
TBranch *b_Array4_TClonesArray; //!
…
Array1 = 0;
Array2 = 0;
Array3 = 0;
Array4 = 0;
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fCurrent = -1;
fChain->SetMakeClass(0);
fChain->SetBranchAddress(“Array1”, &Array1, &b_Array1_TClonesArray);
fChain->SetBranchAddress(“Array2”, &Array2, &b_Array2_TClonesArray);
fChain->SetBranchAddress(“Array3”, &Array3, &b_Array3_TClonesArray);
fChain->SetBranchAddress(“Array4”, &Array4, &b_Array4_TClonesArray);
I can see the content of the tree because when I store it I dump the content of the TMyArray to the screen (after the tree->Fill()) and the common seems to be in the events which crashes the reading is that the Array4 has more then 16 entries:
[printout from the storing code]
Array1: 0; Array2: 3; Array3: 1; Array4: 4
----- Array1 time -----
Array1: 11; Array2: 3; Array3: 2; Array4: 11
----- Array1 time -----
0; time = 266.025
1; time = -105.077
2; time = -548.421
3; time = -68.7861
4; time = 275.719
5; time = 352.087
6; time = 256.14
7; time = -581.412
8; time = -207.875
9; time = -369.517
10; time = -528.262
Array1: 4; Array2: 3; Array3: 1; Array4: 18
----- Array1 time -----
0; time = 142.042
1; time = -503.692
2; time = -113.954
3; time = 200.555
[the same given by the read-back]
6 - Array1 -
7 - Array1 time -
0 - 266.025
1 - -105.077
2 - -548.421
3 - -68.7861
4 - 275.719
5 - 352.087
6 - 256.14
7 - -581.412
8 - -207.875
9 - -369.517
10 - -528.262
Using host libthread_db library “/lib/libthread_db.so.1”.
Attaching to program: /proc/22740/exe, process 22740
Error while mapping shared library sections:
BoundOmega_ppi.so: Success.
[Thread debugging using libthread_db enabled]
[New Thread 47171458248320 (LWP 22740)]
0x00002ae6f53ca715 in waitpid () from /lib/libc.so.6
#1 0x00002ae6f5373721 in strtold_l () from /lib/libc.so.6
#2 0x00002ae6f0bd194a in TUnixSystem::StackTrace ()
from /dsk/tr16/software/builds3rdParty/64bit/root_v5.18_geant4.9.1/lib/root/l
ibCore.so.5.18
#3 0x00002ae6f0bd0be3 in TUnixSystem::DispatchSignals ()
from /dsk/tr16/software/builds3rdParty/64bit/root_v5.18_geant4.9.1/lib/root/l
ibCore.so.5.18
…
if I change the fChain->SetMakeClass(0) to fChain->SetMakeClass(1) all the arrays will have 0 entries …
Can somebody help me to find the problem?
Thanx,
k.