RE: Re: TreePlayer parser confusion?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 05 Jan 2005 15:07:22 -0600


Hi Troy,

When encountering problem with MakeClass, I recommend trying MakeProxy instead.
We are currently developping MakeProxy as a future replacement for MakeClass.

However in your particular case, MakeProxy was updated to support this case only in ROOT 4.03/01.

As mentioned in a separate mail, Rene has also fixed your second problem.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of troy d. straszheim
Sent: Sunday, December 19, 2004 6:54 PM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] Re: TreePlayer parser confusion?

This happens with root_v4.02.00.

I also noticed that MakeClass() generates erroneous code in this case. Calling t->MakeClass("C") produces (in the generated header file)

class C {
public :

   // Declaration of leave types

   C               *plot_my_i.;
   Int_t           plot_my_i_B<void>_i;
   C               *against_my_i.;
   Int_t           against_my_i_B<void>_i;

   // List of branches
   TBranch        *b_plot_my_i_B<void>_i;   //!
   TBranch        *b_against_my_i_B<void>_i;   //!
};

It appears, in fact, that Tree::MakeClass always produces illegal code when the class has been branched with a trailing dot on the branch name, templates or not:

struct C { int i; };
void makeclass()
{
  C c, *cp(&c);
  TTree *t = new TTree("mytree", "foo", 10000);

  t->Branch("my_c.", "C", &cp);
  t->Fill();
  t->MakeClass("C");

}

This produces a C.h that contains

   C *my_c.;

Thanks,

troy .d straszheim

troy d. straszheim writes:
>
> Hi roottalk:
>
> I'm trying to compare some classes in trees. This code shows the
problem:
>
> #include <TTree.h>
> #include <TFile.h>
>
> template <class T>
> struct B { int i; };
>
> struct C : B<void> { };
>
> void plot_my_i()
> {
> C c, *cp(&c);
>
> TTree *t = new TTree("mytree", "Icecube", 10000);
>
> t->Branch("plot_my_i.", "C", &cp);
> t->Branch("against_my_i.", "C", &cp);
>
> for (int i=0; i<100; i++)
> {
> c.i=i*13;
> t->Fill();
> }
> t->Draw("plot_my_i.B<void>.i:against_my_i.B<void>.i");
> t->StartViewer();
> }
>
> So when a class further up in the inheritance hierarchy is a template, >
the angle-brackets get into the branch path, the treeplayer sees them > as comparisions and things dont work. I have tried intermediate > typedefs to outsmart rootcint:
>
> template <class T> struct B { int i; }; > typedef B<void> B_void; >
struct C : B_void { }; > > but rootcint goes around them and the typedeffed name does not appear > in the branch path. Any ideas?
>
> Thanks,
>
> troy d. straszheim
>
Received on Wed Jan 05 2005 - 22:08:49 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET