NSCL DDAS  12.1-001
Support for XIA DDAS at FRIB
RawChannel.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Ron Fox
12  Giordano Cerriza
13  NSCL
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
23 #ifndef RAWCHANNEL_H
24 #define RAWCHANNEL_H
25 
26 #include <stdint.h>
27 #include <stddef.h>
28 
29 namespace DDASReadout {
30 
41  struct RawChannel {
42  uint32_t s_moduleType;
43  double s_time;
44  int s_chanid;
45  bool s_ownData;
48  uint32_t* s_data;
49 
51  RawChannel();
57  RawChannel(size_t nWords);
63  RawChannel(size_t nWords, void* pZcopyData);
65  virtual ~RawChannel();
66 
73  int SetTime();
86  int SetTime(double nsPerTick, bool useExt=false);
91  int SetLength();
98  int SetChannel();
107  int Validate(int expecting);
108 
114  void setData(size_t nWords, void* pZCopyData);
115 
121  void copyInData(size_t nWords, const void* pData);
122 
127  RawChannel(const RawChannel& rhs);
133  RawChannel& operator=(const RawChannel& rhs);
134 
140  static uint32_t channelLength(void* pData);
148  static double moduleCalibration(uint32_t moduleType);
149  };
150 }
151 
152 // Comparison operators -- operate on the timestamp:
153 
161 bool operator<(
163  );
171 bool operator>(
173  );
181 bool operator==(
183  );
184 
185 #endif
bool operator<(const DDASReadout::RawChannel &c1, const DDASReadout::RawChannel &c2)
operator<
Definition: RawChannel.cpp:319
bool operator>(const DDASReadout::RawChannel &c1, const DDASReadout::RawChannel &c2)
operator>
Definition: RawChannel.cpp:329
bool operator==(const DDASReadout::RawChannel &c1, const DDASReadout::RawChannel &c2)
operator==
Definition: RawChannel.cpp:339
Definition: BufferArena.cpp:29
A struct containing a pointer to a hit and its properties.
Definition: RawChannel.h:41
int SetTime()
Set the 48-bit timestamp data from the hit infomration.
Definition: RawChannel.cpp:107
int SetChannel()
Set the channel value from the data.
Definition: RawChannel.cpp:168
bool s_ownData
True if we own s_data.
Definition: RawChannel.h:45
void copyInData(size_t nWords, const void *pData)
Copy in data.
Definition: RawChannel.cpp:227
int Validate(int expecting)
Determine if a channel has the correct amount of data.
Definition: RawChannel.cpp:187
int s_chanid
Channel within module.
Definition: RawChannel.h:44
int s_channelLength
Number of uint32_t in s_data.
Definition: RawChannel.h:47
double s_time
Extracted time, possibly calibrated.
Definition: RawChannel.h:43
void setData(size_t nWords, void *pZCopyData)
Set new data.
Definition: RawChannel.cpp:207
RawChannel & operator=(const RawChannel &rhs)
Assignment operator.
Definition: RawChannel.cpp:264
virtual ~RawChannel()
Destructor.
Definition: RawChannel.cpp:90
int s_ownDataSize
If we own data, how many uint32_t's.
Definition: RawChannel.h:46
static uint32_t channelLength(void *pData)
Extract the number of words in a hit.
Definition: RawChannel.cpp:283
RawChannel()
Default constructor.
Definition: RawChannel.cpp:48
static double moduleCalibration(uint32_t moduleType)
Returns the multiplier used to convert the module raw timestamp into nanoseconds.
Definition: RawChannel.cpp:297
uint32_t s_moduleType
Type of module this comes from.
Definition: RawChannel.h:42
int SetLength()
Set the event length from the data.
Definition: RawChannel.cpp:161
uint32_t * s_data
Pointer to the hit data.
Definition: RawChannel.h:48