Thanks a lot, Enrico! This Interpreter seems to open up lots of possibilities. I’m so glad to know this.
But the code seems not robust enough. As you can see below the shell outputs message, I ran the code twice successively with no changes in between. The first time it gave me segmentation violation
error but second time it went through fine.
First run
$ pythhon3 get_eff.py
*** Break *** bus error
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TUnixSystem::DispatchSignals(ESignals) (no debug info)
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TList::Streamer(TBuffer&) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ReadFastArray(void**, TClass const*, int, bool, TMemberStreamer*, TClass const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] int TStreamerInfo::ReadBuffer<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TStreamerInfoActions::GenericReadAction(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ReadClassBuffer(TClass const*, void*, int, unsigned int, unsigned int, TClass const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libHist.6.22.06.so] TH1::Streamer(TBuffer&) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TStreamerBase::ReadBuffer(TBuffer&, char*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] int TStreamerInfo::ReadBuffer<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TStreamerInfoActions::GenericReadAction(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ReadClassBuffer(TClass const*, void*, int, unsigned int, unsigned int, TClass const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libHist.6.22.06.so] TH2::Streamer(TBuffer&) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TStreamerBase::ReadBuffer(TBuffer&, char*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] int TStreamerInfo::ReadBuffer<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TStreamerInfoActions::GenericReadAction(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TBufferFile::ReadClassBuffer(TClass const*, void*, int, unsigned int, unsigned int, TClass const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libHist.6.22.06.so] TH2D::Streamer(TBuffer&) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TKey::ReadObjectAny(TClass const*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libRIO.6.22.06.so] TDirectoryFile::GetObjectChecked(char const*, TClass const*) (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] cling::IncrementalExecutor::runStaticInitializersOnce(cling::Transaction const&) const (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] cling::Interpreter::executeTransaction(cling::Transaction&) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*> > >&, bool) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] cling::Interpreter::declare(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::Transaction**) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] TCling::LoadText(char const*) const (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCling.6.22.06.so] TCling::Declare(char const*) (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy_backend3_9.6.22.06.so] WrapperCall(long, unsigned long, void*, void*, void*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy_backend3_9.6.22.06.so] Cppyy::CallB(long, void*, unsigned long, void*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::(anonymous namespace)::BoolExecutor::Execute(long, void*, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::CPPMethod::ExecuteFast(void*, long, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::CPPMethod::ExecuteProtected(void*, long, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object*, _object*, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::(anonymous namespace)::mp_call(CPyCppyy::CPPOverload*, _object*, _object*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] _PyObject_MakeTpCall (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] call_function (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] _PyEval_EvalCode (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] PyRun_FileExFlags (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] PyRun_SimpleFileExFlags (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] pymain_run_file (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] pymain_run_python (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] Py_RunMain (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] pymain_main (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
Traceback (most recent call last):
File "/Users/hangyi/Desktop/get_eff.py", line 3, in <module>
ROOT.gInterpreter.Declare("""
cppyy.ll.SegmentationViolation: bool TInterpreter::Declare(const char* code) =>
SegmentationViolation: segfault in C++; program state was reset
*** Break *** segmentation violation
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TUnixSystem::DispatchSignals(ESignals) (no debug info)
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TROOT::CloseFiles() (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TROOT::EndOfProcessCleanups() (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy_backend3_9.6.22.06.so] WrapperCall(long, unsigned long, void*, void*, void*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::(anonymous namespace)::VoidExecutor::Execute(long, void*, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::CPPMethod::ExecuteFast(void*, long, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::CPPMethod::ExecuteProtected(void*, long, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object*, _object*, CPyCppyy::CallContext*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libcppyy3_9.6.22.06.so] CPyCppyy::(anonymous namespace)::mp_call(CPyCppyy::CPPOverload*, _object*, _object*) (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] _PyObject_MakeTpCall (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] call_function (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] _PyFunction_Vectorcall (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] atexit_callfuncs (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] Py_FinalizeEx (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] Py_RunMain (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] pymain_main (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/bin/python3] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/python3.9/site-packages/ROOT/__init__.py", line 113, in cleanup
backend.gROOT.EndOfProcessCleanups()
cppyy.ll.SegmentationViolation: void TROOT::EndOfProcessCleanups() =>
SegmentationViolation: segfault in C++; program state was reset
*** Break *** bus error
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TUnixSystem::DispatchSignals(ESignals) (no debug info)
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TROOT::CloseFiles() (no debug info)
[/usr/lib/system/libsystem_c.dylib] __cxa_finalize_ranges (no debug info)
[/usr/lib/system/libsystem_c.dylib] exit (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
*** Break *** bus error
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TUnixSystem::DispatchSignals(ESignals) (no debug info)
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/opt/homebrew/Caskroom/miniconda/base/envs/analysis/lib/libCore.6.22.06.so] TROOT::CloseFiles() (no debug info)
[/usr/lib/system/libsystem_c.dylib] __cxa_finalize_ranges (no debug info)
[/usr/lib/system/libsystem_c.dylib] exit (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
^C
Second run
$ python3 get_eff.py
The weighted efficiency with RDF is 0.3483978540941734