@@ -50,6 +50,21 @@ int main() {
5050 // TODO: How to get a Grid that can be evolved??
5151 std::string filename = " LHCB_WP_7TEV_opt.pineappl.lz4" ;
5252
53+ // disable LHAPDF banners to guarantee deterministic output
54+ LHAPDF::setVerbosity (0 );
55+ std::string pdfset = " NNPDF31_nlo_as_0118_luxqed" ;
56+ auto pdf = std::unique_ptr<LHAPDF::PDF>(LHAPDF::mkPDF (pdfset, 0 ));
57+
58+ auto xfx = [](int32_t id, double x, double q2, void * pdf) {
59+ return static_cast <LHAPDF::PDF*> (pdf)->xfxQ2 (id, x, q2);
60+ };
61+ auto alphas = [](double q2, void * pdf) {
62+ return static_cast <LHAPDF::PDF*> (pdf)->alphasQ2 (q2);
63+ };
64+
65+ std::vector<LHAPDF::PDF*> pdfs = {pdf.get (), pdf.get ()};
66+ void ** pdf_states = reinterpret_cast <void **>(pdfs.data ());
67+
5368 // read the grid from a file
5469 auto * grid = pineappl_grid_read (filename.c_str ());
5570
@@ -71,8 +86,8 @@ int main() {
7186
7287 // Get the shape of the evolve info objects
7388 std::vector<std::size_t > evinfo_shape (5 );
74- std::vector<uint8_t > apply_order = {3 , 0 };
75- pineappl_grid_evolve_info_shape (grid, apply_order .data (), evinfo_shape.data ());
89+ std::vector<uint8_t > max_orders = {3 , 2 };
90+ pineappl_grid_evolve_info_shape (grid, max_orders .data (), evinfo_shape.data ());
7691
7792 // Get the values of the evolve info parameters. These contain, for example, the
7893 // information on the `x`-grid and `PID` used to interpolate the Grid.
@@ -82,7 +97,7 @@ int main() {
8297 std::vector<int > pids1 (evinfo_shape[2 ]);
8398 std::vector<double > x1 (evinfo_shape[3 ]);
8499 std::vector<double > ren1 (evinfo_shape[4 ]);
85- pineappl_grid_evolve_info (grid, apply_order .data (), fac1.data (),
100+ pineappl_grid_evolve_info (grid, max_orders .data (), fac1.data (),
86101 frg1.data (), pids1.data (), x1.data (), ren1.data ());
87102
88103 // ------------------ Construct the Operator Info ------------------
@@ -114,32 +129,22 @@ int main() {
114129 }
115130 }
116131
117- // Construct the values of alphas
118- std::vector<double > alphas_table (ren1.size (), 0.118 );
132+ // Construct the values of alphas table
133+ std::vector<double > alphas_table;
134+ for (double q2 : ren1) {
135+ double alpha = alphas (q2, pdf.get ());
136+ alphas_table.push_back (alpha);
137+ }
138+
119139 std::vector<double > xi = {1.0 , 1.0 , 1.0 };
120140 std::vector<std::size_t > tensor_shape = {pids1.size (), x1.size (), pids1.size (), x1.size ()};
121141
122142 pineappl_fk_table* fktable = pineappl_grid_evolve (grid, opinfo_slices.data (),
123- apply_order .data (), op_slices.data (), x1.data (),
143+ max_orders .data (), op_slices.data (), x1.data (),
124144 x1.data (), pids1.data (), pids1.data (),
125145 tensor_shape.data (), xi.data (), ren1.data (), alphas_table.data ());
126146
127147 // ------------------ Compare Grid & FK after convolution ------------------
128- // disable LHAPDF banners to guarantee deterministic output
129- LHAPDF::setVerbosity (0 );
130- std::string pdfset = " NNPDF31_nlo_as_0118_luxqed" ;
131- auto pdf = std::unique_ptr<LHAPDF::PDF>(LHAPDF::mkPDF (pdfset, 0 ));
132-
133- auto xfx = [](int32_t id, double x, double q2, void * pdf) {
134- return static_cast <LHAPDF::PDF*> (pdf)->xfxQ2 (id, x, q2);
135- };
136- auto alphas = [](double q2, void * pdf) {
137- return static_cast <LHAPDF::PDF*> (pdf)->alphasQ2 (q2);
138- };
139-
140- std::vector<LHAPDF::PDF*> pdfs = {pdf.get (), pdf.get ()};
141- void ** pdf_states = reinterpret_cast <void **>(pdfs.data ());
142-
143148 // how many bins does this grid have?
144149 std::size_t bins = pineappl_grid_bin_count (grid);
145150
@@ -175,7 +180,7 @@ int main() {
175180 // Print the data
176181 std::cout << std::scientific << std::setprecision (6 );
177182 for (size_t i = 0 ; i < dxsec_grid.size (); ++i) {
178- double reldiff = std::abs (dxsec_grid [i] - dxsec_fktable [i]) / ( std::abs ( dxsec_grid[i])) ;
183+ double reldiff = (dxsec_fktable [i] - dxsec_grid [i]) / dxsec_grid[i];
179184 std::cout << std::setw (idx_width) << i
180185 << std::setw (num_width) << dxsec_grid[i]
181186 << std::setw (num_width) << dxsec_fktable[i]
0 commit comments