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.
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?
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
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);
...
}
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).