1 |
kusanagi |
1.1 |
/** @file |
2 |
kusanagi |
1.2 |
* $Source: /home/cvsmanager/yoda/event/PscuHeader.cpp,v $ |
3 |
kusanagi |
2.0 |
* $Id: PscuHeader.cpp,v 1.5 2004/09/21 20:23:37 kusanagi Exp $ |
4 |
kusanagi |
1.2 |
* $Author: kusanagi $ |
5 |
kusanagi |
1.1 |
* |
6 |
|
|
* Implementation of the PscuHeader class. |
7 |
|
|
*/ |
8 |
|
|
#include <exception> |
9 |
|
|
#include <string> |
10 |
kusanagi |
1.5 |
#include <sstream> |
11 |
kusanagi |
1.1 |
|
12 |
kusanagi |
1.5 |
#include <log4cxx/logger.h> |
13 |
kusanagi |
1.1 |
|
14 |
|
|
#include "PscuHeader.h" |
15 |
|
|
#include "Exception.h" |
16 |
|
|
|
17 |
|
|
using namespace pamela; |
18 |
|
|
|
19 |
kusanagi |
1.5 |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.PscuHeader")); |
20 |
|
|
static std::stringstream oss; |
21 |
kusanagi |
1.1 |
|
22 |
|
|
/** |
23 |
|
|
* Create an PscuHeader object. |
24 |
|
|
*/ |
25 |
|
|
PscuHeader::PscuHeader(): |
26 |
|
|
OrbitalTime(0), |
27 |
|
|
PacketId1(0), |
28 |
|
|
PacketId2(0), |
29 |
|
|
Counter(0), |
30 |
|
|
PacketLenght(0) { } |
31 |
|
|
|
32 |
|
|
PscuHeader::~PscuHeader() { } |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* Get the packet type of this header. |
36 |
|
|
*/ |
37 |
|
|
const PacketType* PscuHeader::GetPacketType(void) const throw (std::exception) { |
38 |
|
|
switch (PacketId1) { |
39 |
kusanagi |
1.3 |
case 0x07: return PacketType::PhysEndRun; |
40 |
|
|
case 0x08: return PacketType::CalibCalPulse1; |
41 |
|
|
case 0x09: return PacketType::CalibCalPulse2; |
42 |
|
|
case 0x10: return PacketType::Physics; |
43 |
|
|
case 0x11: return PacketType::CalibTrkBoth; |
44 |
|
|
case 0x12: return PacketType::CalibTrk1; |
45 |
|
|
case 0x13: return PacketType::CalibTrk2; |
46 |
|
|
case 0x15: return PacketType::CalibTrd; |
47 |
|
|
case 0x16: return PacketType::CalibTof; |
48 |
|
|
case 0x17: return PacketType::CalibS4; |
49 |
|
|
case 0x18: return PacketType::CalibCalPed; |
50 |
|
|
case 0x19: return PacketType::CalibAc; |
51 |
|
|
case 0x20: return PacketType::RunHeader; |
52 |
|
|
case 0x21: return PacketType::RunTrailer; |
53 |
|
|
case 0x22: return PacketType::CalibHeader; |
54 |
|
|
case 0x23: return PacketType::CalibTrailer; |
55 |
|
|
case 0x24: return PacketType::InitHeader; |
56 |
|
|
case 0x25: return PacketType::InitTrailer; |
57 |
|
|
case 0x30: return PacketType::EventTrk; |
58 |
|
|
case 0x40: return PacketType::TestTrk; |
59 |
kusanagi |
1.5 |
case 0x41: return PacketType::TestTof; |
60 |
kusanagi |
1.3 |
case 0x50: return PacketType::Log; |
61 |
|
|
case 0x51: return PacketType::VarDump; |
62 |
|
|
case 0x52: return PacketType::ArrDump; |
63 |
|
|
case 0x53: return PacketType::TabDump; |
64 |
|
|
case 0x54: return PacketType::Tmtc; |
65 |
|
|
case 0x55: return PacketType::Mcmd; |
66 |
|
|
case 0x60: return PacketType::ForcedFECmd; |
67 |
|
|
case 0x70: return PacketType::AcInit; |
68 |
|
|
case 0x71: return PacketType::CalInit; |
69 |
|
|
case 0x72: return PacketType::TrkInit; |
70 |
|
|
case 0x73: return PacketType::TofInit; |
71 |
|
|
case 0x74: return PacketType::TrgInit; |
72 |
kusanagi |
1.5 |
case 0x81: return PacketType::CalAlarm; |
73 |
|
|
case 0x82: return PacketType::AcAlarm; |
74 |
|
|
case 0x83: return PacketType::TrkAlarm; |
75 |
|
|
case 0x84: return PacketType::TrgAlarm; |
76 |
|
|
case 0x85: return PacketType::TofAlarm; |
77 |
kusanagi |
1.3 |
|
78 |
kusanagi |
1.1 |
default: { |
79 |
kusanagi |
1.5 |
oss.flush(); |
80 |
|
|
oss << "\n Unrecognized PacketType: " |
81 |
kusanagi |
1.1 |
<< (int)PacketId1; |
82 |
kusanagi |
1.5 |
logger->error(oss.str().c_str()); |
83 |
kusanagi |
1.1 |
throw Exception("Invalid Packed Id1"); |
84 |
|
|
} |
85 |
|
|
} |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
ClassImp(PscuHeader) |
90 |
|
|
|