Hello!
I'm trying to create a tree with a branch "AllReconstructions" of this
style:
class AllReconstructions {
Reconstruction r[90]
};
class Reconstruction {
Particle p[3];
// some other stuff
};
class Particle {
int t[2]; // index of tracks
// some other stuff
};
I need to have in a TTree a branch like r.p.t (well, I suppose I'll have
to choose smarter names).
I've tried many ways. Placing all data of all three objects as simple
arrays (like the above), TTree does not unroll classes and I have a
lone "r" branch.
Placing them directly as TClonesArray (after made them derived from
TObject, used macros ClassImp/Def, and using a directive "#pragma link
C++ class name;" for each as input for rootcint) and initting them in
constructor, like:
class Reconstruction: public TObject {
TClonesArray p;
Reconastruction(): p(Particle::Class(), 3) { /* ... */ }
// some other stuff
};
the program crashes as I try to allocate the object (new
AllReconstructions), it could be a problem of initialization of virtual
table (I'm using gcc 3.2.0).
Trying to place them as pointers to TClonesArray, the program crashes
when unrolling p (it does something with pointers until it calls
GetClass() from a null TClonesArray).
Using std::vector<> the branches are not unrolled... maybe this is a
bug: the constructor TBranchElement(char*, TStreamerInfo *, ...)
takes what is between angled brackets as the name of the class in the
vector, then asks gROOT if it knows that class; since vector has more
template parameters, the name is something as
"vector<Particle,allocator<Particle>>", so the resulting name is
"Particle,allocator<Particle". Maybe you should make it check for comma
too as a terminator, beside ">".
Which is the correct combination of containers /
place-where-initialize-them / classes-from-which-derive to use to get
that branch r.p.t ? is there one?
Thanks a lot.
--
Hamlet
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET