1 |
kusanagi |
1.1 |
/** @file |
2 |
|
|
* $Source: /home/cvspamela/yoda/techmodel/OrbitalReader.cpp,v $ |
3 |
|
|
* $Id: OrbitalReader.cpp,v 1.6 2004/03/16 10:18:28 nagni Exp $ |
4 |
|
|
* $Author: nagni $ |
5 |
|
|
* |
6 |
|
|
* Implementation of the OrbitalReader class. |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
#include <string> |
10 |
|
|
#include <log4cpp/Category.hh> |
11 |
|
|
extern "C" { |
12 |
|
|
#include <sys/time.h> |
13 |
|
|
} |
14 |
|
|
|
15 |
|
|
#include "ReaderAlgorithms.h" |
16 |
|
|
|
17 |
|
|
using namespace pamela; |
18 |
|
|
using namespace pamela::techmodel; |
19 |
|
|
|
20 |
|
|
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.OrbitalReader"); |
21 |
|
|
|
22 |
|
|
/** |
23 |
|
|
* Constructor. |
24 |
|
|
*/ |
25 |
|
|
OrbitalReader::OrbitalReader(void): |
26 |
|
|
TechmodelAlgorithm(PacketType::Orbital, "TechmodelOrbitalReader") { |
27 |
|
|
cat.debug("Constructor"); |
28 |
|
|
Orbital = new OrbitalEvent(); |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
/** |
32 |
|
|
* Get a string with the version info of the algorithm. |
33 |
|
|
*/ |
34 |
|
|
std::string OrbitalReader::GetVersionInfo(void) const { |
35 |
|
|
return |
36 |
|
|
"$Header: /home/cvspamela/yoda/techmodel/OrbitalReader.cpp,v 1.6 2004/03/16 10:18:28 nagni 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 OrbitalReader::Init(PamelaRun *run) { |
44 |
|
|
SetInputStream(run); |
45 |
|
|
run->WriteSubPacket(this, &Orbital, Orbital->Class()); |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
/** |
49 |
|
|
* Unpack the orbital event from an input file. |
50 |
|
|
*/ |
51 |
|
|
void OrbitalReader::RunEvent(int EventNumber, long int length) { |
52 |
|
|
// First step: unpack the event into the event class. |
53 |
|
|
struct timeval tv; |
54 |
|
|
struct timezone tz; |
55 |
|
|
gettimeofday(&tv, &tz); |
56 |
|
|
Orbital->Set(tv.tv_sec * 1000 + tv.tv_sec/1000, 1, 0); |
57 |
|
|
} |