Re: [ROOT] Deriving a class after using Makeclass

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jul 15 2003 - 19:21:11 MEST


Hi Claus,

deriving a class from photclass is a good idea. You implement in this new class
new functions and you can easily regenerate photclass.h if you change
your tree.
However, you do not need to overide the function Loop. Simply implement
photclass::Loop.
In the automatically generated code, the loop function is not virtual.

I would need to see your photclass.h to understand the error message.
But I repeat, do not define Aphotclass:Loop. You have to implement
only photclass::Loop

Rene Brun

Claus Horn wrote:
> 
> Hello ROOTers,
> 
> I am trying to derive a class (Aphotclass) from the class
> which is generated automatically by MakeClass (photclass).
> My declaration looks like this:
> 
> class Aphotclass : public photclass {
>    Aphotclass(TTree *tree=0) : photclass(tree)  {};
>    ~Aphotclass() {};
>    //Int_t  Cut(Int_t entry);    // I dont want to change these
>    //Int_t  GetEntry(Int_t entry);
>    //Int_t  LoadTree(Int_t entry);
>    //void   Init(TTree *tree);
>    void   Loop();               // This is what I want to overwrite
>    //Bool_t Notify();
>    //void   Show(Int_t entry = -1);
> };
> 
> Under ROOT I get:
> 
> root [1] .L Aphotclass.C
> root [2] Aphotclass m;
> Error: can not call private or protected function FILE:(tmpfile) LINE:1
>   Aphotclass.h  18 Aphotclass Aphotclass::Aphotclass(TTree*);
> Calling : Aphotclass::Aphotclass();
> Match rank: file     line  signature
> *        0 Aphotclass.h  18 Aphotclass Aphotclass::Aphotclass(TTree*);
> *** Interpreter error recovered ***
> root [3]
> 
> There seems to be a problem with the constructor.
> 
> I would be very glad if somebody could help me to get
> this runnig.
> 
> Thanks,
> 
> Claus



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET