Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
oncsSub_idsis3300.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file oncsSub_idsis3300.cc
1 #include "oncsSub_idsis3300.h"
2 #include <cstring>
3 
5  :oncsSubevent_w4 (data)
6 {
7  samples = 0;
8  wraparound = 0;
9 
10 }
11 
12 int *oncsSub_idsis3300::decode ( int *nwout)
13 {
14  int *p;
15 
16 
17  int i,j;
18  int *SubeventData = &SubeventHdr->data;
19 
20  samples = (*SubeventData) & 0xffff;
21  wraparound = (*SubeventData) >> 16;
22 
23  // cout << "Samples: " << samples << std::endl;
24 
25  p = new int [samples*8];
26  j = 0;
27  for ( i = 0; i< samples*4; i++)
28  {
29  p[j++] = (SubeventData[i+1] >> 16) & 0x3fff;
30  p[j++] = SubeventData[i+1] & 0x3fff;
31  }
32 
33  *nwout = j-1;
34  return p;
35 }
36 
37 int oncsSub_idsis3300::iValue(const int ch ,const int s)
38 {
39 
41 
42  if ( ch < 0 || ch >7 ) return 0;
43  if ( s < 0 || s >=samples ) return 0;
44 
45  return decoded_data1[ch + 8*s];
46 
47 }
48 
49 int oncsSub_idsis3300::iValue(const int,const char *what)
50 {
51 
53 
54  if ( strcmp(what,"SAMPLES") == 0 )
55  {
56  return samples;
57  }
58  // see if this is a "wraparound" event, where the samples cross
59  // over the end of the memory and continue a low memory. This is
60  // a debugging function since we think there might be a problem with those events.
61  if ( strcmp(what,"WRAPAROUND") == 0 )
62  {
63  return wraparound;
64  }
65 
66  return 0;
67 
68 }
69 
70 
72 {
73  int i,j;
74 
75  os << "Samples: " << iValue(0,"SAMPLES");
76  if ( iValue(0,"WRAPAROUND") )
77  {
78  os << " - wrap-around reaodut";
79  }
80  os << std::endl;
81 
82  for ( i = 0; i < iValue(0,"SAMPLES"); i++)
83  {
84 
85  os << std::setw(6) << i << " | ";
86  for ( j = 0; j < 8; j++)
87  {
88  os << std::setw(8) << iValue(j,i) << " ";
89  }
90  os << std::endl;
91  }
92  os << std::endl;
93 }
94