//
//     Written by Emiliano Mocchiutti
//
#include "ccal2struct.h"
#define crcalol2 crcalol2_
extern "C" int crcalol2();

void cfillcalol2( CaLevel1 & clevel1, CaLevel2 & clevel2 ) {
  extern struct CaLevel1 clevel1_;
  extern struct CaLevel2 clevel2_;
  memcpy(&clevel1_, &clevel1, sizeof(clevel1));
  //  memcpy(&clevel2_, &clevel2, sizeof(clevel2));
  clevel2_.OBT = clevel2.OBT;
  clevel2_.pkt_num = clevel2.pkt_num;
  clevel2_.pro_num = clevel2.pro_num;
  clevel2_.trigty = clevel2.trigty;
  clevel2_.good = clevel2.good;
  for (Int_t s = 0; s < 4; s++){
    clevel2_.perr[s] = clevel2.perr[s];
    clevel2_.swerr[s] = clevel2.swerr[s];
    clevel2_.crc[s] = clevel2.crc[s];
  }    
  crcalol2();
  memcpy(&clevel2, &clevel2_, sizeof(clevel2));
};
