1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/ArrDumpReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/CalibAcReader.cpp,v $ |
3 |
* $Id: ArrDumpReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $ |
* $Id: CalibAcReader.cpp,v 1.1 2004/07/08 12:31:42 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the ArrDumpReader class. |
* Implementation of the ArrDumpReader class. |
12 |
#include "stdio.h" |
#include "stdio.h" |
13 |
extern "C" { |
extern "C" { |
14 |
#include "CRC.h" |
#include "CRC.h" |
15 |
#include "forroutines/anticoinc/ACcalib.h" |
#include "forroutines/anticounter/ACcalib.h" |
16 |
int ACcalib(unsigned short* datapointer, struct datastruct* calibpointer); |
extern int ACcalib(int length, unsigned short* datapointer, struct datastruct* calibpointer); |
17 |
} |
} |
18 |
|
|
19 |
#include "ReaderAlgorithms.h" |
#include "ReaderAlgorithms.h" |
21 |
using namespace pamela; |
using namespace pamela; |
22 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
23 |
|
|
24 |
|
|
25 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibAcReader"); |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibAcReader"); |
26 |
|
|
27 |
/** |
/** |
36 |
* Get a string with the version info of the algorithm. |
* Get a string with the version info of the algorithm. |
37 |
*/ |
*/ |
38 |
std::string CalibAcReader::GetVersionInfo(void) const { |
std::string CalibAcReader::GetVersionInfo(void) const { |
39 |
return "$Header: /home/cvsmanager/yoda/techmodel/CalibAcReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n"; |
return "$Header: /home/cvsmanager/yoda/techmodel/CalibAcReader.cpp,v 1.1 2004/07/08 12:31:42 kusanagi Exp $\n"; |
40 |
} |
} |
41 |
|
|
42 |
/** |
/** |
71 |
readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
72 |
|
|
73 |
if (subCRC == readCRC){ |
if (subCRC == readCRC){ |
74 |
datastruct output; |
datastruct output; |
75 |
int ERROR; |
int ERROR; |
76 |
ERROR = ACcalib((unsigned short*)subData, &output); |
ERROR = ACcalib(dataLength, (unsigned short*)subData, &output); |
77 |
|
|
78 |
CalibAc->header = output.header; |
CalibAc->header = output.header; |
79 |
memcpy(CalibAc->status, output.status, sizeof(CalibAc->status)); |
memcpy(CalibAc->status, output.status, sizeof(CalibAc->status)); |
80 |
memcpy(CalibAc->DAC, output.DAC, sizeof(CalibAc->DAC)); |
memcpy(CalibAc->DAC, output.DAC, sizeof(CalibAc->DAC)); |
81 |
memcpy(CalibAc->regist, output.regist, sizeof(CalibAc->regist)); |
memcpy(CalibAc->regist, output.regist, sizeof(CalibAc->regist)); |
82 |
memcpy(CalibAc->time, output.time, sizeof(CalibAc->time)); |
memcpy(CalibAc->time, output.time, sizeof(CalibAc->time)); |
83 |
CalibAc->n_tr = output.n_tr; |
CalibAc->n_tr = output.n_tr; |
84 |
memcpy(CalibAc->hitmap_tr, output.hitmap_tr, sizeof(CalibAc->hitmap_tr)); |
memcpy(CalibAc->hitmap_tr, output.hitmap_tr, sizeof(CalibAc->hitmap_tr)); |
85 |
memcpy(CalibAc->curve1, output.curve1, sizeof(CalibAc->curve1)); |
memcpy(CalibAc->curve1, output.curve1, sizeof(CalibAc->curve1)); |
86 |
memcpy(CalibAc->curve2, output.curve2, sizeof(CalibAc->curve2)); |
memcpy(CalibAc->curve2, output.curve2, sizeof(CalibAc->curve2)); |
87 |
CalibAc->iCRC = output.iCRC; |
CalibAc->iCRC = output.iCRC; |
88 |
CalibAc->tail = output.tail; |
CalibAc->tail = output.tail; |
89 |
CalibAc->CRC = output.CRC; |
CalibAc->CRC = output.CRC; |
90 |
|
free(subData); |
|
free(subData); |
|
91 |
} else { |
} else { |
92 |
cat << log4cpp::Priority::ERROR |
cat << log4cpp::Priority::ERROR |
93 |
<< "Wrong CRC on Subpacket in ArrDump Packet " |
<< "Wrong CRC on Subpacket in ArrDump Packet " |