nidas v1.2.3
TwoD_Processing.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2007, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#ifndef _nidas_dynld_raf_2d_processing_h_
28#define _nidas_dynld_raf_2d_processing_h_
29
30#include <nidas/core/Sample.h>
31
32
33namespace nidas { namespace dynld { namespace raf {
34
35using namespace nidas::core;
36
43{
44
45public:
47 virtual ~TwoD_Processing();
48
55 virtual int NumberOfDiodes() const = 0;
56
63 float getResolution() const { return _resolutionMeters; }
64
71 unsigned int getResolutionMicron() const { return _resolutionMicron; }
72
73
74protected:
76 {
77 public:
78 Particle() : height(0), width(0), area(0), edgeTouch(0), liveTime(0), dofReject(false) { } ;
79 void zero() { height = width = area = liveTime = 0; edgeTouch = 0; dofReject = false; }
80
82 unsigned int height;
84 unsigned int width;
89 unsigned int area;
94 unsigned char edgeTouch;
99 unsigned int liveTime;
100
103 } ;
104
112 virtual void processParticleSlice(Particle& p, const unsigned char * slice);
113
119 virtual void countParticle(const Particle& p, float resolutionUsec);
120
122
127 virtual bool acceptThisParticle1D(const Particle& p) const;
128 virtual bool acceptThisParticle2D(const Particle& p) const;
130
132
140 virtual void createSamples(dsm_time_t nextTimeTag,std::list<const Sample *>&results) throw();
141
145 virtual void clearData();
147
151 unsigned int _numImages;
152
157
159
163
167 unsigned int _resolutionMicron;
169
171
173
176 unsigned int * _size_dist_1D;
177 unsigned int * _size_dist_2D;
178
186
188
191 unsigned int _totalRecords;
192 unsigned int _totalParticles;
195 unsigned int _overSizeCount_2D;
196 unsigned int _misAligned;
197 unsigned int _suspectSlices;
198 unsigned int _recordsPerSecond;
200
203
208
210 long long _histoEndTime;
211
218
224
232
241 void saveBuffer(const unsigned char * cp, const unsigned char * eod);
242
253 void setupBuffer(const unsigned char ** cp, const unsigned char ** eod);
254
258 unsigned char * _saveBuffer;
259
264
269
270
271private:
272
275
278};
279
280
281template <typename T, typename V>
282inline
283void
284stream_histogram(T& out, V* sizedist, unsigned int nbins)
285{
286 bool zeros = true;
287 for (unsigned int i = 0; i < nbins; ++i)
288 {
289 if (sizedist[i] == 0)
290 {
291 out << ".";
292 zeros = true;
293 }
294 else if (zeros)
295 {
296 out << sizedist[i];
297 zeros = false;
298 }
299 else
300 {
301 out << ",";
302 out << sizedist[i];
303 }
304 }
305}
306
307}}} // namespace nidas namespace dynld namespace raf
308
309#endif
Definition TwoD_Processing.h:76
void zero()
Definition TwoD_Processing.h:79
Particle()
Definition TwoD_Processing.h:78
unsigned int width
Max particle length, along flight path.
Definition TwoD_Processing.h:84
unsigned int height
Max particle height, along diode array.
Definition TwoD_Processing.h:82
bool dofReject
Depth Of Field Reject? Last bit of sync word.
Definition TwoD_Processing.h:102
unsigned char edgeTouch
Was an edge diode triggered.
Definition TwoD_Processing.h:94
unsigned int area
Actual number of shadowed diodes.
Definition TwoD_Processing.h:89
unsigned int liveTime
Amount of time consumed by the particle as it passed through the array.
Definition TwoD_Processing.h:99
Base class for SPEC 2DS optical array probe on a USB interface.
Definition TwoD_Processing.h:43
unsigned int _overSizeCount_2D
Definition TwoD_Processing.h:195
TwoD_Processing()
Definition TwoD_Processing.cc:45
unsigned int _rejected2D_Cntr
Definition TwoD_Processing.h:193
virtual void countParticle(const Particle &p, float resolutionUsec)
Look at particle stats/info and decide whether to accept or reject.
Definition TwoD_Processing.cc:261
virtual void processParticleSlice(Particle &p, const unsigned char *slice)
Process a slice and update the Particle struct area, edgeTouch, width and height.
Definition TwoD_Processing.cc:159
unsigned int _recordsPerSecond
Definition TwoD_Processing.h:198
unsigned int _misAligned
Definition TwoD_Processing.h:196
virtual int NumberOfDiodes() const =0
Number of diodes in the probe array.
TwoD_Processing(const TwoD_Processing &)
No copying.
float getResolution() const
The probe resolution in meters.
Definition TwoD_Processing.h:63
virtual ~TwoD_Processing()
Definition TwoD_Processing.cc:62
float _twoDAreaRejectRatio
Area of particle rejection ratio.
Definition TwoD_Processing.h:217
void setupBuffer(const unsigned char **cp, const unsigned char **eod)
Derived Classes should call this at the beginning of processing an image block.
Definition TwoD_Processing.cc:316
Particle _particle
Current particle information.
Definition TwoD_Processing.h:223
virtual void clearData()
Clear size_dist arrays.
Definition TwoD_Processing.cc:306
unsigned int getResolutionMicron() const
The probe resolution in micrometers.
Definition TwoD_Processing.h:71
void saveBuffer(const unsigned char *cp, const unsigned char *eod)
In case of mis-aligned data, we may need to save some bytes at the end of an image block to pre-pend ...
Definition TwoD_Processing.cc:335
virtual bool acceptThisParticle2D(const Particle &p) const
Definition TwoD_Processing.cc:242
virtual bool acceptThisParticle1D(const Particle &p) const
Accept/reject criteria are in these functions.
Definition TwoD_Processing.cc:227
unsigned int _numImages
Number of image blocks processed by driver at time of last printStatus.
Definition TwoD_Processing.h:151
unsigned int _rejected1D_Cntr
Definition TwoD_Processing.h:193
unsigned char * _saveBuffer
The saved buffer.
Definition TwoD_Processing.h:258
int _nextraValues
If XML file has a variable RPS (records per second) defined, then _nextravalues will be 2,...
Definition TwoD_Processing.h:231
float _dead_time
Amount of time probe was inactive or amount of time consumed by rejected particles.
Definition TwoD_Processing.h:184
unsigned int _totalRecords
Statistics variables for processRecord().
Definition TwoD_Processing.h:191
unsigned int _totalParticles
Definition TwoD_Processing.h:192
unsigned int * _size_dist_1D
Arrays for size-distribution histograms.
Definition TwoD_Processing.h:176
dsm_sample_id_t _2dcID
Definition TwoD_Processing.h:170
unsigned int _suspectSlices
Definition TwoD_Processing.h:197
virtual void createSamples(dsm_time_t nextTimeTag, std::list< const Sample * > &results)
Send derived data and reset.
Definition TwoD_Processing.cc:81
float _resolutionMeters
Probe resolution in meters.
Definition TwoD_Processing.h:162
long long _histoEndTime
The end time of the current histogram.
Definition TwoD_Processing.h:210
unsigned int _totalPixelsShadowed
total # of pixels shadoweded in the time period. per second...
Definition TwoD_Processing.h:202
long long _lastStatusTime
Time of last printStatus.
Definition TwoD_Processing.h:156
unsigned int * _size_dist_2D
Definition TwoD_Processing.h:177
int _savedAlloc
Size of the saved buffer.
Definition TwoD_Processing.h:268
int _savedBytes
How many bytes were last saved.
Definition TwoD_Processing.h:263
dsm_sample_id_t _1dcID
Definition TwoD_Processing.h:170
TwoD_Processing & operator=(const TwoD_Processing &)
No copying.
unsigned int _resolutionMicron
Probe resolution in micrometers.
Definition TwoD_Processing.h:167
unsigned int _overLoadSliceCount
Definition TwoD_Processing.h:194
dsm_time_t _prevTime
Time from previous record.
Definition TwoD_Processing.h:207
The essential core classes of nidas.
Definition A2DConverter.h:31
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
long long dsm_time_t
Posix time in microseconds, the number of non-leap microseconds since 1970 Jan 1 00:00 UTC.
Definition Sample.h:62
unsigned int dsm_sample_id_t
Definition Sample.h:64
void stream_histogram(T &out, V *sizedist, unsigned int nbins)
Definition TwoD_Processing.h:284
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31