//
// FCaloLEVEL1.cc -- standalone program to call the FCaloLEVEL1 macro. 
//    by Emiliano Mocchiutti
//
//   Version 1.00 (2005/08/16)
//
// Changelog: 
//
// 0.00 - 1.00 : working.
//
#include <TString.h>
#include <iostream>
#include <FCaloLEVEL1fun.h>
extern void info();
using namespace std;
//
int main(int numinp, char *inps[]){
  TString name;
  TString outdir;
  TString calibname;
  int force;
  if ( numinp != 5 ){
    if ( numinp > 1 ){
      if ( !strcmp(inps[1],"--version") ){
	info();
	return(0);
      };
    };
    printf("\nUsage:\n\n FCaloLEVEL1 file out_dir calib_file force \n");
    printf("\n - file                must be in the form: /path/to/filesfromyoda/dw_000000_00000.root \n");
    printf(  " - out_dir             output directory \n");
    printf(  " - calib_file          calibration file (if any) in the same form as 'file' \n");
    printf(  " - force               force flag (0 not force/1 force) \n");
    printf("\nExample: \n\nFCaloLEVEL1 /home/pamela/filesfromyoda/dw_050301_00100.root /tmp/ \"\" 0 \n\n");
    return(0);
    //
  } else {
    printf("\n Welcome to FCaloLEVEL1! \n");
    name = (TString)inps[1];
    outdir = (TString)inps[2];
    calibname = (TString)inps[3];
    force = atoi(inps[4]);
  };
  //
  int ERR = FCaloLEVEL1(name,outdir,calibname,force);
  //
  return(ERR);
}
