EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet_gl1psum.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file packet_gl1psum.cc
1 #include <packet_gl1psum.h>
2 #include <buffer.h>
3 
5  : Packet_w4(data)
6 {
7 }
8 
10 {
11 }
12 
13 int *Packet_gl1psum::decode ( int *nwout)
14 {
15  int *p,*k, *from;
16  int i;
17  p = new int[11];
18 
19  from = (int *) findPacketDataStart(packet);
20 
21  k = p;
22  if ( getHitFormat() == IDGL1PSUMOBS)
23  {
24  for (i =0; i<11; i++) *k++ = buffer::i4swap(from[i]);
25  }
26  else
27  {
28  for (i =0; i<11; i++) *k++ = from[i];
29  }
30 
31  p[0] = p[0] & 0xFF;
32  p[1] = ( p[1] &0xF)+((p[1]>>4)&0x7)*15;
33 
34 
35  *nwout = 11;
36  return p;
37 }
38 
39 int Packet_gl1psum::iValue(const int ich)
40 {
41  if (ich < 0 || ich >= 8) return 0;
42 
44 
45  return decoded_data1[ich+2];
46 }
47 
48 
49 
50 int Packet_gl1psum::iValue(const int ich, const char *what)
51 {
52 
53 
55 
56  if (!strcmp(what,"EVTNR"))
57  {
58  return decoded_data1[0] ;
59  }
60 
61  else if (!strcmp(what,"BEAMCROSSID"))
62  {
63  return decoded_data1[1];
64  }
65  else if (!strcmp(what,"CROSSCTR"))
66  {
67  return decoded_data1[10];
68  }
69  else return 0;
70 
71 }
72 
73 
75 {
76 
77  int i;
78 
79 
80  this->identify(os);
81  os << "Evt number: " << (unsigned int) iValue(0,"EVTNR") << std::endl;
82  os << "Crossing ID: " << (unsigned int) iValue(0, "BEAMCROSSID") << std::endl;
83  os << "Crossing Counter: " << (unsigned int) iValue(0, "CROSSCTR") << std::endl;
84 
85  for ( i = 0; i < 4; i++)
86  {
87  os << std::setw(12) << iValue(i) << " ";
88  }
89  os << std::endl;
90 
91  for ( i = 4; i < 8; i++)
92  {
93  os << std::setw(12) << iValue(i) << " ";
94  }
95  os << std::endl << std::endl;
96 
97 }
98