otsdaq  v2_01_00
PSI46DigData.cc
1 #include "otsdaq-core/DataDecoders/PSI46DigData.h"
2 
3 #include <iostream>
4 
5 using namespace ots;
6 
7 
8 //========================================================================================================================
9 PSI46DigData::PSI46DigData(void)
10 {
11 }
12 
13 //========================================================================================================================
14 PSI46DigData::~PSI46DigData(void)
15 {
16 }
17 
18 //========================================================================================================================
19 bool PSI46DigData::isPSI46Dig(uint32_t data)
20 {
21  int type = data & 0x0f;
22  if (type == 1)
23  return true;
24  return false;
25 }
26 
27 //========================================================================================================================
28 PSI46DigData& PSI46DigData::decode(uint32_t data)
29 {
30  stibId_ = (data >> 30) & 0x03;
31  channelNumber_ = (data >> 27) & 0x07;
32  chipId_ = (data >> 24) & 0x07;
33  set_ = (data >> 12) & 0x1f;
34  stripNumber_ = (data >> 17) & 0x0f;
35  bco_ = (data >> 4) & 0xff;
36  adc_ = (data >> 1) & 0x7;
37  //std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << " Chan: " << chan << " chipId: " << (int)chipId_
38  // << " set: " << (unsigned int)set_ << " strip: " << (int)stripNumber_ << " bco: " << (int)bco_ << std::endl;
39 
40  return *this;
41 }
42 
43 //========================================================================================================================
44 unsigned int PSI46DigData::getStibId(void)
45 {
46  return (unsigned int)stibId_;
47 }
48 
49 //========================================================================================================================
50 unsigned int PSI46DigData::getChannelNumber(void)
51 {
52  return (unsigned int)channelNumber_;
53 }
54 
55 //========================================================================================================================
56 unsigned int PSI46DigData::getChipId(void)
57 {
58  return (unsigned int)chipId_;
59 }
60 
61 //========================================================================================================================
62 unsigned int PSI46DigData::getStripNumber(void)
63 {
64  return (unsigned int)stripNumber_;
65 }
66 
67 //========================================================================================================================
68 unsigned int PSI46DigData::getBco(void)
69 {
70  return (unsigned int)bco_;
71 }
72 
73 //========================================================================================================================
74 unsigned int PSI46DigData::getAdc(void)
75 {
76  return (unsigned int)adc_;
77 }
78 
79 //========================================================================================================================
80 unsigned int PSI46DigData::getSensorStrip()
81 {
82  static unsigned char set_number[] = { 255, 255, 255, 255, 255, 255, 255, 255,
83  255, 255, 0, 1, 4, 5, 3, 2,
84  255, 255, 12, 13, 8, 9, 11, 10,
85  255, 255, 15, 14, 7, 6, 255, 255 };
86  static unsigned char strip_number[] = { 255, 255, 255, 255,
87  255, 0, 2, 1,
88  255, 6, 4, 5,
89  255, 7, 3, 255 };
90 
91  return 128*((int)chipId_-1)+set_number[(int)set_]*8+strip_number[(int)stripNumber_];
92 }
93