/[PAMELA software]/chewbacca/PamOffLineSW/techmodel/Calib1_Ac1Reader.cpp
ViewVC logotype

Annotation of /chewbacca/PamOffLineSW/techmodel/Calib1_Ac1Reader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Sep 23 07:20:25 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: v0r00
CVS Tags: v1r02, v1r00, v1r01, start
Changes since 1.1: +0 -0 lines
Imported sources, 23/09/2008

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

  ViewVC Help
Powered by ViewVC 1.1.23