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

struct FlCaLevel1 {
    Double_t al_p[5][2];
    Float_t estrip[96][22][2];
    Int_t good2;
    Int_t trkchi2;
    Float_t xalig;
    Float_t yalig;
    Float_t zalig;
    Float_t emin;
};

struct FlCaLevel2 {
    Float_t trigty;
    Int_t good;
    Int_t perr[4];
    Int_t swerr[4];
    Int_t crc[4];
    Int_t selftrigger;
    Float_t nstrip;
    Float_t qtot;
    Float_t ncore;
    Float_t qcore;
    Float_t impx;
    Float_t impy;
    Float_t tanx;
    Float_t tany;
    Float_t noint;
    Float_t ncyl;
    Float_t qcyl;
    Float_t qtrack;
    Float_t qmax;
    Float_t nx22;
    Float_t qx22;
    Float_t qq[4];
    Float_t qtrackx;
    Float_t qtracky;
    Float_t dxtrack;
    Float_t dytrack;
    Float_t qlast;
    Float_t nlast;
    Float_t qpre;
    Float_t npre;
    Float_t qpresh;
    Float_t npresh;
    Float_t qlow;
    Float_t nlow;
    Float_t qtr;
    Float_t ntr;
    Float_t planetot;
    Float_t qmean;
    Int_t planemax[2];
    Float_t dX0l;
    Float_t varcfit[2];
    Int_t npcfit[2];
    Int_t cibar[22][2];
    Int_t tibar[22][2];
    Float_t cbar[22][2];
    Float_t tbar[22][2];
    Float_t elen;
    Float_t selen;
};

extern int CaloCore(ULong64_t run, TFile *file, TSQLServer *dbc, Int_t calargc, char *calargv[]);

#endif
