NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
DDASHit.h
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2014.
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  Jeromy Tompkins
13  NSCL
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
18 
19 /* DDASHit class definition header file */
20 
21 #ifndef DAQ_DDAS_DDASHIT_H
22 #define DAQ_DDAS_DDASHIT_H
23 
24 #include <vector>
25 #include <cstdint>
26 
27 
28 namespace DAQ {
29  namespace DDAS {
51  class DDASHit {
52 
53  private:
54  /********** Variables **********/
55 
56  /* Channel events always have the following info. */
57  double time;
58  uint64_t coarsetime;
59 
60  uint32_t energy;
61  uint32_t timehigh;
62  uint32_t timelow;
63  uint32_t timecfd;
64 
65  uint32_t finishcode;
66  uint32_t channellength;
67  uint32_t channelheaderlength;
68  uint32_t overflowcode;
69  uint32_t chanid;
70  uint32_t slotid;
71  uint32_t crateid;
72 
73  uint32_t cfdtrigsourcebit;
74  uint32_t cfdfailbit;
75 
76  uint32_t tracelength;
77 
78  uint32_t ModMSPS;
79 
80  /* A channel may have extra information... */
81  std::vector<uint32_t> energySums;
82  std::vector<uint32_t> qdcSums;
83 
84  /* A waveform (trace) may be stored too. */
85  std::vector<uint16_t> trace;
86 
87  uint64_t externalTimestamp;
88 
89  int m_hdwrRevision;
90  int m_adcResolution;
91  bool m_adcOverflowUnderflow;
92 
93  public:
95  // Canonicals
96 
101  DDASHit();
102  private:
103  void copyIn(const DDASHit& rhs);
104  public:
105 
107  DDASHit(const DDASHit& obj) {
108  copyIn(obj);
109  }
112  DDASHit& operator=(const DDASHit& obj) {
113  if (this != &obj) {
114  copyIn(obj);
115  }
116  return *this;
117  }
118 
119 
120 
122  virtual ~DDASHit();
123 
129  void Reset();
130 
132 
139  uint32_t GetEnergy() const {return energy;}
140 
142  uint32_t GetTimeHigh() const {return timehigh;}
143 
145  uint32_t GetTimeLow() const {return timelow;}
146 
148  uint32_t GetTimeCFD() const {return timecfd;}
149 
173  double GetTime() const {return time;}
174 
176  uint64_t GetCoarseTime() const {return coarsetime;}
177 
182  uint32_t GetFinishCode() const {return finishcode;}
183 
189  uint32_t GetChannelLength() const {return channellength;}
190 
192  uint32_t GetChannelLengthHeader() const {return channelheaderlength;}
193 
195  uint32_t GetOverflowCode() const {return overflowcode;}
196 
198  uint32_t GetSlotID() const {return slotid;}
199 
201  uint32_t GetCrateID() const {return crateid;}
202 
204  uint32_t GetChannelID() const {return chanid;}
205 
207  uint32_t GetModMSPS() const {return ModMSPS;}
208 
210  int GetHardwareRevision() const {return m_hdwrRevision; }
211 
213  int GetADCResolution() const {return m_adcResolution; }
214 
216  uint32_t GetCFDTrigSource() const { return cfdtrigsourcebit; }
217 
219  uint32_t GetCFDFailBit() const { return cfdfailbit; }
220 
222  uint32_t GetTraceLength() const { return tracelength; }
223 
225  std::vector<uint16_t>& GetTrace() {return trace;}
226  const std::vector<uint16_t>& GetTrace() const {return trace;}
227 
229  std::vector<uint32_t>& GetEnergySums() { return energySums; }
230  const std::vector<uint32_t>& GetEnergySums() const { return energySums; }
231 
233  std::vector<uint32_t>& GetQDCSums() { return qdcSums; }
234  const std::vector<uint32_t>& GetQDCSums() const { return qdcSums; }
235 
237  uint64_t GetExternalTimestamp() const {return externalTimestamp; }
238 
244  bool GetADCOverflowUnderflow() const { return m_adcOverflowUnderflow; }
245 
246  void setChannel(uint32_t channel);
247  void setSlot(uint32_t slot);
248  void setCrate(uint32_t crate);
249  void setChannelHeaderLength(uint32_t channelHeaderLength);
250  void setChannelLength(uint32_t channelLength);
251  void setOverflowCode(uint32_t overflow);
252  void setFinishCode(bool finishCode);
253  void setCoarseTime(uint64_t time);
254  void setRawCFDTime(uint32_t data);
255  void setCFDTrigSourceBit(uint32_t bit);
256  void setCFDFailBit(uint32_t bit);
257 
258  void setTimeLow(uint32_t datum);
259  void setTimeHigh(uint32_t datum);
260 
261  void setTime(double time);
262  void setEnergy(uint32_t value);
263  void setTraceLength(uint32_t trace);
264  void setADCFrequency(uint32_t value);
265  void setADCResolution(int value);
266  void setHardwareRevision(int value);
267  void appendEnergySum(uint32_t value);
268  void appendQDCSum(uint32_t value);
269  void appendTraceSample(uint16_t value);
270  void setExternalTimestamp(uint64_t tstamp);
271  void setADCOverflowUnderflow(bool state);
272  };
273  } // end DDAS namespace
274 } // end DAQ namespace
275 #endif
uint32_t GetTraceLength() const
Definition: DDASHit.h:222
double GetTime() const
Retrieve computed time.
Definition: DDASHit.h:173
uint32_t GetTimeLow() const
Retrieve least significant 32-bit of raw timestamp.
Definition: DDASHit.h:145
uint32_t GetCrateID() const
Retrieve the index of the crate the module resided in.
Definition: DDASHit.h:201
DDASHit(const DDASHit &obj)
Copy constructor.
Definition: DDASHit.h:107
uint32_t GetOverflowCode() const
Retrieve the overflow code.
Definition: DDASHit.h:195
uint32_t GetChannelLength() const
Retrieve number of 32-bit words that were in original data packet.
Definition: DDASHit.h:189
Encapsulation of a generic DDAS event.
Definition: DDASHit.h:51
uint32_t GetTimeCFD() const
Retrieve the raw cfd time.
Definition: DDASHit.h:148
std::vector< uint16_t > & GetTrace()
Definition: DDASHit.h:225
virtual ~DDASHit()
Destructor.
Definition: DDASHit.cpp:75
uint32_t GetChannelLengthHeader() const
Retrieve length of header in original data packet.
Definition: DDASHit.h:192
uint32_t GetModMSPS() const
Retrieve the ADC frequency of the module.
Definition: DDASHit.h:207
uint32_t GetCFDTrigSource() const
Definition: DDASHit.h:216
uint32_t GetTimeHigh() const
Retrieve most significant 16-bits of raw timestamp.
Definition: DDASHit.h:142
uint64_t GetCoarseTime() const
Retrieve the 48-bit timestamp in nanoseconds without any CFD correction.
Definition: DDASHit.h:176
uint32_t GetFinishCode() const
Retrieve finish code.
Definition: DDASHit.h:182
DDASHit()
Default constructor.
Definition: DDASHit.cpp:19
std::vector< uint32_t > & GetEnergySums()
Definition: DDASHit.h:229
DDASHit & operator=(const DDASHit &obj)
Assignment operator.
Definition: DDASHit.h:112
uint32_t GetChannelID() const
Retrieve the channel index.
Definition: DDASHit.h:204
uint32_t GetSlotID() const
Retrieve the slot that the module resided in.
Definition: DDASHit.h:198
uint32_t GetEnergy() const
Retrieve the energy.
Definition: DDASHit.h:139
int GetADCResolution() const
Retrieve the adc resolution.
Definition: DDASHit.h:213
void Reset()
Resets the state of all member data to that of initialization.
Definition: DDASHit.cpp:46
std::vector< uint32_t > & GetQDCSums()
Definition: DDASHit.h:233
Definition: functions.h:26
Definition: SystemBooter.cpp:16
uint32_t GetCFDFailBit() const
Definition: DDASHit.h:219
bool GetADCOverflowUnderflow() const
Return the adc overflow/underflow status.
Definition: DDASHit.h:244
uint64_t GetExternalTimestamp() const
Definition: DDASHit.h:237
int GetHardwareRevision() const
Retrieve the hardware revision.
Definition: DDASHit.h:210