/**
file: test.cpp
date: 2018-03-28
author: Michal Krelina
purpose:
  example for using interpolation method interpol.h

  Please cite the following paper if you use the code with vector mesons wave function of total cross section grids:
  J.Cepila, M.Krelina, J.Nemchik, R.Pasechnik, Phys.Rev.DXX:XXXX,2018 [arXiv:XXXX.XXXX].
**/

#include <iostream>
#include <string>
#include "interpol.h";

// global variable for grid data 
interpol::data VMr;
interpol::data VMpz;
interpol::data VMrz;

int main(int argc, char* argv[])
{
  // path + file name
  std::string rGrid = "VM_psi1S_r_BT.grid";
  std::string pzGrid = "VM_psi1S_kz_BT.grid";
  std::string rzGrid = "VM_psi1S_rz_BT.grid";

  // loading of grids into memory
  interpol::iniFile(VMr, rGrid, 1);
  std::cout << std::endl;
  interpol::iniFile(VMpz, pzGrid, 1);
  std::cout << std::endl;
  interpol::iniFile(VMrz, rzGrid, 1);

  std::cout << std::endl;
  std::cout << std::endl;

  // some random values
  double r = 0.2; // fm
  double k = 2.; // GeV
  double z = 0.2;
  double xp[2];


  // getting values
  xp[0] = r;
  std::cout << "Test from non-boosted wave function (r):" << std::endl;
  std::cout << r << "\t" << interpol::get(VMr, xp) << std::endl << std::endl;

  xp[0] = k;
  xp[1] = z;
  std::cout << "Test from boosted wave function (pT,z):" << std::endl;
  std::cout << k << "\t" << z << "\t" << interpol::get(VMpz, xp) << std::endl << std::endl;

  xp[0] = r;
  xp[1] = z;
  std::cout << "Test from boosted wave function (rT,z):" << std::endl;
  std::cout << r << "\t" << z << "\t" << interpol::get(VMpz, xp) << std::endl << std::endl;

  // cleaning
  interpol::del(VMr);
  interpol::del(VMpz);
  interpol::del(VMrz);

  system("pause");
  return 0;
}