Writing Matrix to TTree

Hi all,
I’m trying to understand if it is possible, in root, to write a matrix to
a Tree.
Let’s say: I have a matrix filled per event and I’d like to have it dumped
in the Tree via the Fill method.
This is because the matrix has lots of variables that have similar meaning
and having them packed up in a per event matrix would save a lot of
variables copy-paste and would enlarge the flexibility of the code.
So, instead of

Int_t ADC1[100];
Int_t ADC2[100];

Int_t ADC100[100];
I’d like to have
Int_t ADC[100][100];

Is that possible?

I have tried this way (ADC[100][100]:wink: and got

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1093052608 (LWP 12686)]
0x400e6e86 in TBuffer::WriteFastArray(double const*, int) ()
from /home/Packages/Packages/root/lib/libCore.so
(gdb) where
#0 0x400e6e86 in TBuffer::WriteFastArray(double const*, int) ()
from /home/Packages/Packages/root/lib/libCore.so
#1 0x40c77fd6 in TLeafD::FillBasket(TBuffer&) ()
from /home/Packages/Packages/root/lib/libTree.so
#2 0x40c6284b in TBranch::FillLeaves(TBuffer&) ()
from /home/Packages/Packages/root/lib/libTree.so
#3 0x40c62579 in TBranch::Fill() ()
from /home/Packages/Packages/root/lib/libTree.so
#4 0x40c827a1 in TTree::Fill() ()
from /home/Packages/Packages/root/lib/libTree.so
#5 0x41185c48 in UnMapASCII::UnMapFile() (this=0xbfec5ab0) at UnMapASCII.cc:77
#6 0x08048c6d in main (argc=2, argv=0xbfffeb74) at EfficiencyTest.cc:22
#7 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6

thanks,
alessio


Alessio Sarti INFN Frascati

Yes, this is possible.
See example in $ROOTSYS/test/Event.h

Rene

Please do not post at the same time to roottalk and this forum