Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extern_pdf definition #2

Open
scarrazza opened this issue Mar 26, 2016 · 1 comment
Open

extern_pdf definition #2

scarrazza opened this issue Mar 26, 2016 · 1 comment

Comments

@scarrazza
Copy link
Collaborator

As discussed some time ago, I would suggest to define:

typedef std::function<void(double const&,double const&, size_t const&, real*)> extern_pdf;

So, the user can allocate PDF sets using the LHAPDF6 interface initialized in a well defined container:

class MyPDF
{
public:
  MyPDF(string const& pdfset): { pdf_ = LHAPDF::mkPDFs(pdfset); }
  extern_pdf xfx(double const& x, double const& Q, size_t const& n, real *pdf)
  {
     for (int i = 0; i < 13; i++) res[i] = pdf_[n]->xfxQ(i-6,x,Q);
     return;
  }
private:
  vector<LHAPDF::PDF*> pdf_;
};

int main()
{
  MyPDF pdf("NNPDF30_nlo_as_0118");
   ...
  NNPDF::FKTable FK(infile);
  NNPDF::real* results = new NNPDF::real[FK.GetNData()];
  FK.Convolute(pdf.xfx, 1, results);
}

However this approach requires c++11 and this is potential issue for applgrid.

@nhartland
Copy link
Owner

Yeah, this is certainly nicer but I don't know if it'd cause problems for APPLgrid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants