We have the following class definition, where we have a structure, RelevantQuantity
and a std::map <std::string, RelevantQuantity>
.
We manage to write to disk the class using TRestDataSet::Export
, that implements the folowing:
fDataSet.Snapshot("AnalysisTree", filename);
TFile* f = TFile::Open(filename.c_str(), "UPDATE");
this->Write();
f->Close();
where fDataSet
is a ROOT::RDataFrame
.
The problem is that when trying to reopen the generated file we get an error:
root [0] TFile *f = new TFile("BabyIAXO_Micromegas_TrueWolter_Vacuum.root")
Fatal in <InitializeEx>: Could not load nor generate the dictionary for "pair<string,RelevantQuantity>", some element might be missing their dictionary (eg. enums)
aborting
#0 0x00007f1d971e42d7 in __GI___waitpid (pid=4610, stat_loc=stat_loc
entry=0x7ffec0071808, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1 0x00007f1d9716270f in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2 0x00007f1d99e68153 in TUnixSystem::StackTrace() () from /programas/root/6.26.06/lib/libCore.so
#3 0x00007f1d99d48ef2 in DefaultErrorHandler(int, bool, char const*, char const*) () from /programas/root/6.26.06/lib/libCore.so
#4 0x00007f1d99dfa82f in ErrorHandler () from /programas/root/6.26.06/lib/libCore.so
#5 0x00007f1d99dfb2c2 in Fatal(char const*, char const*, ...) () from /programas/root/6.26.06/lib/libCore.so
#6 0x00007f1d99919fcf in TGenCollectionProxy::InitializeEx(bool) () from /programas/root/6.26.06/lib/libRIO.so
#7 0x00007f1d99915df3 in TGenCollectionProxy::GetValueClass() const () from /programas/root/6.26.06/lib/libRIO.so
#8 0x00007f1d99e0e867 in TClass::GetClass(char const*, bool, bool, unsigned long, unsigned long) () from /programas/root/6.26.06/lib/libCore.so
#9 0x00007f1d99931a9b in TStreamerInfo::BuildCheck(TFile*, bool) () from /programas/root/6.26.06/lib/libRIO.so
#10 0x00007f1d998e0201 in TFile::ReadStreamerInfo() () from /programas/root/6.26.06/lib/libRIO.so
#11 0x00007f1d998eb124 in TFile::Init(bool) () from /programas/root/6.26.06/lib/libRIO.so
#12 0x00007f1d998ecad5 in TFile::TFile(char const*, char const*, char const*, int) () from /programas/root/6.26.06/lib/libRIO.so
#13 0x00007f1d8f52905e in ?? ()
#14 0x000055c1a5ce47d0 in ?? ()
#15 0x000055c1a7bfb050 in ?? ()
#16 0x000055c1a530dc00 in ?? ()
#17 0x00007f1d8f52803b in ?? ()
#18 0x00007f1d998ec200 in ?? () from /programas/root/6.26.06/lib/libRIO.so
#19 0x00007f1d915d3c1a in cling::IncrementalExecutor::runStaticInitializersOnce(cling::Transaction&) () from /programas/root/6.26.06/lib/libCling.so
#20 0x00007f1d9155b9e8 in cling::Interpreter::executeTransaction(cling::Transaction&) () from /programas/root/6.26.06/lib/libCling.so
#21 0x00007f1d915e479a in 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) () from /programas/root/6.26.06/lib/libCling.so
#22 0x00007f1d915e60cb in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /programas/root/6.26.06/lib/libCling.so
#23 0x00007f1d9155eeaa in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) [clone .constprop.548] () from /programas/root/6.26.06/lib/libCling.so
#24 0x00007f1d9155f1de in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /programas/root/6.26.06/lib/libCling.so
#25 0x00007f1d91630048 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /programas/root/6.26.06/lib/libCling.so
#26 0x00007f1d91475b3c in HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /programas/root/6.26.06/lib/libCling.so
#27 0x00007f1d9148ac0f in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /programas/root/6.26.06/lib/libCling.so
#28 0x00007f1d99d27728 in TApplication::ProcessLine(char const*, bool, int*) () from /programas/root/6.26.06/lib/libCore.so
#29 0x00007f1d98b89d80 in TRint::ProcessLineNr(char const*, char const*, int*) () from /programas/root/6.26.06/lib/libRint.so
#30 0x00007f1d98b8a173 in TRint::HandleTermInput() () from /programas/root/6.26.06/lib/libRint.so
#31 0x00007f1d99e69c7b in TUnixSystem::CheckDescriptors() () from /programas/root/6.26.06/lib/libCore.so
#32 0x00007f1d99e6b7b8 in TUnixSystem::DispatchOneEvent(bool) () from /programas/root/6.26.06/lib/libCore.so
#33 0x00007f1d99d8bb21 in TSystem::Run() () from /programas/root/6.26.06/lib/libCore.so
#34 0x00007f1d99d24a22 in TApplication::Run(bool) () from /programas/root/6.26.06/lib/libCore.so
#35 0x00007f1d98b8bb76 in TRint::Run(bool) () from /programas/root/6.26.06/lib/libRint.so
#36 0x000055c1a3befda3 in main ()
Aborted
I had a look here in case it was something related with LinkDef
,
but we include the line #pragma link C++ struct RelevantQuantity;
inside our LinkDef file.
Also, if I open the file in the same ROOT session as the session where the file was generated, there are no issues!
root [0] TRestDataSet d("dataset2.rml")
(TRestDataSet &) Name: BabyIAXO Title: Default TRestDataSet
root [1] d.Initialize()
root [2] d.Export("BabyIAXO_Micromegas_TrueWolter_Vacuum.root")
root [3] TFile *f = new TFile("BabyIAXO_Micromegas_TrueWolter_Vacuum.root")
(TFile *) 0x7f1bec001b10
root [4] .ls
TFile** BabyIAXO_Micromegas_TrueWolter_Vacuum.root BabyIAXO_Micromegas_TrueWolter_Vacuum.root
TFile* BabyIAXO_Micromegas_TrueWolter_Vacuum.root BabyIAXO_Micromegas_TrueWolter_Vacuum.root
KEY: TTree AnalysisTree;1 AnalysisTree
KEY: TRestDataSet BabyIAXO;1 Default TRestDataSet
root [5] BabyIAXO->PrintMetadata()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|| TRestDataSet content ||
|| Config file : dataset2.rml ||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|| Name : BabyIAXO ||
|| Title : Default TRestDataSet ||
|| REST Version : 2.3.14 ||
|| REST Official release: Yes ||
|| Clean state: Yes ||
|| REST Commit : 5f19f747 ||
|| REST Library version : 0 ||
----------------------------------------------------------------------------------------------------
|| - StartTime : 16.85 ||
|| - EndTime : 9.36111 ||
|| - Path : /storage/iaxo/simulations/ray-tracing ||
|| - File pattern : run_006*rayTrac*_Vacuum_jgalan_V2.3.14.root ||