Hi, Many thanks for your help. Indeed, I want to read entry-10000 and entry+10000 of the same TTree. Your last solution (just to "Get" twice MyTree from MyFile) does not work (the "Process" is still painfully slow). I have found that also in this case, one MUST open the same file twice (additionally to the selector). Here is what I do now : 1. in the "MySelector.h" file : class MySelector : public TSelector { public: TFile *f1, *f2; TTree *t1, *t2; Float_t x1, x2; TBranch *b_x1, *b_x2; // ... } // ... Bool_t MySelector::Notify() { if (f1) delete f1; if (f2) delete f2; f1 = new TFile(fChain->GetCurrentFile()->GetName(), "READ"); f2 = new TFile(fChain->GetCurrentFile()->GetName(), "READ"); t1 = (TTree *)f1->Get(fChain->GetName()); t2 = (TTree *)f2->Get(fChain->GetName()); t1->SetBranchAddress("x", &x1); t2->SetBranchAddress("x", &x2); b_x1 = t1->GetBranch("x"); b_x2 = t2->GetBranch("x"); // ... } 2. in the "MySelector.C" file : void MySelector::Begin(TTree *tree) { f1 = (TFile *)0; f2 = (TFile *)0; // ... } // ... void MySelector::Terminate() { if (f1) delete f1; f1 = (TFile *)0; if (f2) delete f2; f2 = (TFile *)0; // ... } Then everything seems to be working fine and fast. Best regards, Jacek.
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:50 MET