#ifndef l2tofcore_h
#define l2tofcore_h
#include <TSystem.h>
#include <TSQLServer.h>

struct ToFInput {
  Double_t al_pp[5];
  Float_t k_s11s31[24][2];
  Float_t k_s11s32[24][2];
  Float_t k_s12s31[18][2];
  Float_t k_s12s32[18][2];
  Float_t k_S21S31[6][2];
  Float_t k_S21S32[6][2];
  Float_t k_S22S31[6][2];
  Float_t k_S22S32[6][2];
  Float_t k_s11s21[16][2];
  Float_t k_s11s22[16][2];
  Float_t k_s12s21[12][2];
  Float_t k_s12s22[12][2];
  Float_t adcx11[2][8][2];
  Float_t adcx12[2][6][2];
  Float_t adcx21[2][2][2];
  Float_t adcx22[2][2][2];
  Float_t adcx31[2][3][2];
  Float_t adcx32[2][3][2];
  Float_t tw11[8][2];
  Float_t tw12[6][2];
  Float_t tw21[2][2];
  Float_t tw22[2][2];
  Float_t tw31[3][2];
  Float_t tw32[3][2];
  Float_t y_coor_lin11[2][8];
  Float_t y_coor_lin12[2][6];
  Float_t y_coor_lin21[2][2];
  Float_t y_coor_lin22[2][2];
  Float_t y_coor_lin31[2][3];
  Float_t y_coor_lin32[2][3];
  Int_t adc[12][4];
  Int_t tdc[12][4];
  Int_t patterntrig[6];
  Int_t ntrk;
};

struct ToFOutput {
  Float_t beta_a[13];
  Float_t betatof_a[13];
  Float_t xtofpos[3];
  Float_t ytofpos[3];
  Float_t adc_c[12][4];
  Float_t adctof_c[12][4];
  Float_t tdc_c[12][4];
  Int_t tofmask[12][4]; 
  Int_t tof_i_flag[6];
  Int_t tof_j_flag[6];
};

extern int ToFCore(UInt_t run, TFile *file, TSQLServer *dbc, Int_t ToFargc, char *ToFargv[]);

#endif
