dr4kan / EcoMug

Efficient COsmic MUon Generator
GNU General Public License v3.0
17 stars 6 forks source link

Very slow when using custom differential flux function #3

Closed xpzhang closed 1 year ago

xpzhang commented 1 year ago

Hello, When I use GenerateFromCustomJ() with a user-defined differential flux function, same with the example code in the paper:

double PrimaryGeneratorAction::J_Gaisser(double p, double theta)
{
  double A = 0.14*pow(p, -2.7);
  double B = 1. / (1. + 1.1*p*cos(theta)/115.);
  double C = 0.054 / (1. + 1.1*p*cos(theta)/850.);
  return A*(B+C);
}

The generation gets very slow (several tenth slower compared to the pre-defined J. What can I do to improve the performance? Thanks.

dr4kan commented 1 year ago

Version 2 will improve this. It will be released in few weeks.

dr4kan commented 1 year ago

I checked and the code is not slow. I suspect that you did not set a reasonable range for the momuntum. Please note that, in the Gaisser parametrization if p is small J diverges...