Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet_cdevdvm.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file packet_cdevdvm.cc
1 #include <packet_cdevdvm.h>
2 
4  : Packet_w4 (data)
5 {
6  ps = 0;
7  decoded = 0;
8 }
9 
10 int *Packet_cdevdvm::decode ( int *nwout)
11 {
12  if (decoded) {
13  *nwout = 0;
14  return 0;
15  }
16 
17  decoded=1; // decode only once...
18 
19  int *k;
20  k = (int *) findPacketDataStart(packet);
21  if (k == 0)
22  {
23  ps = 0;
24  *nwout = 0;
25  return 0;
26  }
27 
28  ps = ( struct cdevDvmData *) k;
29 
30 
31 
32  *nwout = 0;
33  return 0;
34 }
35 
36 float Packet_cdevdvm::fValue(const int ich, const char *what)
37 {
38  int i;
39  decode (&i);
40 
41  if ( strcmp(what, "beamLifeTime") == 0 ) return ps->beamLifeTime;
42 
43  std::cout << "packet_cdevdvm::fValue error unknown datum: " << what << std::endl;
44  return 0;
45 
46 }
47 
48 
49 float Packet_cdevdvm::rValue(const int ich, const char *what)
50 {
51  int i;
52  decode (&i);
53 
54  if ( strcmp(what, "beamLifeTime") == 0 ) return ps->beamLifeTime;
55 
56  std::cout << "packet_cdevdvm::rValue error unknown datum: " << what << std::endl;
57  return 0;
58 
59 }
60 
61 
62 double Packet_cdevdvm::dValue(const int channel,const char *what)
63 {
64  int i;
65  decode (&i);
66 
67  if ( strcmp(what, "beamCurrent") == 0 ) return ps->beamCurrent;
68  if ( strcmp(what, "beamLifeTime") == 0 ) return ps->beamLifeTime;
69 
70 
71  std::cout << "packet_cdevdvm::dValue error unknown datum: " << what << std::endl;
72  return 0;
73 }
74 
75 
76 
78 {
79  int i;
80  decode (&i);
81 
82  this->identify(os);
83 
84  os << std::setw(12)<< "beamCurrent " << ps->beamCurrent << std::endl;
85  os << std::setw(12)<< "beamLifeTime " << ps->beamLifeTime << std::endl;
86 
87 }
88 
89 
90 
91 
92