Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JTRIGGER::JChecksum Struct Reference

Auxiliary class to perform check-sum on raw data. More...

#include <JChecksum.hh>

Classes

struct  error
 Error. More...
 
struct  result_type
 Auxiliary data structure for result of checksum. More...
 

Public Types

enum  error_types {
  EPMT_t = 1 , ETDC_t , TIME_t , EUDP_t ,
  SIZE_t
}
 Error types. More...
 
typedef result_type::const_iterator const_iterator
 
typedef result_type::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 JChecksum ()
 Default constructor.
 
const result_typeoperator() (const JDAQSuperFrame &frame) const
 Check sum.
 

Private Attributes

std::vector< JDAQHit::JTDC_tt0
 
result_type buffer
 

Detailed Description

Auxiliary class to perform check-sum on raw data.

Definition at line 41 of file JChecksum.hh.

Member Typedef Documentation

◆ const_iterator

result_type::const_iterator JTRIGGER::JChecksum::const_iterator

Definition at line 119 of file JChecksum.hh.

◆ const_reverse_iterator

result_type::const_reverse_iterator JTRIGGER::JChecksum::const_reverse_iterator

Definition at line 120 of file JChecksum.hh.

Member Enumeration Documentation

◆ error_types

Error types.

Enumerator
EPMT_t 

PMT number error.

ETDC_t 

TDC value error.

TIME_t 

Time order error.

EUDP_t 

UDP packet error.

SIZE_t 

size error

Definition at line 45 of file JChecksum.hh.

45 {
46 EPMT_t = 1, //!< PMT number error
47 ETDC_t, //!< TDC value error
48 TIME_t, //!< Time order error
49 EUDP_t, //!< UDP packet error
50 SIZE_t //!< size error
51 };
@ ETDC_t
TDC value error.
Definition JChecksum.hh:47
@ SIZE_t
size error
Definition JChecksum.hh:50
@ EUDP_t
UDP packet error.
Definition JChecksum.hh:49
@ EPMT_t
PMT number error.
Definition JChecksum.hh:46
@ TIME_t
Time order error.
Definition JChecksum.hh:48

Constructor & Destructor Documentation

◆ JChecksum()

JTRIGGER::JChecksum::JChecksum ( )
inline

Default constructor.

Definition at line 126 of file JChecksum.hh.

127 {
128 t0.resize(NUMBER_OF_PMTS, 0);
129 }
std::vector< JDAQHit::JTDC_t > t0
Definition JChecksum.hh:192

Member Function Documentation

◆ operator()()

const result_type & JTRIGGER::JChecksum::operator() ( const JDAQSuperFrame & frame) const
inline

Check sum.

The following checks are made:

  1. UDP packet assembly is complete;
  2. PMT number greater or equals zero and less than NUMBER_OF_PMTS;
  3. TDC value less than frame time (with 5% margin);
  4. TDC values from same PMT are monotonously increasing;
Parameters
frameDAQ frame
Returns
list of errors; empty if all okay

Definition at line 144 of file JChecksum.hh.

145 {
146 using namespace std;
147 using namespace KM3NETDAQ;
148
149 const JDAQHit::JTDC_t Tmax = (JDAQHit::JTDC_t) (getTimeSinceRTS(frame.getFrameIndex()) + 1.05 * getFrameTime());
150
151 buffer.clear();
152
153 for (vector<JDAQHit::JTDC_t>::iterator i = t0.begin(); i != t0.end(); ++i) {
154 *i = 0;
155 }
156
157 if (frame.size() > MAXIMAL_FRAME_SIZE) {
158 buffer.push_back(error(-1, SIZE_t));
159 }
160
161 if (!frame.testDAQStatus()) {
162 buffer.push_back(error(-1, EUDP_t));
163 }
164
165 for (JDAQSuperFrame::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
166
167 const JDAQHit::JTDC_t pmt = hit->getPMT();
168 const JDAQHit::JTDC_t tdc = hit->getT();
169
170 if (pmt < NUMBER_OF_PMTS) {
171
172 if (tdc < t0[pmt]) {
173 buffer.push_back(error(distance(frame.begin(), hit), TIME_t));
174 }
175
176 if (tdc > Tmax) {
177 buffer.push_back(error(distance(frame.begin(), hit), ETDC_t));
178 }
179
180 t0[pmt] = tdc;
181
182 } else {
183
184 buffer.push_back(error(distance(frame.begin(), hit), EPMT_t));
185 }
186 }
187
188 return buffer;
189 }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
int getFrameIndex() const
Get frame index.
bool testDAQStatus() const
Test DAQ status of packets.
const_iterator end() const
Definition JDAQFrame.hh:166
const_iterator begin() const
Definition JDAQFrame.hh:165
Hit data structure.
Definition JDAQHit.hh:35
unsigned int JTDC_t
leading edge [ns]
Definition JDAQHit.hh:39
static int MAXIMAL_FRAME_SIZE
Maximal frame size.
Definition JChecksum.hh:35
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
Definition JDAQClock.hh:263
result_type buffer
Definition JChecksum.hh:193

Member Data Documentation

◆ t0

std::vector<JDAQHit::JTDC_t> JTRIGGER::JChecksum::t0
mutableprivate

Definition at line 192 of file JChecksum.hh.

◆ buffer

result_type JTRIGGER::JChecksum::buffer
mutableprivate

Definition at line 193 of file JChecksum.hh.


The documentation for this struct was generated from the following file: