#define MySel_cxx #include "MySel.h" ClassImp(MySel); void MySel::Begin(TChain *inTree) { inTreeInit(inTree); cout << "set the mode and channel" << endl; } void MySel::SlaveBegin() { cout << "Beginning slave." << endl; outTree = new TTree("outTree","outTree"); outTree->Branch("outVariable", &outVariable); fOutput->Add(outTree); cout << "Slave begun." << endl; } Bool_t MySel::Process(Long64_t entry) { cout << " Process called " << endl; inTree->GetEntry(entry); outVariable = inVariable; outTree->Fill(); return kTRUE; } void MySel::SlaveTerminate() { } void MySel::Terminate() { 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; } }