1 |
mocchiut |
1.1 |
/** @file |
2 |
|
|
* $Source: /repository/PamOffLineSW/techmodel/Calib2_Ac2Reader.cpp,v $ |
3 |
|
|
* $Id: Calib2_Ac2Reader.cpp,v 1.4 2008-03-04 18:09:30 messineo Exp $ |
4 |
|
|
* $Author: messineo $ |
5 |
|
|
* |
6 |
|
|
* Implementation of the Calib2_Ac2Reader class. |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
extern "C" { |
10 |
|
|
#include "CRC.h" |
11 |
|
|
#include "forroutines/anticounter/AC.h" |
12 |
|
|
extern int ACcalib(int length, unsigned char* calibpointer, struct calibstruct *calibpointer); |
13 |
|
|
} |
14 |
|
|
|
15 |
|
|
#include "ReaderAlgorithms.h" |
16 |
|
|
|
17 |
|
|
using namespace pamela; |
18 |
|
|
using namespace pamela::techmodel; |
19 |
|
|
|
20 |
|
|
/** |
21 |
|
|
* Constructor. |
22 |
|
|
*/ |
23 |
|
|
Calib2_Ac2Reader::Calib2_Ac2Reader(void): |
24 |
|
|
TechmodelAlgorithm(PacketType::Calib2_Ac2, "Calib2_Ac2") { |
25 |
|
|
calib2_Ac2 = new Calib2_Ac2Event(); |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
/** |
29 |
|
|
* Get a string with the version info of the algorithm. |
30 |
|
|
*/ |
31 |
|
|
std::string Calib2_Ac2Reader::GetVersionInfo(void) const { |
32 |
|
|
return "$Header: /repository/PamOffLineSW/techmodel/Calib2_Ac2Reader.cpp,v 1.4 2008-03-04 18:09:30 messineo Exp $\n"; |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
/** |
36 |
|
|
* Initialize the algorithm with a special run. This will initialize the |
37 |
|
|
* event reader routines for all packet types. |
38 |
|
|
*/ |
39 |
|
|
void Calib2_Ac2Reader::Init(PamelaRun *run) { |
40 |
|
|
run->WriteSubPacket(this, &calib2_Ac2, calib2_Ac2->Class()); |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
/** |
44 |
|
|
* Unpack the CalibAc event |
45 |
|
|
*/ |
46 |
|
|
void Calib2_Ac2Reader::PKT_RunEvent(char* subData, long int dataLength) throw (Exception){ |
47 |
|
|
struct calibstruct output = {0}; |
48 |
|
|
calib2_Ac2->ERROR = ACcalib(dataLength, (unsigned char*)subData, &output); |
49 |
|
|
memcpy(calib2_Ac2->header, output.header, sizeof(output.header)); |
50 |
|
|
memcpy(calib2_Ac2->status, output.status, sizeof(output.status)); |
51 |
|
|
memcpy(calib2_Ac2->temp, output.temp, sizeof(output.temp)); |
52 |
|
|
memcpy(calib2_Ac2->DAC1, output.DAC1, sizeof(output.DAC1)); |
53 |
|
|
memcpy(calib2_Ac2->DAC2, output.DAC2, sizeof(output.DAC2)); |
54 |
|
|
memcpy(calib2_Ac2->regist, output.regist, sizeof(output.regist)); |
55 |
|
|
memcpy(calib2_Ac2->time, output.time, sizeof(output.time)); |
56 |
|
|
calib2_Ac2->n_tr = output.n_tr; |
57 |
|
|
memcpy(calib2_Ac2->hitmap_tr, output.hitmap_tr, sizeof(output.hitmap_tr)); |
58 |
|
|
memcpy(calib2_Ac2->curve1, output.curve1, sizeof(output.curve1)); |
59 |
|
|
memcpy(calib2_Ac2->curve2, output.curve2, sizeof(output.curve2)); |
60 |
|
|
calib2_Ac2->iCRC = output.iCRC; |
61 |
|
|
calib2_Ac2->tail = output.tail; |
62 |
|
|
calib2_Ac2->CRC = output.CRC; |
63 |
|
|
calib2_Ac2->CRCcheck = output.CRCcheck; |
64 |
|
|
|
65 |
|
|
} |