Hi Chiara,
You can only do this as part of another object.
class MyCollection {
Int_t fSize;
TH1F **fSPD; //[fSize]
};
If you can not use a wrapper object, then you have to loop over each of the elements and save them individualy.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
Behalf Of Chiara Zampolli
Sent: Tuesday, February 12, 2008 6:12 AM
To: roottalk
Subject: [ROOT] writing pointers to pointers to a file
Dear rooters,
would it be possible to write pointers to pointers into a file? The problem arises from the need to write an instance of a class which contains pointers to pointers data members into a file. In particular, the pointers to pointers are TH1F**, and the error message reads:
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1433986848 (LWP 24923)] 0x048e1245 in vtable for TAxis ()
from /home/zampolli/SOFT/ROOT/root/lib/libHist.so
This, as I said, trying to write an instance of the class. Moreover, trying to write directly on a file a pointer to pointer - such as with:
TH1F **hSPD = new TH1F*[2];
char name[100];
for (Int_t i=0;i<2;i++){
sprintf(name,"hist_%i",i); hSPD[i]=new TH1F(name,name,10*(i+1),10*i,10*(i+1));}
hSPD->Write();
does not work either...
So, I'm wondering whether writing pointers to pointers to a file is not
possible at all...
Thanks for your help.
Cheers,
chiara Received on Tue Feb 12 2008 - 16:23:00 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 14 2008 - 17:50:02 CET