forked from sPHENIX-Collaboration/online_distribution
/
packet_cdevdvm.cc
executable file
·92 lines (59 loc) · 1.63 KB
/
packet_cdevdvm.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <packet_cdevdvm.h>
Packet_cdevdvm::Packet_cdevdvm(PACKET_ptr data)
: Packet_w4 (data)
{
ps = 0;
decoded = 0;
}
int *Packet_cdevdvm::decode ( int *nwout)
{
if (decoded) {
*nwout = 0;
return 0;
}
decoded=1; // decode only once...
int *k;
k = (int *) findPacketDataStart(packet);
if (k == 0)
{
ps = 0;
*nwout = 0;
return 0;
}
ps = ( struct cdevDvmData *) k;
*nwout = 0;
return 0;
}
float Packet_cdevdvm::fValue(const int ich, const char *what)
{
int i;
decode (&i);
if ( strcmp(what, "beamLifeTime") == 0 ) return ps->beamLifeTime;
std::cout << "packet_cdevdvm::fValue error unknown datum: " << what << std::endl;
return 0;
}
float Packet_cdevdvm::rValue(const int ich, const char *what)
{
int i;
decode (&i);
if ( strcmp(what, "beamLifeTime") == 0 ) return ps->beamLifeTime;
std::cout << "packet_cdevdvm::rValue error unknown datum: " << what << std::endl;
return 0;
}
double Packet_cdevdvm::dValue(const int channel,const char *what)
{
int i;
decode (&i);
if ( strcmp(what, "beamCurrent") == 0 ) return ps->beamCurrent;
if ( strcmp(what, "beamLifeTime") == 0 ) return ps->beamLifeTime;
std::cout << "packet_cdevdvm::dValue error unknown datum: " << what << std::endl;
return 0;
}
void Packet_cdevdvm::dump ( OSTREAM& os)
{
int i;
decode (&i);
this->identify(os);
os << std::setw(12)<< "beamCurrent " << ps->beamCurrent << std::endl;
os << std::setw(12)<< "beamLifeTime " << ps->beamLifeTime << std::endl;
}