ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet_cdevbuckets.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file packet_cdevbuckets.cc
1 #include <packet_cdevbuckets.h>
2 
4  : Packet_w4 (data)
5 {
6  ps = 0;
7  decoded = 0; // only decode once...
8 }
9 
10 int *Packet_cdevbuckets::decode ( int *nwout)
11 {
12  if (decoded) {
13  *nwout = 0;
14  return 0;
15  }
16 
17  decoded = 1;
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  if ( getHitFormat() == IDCDEVBUCKETS)
29  {
30  ps = ( struct cdevBucketsData *) k;
31  }
32 
33 
34 
35  *nwout = 0;
36  return 0;
37 }
38 
39 int Packet_cdevbuckets::iValue(const int ich, const char *what)
40 {
41  int i;
42  decode (&i);
43 
44 
45  if ( strcmp(what, "intendedFillPattern") == 0 ) {
46  if (ich >= 0 && ich < 360 ) {
47  return ps->m_intendedFillPattern[ich];
48  }
49  }
50 
51  if ( strcmp(what, "measuredFillPattern") == 0 ) {
52  if (ich >= 0 && ich < 360 ) {
53  return ps->m_measuredFillPattern[ich];
54  }
55  }
56 
57  if ( strcmp(what, "polarizationFillPattern") == 0 ) {
58  if (ich >= 0 && ich < 360 ) {
59  return ps->m_polarizationFillPattern[ich];
60  }
61  }
62 
63 
64 
65 
66 
67 
68 
69 
70  std::cout << "packet_cdevbuckets::iValue error unknown datum: " << what << std::endl;
71  return 0;
72 
73 }
74 
75 
76 double Packet_cdevbuckets::dValue(const int channel,const char *what)
77 {
78  int i;
79  decode (&i);
80 
81  if ( strcmp(what, "bunchLength") == 0 ) return ps->m_bunchLength;
82  if ( strcmp(what, "fillPatternThreshold") == 0 ) return ps->m_fillPatternThreshold;
83  if ( strcmp(what, "bunchOneRelativePhase") == 0 ) return ps->m_bunchOneRelativePhase;
84 
85  std::cout << "packet_cdevbuckets::dValue error unknown datum: " << what << std::endl;
86  return 0;
87 }
88 
89 
90 
92 {
93  int i;
94  decode (&i);
95 
96  this->identify(os);
97 
98  os << "m_bunchLength " << ps->m_bunchLength << std::endl;
99  os << "m_fillPatternThreshol " << ps->m_fillPatternThreshold << std::endl;
100  os << "m_bunchOneRelativePhase " << ps->m_bunchOneRelativePhase << std::endl;
101 
102  os << "index " <<" intendedFillPattern " << " measuredFillPattern "<< " polarizationFillPattern " << std::endl;
103  for (i = 0 ; i < 360 ;i++)
104  {
105  os << std::setw(3) <<i << std::setw(3)<< "|" << std::setw(10) << iValue(i,"intendedFillPattern")<< std::setw( 20)<< iValue(i,"measuredFillPattern")<< std::setw( 23)<<iValue(i,"polarizationFillPattern");
106  os << std::endl;
107  }
108  os << std::endl;
109 
110 }
111