Problem with derived class PROOF

Hi,

I have problems accessing data from a custom class derived from TObject:

class Tmap : public TObject {
private:
    std::map< int,std::vector<double> *> *fT;

public :
    Tmap(void);
    virtual ~Tmap(){};
     void TAdd(int key, vector<double> *v, double number);
    virtual bool TExist(int key);
    virtual std::map< int,std::vector<double>* >* GetTmap(void) const{ return fT; }
    ClassDef(Tmap,1)
};

ClassImp(Tmap)
Tmap::Tmap(void){
    fT = new map<int, std::vector<double>*>();
}
void Tmap::TAdd(int key, std::vector<double> *v, double number){
    v->push_back(number); // fill with values
    // insert record into structure
    fT->insert(std::pair<int, std::vector<double>*>(key, v));
}
bool Tmap::TExist(int key){
    bool exist;
    if ( fT->find(key) == fT->end()){
        return false;
    }
    else{
        return true;}
}
#endif

The class works fine without implementing it in the TSelector. Tmap class contains all the processed data from some TTree events and is analyzed in the Terminate() part of the TSelector derived class (TSelector is run in PROOF ). Simplified overview of the code:

class Selector : public TSelector {
public :
 	Tmap* LYZ_Q;
    	Tmap* LYZ_M;
    Selector(void)
      :LYZ_Q(0),
        LYZ_M(0),
        {}
         virtual~Selector(void){}
    virtual void Init(TTree* tree);
    virtual void Begin(TTree *tree);
    virtual void SlaveBegin(TTree*);
    virtual bool Process(Long64_t entry);
    virtual void SlaveTerminate();
    virtual void Terminate(void);
    virtual TList  *GetOutputList() const { return fOutput; }
    virtual void    SetOption(const char *option) { fOption = option; }
    virtual void    SetObject(TObject *obj) { fObject = obj; }
    virtual void    SetInputList(TList *input) { fInput = input; }
    virtual int Version() const { return 2; }
    virtual Bool_t SetTree(TTree* tree);
    ClassDef(Selector,1);
};

void Selector::SlaveBegin(TTree* tree){
    SetTree(tree);
    v2_LYZ = new TH2F("v2_LYZ", "v_{2} Distribution", 100, 0, 150, 100, 0, 0.5);
    fOutput->Add(v2_LYZ);

    LYZ_Q = new Tmap();
    LYZ_M = new Tmap();
    fOutput->Add(LYZ_Q);
    fOutput->Add(LYZ_M);
}

bool Selector::Process(Long64_t entry )
{ 
 t->GetEntry(entry);
 Q_theta(particles_intersection_mcp,2, h->c, "c",   LYZ_Q,  LYZ_M);
 }
 
 void Selector::Terminate()
{
	LYZ(LYZ_Q, LYZ_M, v2_LYZ );
	TFile* output = TFile::Open("output.root","RECREATE");
    	v2_LYZ->Write();
}
#endif

If I print some information of Tmap LYZ_Q in process() it works fine, but in the Terminate() it can’t be accessed and I get:

 *** Break *** segmentation violation
 Generating stack trace...
 0x000000010c9285ac in TProofPlayerLite::Finalize(bool, bool) (in libProofPlayer.so) + 732
 0x000000010c928114 in TProofPlayerLite::Process(TDSet*, char const*, char const*, long long, long long) (in libProofPlayer.so) + 3700
 0x000000010c92725f in TProofPlayerLite::Process(TDSet*, TSelector*, char const*, long long, long long) (in libProofPlayer.so) + 127
 0x000000010c0bcbc3 in TProofLite::Process(TDSet*, char const*, char const*, long long, long long) (in libProof.so) + 3555
 0x000000010c09528f in TProof::Process(TDSet*, TSelector*, char const*, long long, long long) (in libProof.so) + 63
 0x000000010c890238 in <unknown function>
 0x000000010c890051 in <unknown function>
 0x00000001015345fd in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (in libCling.so) + 317
 0x0000000101533a89 in cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**) (in l
 0x0000000101572ca2 in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) (in libCling.so) + 434
 0x000000010156bea9 in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) (in libCling.so) + 745
 0x000000010156b617 in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) (in libCling.so) + 135
 0x000000010156b3ea in cling::MetaParser::isMetaCommand(cling::MetaSema::ActionResult&, cling::Value*) (in libCling.so) + 42
 0x0000000101570a72 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) (in libCling.so) + 274
 0x00000001014293a7 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (in libCling.so) + 3111
 0x000000010142c5f9 in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (in libCling.so) + 121
 0x0000000101005de9 in TApplication::ExecuteFile(char const*, int*, bool) (in libCore.so) + 2329
 0x0000000101325b96 in TRint::ProcessLineNr(char const*, char const*, int*) (in libRint.so) + 118
 0x00000001013258ff in TRint::Run(bool) (in libRint.so) + 943
 0x0000000100f91e8f in main (in root.exe) + 79
 0x00007fff9252b5c9 in start (in libdyld.dylib) + 1
 0x0000000000000004 in <unknown function>
Root > 

I have been through most of the previous posts, but I couldn’t find any help there, and I hope some one can help me.

Thanks.

See : Problem with derived class