/[PAMELA software]/yoda/techmodel/CalibCalPedReader.cpp
ViewVC logotype

Contents of /yoda/techmodel/CalibCalPedReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Jul 8 12:31:42 2004 UTC (20 years, 5 months ago) by kusanagi
Branch: MAIN
Changes since 1.1: +20 -9 lines
*** empty log message ***

1 /** @file
2 * $Source: /home/cvsmanager/yoda/techmodel/CalibCalPedReader.cpp,v $
3 * $Id: CalibCalPedReader.cpp,v 1.1 2004/07/06 14:07:27 kusanagi Exp $
4 * $Author: kusanagi $
5 *
6 * Implementation of the LogReader class.
7 * ToBeDone:
8 * Control the CRC for the entire data Packet not just for single records
9 */
10
11 //#define UINT unsigned int
12 #define BYTE unsigned char
13 #include <string>
14 #include <log4cpp/Category.hh>
15 #include <fstream>
16 #include "stdio.h"
17 extern "C" {
18
19 //Struct per il passaggio di dati da e verso la chiamata fortran
20 extern struct {
21 int IEV2;
22 int calped[96][11][4];
23 int calgood[96][11][4];
24 int calthr[96][11][4];
25 int calrms[96][11][4];
26 int calbase[96][11][4];
27 int calvar[96][11][4];
28 int calpuls[96][11][4];
29 } calib_;
30
31 //external declaration of the Fortran function
32 // void calpedestal_(short[], int, int*);
33 }
34
35 #include "ReaderAlgorithms.h"
36 #include "event/CalibCalPedEvent.h"
37
38 using namespace pamela;
39 using namespace pamela::techmodel;
40
41 static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibCalPedReader");
42
43 /**
44 * Constructor.
45 */
46 CalibCalPedReader::CalibCalPedReader(void):
47 TechmodelAlgorithm(PacketType::Log, "TechmodelCalibCalPedReader") {
48 cat << log4cpp::Priority::DEBUG
49 << "Constructor "
50 << "\n " << log4cpp::CategoryStream::ENDLINE;
51 CalibCalPed = new CalibCalPedEvent();
52 }
53
54 /**
55 * Get a string with the version info of the algorithm.
56 */
57 std::string CalibCalPedReader::GetVersionInfo(void) const {
58 return
59 "$Header: /home/cvsmanager/yoda/techmodel/CalibCalPedReader.cpp,v 1.1 2004/07/06 14:07:27 kusanagi Exp $\n";
60 }
61
62 /**
63 * Initialize the algorithm with a special run. This will initialize the
64 * event reader routines for all packet types.
65 */
66 void CalibCalPedReader::Init(PamelaRun *run) {
67 SetInputStream(run);
68 run->WriteSubPacket(this, &CalibCalPed, CalibCalPed->Class());
69 }
70
71 /**
72 * Unpack the CalibCalPed event from an input file.
73 */
74 void CalibCalPedReader::RunEvent(int EventNumber, long int length) {
75
76 char *subData;
77 long int dataLength;
78 int ERROR;
79
80 //the 2 bytes subtracted belong to the final event CRC bytes
81 dataLength = length - (long int)2;
82
83 subData = new char[dataLength];
84 InputFile->read(subData, sizeof(unsigned char)*dataLength);
85
86 //Skip the last two crc bytes already checked in UnpackPscu
87 //This part have to be refactored!!!! too bad......
88 InputFile->seekg((long int)2, std::ios::cur);
89
90 //Chiamata alla funzione fortran per la lettura dei piedistalli
91 // calpedestal_((short*)subData, dataLength, &ERROR);
92 cat << log4cpp::Priority::ERROR
93 << "Fortran77 function calpedestal error code = " << ERROR
94 << "\n " << log4cpp::CategoryStream::ENDLINE;
95 free(subData);
96 }
97
98

  ViewVC Help
Powered by ViewVC 1.1.23