--- yoda/techmodel/CalibAcReader.cpp 2004/07/17 20:03:38 1.2 +++ yoda/techmodel/CalibAcReader.cpp 2004/10/17 12:28:38 2.1 @@ -1,19 +1,19 @@ /** @file * $Source: /home/cvsmanager/yoda/techmodel/CalibAcReader.cpp,v $ - * $Id: CalibAcReader.cpp,v 1.1 2004/07/08 12:31:42 kusanagi Exp $ + * $Id: CalibAcReader.cpp,v 2.0 2004/09/21 20:50:54 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the ArrDumpReader class. */ #include -#include +#include #include #include "stdio.h" extern "C" { #include "CRC.h" - #include "forroutines/anticounter/ACcalib.h" - extern int ACcalib(int length, unsigned short* datapointer, struct datastruct* calibpointer); + #include "forroutines/anticounter/AC.h" + extern int ACcalib(int length, unsigned char* calibpointer, struct calibstruct* calibpointer); } #include "ReaderAlgorithms.h" @@ -21,14 +21,14 @@ using namespace pamela; using namespace pamela::techmodel; - -static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibAcReader"); +static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.CalibAcReader")); /** * Constructor. */ CalibAcReader::CalibAcReader(void): TechmodelAlgorithm(PacketType::CalibAc, "TechmodelCalibAc") { + logger->debug(_T("Constructor")); CalibAc = new CalibAcEvent(); } @@ -36,7 +36,7 @@ * Get a string with the version info of the algorithm. */ std::string CalibAcReader::GetVersionInfo(void) const { - return "$Header: /home/cvsmanager/yoda/techmodel/CalibAcReader.cpp,v 1.1 2004/07/08 12:31:42 kusanagi Exp $\n"; + return "$Header: /home/cvsmanager/yoda/techmodel/CalibAcReader.cpp,v 2.0 2004/09/21 20:50:54 kusanagi Exp $\n"; } /** @@ -44,6 +44,7 @@ * event reader routines for all packet types. */ void CalibAcReader::Init(PamelaRun *run) { + logger->debug(_T("Initialize")); SetInputStream(run); run->WriteSubPacket(this, &CalibAc, CalibAc->Class()); } @@ -52,7 +53,6 @@ * Unpack the CalibAc event from an input file. */ void CalibAcReader::RunEvent(int EventNumber, long int length) { - char *subData; char eventCRC[2]; UINT16 subCRC; //CRC of the data @@ -71,13 +71,15 @@ readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); if (subCRC == readCRC){ - datastruct output; + calibstruct output; int ERROR; - ERROR = ACcalib(dataLength, (unsigned short*)subData, &output); + ERROR = ACcalib(dataLength, (unsigned char*)subData, &output); CalibAc->header = output.header; memcpy(CalibAc->status, output.status, sizeof(CalibAc->status)); - memcpy(CalibAc->DAC, output.DAC, sizeof(CalibAc->DAC)); + memcpy(CalibAc->temp, output.temp, sizeof(CalibAc->temp)); + memcpy(CalibAc->DAC1, output.DAC1, sizeof(CalibAc->DAC1)); + memcpy(CalibAc->DAC2, output.DAC2, sizeof(CalibAc->DAC2)); memcpy(CalibAc->regist, output.regist, sizeof(CalibAc->regist)); memcpy(CalibAc->time, output.time, sizeof(CalibAc->time)); CalibAc->n_tr = output.n_tr; @@ -87,10 +89,8 @@ CalibAc->iCRC = output.iCRC; CalibAc->tail = output.tail; CalibAc->CRC = output.CRC; - free(subData); } else { - cat << log4cpp::Priority::ERROR - << "Wrong CRC on Subpacket in ArrDump Packet " - << "\n " << log4cpp::CategoryStream::ENDLINE; + logger->warn(_T("Wrong CRC on Subpacket in ArrDump Packet ")); } + delete [] subData; }