Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
JTRIGGER::JChecksum Struct Reference

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

#include <JChecksum.hh>

Classes

struct  error
 Error. More...
 

Public Types

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

Public Member Functions

 JChecksum ()
 Default constructor. More...
 
const result_typeget (const JDAQSuperFrame &frame) const
 Check sum. More...
 
bool operator() (const JDAQSuperFrame &frame) const
 Check sum. More...
 

Private Attributes

std::vector< JDAQHit::JTDC_tt0
 
result_type buffer
 

Detailed Description

Auxiliary class to perform check-sum on raw data.

Definition at line 38 of file JChecksum.hh.

Member Typedef Documentation

Definition at line 82 of file JChecksum.hh.

typedef result_type::const_iterator JTRIGGER::JChecksum::const_iterator

Definition at line 83 of file JChecksum.hh.

typedef result_type::const_reverse_iterator JTRIGGER::JChecksum::const_reverse_iterator

Definition at line 84 of file JChecksum.hh.

Member Enumeration Documentation

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 42 of file JChecksum.hh.

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

Constructor & Destructor Documentation

JTRIGGER::JChecksum::JChecksum ( )
inline

Default constructor.

Definition at line 90 of file JChecksum.hh.

91  {
92  t0.resize(NUMBER_OF_PMTS, 0);
93  }
std::vector< JDAQHit::JTDC_t > t0
Definition: JChecksum.hh:168
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26

Member Function Documentation

const result_type& JTRIGGER::JChecksum::get ( 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 108 of file JChecksum.hh.

109  {
110  using namespace std;
111  using namespace KM3NETDAQ;
112 
113  const JDAQHit::JTDC_t Tmax = (JDAQHit::JTDC_t) (getTimeSinceRTS(frame.getFrameIndex()) + 1.05 * getFrameTime());
114 
115  buffer.clear();
116 
117  for (vector<JDAQHit::JTDC_t>::iterator i = t0.begin(); i != t0.end(); ++i) {
118  *i = 0;
119  }
120 
121  if (frame.size() > MAXIMAL_FRAME_SIZE) {
122  buffer.push_back(error(-1, SIZE_t));
123  }
124 
125  if (!frame.testDAQStatus()) {
126  buffer.push_back(error(-1, EUDP_t));
127  }
128 
129  for (JDAQSuperFrame::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
130 
131  const JDAQHit::JTDC_t pmt = hit->getPMT();
132  const JDAQHit::JTDC_t tdc = hit->getT();
133 
134  if (pmt < NUMBER_OF_PMTS) {
135 
136  if (tdc < t0[pmt]) {
137  buffer.push_back(error(distance(frame.begin(), hit), TIME_t));
138  }
139 
140  if (tdc > Tmax) {
141  buffer.push_back(error(distance(frame.begin(), hit), ETDC_t));
142  }
143 
144  t0[pmt] = tdc;
145 
146  } else {
147 
148  buffer.push_back(error(distance(frame.begin(), hit), EPMT_t));
149  }
150  }
151 
152  return buffer;
153  }
std::vector< JDAQHit::JTDC_t > t0
Definition: JChecksum.hh:168
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
unsigned int JTDC_t
leading edge [ns]
Definition: JDAQHit.hh:39
static int MAXIMAL_FRAME_SIZE
Maximal frame size.
Definition: JChecksum.hh:32
int getFrameIndex() const
Get frame index.
Hit data structure.
Definition: JDAQHit.hh:34
const_iterator begin() const
Definition: JDAQFrame.hh:165
double getFrameTime()
Get frame time duration.
Definition: JDAQClock.hh:162
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
Definition: JDAQClock.hh:263
TDC value error.
Definition: JChecksum.hh:44
Time order error.
Definition: JChecksum.hh:45
PMT number error.
Definition: JChecksum.hh:43
result_type buffer
Definition: JChecksum.hh:169
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
UDP packet error.
Definition: JChecksum.hh:46
bool testDAQStatus() const
Test DAQ status of packets.
int size() const
Definition: JDAQFrame.hh:183
const_iterator end() const
Definition: JDAQFrame.hh:166
bool JTRIGGER::JChecksum::operator() ( const JDAQSuperFrame frame) const
inline

Check sum.

Parameters
frameDAQ frame
Returns
true if okay; else false

Definition at line 162 of file JChecksum.hh.

163  {
164  return get(frame).empty();
165  }

Member Data Documentation

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

Definition at line 168 of file JChecksum.hh.

result_type JTRIGGER::JChecksum::buffer
mutableprivate

Definition at line 169 of file JChecksum.hh.


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