Hi,
I just started using root and I some problems.
I generated a class with MakeClass (.h and .C files) from a root file with a tree not made by me. Than I wrote a small application .cc in order to call the Loop() function of the .C file, but when I execute it I get this error:
Error in TFile::TFile: file ntuple_tetraquarks_pseudoscalar_14Gev.root does not exist
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
#0 0x00007ff42b23e46c in waitpid () from /lib64/libc.so.6 #1 0x00007ff42b1bbf62 in do_system () from /lib64/libc.so.6 #2 0x00007ff42fbcd5dc in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.6.22 #3 0x00007ff42fbd006a in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.6.22 #4 #5 0x0000000000401ef8 in main ()
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
It means that it gives the same error as before, not existing file.
With your code I have a compilation error:
AppTreeAnalysis1.cc: In function ‘int main(int, char**)’:
AppTreeAnalysis1.cc:20:41: error: no matching function for call to ‘TFile::GetObject(const char [17])’
rootfile->GetObject(“GenAnalysis/tree”);
^
AppTreeAnalysis1.cc:20:41: note: candidate is:
In file included from /usr/include/root/TROOT.h:28:0,
from TreeAnalysis.h:11,
from TreeAnalysis.C:2,
from AppTreeAnalysis1.cc:1:
/usr/include/root/TDirectory.h:155:35: note: template void TDirectory::GetObject(const char*, T*&)
template inline void GetObject(const char* namecycle, T*& ptr) // See TDirectory::Get for information
^
/usr/include/root/TDirectory.h:155:35: note: template argument deduction/substitution failed:
AppTreeAnalysis1.cc:20:41: note: candidate expects 2 arguments, 1 provided
rootfile->GetObject(“GenAnalysis/tree”);
/tmp/ccjv37uK.o: In function TreeAnalysis::TreeAnalysis(TTree*)': TreeAnalysis.C:(.text+0x0): multiple definition of TreeAnalysis::TreeAnalysis(TTree*)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x0): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::Init(TTree*)': TreeAnalysis.C:(.text+0x2e0): multiple definition of TreeAnalysis::Init(TTree*)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x2e0): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::TreeAnalysis(TTree*)': TreeAnalysis.C:(.text+0x0): multiple definition of TreeAnalysis::TreeAnalysis(TTree*)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x0): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::~TreeAnalysis()': TreeAnalysis.C:(.text+0x130): multiple definition of TreeAnalysis::~TreeAnalysis()’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x130): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::~TreeAnalysis()': TreeAnalysis.C:(.text+0x130): multiple definition of TreeAnalysis::~TreeAnalysis()’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x130): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::~TreeAnalysis()': TreeAnalysis.C:(.text+0x192): multiple definition of TreeAnalysis::~TreeAnalysis()’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x192): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::GetEntry(long long)': TreeAnalysis.C:(.text+0x1b8): multiple definition of TreeAnalysis::GetEntry(long long)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x1b8): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::LoadTree(long long)': TreeAnalysis.C:(.text+0x208): multiple definition of TreeAnalysis::LoadTree(long long)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x208): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::Notify()': TreeAnalysis.C:(.text+0x117e): multiple definition of TreeAnalysis::Notify()’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x117e): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::Show(long long)': TreeAnalysis.C:(.text+0x118e): multiple definition of TreeAnalysis::Show(long long)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x118e): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::Cut(long long)': TreeAnalysis.C:(.text+0x11da): multiple definition of TreeAnalysis::Cut(long long)’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x11da): first defined here
/tmp/ccjv37uK.o: In function TreeAnalysis::Loop()': TreeAnalysis.C:(.text+0x11ee): multiple definition of TreeAnalysis::Loop()’
/tmp/ccNIHKZe.o:AppTreeAnalysis1.cc:(.text+0x11ee): first defined here
collect2: error: ld returned 1 exit status
Thank you, now it compiles without errors. In the execution there is still an error with the file, but now is:
Error in TFile::TFile: file /home/student/Tesi/ntuple_tetraquarks_pseudoscalar_14Gev.root does not exist
Problems reading file /home/student/Tesi/ntuple_tetraquarks_pseudoscalar_14Gev.root