#include "MySel.h" ClassImp(MySel); void MySel::Begin(TTree * /*tree*/) { cout << "-->Client beginning..." << endl; } void MySel::SlaveBegin(TTree * /*tree*/) { cout << "-->Slave beginning..." << endl; outTree = new TTree("outTree","outTree"); outTree->Branch("outVariable", &outVariable); fOutput->Add(outTree); cout << "-->Slave finished." << endl; } Bool_t MySel::Process(Long64_t entry) { fChain->GetEntry(entry); outVariable = hdig_Epluspc2; outTree->Fill(); return kTRUE; } void MySel::SlaveTerminate() { } void MySel::Terminate() { cout << "-->Terminating... " << endl; outTree = (TTree *) fOutput->FindObject("outTree"); if (outTree) { cout << "--->successfully made the bush." << endl; cout << "--->it has # of entries = " << outTree->GetEntries() << endl; TFile *f = TFile::Open("testing.root", "RECREATE"); f->WriteObject(outTree, "bush"); delete f; } }