1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v $ |
3 |
* $Id: CalibTrk2Reader.cpp,v 1.4 2004/08/19 15:24:46 kusanagi Exp $ |
* $Id: CalibTrk2Reader.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 |
//Passo il path verso la il file temporaneo |
//Passo il path verso la il file temporaneo |
51 |
using namespace pamela; |
using namespace pamela; |
52 |
using namespace pamela::techmodel; |
using namespace pamela::techmodel; |
53 |
|
|
54 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.CalibTrk2Reader"); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.CalibTrk2Reader")); |
55 |
|
|
56 |
/** |
/** |
57 |
* Constructor. |
* Constructor. |
58 |
*/ |
*/ |
59 |
CalibTrk2Reader::CalibTrk2Reader(void): |
CalibTrk2Reader::CalibTrk2Reader(void): |
60 |
TechmodelAlgorithm(PacketType::CalibTrk2, "TechmodelCalibTrk2Reader") { |
TechmodelAlgorithm(PacketType::CalibTrk2, "TechmodelCalibTrk2Reader") { |
61 |
cat << log4cpp::Priority::DEBUG |
logger->debug(_T("Constructor")); |
|
<< "Constructor " |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
62 |
calibTrk2 = new CalibTrk2Event(); |
calibTrk2 = new CalibTrk2Event(); |
63 |
} |
} |
64 |
|
|
67 |
*/ |
*/ |
68 |
std::string CalibTrk2Reader::GetVersionInfo(void) const { |
std::string CalibTrk2Reader::GetVersionInfo(void) const { |
69 |
return |
return |
70 |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v 1.4 2004/08/19 15:24:46 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/CalibTrk2Reader.cpp,v 1.5 2004/08/24 16:01:57 kusanagi Exp $\n"; |
71 |
} |
} |
72 |
|
|
73 |
/** |
/** |
75 |
* event reader routines for all packet types. |
* event reader routines for all packet types. |
76 |
*/ |
*/ |
77 |
void CalibTrk2Reader::Init(PamelaRun *run) { |
void CalibTrk2Reader::Init(PamelaRun *run) { |
78 |
|
logger->debug(_T("Initialize")); |
79 |
SetInputStream(run); |
SetInputStream(run); |
80 |
run->WriteSubPacket(this, &calibTrk2, calibTrk2->Class()); |
run->WriteSubPacket(this, &calibTrk2, calibTrk2->Class()); |
81 |
} |
} |
84 |
* Unpack the CalibTrk2 event from an input file. |
* Unpack the CalibTrk2 event from an input file. |
85 |
*/ |
*/ |
86 |
void CalibTrk2Reader::RunEvent(int EventNumber, long int length) { |
void CalibTrk2Reader::RunEvent(int EventNumber, long int length) { |
87 |
|
std::stringstream oss; |
88 |
char *subData; |
char *subData; |
89 |
char eventCRC[2]; |
char eventCRC[2]; |
90 |
UINT16 subCRC; //CRC of the data |
UINT16 subCRC; //CRC of the data |
153 |
} |
} |
154 |
} |
} |
155 |
//----------------------------------------------------------------------------------------- |
//----------------------------------------------------------------------------------------- |
156 |
|
oss.flush(); |
157 |
cat << log4cpp::Priority::ERROR |
oss << "Fortran77 function trkcalibpkt error code = " << ERROR; |
158 |
<< "Fortran77 function trkcalibpkt error code = " << ERROR |
logger->warn(oss.str().c_str()); |
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
159 |
} else { |
} else { |
160 |
cat << log4cpp::Priority::ERROR |
logger->debug(_T("Wrong CRC for CalibTrk2 Packet ")); |
|
<< "Wrong CRC for CalibTrk2 Packet " |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
161 |
} |
} |
162 |
delete [] subData; |
delete [] subData; |
163 |
} |
} |