Re: [ROOT] sub-branch SetAddress/GetEvent behavior question

From: Kate Scholberg (schol@mit.edu)
Date: Fri Aug 24 2001 - 17:48:24 MEST


Dear Rene,

Well, I think I have solved the problem.  The classes used for the
split branch apparently did not have default constructors.  When I add
these, the behavior for "dotted" branches is as you would expect.

The code compiles without even default constructors for the classes
(contrary to what is said in the Root
manual,e.g. ttp://root.cern.ch/root/Using.html!) ... and I suspect this
is what led to the unpredictable behavior for the split branch.

Thanks very much for your prompt response,
Kate.

============================================================


>
> > Looking at your file, I see that the branch contents are wrong.
> > I do not understand how your Tree had been created. I do not see any problems
> > with branches having the same attribute names in different classes.
> > Could you run the example below on your system and let me know if you get
> > correct results? if results are correct (this should work with versions
> > 2.25,3.00 or 3.01), we have to understand what is different in your
> > configuration. Could you reproduce the program writing the file
> > with a small test program ?
> >
>
> Yes, your file creation macro seems to work for me...
> I can read the file back with:
>
> void testdots()
> {
>   TFile file("dots.root");
>   TTree *amstree = (TTree*)file->Get("T");
>   int nevent = amstree->GetEntries();
>   printf("nevent %d\n",nevent);
>   T->Show(1);
>
>   Double_t x1_1=0; Double_t x2_1=0;
>   amstree->SetBranchAddress("line1.fX1", &x1_1);
>   amstree->SetBranchAddress("line2.fX1", &x2_1);
>
>   nevent = 10;
>   for(int i=0;i<nevent;i++) {
>     amstree->GetEvent(i);
>     printf("i %d %f %f\n",i,x1_1,x2_1);
>   }
> }
>
>
> So maybe it is something funny for a
> split branch made from a more complicated class...
> The branches are made with statements like:
>
>     static void *pev2=(void*)&_event02;
>    TBranch *b2=_tree->Branch("event02.", "EventNtuple02",  &pev2, 64000,1);
>
> then, I think, written in a standard way.
>
> The classes (e.g. EventNtuple02) are simple, with just data members, but
> they have friend classes (AMS classes) which are not so simple;
> perhaps this is the problem?
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:58 MET