/*
 * CalibratorDEB.cpp
 *
 *  Created on: Jul 30, 2015
 *      Author: jjpalacios
 */

#include "./Calibrator/Calibrator.h"

// Test variables (for debugging)
#define setup "/home/ECSC/jjpalacios/Documents/workspace/DEB/DEB_Framework/setup_files/GATE/Clb_up_COH09_1"
#define algorithm "/home/ECSC/jjpalacios/Documents/workspace/DEB/DEB_Framework/setup_files/NGA_Setup"


int main(int argc, const char *argv[]) {
	clbDEB::Calibrator *calibrator;

	try {
	if(argc < 3) {
		std::cout << "WARNING: Not enough input arguments. Using ";
		std::cout << "default paths:" << std::endl;
		std::cout << "Calibrator setup: " << setup << std::endl ;
		std::cout << "Algorithm setup: " << algorithm << std::endl << std::endl;
		calibrator = new clbDEB::Calibrator(setup, algorithm);
	}
	else {
		calibrator = new clbDEB::Calibrator(argv[1], argv[2]);
	}

	std::vector< std::pair<std::string, double> > solution;
	solution = calibrator->calibrate();

	std::cout << "Best setup:" << std::endl;
	for(unsigned int i=0; i < solution.size(); i++) {
		std::cout << solution[i].first << "\t" << solution[i].second;
		std::cout << std::endl;
	}


	} catch(clbDEB::ClbException &ex) {
		std::cout << ex.what() << std::endl << std::endl;
		return -2;
	}

	delete calibrator;

	return 0;
}

