NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Files Functions Variables Macros Pages
DDASHit.h
1 /* DDASHit class definition header file */
2 
3 #ifndef DAQ_DDAS_DDASHIT_H
4 #define DAQ_DDAS_DDASHIT_H
5 
6 #include <vector>
7 #include <cstdint>
8 
9 
10 namespace DAQ {
11  namespace DDAS {
33  class DDASHit {
34 
35  private:
36  /********** Variables **********/
37 
38  /* Channel events always have the following info. */
39  double time;
40  uint64_t coarsetime;
41 
42  uint32_t energy;
43  uint32_t timehigh;
44  uint32_t timelow;
45  uint32_t timecfd;
46 
47  uint32_t finishcode;
48  uint32_t channellength;
49  uint32_t channelheaderlength;
50  uint32_t headerlength;
51  uint32_t overflowcode;
52  uint32_t chanid;
53  uint32_t slotid;
54  uint32_t crateid;
55 
56  uint32_t cfdtrigsourcebit;
57  uint32_t cfdfailbit;
58 
59  uint32_t tracelength;
60 
61  uint32_t ModMSPS;
62 
63  /* A channel may have extra information... */
64  std::vector<uint32_t> energySums;
65  std::vector<uint32_t> qdcSums;
66 
67  /* A waveform (trace) may be stored too. */
68  std::vector<uint16_t> trace;
69 
70  uint64_t externalTimestamp;
71 
72  public:
74  // Canonicals
75 
80  DDASHit();
81 
83  DDASHit(const DDASHit& obj) = default;
84 
86  DDASHit& operator=(const DDASHit& obj);
87 
89  ~DDASHit();
90 
96  void Reset();
97 
99 
101  uint32_t GetEnergy() const {return energy;}
102 
104  uint32_t GetTimeHigh() const {return timehigh;}
105 
107  uint32_t GetTimeLow() const {return timelow;}
108 
110  uint32_t GetTimeCFD() const {return timecfd;}
111 
135  double GetTime() const {return time;}
136 
138  uint64_t GetCoarseTime() const {return coarsetime;}
139 
144  uint32_t GetFinishCode() const {return finishcode;}
145 
151  uint32_t GetChannelLength() const {return channellength;}
152 
154  uint32_t GetChannelLengthHeader() const {return channelheaderlength;}
155 
157  uint32_t GetOverflowCode() const {return overflowcode;}
158 
160  uint32_t GetSlotID() const {return slotid;}
161 
163  uint32_t GetCrateID() const {return crateid;}
164 
166  uint32_t GetChannelID() const {return chanid;}
167 
168  uint32_t GetHeaderLength() const { return headerlength; }
169 
171  uint32_t GetModMSPS() const {return ModMSPS;}
172 
174  uint32_t GetCFDTrigSource() const { return cfdtrigsourcebit; }
175 
177  uint32_t GetCFDFailBit() const { return cfdfailbit; }
178 
180  uint32_t GetTraceLength() const { return tracelength; }
181 
183  std::vector<uint16_t>& GetTrace() {return trace;}
184  const std::vector<uint16_t>& GetTrace() const {return trace;}
185 
187  std::vector<uint32_t>& GetEnergySums() { return energySums; }
188  const std::vector<uint32_t>& GetEnergySums() const { return energySums; }
189 
191  std::vector<uint32_t>& GetQDCSums() { return qdcSums; }
192  const std::vector<uint32_t>& GetQDCSums() const { return qdcSums; }
193 
194  uint64_t GetExternalTimestamp() const {return externalTimestamp; }
195 
196  void setChannel(uint32_t channel);
197  void setSlot(uint32_t slot);
198  void setCrate(uint32_t crate);
199  void setChannelHeaderLength(uint32_t channelHeaderLength);
200  void setChannelLength(uint32_t channelLength);
201  void setOverflowCode(uint32_t overflow);
202  void setFinishCode(bool finishCode);
203  void setCoarseTime(uint64_t time);
204  void setRawCFDTime(uint32_t data);
205  void setCFDTrigSourceBit(uint32_t bit);
206  void setCFDFailBit(uint32_t bit);
207 
208  void setTimeLow(uint32_t datum);
209  void setTimeHigh(uint32_t datum);
210 
211  void setTime(double time);
212  void setEnergy(uint32_t value);
213  void setTraceLength(uint32_t trace);
214  void setADCFrequency(uint32_t value);
215  void appendEnergySum(uint32_t value);
216  void appendQDCSum(uint32_t value);
217  void appendTraceSample(uint16_t value);
218  void setExternalTimestamp(uint64_t tstamp);
219  };
220  } // end DDAS namespace
221 } // end DAQ namespace
222 #endif