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

Member Typedef Documentation

Definition at line 79 of file JChecksum.hh.

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

Definition at line 80 of file JChecksum.hh.

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

Definition at line 81 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 40 of file JChecksum.hh.

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

Constructor & Destructor Documentation

JTRIGGER::JChecksum::JChecksum ( )
inline

Default constructor.

Definition at line 87 of file JChecksum.hh.

88  {
89  t0.resize(NUMBER_OF_PMTS, 0);
90  }
std::vector< JDAQHit::JTDC_t > t0
Definition: JChecksum.hh:162
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 105 of file JChecksum.hh.

106  {
107  using namespace std;
108  using namespace KM3NETDAQ;
109 
110  const JDAQHit::JTDC_t Tmax = (JDAQHit::JTDC_t) (getTimeSinceRTS(frame.getFrameIndex()) + 1.05 * getFrameTime());
111 
112  buffer.clear();
113 
114  for (vector<JDAQHit::JTDC_t>::iterator i = t0.begin(); i != t0.end(); ++i) {
115  *i = 0;
116  }
117 
118  if (!frame.testDAQStatus()) {
119  buffer.push_back(error(-1, EUDP_t));
120  }
121 
122  for (JDAQSuperFrame::const_iterator hit = frame.begin(); hit != frame.end(); ++hit) {
123 
124  const JDAQHit::JTDC_t pmt = hit->getPMT();
125  const JDAQHit::JTDC_t tdc = hit->getT();
126 
127  if (pmt < NUMBER_OF_PMTS) {
128 
129  if (tdc < t0[pmt]) {
130  buffer.push_back(error(distance(frame.begin(), hit), TIME_t));
131  }
132 
133  if (tdc > Tmax) {
134  buffer.push_back(error(distance(frame.begin(), hit), ETDC_t));
135  }
136 
137  t0[pmt] = tdc;
138 
139  } else {
140 
141  buffer.push_back(error(distance(frame.begin(), hit), EPMT_t));
142  }
143  }
144 
145  return buffer;
146  }
std::vector< JDAQHit::JTDC_t > t0
Definition: JChecksum.hh:162
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT parameters.
Definition: JDetector.hh:254
unsigned int JTDC_t
leading edge [ns]
Definition: JDAQHit.hh:39
int getFrameIndex() const
Get frame index.
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
Definition: JTransitTime.sh:36
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:42
Time order error.
Definition: JChecksum.hh:43
PMT number error.
Definition: JChecksum.hh:41
result_type buffer
Definition: JChecksum.hh:163
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
UDP packet error.
Definition: JChecksum.hh:44
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 155 of file JChecksum.hh.

156  {
157  return get(frame).empty();
158  }

Member Data Documentation

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

Definition at line 162 of file JChecksum.hh.

result_type JTRIGGER::JChecksum::buffer
mutableprivate

Definition at line 163 of file JChecksum.hh.


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