Exemplo n.º 1
0
int
gsl_integration_qagiu (gsl_function * f,
                       double a,
                       double epsabs, double epsrel, size_t limit,
                       gsl_integration_workspace * workspace,
                       double *result, double *abserr)
{
  int status;

  gsl_function f_transform;
  struct iu_params transform_params  ;

  transform_params.a = a ;
  transform_params.f = f ;

  f_transform.function = &iu_transform;
  f_transform.params = &transform_params;

  status = qags (&f_transform, 0.0, 1.0, 
                 epsabs, epsrel, limit,
                 workspace,
                 result, abserr,
                 &gsl_integration_qk15);

  return status;
}
Exemplo n.º 2
0
int
gsl_integration_qags (const gsl_function *f,
                      double a, double b,
                      double epsabs, double epsrel, size_t limit,
                      gsl_integration_workspace * workspace,
                      double * result, double * abserr)
{
  int status = qags (f, a, b, epsabs, epsrel, limit,
                     workspace, 
                     result, abserr, 
                     &gsl_integration_qk21) ;
  return status ;
}
Real calorimeterLSF::getLSF (Real deltaE1, Real deltaE2)
{
  //  Real answer = qags (deltaE2, deltaE1);
  //  Real answer = qng (deltaE2, deltaE1);
  setEpsRel (1.e-3); // desired accuracy of integral over energy bin
  Real limit = 1.e-10 / itsETau; // below a certain threshold throw out the tail
  if (compare (integrand (deltaE1), limit) == -1) {
    if (compare (integrand (deltaE2), limit) == -1) {
      return 0.;
    }
  }
  Real answer = qag (deltaE2, deltaE1, 4);
  int status = getStatus ();
  if (status) {
    cout << deltaE1 << " " << deltaE2 << " " << answer << "\n";
    cout << integrand (deltaE1) << " " << integrand (deltaE2) << "\n";
  }
  return qags (deltaE2, deltaE1);
}