Hi,
I have derived a class from TDirectory and I am trying to store and retrieve an instance of this class to/from a ROOT file.
I am using the autogenerated Streamer function and when I call
TDirectory
<http://root.cern.ch/root/html514/src/TDirectory.cxx.html#OUS8P>(const
char *name, const char *title, Option_t
<http://root.cern.ch/root/html514/ListOfTypes.html#Option_t> *classname,
TDirectory <http://root.cern.ch/root/html514/TDirectory.html>*
initMotherDir) from the constructor of my class, I set classname to the
name of my class.
I do not get any warning/error message when I Write the instance in the root file, but I get the following error when I try to load the instance using TFile::Get:
Error in <TBuffer::ReadVersion>: Could not find the StreamerInfo with a
checksum of 0 for the class "TUUID" in file.root.
Error in <TBuffer::CheckByteCount>: object of class TUUID read too few
bytes: 22 instead of 898023151
Error in <TBuffer::CheckByteCount>: Byte count probably corrupted around
buffer position 85:
898023151 for a possible maximum of 17 SysError in <TFile::Seek>: cannot seek to position 60235645022633984 in file file.root, retpos=-1 (Invalid argument) Error in <TFile::ReadBuffer>: error reading all requested bytes from file file.root, got 186 of 2687036
Here is the code of a class that allows to reproduce the problem:
class QMyDir: public TDirectory
{
public:
QMyDir():TDirectory(){}
QMyDir(const QMyDir& newqds):TDirectory(){*this=newqds; }
QMyDir(const char *name, const char *title, TDirectory* motherDir = 0):TDirectory(name,title,"QMyDir",motherDir){}
virtual ~QMyDir(){}
QMyDir& operator=(const QMyDir &rhs){fprintf(stderr,"Warning: TDirectory::operator= function is private and cannot be called by derived class QMyDir\n"); return *this;}
private:
ClassDef(QMyDir,1) //QSigEx Data Structure Class };
Here is the code of the autogenerated Streamer function:
void QMyDir::Streamer(TBuffer &R__b)
{
// Stream an object of class QMyDir.
UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { } TDirectory::Streamer(R__b); R__b.CheckByteCount(R__s, R__c, QMyDir::IsA()); } else { R__c = R__b.WriteVersion(QMyDir::IsA(), kTRUE); TDirectory::Streamer(R__b); R__b.SetByteCount(R__c, kTRUE);
Now how I get the error in CINT:
root [0] TFile file("file.root","recreate") root [1] QMyDir* dir=new QMyDir("dir","dir") root [2] file.ls() TFile** file.root TFile* file.root QMyDir* dir dir
root [0] TFile file("file.root","read")
root [1] file.ls()
TFile** file.root TFile* file.root
898023151 for a possible maximum of 17 SysError in <TFile::Seek>: cannot seek to position 60235645022633984 in file file.root, retpos=-1 (Invalid argument) Error in <TFile::ReadBuffer>: error reading all requested bytes from file file.root, got 186 of 2687036
Thanks!
Pierre-Luc Drouin
Received on Mon Mar 17 2008 - 21:59:57 CET
This archive was generated by hypermail 2.2.0 : Mon Mar 17 2008 - 23:50:01 CET