test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VFATFrame.h
Go to the documentation of this file.
1 /**********************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Jan Kaspar (jan.kaspar@gmail.com)
6 *
7 **********************************************************/
8 
9 #ifndef EventFilter_CTPPSRawToDigi_VFATFrame
10 #define EventFilter_CTPPSRawToDigi_VFATFrame
11 
12 #include <vector>
13 #include <cstddef>
14 #include <stdint.h>
15 
19 class VFATFrame
20 {
21  public:
22  typedef uint16_t word;
23 
24  public:
25  VFATFrame(const word* _data = NULL);
26 
28  {
29  setData(copy.data);
33  }
34 
35  virtual ~VFATFrame() {}
36 
38  void setData(const word *_data);
39 
41  {
42  return data;
43  }
44 
47  {
48  return data[11] & 0x0FFF;
49  }
50 
53  {
54  return (data[10] & 0x0FF0) >> 4;
55  }
56 
59  {
60  return data[10] & 0x000F;
61  }
62 
65  {
66  return data[9] & 0x0FFF;
67  }
68 
71  {
72  return data[0];
73  }
74 
76  void setPresenceFlags(uint8_t v)
77  {
78  presenceFlags = v;
79  }
80 
82  bool isBCPresent() const
83  {
84  return presenceFlags & 0x1;
85  }
86 
88  bool isECPresent() const
89  {
90  return presenceFlags & 0x2;
91  }
92 
94  bool isIDPresent() const
95  {
96  return presenceFlags & 0x4;
97  }
98 
100  bool isCRCPresent() const
101  {
102  return presenceFlags & 0x8;
103  }
104 
107  {
108  return presenceFlags & 0x10;
109  }
110 
112  void setDAQErrorFlags(uint8_t v)
113  {
114  daqErrorFlags = v;
115  }
116 
117  void setNumberOfClusters(uint8_t v)
118  {
120  }
121 
124  uint8_t getNumberOfClusters() const
125  {
126  return numberOfClusters;
127  }
128 
131  bool checkFootprint() const;
132 
136  virtual bool checkCRC() const;
137 
140  virtual bool channelActive(unsigned char channel) const
141  {
142  return ( data[1 + (channel / 16)] & (1 << (channel % 16)) ) ? 1 : 0;
143  }
144 
147  virtual std::vector<unsigned char> getActiveChannels() const;
148 
151  void Print(bool binary = false) const;
152 
153  private:
166  word data[12];
167 
174  uint8_t presenceFlags;
175 
177  uint8_t daqErrorFlags;
178 
182 
184  static word calculateCRC(word crc_in, word dato);
185 };
186 
187 #endif
word data[12]
Definition: VFATFrame.h:166
VFATFrame::word getFlags() const
Returns flags.
Definition: VFATFrame.h:58
VFATFrame::word * getData()
Definition: VFATFrame.h:40
VFATFrame::word getBC() const
Returns Bunch Crossing number (BC&lt;11:0&gt;).
Definition: VFATFrame.h:46
uint16_t word
Definition: VFATFrame.h:22
#define NULL
Definition: scimark2.h:8
bool checkFootprint() const
Definition: VFATFrame.cc:63
virtual bool checkCRC() const
Definition: VFATFrame.cc:79
uint8_t getNumberOfClusters() const
Definition: VFATFrame.h:124
bool isECPresent() const
Returns true if the EC word is present in the frame.
Definition: VFATFrame.h:88
bool isNumberOfClustersPresent() const
Returns true if the CRC word is present in the frame.
Definition: VFATFrame.h:106
uint8_t daqErrorFlags
Error flag as given by certain versions of DAQ.
Definition: VFATFrame.h:177
void Print(bool binary=false) const
Definition: VFATFrame.cc:128
uint8_t presenceFlags
Definition: VFATFrame.h:174
VFATFrame::word getCRC() const
Returns the CRC.
Definition: VFATFrame.h:70
void setPresenceFlags(uint8_t v)
Sets presence flags.
Definition: VFATFrame.h:76
VFATFrame::word getEC() const
Returns Event Counter (EV&lt;7:0&gt;).
Definition: VFATFrame.h:52
bool isBCPresent() const
Returns true if the BC word is present in the frame.
Definition: VFATFrame.h:82
VFATFrame(const word *_data=NULL)
Definition: VFATFrame.cc:18
static word calculateCRC(word crc_in, word dato)
internaly used to check CRC
Definition: VFATFrame.cc:100
void setDAQErrorFlags(uint8_t v)
Sets DAQ error flags.
Definition: VFATFrame.h:112
virtual ~VFATFrame()
Definition: VFATFrame.h:35
bool isIDPresent() const
Returns true if the ID word is present in the frame.
Definition: VFATFrame.h:94
uint8_t numberOfClusters
Definition: VFATFrame.h:181
VFATFrame::word getChipID() const
Returns ChipID (ChipID&lt;11:0&gt;).
Definition: VFATFrame.h:64
virtual std::vector< unsigned char > getActiveChannels() const
Definition: VFATFrame.cc:38
void setData(const word *_data)
Copies a memory block to data buffer.
Definition: VFATFrame.cc:31
bool isCRCPresent() const
Returns true if the CRC word is present in the frame.
Definition: VFATFrame.h:100
void setNumberOfClusters(uint8_t v)
Definition: VFATFrame.h:117
virtual bool channelActive(unsigned char channel) const
Definition: VFATFrame.h:140
VFATFrame(const VFATFrame &copy)
Definition: VFATFrame.h:27