NSCL DDAS 12.2-009
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 <cstddef>
27#include <cstdint>
28
29namespace DDASReadout {
30
41struct RawChannel {
42 uint32_t s_moduleType;
43 double s_time;
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} // namespace DDASReadout
151
152// Comparison operators -- operate on the timestamp:
153
162 const DDASReadout::RawChannel &c2);
171 const DDASReadout::RawChannel &c2);
180 const DDASReadout::RawChannel &c2);
181
182#endif
bool operator<(const DDASReadout::RawChannel &c1, const DDASReadout::RawChannel &c2)
operator<
Definition: RawChannel.cpp:291
bool operator>(const DDASReadout::RawChannel &c1, const DDASReadout::RawChannel &c2)
operator>
Definition: RawChannel.cpp:300
bool operator==(const DDASReadout::RawChannel &c1, const DDASReadout::RawChannel &c2)
operator==
Definition: RawChannel.cpp:309
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:102
int SetChannel()
Set the channel value from the data.
Definition: RawChannel.cpp:157
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:210
int Validate(int expecting)
Determine if a channel has the correct amount of data.
Definition: RawChannel.cpp:174
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:192
RawChannel & operator=(const RawChannel &rhs)
Assignment operator.
Definition: RawChannel.cpp:245
virtual ~RawChannel()
Destructor.
Definition: RawChannel.cpp:86
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:261
RawChannel()
Default constructor.
Definition: RawChannel.cpp:47
static double moduleCalibration(uint32_t moduleType)
Returns the multiplier used to convert the module raw timestamp into nanoseconds.
Definition: RawChannel.cpp:273
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:152
uint32_t * s_data
Pointer to the hit data.
Definition: RawChannel.h:48