MakeProxy and nested objects in a tree

Hi,

I have a tree with one superbranch that’s based on a class (Event). Event contains objects of Track class.

I would like to be able to access the branches both through an object (using library containing classes implementation) or without using the object.

I’m trying to achieve it by using TTree::MakeProxy. Everything works fine when I access the data through the Event object.

But I have problems when I try to access the data through interface generated by MakeProxy. I’m using ROOT 5.15/07.

I prepared a simplified test case. Code is in attachment.
Objects of following classes are stored in the tree:

[code]class Track : public TObject
{
public:
int ID;
TLorentzVector mom;
ClassDef(Track, 1) //Track
};
class Event : public TObject

{
public:
Event();
int eRun; // run number
TLorentzVector beam;
Track particle;
TObjArray* particles;
TClonesArray* tracks;
ClassDef(Event, 1)
};[/code]

Now how do I access Event::particle.mom.X ??
I came up with two solutions after reading the code generated by MakeProxy, but none of them works:

double Test1() { return Event.particle.fX; }

Gives:

Error in <Read>: Unable to initialize particle.fX

And

double Test2() { return Event.particle->X(); }

Gives:

Info in <TUnixSystem::ACLiC>: creating shared library /home/6/klimasz/hpt/soft/Proxy/./Test_proxy_2_h.so /home/6/klimasz/hpt/soft/Proxy/./Test2.cc: In member function ‘double Test_proxy_2::Test2()’: /home/6/klimasz/hpt/soft/Proxy/./Test2.cc:3: error: request for member ‘operator->’ is ambiguous /home/6/klimasz/hpt/soft/Proxy/./Test_proxy_2.h:246: error: candidates are: const TObject* Test_proxy_2::TPx_TObject_5::operator->() /home/6/klimasz/hpt/soft/Proxy/./Test_proxy_2.h:273: error: const TVector3* Test_proxy_2::TPx_TVector3_1::operator->() /home/6/klimasz/hpt/soft/Proxy/./Test_proxy_2.h:224: error: const TObject* Test_proxy_2::TPx_TObject_4::operator->() /home/6/klimasz/hpt/soft/Proxy/./Test_proxy_2.h:300: error: const TLorentzVector* Test_proxy_2::TPx_TLorentzVector_1::operator->() /home/6/klimasz/hpt/soft/Proxy/./Test_proxy_2.h:202: error: const TObject* Test_proxy_2::TPx_TObject_3::operator->() g++: /home/6/klimasz/hpt/soft/Proxy/./fileQK6XOg.o: No such file or directory Error in <ACLiC>: Compilation failed!

Is there some other way to access this variable without simply using Event object?

The second problem is with arrays.
Is there any possibility to store objects in some array other then TClonesArray and access members of those objects via MakeProxy (but not through Event object) ?

I tried with TObjArray but this requires to cast TObject to Track, which implies that I provide library for Track class.
I also tried with std::vector but this seems to be unsupported:

Error in <AnalyzeBranch>: Unsupported type for names (300).

I will be grateful for any help.

Cheers,
Konrad
Proxy.tar.gz (1.64 KB)

[quote]I also tried with std::vector but this seems to be unsupported: [/quote]Indeed vector are still unsupported (this should be added) later this month.

Cheers,
Philippe

I can reproduce your problem and I am working at fixing them.

Cheers,
Philippe

Thanks for reporting this problem (and your patience).
This is now fixed in the CVS repository.

Cheers,
Philippe.