VavilovAccurate with OpenMP

Hello Rooters,

I need to use the Vavilov distribution function in my analysis. To speed things up, I am using OpenMP threads. However, it seems that the class ROOT::Math::VavilovAccurate, which I am using, is not thread safe. Things are fine when I run my code with a single thread. However, with multiple thread, the code crashes. Basically, I need to execute the following statement in parallel with OpenMP, with different parameters.

a = 1-ROOT::Math::vavilov_accurate_cdf((-1-x)/3,par[0],par[1])-ROOT::Math::vavilov_accurate_cdf_c((1-x)/3,par[0],par[1]);

A mininal version of the code (to be compiled) is attached. See the comments in the header to run it in serial or in parallel. Any help is appreciated.

Cheers,
Tarak.
Vavilov03.cpp (855 Bytes)

Found a solution and posting it here, just in case someone comes across the same issue.
Solved the problem by pre calculating the VavilovAccurate initialization and integrals without using OpenMP threads. Then those pre calculated integrals are used in the OpenMP threads for the analysis.

Cheers,
Tarak.