1 |
kusanagi |
2.1 |
|
2 |
|
|
// Implementation of the S4InitReader class. |
3 |
|
|
|
4 |
|
|
#include "ReaderAlgorithms.h" |
5 |
|
|
using namespace pamela::techmodel; |
6 |
|
|
|
7 |
|
|
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.S4InitReader")); |
8 |
|
|
|
9 |
|
|
/** |
10 |
|
|
* Constructor. |
11 |
|
|
*/ |
12 |
|
|
S4InitReader::S4InitReader(void): |
13 |
|
|
TechmodelAlgorithm(PacketType::S4Init, "S4InitReader") { |
14 |
|
|
logger->debug(_T("Constructor")); |
15 |
|
|
s4Init = new S4InitEvent; |
16 |
|
|
} |
17 |
|
|
|
18 |
|
|
/** |
19 |
|
|
* Get a string with the version info of the algorithm. |
20 |
|
|
*/ |
21 |
|
|
std::string S4InitReader::GetVersionInfo(void) const { |
22 |
|
|
return |
23 |
kusanagi |
5.3 |
"$Trailer: /home/cvsmanager/yoda/techmodel/S4InitReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 Maurizio Nagni Exp $\n"; |
24 |
kusanagi |
2.1 |
} |
25 |
|
|
|
26 |
|
|
/** |
27 |
|
|
* Initialize the algorithm with a special run. This will initialize the |
28 |
|
|
* event reader routines for all packet types. |
29 |
|
|
*/ |
30 |
|
|
void S4InitReader::Init(PamelaRun *run) { |
31 |
|
|
logger->debug(_T("Initialize")); |
32 |
|
|
SetInputStream(run); |
33 |
|
|
run->WriteSubPacket(this, &s4Init, s4Init->Class()); |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
/** |
37 |
|
|
* Unpack the S4Init event from an input file. |
38 |
|
|
*/ |
39 |
kusanagi |
6.1 |
void S4InitReader::RunEvent(int EventNumber, long int dataLength) throw (WrongCRCException){ |
40 |
|
|
char subData[dataLength]; |
41 |
mocchiut |
6.3 |
memset(subData, 0, dataLength*sizeof(char)); |
42 |
kusanagi |
6.1 |
InputFile->read(subData, sizeof(subData)); |
43 |
|
|
s4Init->s4InitData = new TArrayC(dataLength, subData); |
44 |
kusanagi |
2.1 |
} |
45 |
|
|
|