Seg. fault in TRestHitsGaussAnalysisProcess when running REST in multithread mode

REST version : v2.2.21
REST commit : 7886c397

The recently implemented TRestHitsGaussAnalysisProcess produces seg. fault if the analysis is launched in multithread mode. I think it might be related to the histograms that this process handles internally, but I don’t know how to solve it.

If multithread is not used, the process works fine.

Any ideas?

Hi Cristina, thanks for posting this issue.

I have experienced myself problems with multi-thread running on MonteCarlo data. But I had no time to test the conditions where this happens.

Are you sure the problem only appears when you use the new process TRestHitsGaussAnalysisProcess? If you remove it from the chain the multithreading works properly? Which other processes do you have in the chain?

Hope @nkx will give some light on this.

Yes, it only happens when that process is in the chain.

About the processes I have, in the chain, I use a root file that is already an output of mainly TRestRawSignalAnalysisProcess and TRestZeroSupressionProcess.

Then I run on this root file the following:
TRestSignalToHitsProcess
TRestHitsAnalysisProcess
TRestHitsGaussAnalysisProcess
TRestHitsToTrackProcess
TRestTrackAnalysisProcess

And it’s here where I get the segmentation fault.

This is because ROOT finds object with name in a global list. We should prevent using name string to specify the object when calling ROOT method in multi-thread environment.

Maybe writing in this way can solve the problem:

Double_t TRestHits::GetGaussSigmaX() {
...

    TF1* fit = new TF1("", "gaus", hh->GetMaximumBin() / 2 - 32, hh->GetMaximumBin() / 2 - 26);

    hh->Fit(fit, "QNR");  // Q = quiet, no info in screen; N = no plot; R = fit in the function range

    gausSigmaX = fit->GetParameter(2);

...
}


1 Like

Ok that works, thanks.

Cristina.

PS: The piece of code you’ve pasted was not the latest, so there are some other changes now. It’s all now in commit 9d73dfac (including the change you suggested).

I understand the problem has gone?

Yes, the problem is solved now

2 Likes