Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRestRawMultiFEMINOSToSignalProcess: first two events are with the same id #36

Open
nkx111 opened this issue Aug 19, 2021 · 4 comments
Open
Labels
bug Something isn't working

Comments

@nkx111
Copy link
Member

nkx111 commented Aug 19, 2021

I found that the first two events from TRestRawMultiFEMINOSToSignalProcess are with same id. Don't know if is the file/daq problem or the process's problem.

I download this file: https://github.com/rest-for-physics/rawlib/blob/master/pipeline/data/R01208_Ar2Iso_Background14h_14Vetos_IccubFEC-000.aqs

and type directly in restRoot:

TRestRawMultiFEMINOSToSignalProcess pc;  
pc.OpenInputFiles({"R01208_Ar2Iso_Background14h_14Vetos_IccubFEC-000.aqs"});
TRestRun r; 
pc.SetRunInfo(&r);
pc.InitProcess()

pc.ProcessEvent(NULL)->GetTimeStamp().GetNanoSec() //293870925
pc.ProcessEvent(NULL)->GetTimeStamp().GetNanoSec() //293870925
pc.ProcessEvent(NULL)->GetTimeStamp().GetNanoSec() //375673055
pc.ProcessEvent(NULL)->GetTimeStamp().GetNanoSec() //317906618

And see the timestamp of the first two events are same. We can also try event id, and see they are same. However, the signal data seems to be different, meaning that the events are not actually same.

TRestRawMultiFEMINOSToSignalProcess pc;  
pc.OpenInputFiles({"R01208_Ar2Iso_Background14h_14Vetos_IccubFEC-000.aqs"});
TRestRun r; 
pc.SetRunInfo(&r);
pc.InitProcess();

((TRestRawSignalEvent*)pc.ProcessEvent(NULL))->GetSignal(0)->GetData(0) //249
((TRestRawSignalEvent*)pc.ProcessEvent(NULL))->GetSignal(0)->GetData(0) //261
((TRestRawSignalEvent*)pc.ProcessEvent(NULL))->GetSignal(0)->GetData(0) //269
((TRestRawSignalEvent*)pc.ProcessEvent(NULL))->GetSignal(0)->GetData(0) //249

@juanangp
Copy link
Member

juanangp commented Aug 19, 2021

Looking at the code, the bug looks more or less clear to me:

if (fSignalEvent->GetID() == 0) {
if (fLastEventId == 0) {
fSignalEvent->SetID(tmp);
fSignalEvent->SetTime(tStart + (2147483648 * r2 + 32768 * r1 + r0) * 2e-8);
} else {
fSignalEvent->SetID(fLastEventId);
fSignalEvent->SetTime(fLastTimeStamp);
}
}
fLastEventId = tmp;
fLastTimeStamp = tStart + (2147483648 * r2 + 32768 * r1 + r0) * 2e-8;

So I am not surprised that the timestamp and the ID are the same for the first 2 events.

@nkx111
Copy link
Member Author

nkx111 commented Aug 20, 2021

It seems the first event is stampped by the header frame after it, and the other events are stampped by the header frame ahead. So actually the first two events are using same header. What is the correct place for the header in FEMINOS daq?

@juanangp
Copy link
Member

Following the FEMINOS manual the Event Count and the Timestamp are written once per event, I guess that if you have several FEMINOS you should get one Event Count and Timestamp per FEMINOS.

image

As far as I understand, event boundaries are between PFX_START_OF_EVENT and PFX_END_OF_EVENT, this should work for a single FEMINOS set-up. However, in a multi FEMINOS set-up I think you should check for PFX_START_OF_BUILT_EVENT and PFX_END_OF_BUILT_EVENT because you should have one event count and timestamp per FEMINOS that indeed should match for every event.

Anyhow, perhaps would be better if the person that wrote the code comment on that.

@nkx111 nkx111 added the bug Something isn't working label Aug 22, 2021
@jgalan
Copy link
Member

jgalan commented Feb 6, 2022

There are few comments above line 496. In principle, the code mentioned by @juanangp should only be accessed in case the event id of the event is =0. I guess this should not be the case, or it is? It is the DAQ event id starting by zero?

If that lines of code are at the origin of the problem, perhaps a solution would be to initialise ID to -1, and then use the condition if( fSignalEvent->GetID() == -1)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants