LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 <stdint.h> // uint32_t
27 #include <cstdlib> // size_t
28 #include <vector>
29 // #include <bitset>
30 
31 // LArSoft libraries
32 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::Compress_t, raw::Channel_t
33 
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  /*
86  // removed waiting for a real use for flags
87  typedef enum {
88  fiSaturation, ///< saturation flag: set if saturated at any time
89  NLArSoftFlags = 8, ///< LArSoft reserves flags up to here (this excluded)
90  NFlagIndices = NLArSoftFlags ///< number of flags
91  } FlagIndices_t; ///< type of index of flags
92  */
93 
104  RawDigit(ChannelID_t channel,
105  unsigned short samples,
106  ADCvector_t const& adclist,
107  raw::Compress_t compression = raw::kNone /*,
108  const Flags_t& flags = DefaultFlags */
109  );
110 
121  RawDigit(ChannelID_t channel,
122  unsigned short samples,
123  ADCvector_t&& adclist,
124  raw::Compress_t compression = raw::kNone /*,
125  const Flags_t& flags = DefaultFlags */
126  );
127 
129  void SetPedestal(float ped, float sigma = 1.);
130 
133 
135  const ADCvector_t& ADCs() const;
136 
138  size_t NADC() const;
139 
141  short ADC(int i) const;
142 
144  ChannelID_t Channel() const;
145 
147  unsigned short Samples() const;
148 
151  float GetPedestal() const;
152 
154  float GetSigma() const;
155 
159 
160  /*
161  // removed waiting for a real use for flags
165  const Flags_t& Flags() const;
166 
168  bool isSaturated() const;
169 
170  // the unsigned long long thing is from std::bitset<> constructors
172  static const unsigned long long SaturationBit = 1ULL << fiSaturation;
173 
175  static const unsigned long long DefaultFlags = 0ULL;
176 
178  */
179 
180 
181  private:
182  std::vector<short> fADC;
183 
185  unsigned short fSamples;
186 
187  float fPedestal;
188  float fSigma;
189 
191 
192 
193  // removed waiting for a real use for flags
194  // Flags_t fFlags; ///< set of digit flags
195 
196  }; // class RawDigit
197 
198 
199 } // namespace raw
200 
201 
202 //------------------------------------------------------------------------------
203 //--- inline implementation
204 //---
205 
206 inline size_t raw::RawDigit::NADC() const { return fADC.size(); }
207 inline short raw::RawDigit::ADC(int i) const { return fADC.at(i); }
208 inline const raw::RawDigit::ADCvector_t&
209  raw::RawDigit::ADCs() const { return fADC; }
210 inline raw::ChannelID_t
211  raw::RawDigit::Channel() const { return fChannel; }
212 inline unsigned short raw::RawDigit::Samples() const { return fSamples; }
213 inline float raw::RawDigit::GetPedestal() const { return fPedestal; }
214 inline float raw::RawDigit::GetSigma() const { return fSigma; }
216 /*
217 // removed waiting for a real use for flags
218 inline const raw::RawDigit::Flags_t&
219  raw::RawDigit::Flags() const { return fFlags; }
220 inline bool raw::RawDigit::isSaturated() const { return fFlags.test(fiSaturation); }
221 */
222 
223 
224 #endif // RAWDATA_RAWDIGIT_H
225 
float GetPedestal() const
Definition: RawDigit.h:213
std::vector< short > fADC
ADC readout per tick, before pedestal subtraction.
Definition: RawDigit.h:182
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:209
enum raw::_compress Compress_t
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:207
float fSigma
sigma of the pedestal counts for this channel
Definition: RawDigit.h:188
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:211
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
unsigned short Samples() const
Number of samples in the uncompressed ADC data.
Definition: RawDigit.h:212
size_t NADC() const
Number of elements in the compressed ADC sample vector.
Definition: RawDigit.h:206
Compress_t fCompression
compression scheme used for the ADC vector
Definition: RawDigit.h:190
RawDigit()
Default constructor: an empty raw digit.
Definition: RawDigit.cxx:20
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
Definition: RawDigit.h:215
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
Definition: RawDigit.cxx:68
float fPedestal
pedestal for this channel
Definition: RawDigit.h:187
ChannelID_t fChannel
channel number in the readout
Definition: RawDigit.h:184
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
float GetSigma() const
TODO RMS of the pedestal level?
Definition: RawDigit.h:214
unsigned short fSamples
number of ticks of the clock
Definition: RawDigit.h:185