1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk1Reader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk1Reader.cpp,v $ |
3 |
* $Id: CalibTrk1Reader.cpp,v 1.4 2004/08/19 15:24:46 kusanagi Exp $ |
* $Id: CalibTrk1Reader.cpp,v 1.5 2004/08/24 16:01:57 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the LogReader class. |
* Implementation of the LogReader class. |
11 |
#define UINT unsigned int |
#define UINT unsigned int |
12 |
#define BYTE unsigned char |
#define BYTE unsigned char |
13 |
#include <string> |
#include <string> |
14 |
#include <log4cpp/Category.hh> |
#include <log4cxx/logger.h> |
15 |
extern "C" { |
extern "C" { |
16 |
#include "CRC.h" |
#include "CRC.h" |
17 |
//The int* return the error code |
//The int* return the error code |
52 |
using namespace pamela; |
using namespace pamela; |
53 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
54 |
|
|
55 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibTrk1Reader"); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.CalibTrk1Reader")); |
56 |
|
|
57 |
/** |
/** |
58 |
* Constructor. |
* Constructor. |
59 |
*/ |
*/ |
60 |
CalibTrk1Reader::CalibTrk1Reader(void): |
CalibTrk1Reader::CalibTrk1Reader(void): |
61 |
TechmodelAlgorithm(PacketType::CalibTrk1, "TechmodelCalibTrk1Reader") { |
TechmodelAlgorithm(PacketType::CalibTrk1, "TechmodelCalibTrk1Reader") { |
62 |
cat << log4cpp::Priority::DEBUG |
logger->debug(_T("Constructor")); |
|
<< "Constructor " |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
63 |
calibTrk1 = new CalibTrk1Event(); |
calibTrk1 = new CalibTrk1Event(); |
64 |
} |
} |
65 |
|
|
68 |
*/ |
*/ |
69 |
std::string CalibTrk1Reader::GetVersionInfo(void) const { |
std::string CalibTrk1Reader::GetVersionInfo(void) const { |
70 |
return |
return |
71 |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk1Reader.cpp,v 1.4 2004/08/19 15:24:46 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk1Reader.cpp,v 1.5 2004/08/24 16:01:57 kusanagi Exp $\n"; |
72 |
} |
} |
73 |
|
|
74 |
/** |
/** |
76 |
* event reader routines for all packet types. |
* event reader routines for all packet types. |
77 |
*/ |
*/ |
78 |
void CalibTrk1Reader::Init(PamelaRun *run) { |
void CalibTrk1Reader::Init(PamelaRun *run) { |
79 |
|
logger->debug(_T("Initialize")); |
80 |
SetInputStream(run); |
SetInputStream(run); |
81 |
run->WriteSubPacket(this, &calibTrk1, calibTrk1->Class()); |
run->WriteSubPacket(this, &calibTrk1, calibTrk1->Class()); |
82 |
} |
} |
86 |
*/ |
*/ |
87 |
//void CalibTrkReader::RunEvent(int EventNumber, long int length, char *subData) { |
//void CalibTrkReader::RunEvent(int EventNumber, long int length, char *subData) { |
88 |
void CalibTrk1Reader::RunEvent(int EventNumber, long int length) { |
void CalibTrk1Reader::RunEvent(int EventNumber, long int length) { |
89 |
|
std::stringstream oss; |
90 |
char *subData; |
char *subData; |
91 |
char eventCRC[2]; |
char eventCRC[2]; |
92 |
UINT16 subCRC; //CRC of the data |
UINT16 subCRC; //CRC of the data |
153 |
} |
} |
154 |
} |
} |
155 |
//----------------------------------------------------------------------------------------- |
//----------------------------------------------------------------------------------------- |
156 |
|
oss.flush(); |
157 |
|
oss << "Fortran77 function trkcalibpkt error code = " << ERROR; |
158 |
cat << log4cpp::Priority::ERROR |
logger->warn(oss.str().c_str()); |
|
<< "Fortran77 function trkcalibpkt error code = " << ERROR |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
159 |
} else { |
} else { |
160 |
cat << log4cpp::Priority::ERROR |
logger->debug(_T("Wrong CRC for CalibTrk1 Packet ")); |
|
<< "Wrong CRC for CalibTrk1 Packet " |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
161 |
} |
} |
162 |
delete [] subData; |
delete [] subData; |
163 |
} |
} |