I have segmentation violation Error When I use TTreader array from two different ROOT files.
TFile* f = new TFile("SFtest0525_5degree_1K.edm4hep.root");
f->cd();
//TTree* t = (TTree*)f->Get("events");
TTreeReader myReader("events", f); // name of tree and file
TTreeReaderArray<Float_t> energy(myReader, "LumiDirectPCALHits.energy");
TTreeReaderArray<Float_t> x(myReader, "LumiDirectPCALHits.position.x");
TTreeReaderArray<Float_t> y(myReader, "LumiDirectPCALHits.position.y");
// Rootfile and Tree
TFile* f1 = new TFile("SFtest0525_5rad_1K.edm4hep.root");
f1->cd();
TTreeReader myReader1("events", f1);
TTreeReaderArray<Float_t> z(myReader1, "LumiDirectPCALHits.position.z");
yasir@yasir-X270:~/Downloads/Analysis/fiber_CAL$ root crystal_dep.C -l
root [0]
Processing crystal_dep.C...
Warning in <TClass::Init>: no dictionary for class podio::GenericParameters is available
Warning in <TClass::Init>: no dictionary for class edm4hep::MCParticleData is available
Warning in <TClass::Init>: no dictionary for class edm4hep::Vector3d is available
Warning in <TClass::Init>: no dictionary for class edm4hep::Vector3f is available
Warning in <TClass::Init>: no dictionary for class edm4hep::Vector2i is available
Warning in <TClass::Init>: no dictionary for class podio::ObjectID is available
Warning in <TClass::Init>: no dictionary for class edm4hep::EventHeaderData is available
Warning in <TClass::Init>: no dictionary for class edm4hep::SimTrackerHitData is available
Warning in <TClass::Init>: no dictionary for class edm4hep::SimCalorimeterHitData is available
Warning in <TClass::Init>: no dictionary for class edm4hep::CaloHitContributionData is available
Warning in <TClass::Init>: no dictionary for class podio::CollectionIDTable is available
Warning in <TClass::Init>: no dictionary for class podio::version::Version is available
Warning in <TClass::Init>: no dictionary for class pair<int,podio::GenericParameters> is available
Event: 1
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f61782ea45a in __GI___wait4 (pid=9724, stat_loc=stat_loc
entry=0x7ffcdb8e8fd8, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1 0x00007f61782ea41b in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffcdb8e8fd8, options=options
entry=0) at ./posix/waitpid.c:38
#2 0x00007f6178250bcb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3 0x00007f6178d168a4 in TUnixSystem::StackTrace() () from /home/yasir/Downloads/root/lib/libCore.so.6.26
#4 0x00007f6178d13bb5 in TUnixSystem::DispatchSignals(ESignals) () from /home/yasir/Downloads/root/lib/libCore.so.6.26
#5 <signal handler called>
#6 0x00007f6178835a1f in ?? ()
#7 0x00007ffcdb8ebe48 in ?? ()
#8 0x00007f6178836890 in ?? ()
#9 0x0000000000000000 in ?? ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
Warnings like these one might then result in the segfault you are experiencing. Are you sure you are loading all the libraries needed for your application? Even so, you still need to generate the dictionaries for the classes of the content of your dataset (find more info at I/O of custom classes - ROOT).
Please provide a small, self-contained reproducer, the ROOT version, platform and compiler version you are using.
No these warnings are not creating problem Code runs with these warning and if I use one TTreader but when i try to read separate histogram using seperate TTreader
TFile* f = new TFile(“SFtest0525_5degree_1K.edm4hep.root”);
f->cd();
//TTree* t = (TTree*)f->Get("events");
TTreeReader myReader("events", f); // name of tree and file
TTreeReaderArray<Float_t> energy(myReader, "LumiDirectPCALHits.energy");
TTreeReaderArray<Float_t> x(myReader, "LumiDirectPCALHits.position.x");
TTreeReaderArray<Float_t> y(myReader, "LumiDirectPCALHits.position.y");
TTreeReaderArray<Float_t> z(myReader, "LumiDirectPCALHits.position.z");
Sorry even after changing while (myReader.Next() && myReader1.Next()) It crashes after 3 Events
root [0]
Processing crystal_dep.C…
Warning in TClass::Init: no dictionary for class podio::GenericParameters is available
Warning in TClass::Init: no dictionary for class edm4hep::MCParticleData is available
Warning in TClass::Init: no dictionary for class edm4hep::Vector3d is available
Warning in TClass::Init: no dictionary for class edm4hep::Vector3f is available
Warning in TClass::Init: no dictionary for class edm4hep::Vector2i is available
Warning in TClass::Init: no dictionary for class podio::ObjectID is available
Warning in TClass::Init: no dictionary for class edm4hep::EventHeaderData is available
Warning in TClass::Init: no dictionary for class edm4hep::SimTrackerHitData is available
Warning in TClass::Init: no dictionary for class edm4hep::SimCalorimeterHitData is available
Warning in TClass::Init: no dictionary for class edm4hep::CaloHitContributionData is available
Warning in TClass::Init: no dictionary for class podio::CollectionIDTable is available
Warning in TClass::Init: no dictionary for class podio::version::Version is available
Warning in TClass::Init: no dictionary for class pair<int,podio::GenericParameters> is available
Event: 1
Event: 2
Event: 3
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
#0 0x00007ff2b8cea45a in __GI___wait4 (pid=17848, stat_loc=stat_loc
entry=0x7ffc6292c998, options=options
entry=0, usage=usage
entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:30 #1 0x00007ff2b8cea41b in __GI___waitpid (pid=, stat_loc=stat_loc
entry=0x7ffc6292c998, options=options
entry=0) at ./posix/waitpid.c:38 #2 0x00007ff2b8c50bcb in do_system (line=) at …/sysdeps/posix/system.c:171 #3 0x00007ff2b97168a4 in TUnixSystem::StackTrace() () from /home/yasir/Downloads/root/lib/libCore.so.6.26 #4 0x00007ff2b9713bb5 in TUnixSystem::DispatchSignals(ESignals) () from /home/yasir/Downloads/root/lib/libCore.so.6.26 #5 #6 0x00007ff2b99cab74 in ?? () #7 0x0000000000000150 in ?? () #8 0x00007ff2b4cc0920 in ?? () from /home/yasir/Downloads/root/lib/libCling.so #9 0x00007ffc6292ff40 in ?? () #10 0x0000560ff5d95990 in ?? () #11 0x00007ffc6292ff40 in ?? () #12 0x0001010000000001 in ?? () #13 0x0000000000000032 in ?? () #14 0x00007ff2b765f2bd in llvm::MCAsmLayout::getFragmentOffset(llvm::MCFragment const*) const () from /home/yasir/Downloads/root/lib/libCling.so #15 0x00007ff2b762f3a2 in llvm::MCAssembler::computeFragmentSize(llvm::MCAsmLayout const&, llvm::MCFragment const&) const () from /home/yasir/Downloads/root/lib/libCling.so #16 0x0000000200000003 in ?? () #17 0x00000000c7813300 in ?? () #18 0x3db851ec3d75c28f in ?? () #19 0x000004b0000003e8 in ?? () #20 0x00007ffc6292f818 in ?? () #21 0x0000000000000006 in ?? () #22 0x0000796772656e65 in ?? () #23 0x0000000000000000 in ?? ()
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum ROOT Forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at Sign in to GitHub · GitHub Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
#6 0x00007ff2b99cab74 in ?? () #7 0x0000000000000150 in ?? () #8 0x00007ff2b4cc0920 in ?? () from /home/yasir/Downloads/root/lib/libCling.so #9 0x00007ffc6292ff40 in ?? () #10 0x0000560ff5d95990 in ?? () #11 0x00007ffc6292ff40 in ?? () #12 0x0001010000000001 in ?? () #13 0x0000000000000032 in ?? () #14 0x00007ff2b765f2bd in llvm::MCAsmLayout::getFragmentOffset(llvm::MCFragment const*) const () from /home/yasir/Downloads/root/lib/libCling.so #15 0x00007ff2b762f3a2 in llvm::MCAssembler::computeFragmentSize(llvm::MCAsmLayout const&, llvm::MCFragment const&) const () from /home/yasir/Downloads/root/lib/libCling.so #16 0x0000000200000003 in ?? () #17 0x00000000c7813300 in ?? () #18 0x3db851ec3d75c28f in ?? () #19 0x000004b0000003e8 in ?? () #20 0x00007ffc6292f818 in ?? () #21 0x0000000000000006 in ?? () #22 0x0000796772656e65 in ?? () #23 0x0000000000000000 in ?? ()
Processing crystal_dep.C…
In file included from input_line_8:1:
/home/yasir/Downloads/Analysis/fiber_CAL/crystal_dep.C:104:42: error: no matching function for call to ‘abs’
h3[“energy”]->Fill(x[i],y[i],abs(z.At(i) - zmin,energy[i]);
^~~
/usr/include/c++/11/complex:626:5: note: candidate function template not viable: requires single argument ‘__z’, but 2 arguments were provided
abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
^
/usr/include/c++/11/bits/valarray_after.h:445:33: note: candidate function template not viable: requires single argument ‘__e’, but 2 arguments were provided
_DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
^
/usr/include/c++/11/bits/valarray_after.h:445:33: note: candidate function template not viable: requires single argument ‘__v’, but 2 arguments were provided
/home/yasir/Downloads/root/include/Vc/scalar/…/common/…/sse/vector.h:448:52: note: candidate function not viable: requires single argument ‘x’, but 2 arguments were provided
Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> abs(Vector<T, VectorAbi::Sse> x)
^
/home/yasir/Downloads/root/include/Vc/common/simdarray.h:1806:27: note: candidate function not viable: requires single argument ‘x’, but 2 arguments were provided
Vc_FORWARD_UNARY_OPERATOR(abs);
^
/home/yasir/Downloads/root/include/Vc/common/simdarray.h:1806:27: note: candidate function not viable: requires single argument ‘x’, but 2 arguments were provided
/home/yasir/Downloads/root/include/Vc/scalar/math.h:88:44: note: candidate function not viable: requires single argument ‘x’, but 2 arguments were provided
Vc_ALWAYS_INLINE Vc_PURE Scalar::Vector abs(Scalar::Vector x)
^
/usr/include/stdlib.h:848:12: note: candidate function not viable: requires single argument ‘__x’, but 2 arguments were provided
extern int abs (int __x) __THROW attribute ((const)) __wur;
^
/usr/include/c++/11/bits/std_abs.h:79:3: note: candidate function not viable: requires single argument ‘__x’, but 2 arguments were provided
abs(long double __x)
^
/usr/include/c++/11/bits/std_abs.h:56:3: note: candidate function not viable: requires single argument ‘__i’, but 2 arguments were provided
abs(long __i) { return __builtin_labs(__i); }
^
/usr/include/c++/11/bits/std_abs.h:61:3: note: candidate function not viable: requires single argument ‘__x’, but 2 arguments were provided
abs(long long __x) { return __builtin_llabs (__x); }
^
/usr/include/c++/11/bits/std_abs.h:71:3: note: candidate function not viable: requires single argument ‘__x’, but 2 arguments were provided
abs(double __x)
^
/usr/include/c++/11/bits/std_abs.h:75:3: note: candidate function not viable: requires single argument ‘__x’, but 2 arguments were provided
abs(float __x)
^
/home/yasir/Downloads/root/include/Vc/scalar/math.h:93:48: note: candidate function not viable: requires single argument ‘x’, but 2 arguments were provided
Vc_ALWAYS_INLINE Vc_PURE Scalar::Vector abs(Scalar::Vector x)
^
<<< cling interactive line includer >>>:1:1: error: expected ‘}’
/home/yasir/Downloads/Analysis/fiber_CAL/crystal_dep.C:36:1: note: to match this ‘{’