Jpp
 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 }
 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 33 of file JChecksum.hh.

Member Typedef Documentation

Definition at line 76 of file JChecksum.hh.

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

Definition at line 77 of file JChecksum.hh.

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

Definition at line 78 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.

Definition at line 37 of file JChecksum.hh.

37  {
38  EPMT_t = 1, //!< PMT number error
39  ETDC_t, //!< TDC value error
40  TIME_t, //!< Time order error
41  EUDP_t //!< UDP packet error
42  };
TDC value error.
Definition: JChecksum.hh:39
Time order error.
Definition: JChecksum.hh:40
PMT number error.
Definition: JChecksum.hh:38
UDP packet error.
Definition: JChecksum.hh:41

Constructor & Destructor Documentation

JTRIGGER::JChecksum::JChecksum ( )
inline

Default constructor.

Definition at line 84 of file JChecksum.hh.

85  {
86  t0.resize(NUMBER_OF_PMTS, 0);
87  }
std::vector< JDAQHit::JTDC_t > t0
Definition: JChecksum.hh:159
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 102 of file JChecksum.hh.

103  {
104  using namespace std;
105  using namespace KM3NETDAQ;
106 
107  const JDAQHit::JTDC_t Tmax = (JDAQHit::JTDC_t) (getTimeSinceRTS(frame.getFrameIndex()) + 1.05 * getFrameTime());
108 
109  buffer.clear();
110 
111  for (vector<JDAQHit::JTDC_t>::iterator i = t0.begin(); i != t0.end(); ++i) {
112  *i = 0;
113  }
114 
115  if (!frame.testDAQStatus()) {
116  buffer.push_back(error(-1, EUDP_t));
117  }
118 
119  for (JDAQSuperFrame::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
120 
121  const JDAQHit::JTDC_t pmt = hit->getPMT();
122  const JDAQHit::JTDC_t tdc = hit->getT();
123 
124  if (pmt < NUMBER_OF_PMTS) {
125 
126  if (tdc < t0[pmt]) {
127  buffer.push_back(error(distance(frame.begin(), hit), TIME_t));
128  }
129 
130  if (tdc > Tmax) {
131  buffer.push_back(error(distance(frame.begin(), hit), ETDC_t));
132  }
133 
134  t0[pmt] = tdc;
135 
136  } else {
137 
138  buffer.push_back(error(distance(frame.begin(), hit), EPMT_t));
139  }
140  }
141 
142  return buffer;
143  }
std::vector< JDAQHit::JTDC_t > t0
Definition: JChecksum.hh:159
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
int getFrameIndex() const
Get frame index.
Hit data structure.
Definition: JDAQHit.hh:34
const_iterator begin() const
Definition: JDAQFrame.hh:136
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:39
Time order error.
Definition: JChecksum.hh:40
PMT number error.
Definition: JChecksum.hh:38
result_type buffer
Definition: JChecksum.hh:160
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
UDP packet error.
Definition: JChecksum.hh:41
bool testDAQStatus() const
Test DAQ status of packets.
const_iterator end() const
Definition: JDAQFrame.hh:137
bool JTRIGGER::JChecksum::operator() ( const JDAQSuperFrame frame) const
inline

Check sum.

Parameters
frameDAQ frame
Returns
true if okay; else false

Definition at line 152 of file JChecksum.hh.

153  {
154  return get(frame).empty();
155  }

Member Data Documentation

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

Definition at line 159 of file JChecksum.hh.

result_type JTRIGGER::JChecksum::buffer
mutableprivate

Definition at line 160 of file JChecksum.hh.


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