Create BaseSelector

I have a ntuple format, and I want to do some different analysis with different TSelector. I can create different TSelector each time using MakeSelector, but it is boring. So I create only one TSelector using MakeSelector and I’ve called it PAUBaseSelector. From the PAUBaseSelector I’ve removed everythings, now it is:

#define PAUBaseSelector_cxx

#include "PAUBaseSelector.h"
#include <TH2.h>
#include <TStyle.h>

Now I want to create a userfull selector from this one:

class SelectorExample : public PAUBaseSelector
{
public:
    TH1F *histo_pt;

    virtual void    Begin(TTree *tree);
    virtual void    SlaveBegin(TTree *tree);
    virtual Bool_t  Process(Long64_t entry);
    virtual void    SlaveTerminate();
    virtual void    Terminate();
    ClassDef(SelectorExample,0);
};

but the problem is that if I do:

.L PAUBaseSelector.C+

I got:

dlopen error: /gpfs/storage_4/users/home/turra/diphoton/commons/pauselector/./PAUBaseSelector_C.so: undefined symbol: _ZTI15PAUBaseSelector
Load Error: Failed to load Dynamic link library /gpfs/storage_4/users/home/turra/diphoton/commons/pauselector/./PAUBaseSelector_C.so
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/gpfs/storage_4/users/home/turra/diphoton/commons/pauselector/PAUBaseSelector_C_ACLiC_dict.o: In function `ROOT::GenerateInitInstanceLocal(PAUBaseSelector const*)':
PAUBaseSelector_C_ACLiC_dict.cxx:(.text+0xb01f): undefined reference to `typeinfo for PAUBaseSelector'
/gpfs/storage_4/users/home/turra/diphoton/commons/pauselector/PAUBaseSelector_C_ACLiC_dict.o: In function `PAUBaseSelector::PAUBaseSelector(TTree*)':
PAUBaseSelector_C_ACLiC_dict.cxx:(.gnu.linkonce.t._ZN15PAUBaseSelectorC1EP5TTree+0x20): undefined reference to `vtable for PAUBaseSelector'
collect2: ld returned 1 exit status
*** Interpreter error recovered ***

what’s that?

Hi,

This error message usually indicates that one (the first one usually) of the virtual function has not been implemented.

Cheers,
Philippe.

[quote=“pcanal”]Hi,

This error message usually indicates that one (the first one usually) of the virtual function has not been implemented.

Cheers,
Philippe.[/quote]

Yes, I know, but what’s the problem? Why I can’t compile abstract class?

[quote]Why I can’t compile abstract class?[/quote]Humm … because it is not abstract? In the example you showed you may have been missing the ‘= 0;’ indicator of intentional non implemented function …

Ok, thanks, I’ll check