Problem with in my program?

Dear Rooters

I’m running a program in Mac and it works and when I tried it in Linux system it couldn’t. Can you please guide me that what’s wrong with it. Thank you. Attached is the program.
twoDMap.cpp (2.5 KB)

Regards

Zaheer

You need to write what error(s) you get.

Thank you very much for your reply. The following error I got.
Processing twoDMap.cpp…
Error: Function access(rootfile,0) is not defined in current scope twoDMap.cpp:27:
*** Interpreter error recovered ***
Note: I’m the beginner using Root.

Regards
Zaheer

Well, ROOT 5 interpreter doesn’t know it.
You would need to precompile it using ACLiC, e.g.: root [0] .x twoDMap.cpp++

Or use this:

void twoDMap()
{
  const char *rootfile = "/Users/shishaoxi/research/data/spectra/rootfiles/o2_12.root";
  TFile *fin = TFile::Open(rootfile);
  if ((!fin) || fin->IsZombie()) { // just a precaution
    std::cout << "***File " << rootfile << " not usable!***" << std::endl;
    delete fin;
    return;
  }
  TTree *tree;
  fin->GetObject("t", tree);
  if (!tree) { // just a precaution
    std::cout << "***Tree not found in the " << rootfile << " file!***" << std::endl;
    delete fin;
    return;
  }
  // ...
  delete fout; // automatically deletes the "T777", too
  delete fin; // automatically deletes the "tree", too
}

Thank you very much, but my question is why the same program works in Mac system using ROOT, but it doesn’t work in Linux system.

Regards
Zaheer

Different ROOT versions?

For Mac: v6.10.08,
For Ubuntu: Version 5.34/30

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.