Accessing the analysis tree inside a process at `EndProcess`

REST version : v2.2.13
REST commit : 7cf21993

I would like to create a REST process that its only function is to extract some information from the analysis tree, and insert that information in a dedicated metadata class once all events have been processed.

However, it seems not possible to access the final analysis tree, at TRestSpecificEventProcess::EndProcess. It I use

fRunInfo->GetAnalysisTree()->GetNumberOfObservables();

or

fAnalysisTree->GetNumberOfObservables();

it returns 0, but there are observables registered and present in the final ROOT file.

@nkx It would be possible to arm the analysisTree, internally, at restcore level before EndProcess is called?

Additionally, when using threads EndProcess is called several times, I believe it would be desirable it would be called one time, once all the trees haven been combined together.

I guess the analysis tree in TRestProcessRunner is already ready at that time. I have added a method TRestEventProcess::GetFullAnalysisTree() to retrieve that. Can you try to use this method?

Now when I try GetFullAnalysisTree()->GetEntries() or GetFullAnalysisTree()->GetNumberObservables(), it will return the right value.

However, it crashes when I try GetFullAnalysisTree()->PrintObservables();.

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f1bf9e4404a in __GI___waitpid (pid=24642, stat_loc=stat_loc
entry=0x7ffe387670c0, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007f1bf9dcb0ab in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007f1c00ea19d7 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x558c4dcb9570) at /home/jgalan/apps/root-6.14.04/source/core/unix/src/TUnixSystem.cxx:2119
#3  TUnixSystem::StackTrace (this=0x558c4dcb9570) at /home/jgalan/apps/root-6.14.04/source/core/unix/src/TUnixSystem.cxx:2413
#4  0x00007f1c00ea4124 in TUnixSystem::DispatchSignals (this=0x558c4dcb9570, sig=kSigSegmentationViolation) at /home/jgalan/apps/root-6.14.04/source/core/unix/src/TUnixSystem.cxx:3644
#5  <signal handler called>
#6  0x00007f1bfac30b35 in REST_Reflection::TRestReflector::ToString[abi:cxx11]() () from /programas/REST/v2.2.13_dev/lib/libRestTools.so
#7  0x00007f1bfaf246cd in TRestAnalysisTree::PrintObservable(int) () from /programas/REST/v2.2.13_dev/lib/libRestCore.so
#8  0x00007f1bfaf2459b in TRestAnalysisTree::PrintObservables(TRestEventProcess*, int) () from /programas/REST/v2.2.13_dev/lib/libRestCore.so
#9  0x00007f1be8a880cf in TRestPeakFinderProcess::EndProcess() () from /programas/REST/v2.2.13_dev/lib/libRestDummy.so

I have fix this problem. Now the GetFullAnalysisTree() method shall give a functional tree

1 Like

Oh, it’s great! I checked, it works smooth.