TRestRawSignalChannelActivity Process removes all the signals from the events

REST version : v2.3.4
REST commit : ab3d2094

I am analysing data with this version and if I use TRestRawSignalChannelActivityProcess, it removes all the signals, so my events are empty. This shouldn’t happen, and it was working fine with former versions.

Checking the process I saw that in TRestRawSignalChannelActivityProcess::Initialize (link here) we have fSignalEvent = new TRestRawSignalEvent(). However, in TRestRawSignalAnalysisProcess (here) it is fSignalEvent = NULL. So I tried setting it to NULL but it still doesn’t work.

Any ideas?

I had the idea to add the process TRestRawSignalChannelActivityProcess to the validation pipeline, inside the trexdm data processing chain. So that the problem shows on the main validation line.

In principle this process does nothing to the event data, and if we printout the event just before return fSignalEvent, the event data seems to be there, as expected.

However, as @CMargalejo mentions, when accessing the ROOT file, the events are empty, with no signals. @CMargalejo was using that process on a previous version of 2.2.X, without problems.

Plz, @nkx could you have a look?

I moved to v2.3.4 and it works there.

No, it is not posible, the TREX-DM pipeline fails after adding the TRestRawSignalChannelActivityProcess to the processing chain, I added it at one of the latest commits.

The commit:

The pipeline execution output:

Kaixiang must be right now on Chinese holidays. @nkx Happy New Lunar Year! :slight_smile:

Happy new Lunar year!

I have looked into TRestRawSignalChannelActivityProcess and find the problem. It is because we didn’t update the class data member fSignalEvent in ProcessEvent(). Instead, we use a temporal fSignalEvent inside the method. This makes REST wrongly determine the output event at the stage of test run(In test run, it uses TRestEventProcess::GetOutputEvent() to get output event, so the determined output event is TRestRawSignalChannelActivityProcess::fSignalEvent, but the actual used event is the returned event of TRestRawSignalChannelActivityProcess::ProcessEvent()). Then the created event tree is also with wrong event.

I have updated both the code of TRestRawSignalChannelActivityProcess and TRestThread to fix this problem.

2 Likes

Ok, I see the issue with the local variable definition. Will somehow the changes at TRestThread identify the problem?

It means we could prevent users from doing that by introducing a validation.py that checks that we do not redeclare as local the main event pointer?

TRestXXEvent* fYY = (TRestXXEvent*)evInput;

I.e., any coincidence with TRestXXEvent* fYY at ProcessEvent should result on a failure at the pipeline.

This check would be too strict, I guess. I prefer doing the check at TRestThread, and just prompt a warning if the returned value is different in GetOutputEvent() and ProcessEvent()

Ok, great, just one naive question.

  • At the Initialize method, at TRestRawSignalAnalysisProcess we initialize fSignalEvent to NULL.

  • But at the corresponding method at TRestRawSignalChannelActivityProcess we use fSignalEvent = new.

I guess the right way is the first version for a pure analysis process, and we should avoid to create a new?

Happy new Lunar year!
I tested the fix and it works perfectly for me too. Thanks.

Right. Otherwise there will be memory leak, the newed event can never be deleted. Still it is not a big problem. Each process will produce just one “lost” event, it is not a big leak.

I have created a dedicated category for RestRawLib and I updated this post in consequence to that category.

Ok, I proceeded like that, I removed the delete from line 130 and the new from line 145 at rawlib/src/TRestRawSignalChannelActivityProcess.cxx at master · rest-for-physics/rawlib · GitHub

See also latest commits at rawlib.

However, after checking it with @konrad during the processing, the connection of this process causes a segmentation fault.

Perhaps it is required to do fSignalEvent=NULL at initialization?

I updated the process to initialize it with fSignalEvent=NULL. I believe the problem is solved.