Notify() from TTree::LoadTree(Long64_t entry)

foo.h file:

class TMyClass : public TNamed {

private:
  TChain       *fChain;       // !analyses chain, trees
  TBranch      *fMyBranch;    // branch

  bla_bla;

public:
  Bool_t        Notify(); // overridde TObject
  void          AnalyzeEntry(const Int_t entry) const;
  TChain       *GetChain() const { return fChain; }

  bla_bla;
};

foo.cxx file:

TMyClass::TMyClass()
{
  fMyBranch = 0;
}

bla_bla;

//____________________________
void TMyClass::AnalyzeEntry(const Int_t entry) const
{
  Long64_t localEntry = fChain->LoadTree(entry); // also call Notify()
  if (fMyBranch)
    fMyBranch->GetEntry(localEntry);
  AnyFunctionWithCurrentEntry();
}
//____________________________
Bool_t TMyClass::Notify()
{
  fMyBranch = fChain->GetBranch("any_branch");

  if (fChain->GetCurrentFile())
    Printf("Processing file: %s",fChain->GetCurrentFile()->GetName());
  return kTRUE;
}

and now:
[ul]
root [ ] TMyClass *foo = new TMyClass(“foo”);
// fChain is any TTree or TChain
root [ ] foo->AnalyzeEntry(12345); // all OK, function Notify() is calling
root [ ] Processing file: /home/user/any_file.root
[/ul]
but
[ul]
root [ ] TMyClass *foo = new TMyClass(“foo”);
// fChain is any TTree or TChain
root [ ] foo->GetChain()->Draw(“any_var”); // afther this command, member fReadEntry in TTree.cxx is more than 0
root [ ] foo->AnalyzeEntry(12345); // function Notify() is not calling (because fRead in not <0) and fMyBranch = 0
// How solve this problem ( without direct call foo->Notify() ) ?
[/ul]
Thanks and sorry to my poor English.

Notify is called only when a new file must be loaded.
In your case you are requesting an entry in the current file, so Notify will not be called.
You can force a call to Notify call calling LoadTree with an entry number
outside the range, eg LoadTree(-1)

Rene

I try this:
[ul]
root [ ] foo->GetChain()->Draw(“any_var”);
root [ ] foo->GetChain()->LoadTree(-1); // fReadEntry = -1
root [ ] foo->AnalyzeEntry(12345); // however Notify() is not calling ?! and fMyBranch = 0
[/ul]
root 4.04.02b, gcc 3.4