Hi Mike,
Following your code I was able to reproduce the message:
"Error in <TClass::New>: cannot create object of class EBlahType"
However in my case, the file was still properly produced. Scan worked
nicely.
One thing that I did differently is to have Base derived from TObject.
I would need more information in order to reproduce and understand
the problem.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Michael Alan Kordosky
Sent: Thursday, July 26, 2001 2:20 AM
To: ROOTtalk Mailing List
Subject: [ROOT] Derived class in a tree
Hi,
Is the following expected to work (in a tree)?
An (abstract) base class with no data members and a derived class with
basic types + an enum:
class Base{
/* ... */
ClassDef(Base, 0)
};
enum EBlahType {kA = 0, kB};
class Derived : public Base{
/* ... */
EBlahType fBlahType;
ClassDef(Derived, 1)
};
LinkDef:
#ifdef __CINT__
/*
link offs
*/
#pragma link C++ Base+;
#pragma link C++ enum EBlahType+;
#pragma link C++ Derived+;
#endif
I am having two problems:
First:
When writing Derived to a tree (via a macro), I get an error message of
the form:
"Error in <TClass::New>: cannot create object of class EBlahType"
The interpreter tab completes EBlahType and knows the right enumeration
for its constants.
Second:
/* Get TTree* t from a file */
root [5] t->Scan();
Error in <TObjArray::At>: index -2 out of bounds (size: 16, this:
0x0866e5c0)
If I give Scan() specific arguments, it seems to work. The enum type has
the correct values. Could the base class be causing this problem? I
notice that it is a branch of my tree, and actually takes up a suprising
amount of space, so perhaps I am doing something wrong.
Any ideas/advice?
Mike Kordosky
--
Graduate Research Assistant // High Energy Physics Lab
kordosky@hep.utexas.edu // University of Texas at Austin
kordosky@fnal.gov //
ph: (512) 471-8426 (RLM Lab, Office)
(512) 475-8673 (ENS Lab)
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:53 MET