[ROOT] Derived class in a tree

From: Michael Alan Kordosky (kordosky@mail.hep.utexas.edu)
Date: Thu Jul 26 2001 - 09:19:53 MEST


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