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

Contents of /chewbacca/PamOffLineSW/techmodel/Calib1_Ac2Reader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Aug 4 13:58:11 2009 UTC (15 years, 4 months ago) by mocchiut
Branch: MAIN
Changes since 1.1: +5 -5 lines
Changed to work with GCC 4.x (gfortran) + ROOT >= 5.24

1 /** @file
2 * $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/Calib1_Ac2Reader.cpp,v $
3 * $Id: Calib1_Ac2Reader.cpp,v 1.1.1.1 2008/09/23 07:20:28 mocchiut Exp $
4 * $Author: mocchiut $
5 *
6 * Implementation of the Calib1_Ac2Reader 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_Ac2Reader::Calib1_Ac2Reader(void):
28 TechmodelAlgorithm(PacketType::Calib1_Ac2, "Calib1_Ac2") {
29 calib1_Ac2 = new Calib1_Ac2Event();
30 }
31
32 /**
33 * Get a string with the version info of the algorithm.
34 */
35 std::string Calib1_Ac2Reader::GetVersionInfo(void) const {
36 return "$Header: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/Calib1_Ac2Reader.cpp,v 1.1.1.1 2008/09/23 07:20:28 mocchiut 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_Ac2Reader::Init(PamelaRun *run) {
44 run->WriteSubPacket(this, &calib1_Ac2, calib1_Ac2->Class());
45 }
46
47 /**
48 * Unpack the Calib1_Ac2Reader event
49 */
50 void Calib1_Ac2Reader::PKT_RunEvent(char* subData, long int dataLength) throw (Exception){
51
52 struct calibstruct output;// = {0};
53 calib1_Ac2->ERROR = ACcalib(dataLength, (unsigned char*)subData, &output);
54 memcpy(calib1_Ac2->header, output.header, sizeof(output.header));
55 memcpy(calib1_Ac2->status, output.status, sizeof(output.status));
56 memcpy(calib1_Ac2->temp, output.temp, sizeof(output.temp));
57 memcpy(calib1_Ac2->DAC1, output.DAC1, sizeof(output.DAC1));
58 memcpy(calib1_Ac2->DAC2, output.DAC2, sizeof(output.DAC2));
59 memcpy(calib1_Ac2->regist, output.regist, sizeof(output.regist));
60 memcpy(calib1_Ac2->time, output.time, sizeof(output.time));
61 calib1_Ac2->n_tr = output.n_tr;
62 memcpy(calib1_Ac2->hitmap_tr, output.hitmap_tr, sizeof(output.hitmap_tr));
63 memcpy(calib1_Ac2->curve1, output.curve1, sizeof(output.curve1));
64 memcpy(calib1_Ac2->curve2, output.curve2, sizeof(output.curve2));
65 calib1_Ac2->iCRC = output.iCRC;
66 calib1_Ac2->tail = output.tail;
67 calib1_Ac2->CRC = output.CRC;
68 calib1_Ac2->CRCcheck = output.CRCcheck;
69
70 }

  ViewVC Help
Powered by ViewVC 1.1.23