Problem with Reading Root File

An expert’s advice is needed, why there is a “segmentation violation” in the code below. 8-[

{
  TFile *TPCTOFEfffile = TFile::Open("EFFTPCTOF.root", "read");
  
#if 1 /* 0 or 1 */
  // This method works well.
  TH1F *TPCTOFEFFDeltapp = (TH1F*)(TPCTOFEfffile->FindObjectAny("hEff;1"));
  TH1F *TPCTOFEFFDeltamm = (TH1F*)(TPCTOFEfffile->FindObjectAny("hEff;2"));
  TH1F *TPCTOFEFFAverage = (TH1F*)(TPCTOFEfffile->FindObjectAny("hEff;3"));
#else /* 0 or 1 */
  // This method should also work, I get these pointers initialized, but
  // then I get a "segmentation violation" in the "Draw" command below.
  // Always only the last call to "GetObject" gives a "valid" object,
  // pointers initialized before become "invalid".
  TH1F *TPCTOFEFFDeltapp, *TPCTOFEFFDeltamm, *TPCTOFEFFAverage;
  TPCTOFEfffile->GetObject("hEff;1", TPCTOFEFFDeltapp);
  TPCTOFEfffile->GetObject("hEff;2", TPCTOFEFFDeltamm);
  TPCTOFEfffile->GetObject("hEff;3", TPCTOFEFFAverage);
#endif /* 0 or 1 */
  
  TCanvas *d23 = new TCanvas("d23", "efficiency*acc", 0, 0, 950, 700);
  
  TPCTOFEFFDeltapp->Draw();
  TPCTOFEFFDeltamm->Draw("same");
  TPCTOFEFFAverage->Draw("same");
  
  d23->SaveAs("TPC_TOF_EFF_ACC.eps");
}