Alessio,
Your original request was to save a fix size matrix like
Int_t ADC[100][100];
Now, you say that you want to save a matrix where the number of rows and columns
is variable. ROOT supports simple C++ structures like
int n;
float *x; //[n]
but not x[n][m]. You can use a TMatrixD class for this.
Rene Brun
Alessio Sarti wrote:
>
> HI Rene,
> thanks for the answer.
> I'm having problems finding out in test/Event.h how to write an fMatrix
> object to a tree.
> There's no implementation of
> dataTree->Branch("fMatrix", fMatrix, "fMatrix[io][in]/D");
> in the code in test/* files.
>
> I've tried my own
> dataTree->Branch("adcM", adcM, "adcM[nCadc][nadc]/D");
>
> but the code crashes:
>
> *** Break *** segmentation violation
> Generating stack trace...
> /usr/bin/c++filt: unknown demangling style `gnu-new-abi'
>
> running the debugger I got:
>
> [Switching to Thread 1093052608 (LWP 12945)]
> 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=0xbfec54a0) at
> UnMapASCII.cc:77
> #6 0x08048c6d in main (argc=2, argv=0xbfffe564) at EfficiencyTest.cc:22
> #7 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
>
> Do you have any Idea of what is the problem?
>
> Cheers,
> alessio
>
> ______________________________________________________
> Alessio Sarti INFN Frascati
>
> >>>I'm in Frascati<<<
>
> Cell +39-06-94038166
> Office +39-06-94032776
> Fax +39-06-94032427
>
> "... e a un Dio 'fatti il culo' non credere mai..."
> (F. De Andre')
>
> "He was turning over in his mind an intresting new concept in
> Thau-dimensional physics which unified time, space, magnetism, gravity
> and, for some reason, broccoli". (T. Pratchett: "Pyramids")
>
> On Fri, 30 Apr 2004, Rene Brun wrote:
>
> > Hi Alessio,
> >
> > Yes, this is possible. See example in $ROOTSYS/test/Event.h
> >
> > Rene Brun
> >
> > Alessio Sarti wrote:
> > >
> > > 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?
> > > thanks,
> > > alessio
> > >
> > > ______________________________________________________
> > > Alessio Sarti INFN Frascati
> > >
> > > >>>I'm in Frascati<<<
> > >
> > > Cell +39-06-94038166
> > > Office +39-06-94032776
> > > Fax +39-06-94032427
> > >
> > > "... e a un Dio 'fatti il culo' non credere mai..."
> > > (F. De Andre')
> > >
> > > "He was turning over in his mind an intresting new concept in
> > > Thau-dimensional physics which unified time, space, magnetism, gravity
> > > and, for some reason, broccoli". (T. Pratchett: "Pyramids")
> >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET