forked from sPHENIX-Collaboration/online_distribution
/
packet_cdevpoltarget.cc
75 lines (48 loc) · 1.22 KB
/
packet_cdevpoltarget.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <packet_cdevpoltarget.h>
#include <stdio.h>
Packet_cdevpoltarget::Packet_cdevpoltarget(PACKET_ptr data)
: Packet_w4 (data)
{
ps = 0;
}
int *Packet_cdevpoltarget::decode ( int *nwout)
{
if (ps != 0) return 0;
int *k = (int *) findPacketDataStart(packet);
if (k == 0)
{
ps = 0;
*nwout = 0;
return 0;
}
ps = ( struct cdevPolTargetData *) k;
*nwout = 0;
return 0;
}
// ------------------------------------------------------
void Packet_cdevpoltarget::dump ( OSTREAM &os)
{
int i;
decode (&i);
this->identify(os);
os << "positionEncLinear " << iValue(i,"positionEncLinear") << std::endl;
os << "positionEncRot " << iValue(i,"positionEncRot") << std::endl;
dumpErrorBlock(os);
dumpDebugBlock(os);
}
int Packet_cdevpoltarget::iValue(const int ich, const char *what)
{
// std::cout << "IN Packet_cdevpoltarget::iValue " << std::endl;
int i;
decode (&i);
if ( strcmp(what,"positionEncLinear") == 0)
{
return ps->positionEncLinear;
}
if ( strcmp(what,"positionEncRot") == 0)
{
return ps->positionEncRot;
}
std::cout << "packet_cdevpoltarget::iValue error unknown datum: " << what << std::endl;
return 0;
}