A call to TChain::Process on a user defined TSelector erroneously iterates over and over again on the first TFile of a TChain. In addition, this second and subsequent erroneous iterations over the first TFile is at least an order of magnitude slower than the first iteration, if not more. I have attached the small, simple file named MySelector.cxx which demonstrates this problem. Notice that I defined MySelector::ProcessCut as follows: Bool_t ProcessCut( Int_t entry ) { fTree->GetEntry( entry ); return kTRUE; } Is this not the correct way to simply read in all of a TTree's TBranches? I also tried the following with the same result: Bool_t ProcessCut( Int_t entry ) { b_foo->GetEntry( entry ); return kTRUE; } I followed the example in the files h1analysis.h and h1analysis.C in the tutorials subdirectory, which seem to do it as I describe as well. The nature of the problem suggests that the user is required to call TChain::LoadTree during the call to TSelector::Notify, in a manner similar to the case with the code generated by TTree::MakeClass. However, it didn't seem like I should have to do this with a TSelector. Could somebody help me please? Thank you :-) Regards, Matt -- Matthew D. Langston SLD, Stanford Linear Accelerator Center langston@SLAC.Stanford.EDU #include <TString.h> // sigh... #include <TSelector.h> #include <TFile.h> #include <TChain.h> #include <iostream> class MySelector : public TSelector { public: MySelector() {} virtual ~MySelector() {} virtual void Begin( TTree* tree ) { if ( tree == 0 ) { return; } fTree = tree; fTree->SetBranchAddress( "foo", &f_foo ); } virtual Bool_t Notify() { b_foo = fTree->GetBranch( "foo" ); return kTRUE; } virtual Bool_t ProcessCut( Int_t entry ) { fTree->GetEntry( entry ); return kTRUE; } virtual void ProcessFill( Int_t entry ) { cerr << "entry " << entry << ", foo " << f_foo << endl; } private: TTree* fTree; Int_t f_foo; TBranch* b_foo; }; // Local variables: // compile-command: "g++ -Wall `root-config --cflags` -c MySelector.cxx" // End:
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:33 MET