File: lhapdf-ccregdump.cc

package info (click to toggle)
lhapdf 5.8.7%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 18,096 kB
  • sloc: fortran: 55,662; sh: 10,220; cpp: 2,033; ansic: 612; python: 488; makefile: 426
file content (39 lines) | stat: -rw-r--r-- 947 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "LHAPDF/LHAPDF.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdlib>
using namespace std;


int main(int argc, char** argv) {
  if (argc != 4) {
    cerr << "Usage: lhapdf-ccregdump <pdffile> <pdfmember> <refdumpfile>" << endl;
    exit(1);
  }
  string pdffile = argv[1];
  int pdfmember  = atoi(argv[2]);
  string reffile = argv[3];

  LHAPDF::setVerbosity(LHAPDF::SILENT);
  LHAPDF::initPDFSet(pdffile, pdfmember);
  
  ifstream fref(reffile.c_str(), fstream::in);
  string line;
  while (getline(fref, line)) {
    istringstream iss(line);
    double x, Q;
    iss >> x;
    iss >> Q;
    vector<double> thisxfx = LHAPDF::xfx(x, Q);
    cout << scientific << x << "\t" << scientific << Q;
    for (vector<double>::const_iterator v = thisxfx.begin(); v != thisxfx.end(); ++v) {
      cout << "\t" << scientific << *v;
    }
    cout << endl;
  }
  
  return EXIT_SUCCESS;
}