LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RawDigit.h
Go to the documentation of this file.
1 
22 #ifndef RAWDATA_RAWDIGIT_H
23 #define RAWDATA_RAWDIGIT_H
24 
25 // C/C++ standard libraries
26 #include <cstdlib> // size_t
27 #include <vector>
28 
29 // LArSoft libraries
30 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::Compress_t, raw::Channel_t
31 
32 // ROOT includes
33 #include "RtypesCore.h"
34 
36 namespace raw {
37 
68  class RawDigit {
69 
70  public:
72  typedef std::vector<short> ADCvector_t;
73 
74  /*
75 // removed waiting for a real use for flags
77  typedef std::bitset<16> Flags_t;
78 */
79 
81  RawDigit();
82 
83  public:
84  /*
85  // removed waiting for a real use for flags
86  typedef enum {
87  fiSaturation, ///< saturation flag: set if saturated at any time
88  NLArSoftFlags = 8, ///< LArSoft reserves flags up to here (this excluded)
89  NFlagIndices = NLArSoftFlags ///< number of flags
90  } FlagIndices_t; ///< type of index of flags
91  */
92 
103  RawDigit(ChannelID_t channel,
104  ULong64_t samples,
105  ADCvector_t const& adclist,
106  raw::Compress_t compression = raw::kNone /*,
107  const Flags_t& flags = DefaultFlags */
108  );
109 
120  RawDigit(ChannelID_t channel,
121  ULong64_t samples,
122  ADCvector_t&& adclist,
123  raw::Compress_t compression = raw::kNone /*,
124  const Flags_t& flags = DefaultFlags */
125  );
126 
128  void SetPedestal(float ped, float sigma = 1.);
129 
132 
134  const ADCvector_t& ADCs() const;
135 
137  size_t NADC() const;
138 
140  short ADC(int i) const;
141 
143  ChannelID_t Channel() const;
144 
146  ULong64_t Samples() const;
147 
150  float GetPedestal() const;
151 
153  float GetSigma() const;
154 
158 
159  /*
160  // removed waiting for a real use for flags
164  const Flags_t& Flags() const;
165 
167  bool isSaturated() const;
168 
169  // the unsigned long long thing is from std::bitset<> constructors
171  static const unsigned long long SaturationBit = 1ULL << fiSaturation;
172 
174  static const unsigned long long DefaultFlags = 0ULL;
175 
177  */
178 
179  private:
180  std::vector<short> fADC;
181 
183  ULong64_t fSamples;
184 
185  float fPedestal;
186  float fSigma;
187 
189 
190  // removed waiting for a real use for flags
191  // Flags_t fFlags; ///< set of digit flags
192 
193  }; // class RawDigit
194 
195 } // namespace raw
196 
197 //------------------------------------------------------------------------------
198 //--- inline implementation
199 //---
200 
201 inline size_t raw::RawDigit::NADC() const
202 {
203  return fADC.size();
204 }
205 inline short raw::RawDigit::ADC(int i) const
206 {
207  return fADC.at(i);
208 }
210 {
211  return fADC;
212 }
214 {
215  return fChannel;
216 }
217 inline ULong64_t raw::RawDigit::Samples() const
218 {
219  return fSamples;
220 }
221 inline float raw::RawDigit::GetPedestal() const
222 {
223  return fPedestal;
224 }
225 inline float raw::RawDigit::GetSigma() const
226 {
227  return fSigma;
228 }
230 {
231  return fCompression;
232 }
233 /*
234 // removed waiting for a real use for flags
235 inline const raw::RawDigit::Flags_t&
236  raw::RawDigit::Flags() const { return fFlags; }
237 inline bool raw::RawDigit::isSaturated() const { return fFlags.test(fiSaturation); }
238 */
239 
240 #endif // RAWDATA_RAWDIGIT_H
241 
float GetPedestal() const
Definition: RawDigit.h:221
std::vector< short > fADC
ADC readout per tick, before pedestal subtraction.
Definition: RawDigit.h:180
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:209
enum raw::_compress Compress_t
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Definition: RawDigit.h:217
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:68
short ADC(int i) const
ADC vector element number i; no decompression is applied.
Definition: RawDigit.h:205
float fSigma
sigma of the pedestal counts for this channel
Definition: RawDigit.h:186
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:213
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
Raw data description.
Definition: RawTypes.h:6
no compression
Definition: RawTypes.h:9
size_t NADC() const
Number of elements in the compressed ADC sample vector.
Definition: RawDigit.h:201
Compress_t fCompression
compression scheme used for the ADC vector
Definition: RawDigit.h:188
RawDigit()
Default constructor: an empty raw digit.
Definition: RawDigit.cxx:19
ULong64_t fSamples
number of ticks of the clock
Definition: RawDigit.h:183
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
Definition: RawDigit.h:229
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
Definition: RawDigit.cxx:62
float fPedestal
pedestal for this channel
Definition: RawDigit.h:185
ChannelID_t fChannel
channel number in the readout
Definition: RawDigit.h:182
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
float GetSigma() const
TODO RMS of the pedestal level?
Definition: RawDigit.h:225