ROOT file. Access to histograms

{
  TFile *file = TFile::Open("/path/to/file.root");
  if (!file || file->IsZombie()) { delete file; file = 0; } // just a precaution
  if (file) file->ls();
  int NofLayers = 3;
  for(int i = 0; i < NofLayers; i++) {
    TH1D *hist = 0;
    if (file) file->GetObject(TString::Format("Fiber_%d", i), hist);
    if (!hist) continue; // just a precaution
    hist->SetDirectory(gROOT);
    new TCanvas(); hist->Draw(); // each histogram in its own canvas
  }
  delete file; file = 0;
}