Jpp
JSuperFrame2D.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JSUPERFRAME2D__
2 #define __JTRIGGER__JSUPERFRAME2D__
3 
4 #include <vector>
5 
6 #include "JDAQ/JDAQ.hh"
7 #include "JDAQ/JDAQSuperFrame.hh"
8 #include "JDetector/JModule.hh"
10 #include "JTrigger/JFrame.hh"
12 
13 
14 /**
15  * \author mdejong
16  */
17 
18 namespace JTRIGGER {}
19 namespace JPP { using namespace JTRIGGER; }
20 
21 namespace JTRIGGER {
22 
24  using JDETECTOR::JModule;
25 
26 
27  /**
28  * 2-dimensional frame with time calibrated data from one optical module.\n
29  * For each PMT, data are stored in a separate frame.
30  * In the following, the data of a single PMT are assumed to be time ordered.\n
31  * Note that the data of each PMT are terminated with an end marker.
32  *
33  * The data of a given PMT are reduced to a single end marker when:
34  * - high-rate veto bit is on; or
35  * - FIFO (almost) full bit is on; or
36  * - PMT has status bit set.
37  *
38  * The data member JSuperFrame2D::demultiplex can be used as an I/O buffer.
39  */
40  template<class JElement_t, class JAllocator_t = std::allocator<JElement_t> >
41  class JSuperFrame2D :
42  public JModuleHeader,
43  public std::vector< JFrame<JElement_t, JAllocator_t> >
44  {
45  public:
46 
49 
54 
55 
56  /**
57  * Default constructor.
58  */
60  {}
61 
62 
63  /**
64  * Process DAQ super frame.
65  * The time calibration is applied and an appropriate end marker is added.
66  *
67  * \param input DAQ super frame
68  * \param module module data
69  * \return this 2D super frame
70  */
72  const JModule& module)
73  {
75  using JDETECTOR::JPMT;
76 
77  this->setDAQChronometer (input.getDAQChronometer());
79  this->setPosition (module.getPosition());
80 
81  this->resize(NUMBER_OF_PMTS);
82 
83  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
84 
85  JFrame<JElement_t, JAllocator_t>& frame = (*this)[i];
86 
87  frame.clear();
88 
89  frame.setDAQChronometer(this->getDAQChronometer());
91  frame.setAxis (module.getPMT(i).getAxis());
92  frame.setCalibration (module.getPMT(i).getCalibration());
93  }
94 
95  int n = input.size();
96 
97  for (JDAQSuperFrame::const_iterator i = input.begin(); n != 0; --n, ++i) {
98  (*this)[i->getPMT()].push_back(*i);
99  }
100 
101  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
102  if ((!module.getPMT(i).has(JPMT::DAQ_STATUS) && input.testHighRateVeto(i)) ||
103  (!module.getPMT(i).has(JPMT::DAQ_STATUS) && input.testFIFOStatus (i)) ||
104  module.getPMT(i).has(JPMT::PMT_STATUS)) {
105  (*this)[i].clear();
106  }
107  }
108 
109  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
110  (*this)[i].putEndMarker();
111  }
112 
113  return *this;
114  }
115 
116 
117  /**
118  * Apply high-rate veto.
119  *
120  * \param rate_Hz high-rate veto [Hz]
121  */
122  void applyHighRateVeto(const double rate_Hz)
123  {
124  for (iterator i = this->begin(); i != this->end(); ++i) {
125  i->applyHighRateVeto(rate_Hz);
126  }
127  }
128 
129 
130  /**
131  * Pre-process data.
132  *
133  * \param option option
134  * \param match match criterion
135  */
136  void preprocess(JPreprocessor::JOption_t option, const match_type& match)
137  {
138  switch (option) {
139 
141  for (iterator i = this->begin(); i != this->end(); ++i) {
142  i->join(match);
143  }
144  break;
145 
147  for (iterator i = this->begin(); i != this->end(); ++i) {
148  i->filter(match);
149  }
150  break;
151 
152  default:
153  break;
154  }
155  }
156 
157 
158  /**
159  * Demultiplexer.
160  */
162  };
163 
164 
165  /**
166  * Demultiplexer.
167  */
168  template<class JElement_t, class JAllocator_t>
170 }
171 
172 #endif
JModule.hh
KM3NETDAQ::JDAQChronometer::setDAQChronometer
void setDAQChronometer(const JDAQChronometer &chronometer)
Set DAQ chronometer.
Definition: JDAQChronometer.hh:99
JDAQ.hh
JModuleHeader.hh
JPreprocessor.hh
JTRIGGER::JSuperFrame2D::preprocess
void preprocess(JPreprocessor::JOption_t option, const match_type &match)
Pre-process data.
Definition: JSuperFrame2D.hh:136
KM3NETDAQ::JDAQFrameStatus::testHighRateVeto
bool testHighRateVeto() const
Test high-rate veto status.
Definition: JDAQFrameStatus.hh:202
JTRIGGER::JMatch
Function object interface for hit matching.
Definition: JMatch.hh:25
KM3NETDAQ::JDAQModuleIdentifier::setModuleIdentifier
void setModuleIdentifier(const JDAQModuleIdentifier &module)
Set Module identifier.
Definition: JDAQModuleIdentifier.hh:61
JDETECTOR::JPMT::has
bool has(const JPMTStatusBits_t bit) const
Test PMT status.
Definition: JPMT.hh:145
KM3NETDAQ::JDAQFrame::size
int size() const
Definition: JDAQFrame.hh:157
JTRIGGER::JSuperFrame2D::const_reverse_iterator
std::vector< value_type >::const_reverse_iterator const_reverse_iterator
Definition: JSuperFrame2D.hh:53
JTOOLS::n
const int n
Definition: JPolint.hh:628
JGEOMETRY3D::JAxis3D::getAxis
const JAxis3D & getAxis() const
Get axis.
Definition: JAxis3D.hh:109
std::vector
Definition: JSTDTypes.hh:12
JTRIGGER::JSuperFrame2D::demultiplex
static JSuperFrame2D< JElement_t, JAllocator_t > demultiplex
Demultiplexer.
Definition: JSuperFrame2D.hh:161
JGEOMETRY3D::JAxis3D::setAxis
void setAxis(const JAxis3D &axis)
Set axis.
Definition: JAxis3D.hh:120
KM3NETDAQ::NUMBER_OF_PMTS
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
KM3NETDAQ::JDAQModuleIdentifier::getModuleID
int getModuleID() const
Get module identifier.
Definition: JDAQModuleIdentifier.hh:72
JTRIGGER::JPreprocessor::join_t
join consecutive hits according match criterion
Definition: JPreprocessor.hh:39
JTRIGGER::JSuperFrame2D::match_type
JMatch< JElement_t > match_type
Definition: JSuperFrame2D.hh:47
JTRIGGER::JSuperFrame2D::const_iterator
std::vector< value_type >::const_iterator const_iterator
Definition: JSuperFrame2D.hh:51
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
KM3NETDAQ::JDAQSuperFrame::const_iterator
JDAQFrame::const_iterator const_iterator
Definition: JDAQSuperFrame.hh:34
KM3NETDAQ::JDAQModuleIdentifier::getModuleIdentifier
const JDAQModuleIdentifier & getModuleIdentifier() const
Get Module identifier.
Definition: JDAQModuleIdentifier.hh:50
JTRIGGER::JSuperFrame2D::applyHighRateVeto
void applyHighRateVeto(const double rate_Hz)
Apply high-rate veto.
Definition: JSuperFrame2D.hh:122
JDETECTOR::JModule::getPMT
const JPMT & getPMT(const int index) const
Get PMT.
Definition: JModule.hh:173
JDETECTOR::JPMT::PMT_STATUS
Enable (disable) use of PMT data if 0 (1);.
Definition: JPMT.hh:66
JTRIGGER::JModuleHeader
Header for Module.
Definition: JModuleHeader.hh:26
JTRIGGER::JSuperFrame2D::reverse_iterator
std::vector< value_type >::reverse_iterator reverse_iterator
Definition: JSuperFrame2D.hh:52
JDETECTOR::JCalibration::getCalibration
const JCalibration & getCalibration() const
Get calibration.
Definition: JDetector/JCalibration.hh:61
JDETECTOR::JPMT::DAQ_STATUS
Enable (disable) use of high-rate veto and FIFO (almost) full if 0 (1);.
Definition: JPMT.hh:67
JDETECTOR::JModule
Data structure for a composite optical module.
Definition: JModule.hh:49
KM3NETDAQ::JDAQFrameStatus::testFIFOStatus
bool testFIFOStatus() const
Test FIFO status.
Definition: JDAQFrameStatus.hh:246
JDETECTOR::JPMT
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:53
JTRIGGER::JFrame
Data frame for calibrated hits of one PMT.
Definition: JFrame.hh:32
JTRIGGER::JPreprocessor::filter_t
filter-out consecutive hits according match criterion
Definition: JPreprocessor.hh:40
JDETECTOR::JCalibration::setCalibration
void setCalibration(const JCalibration &cal)
Set calibration.
Definition: JDetector/JCalibration.hh:72
JTRIGGER::JPreprocessor::JOption_t
JOption_t
Preprocessing options.
Definition: JPreprocessor.hh:37
JGEOMETRY3D::JPosition3D::setPosition
void setPosition(const JVector3D &pos)
Set position.
Definition: JPosition3D.hh:151
JTRIGGER::JSuperFrame2D::JSuperFrame2D
JSuperFrame2D()
Default constructor.
Definition: JSuperFrame2D.hh:59
KM3NETDAQ::JDAQPMTIdentifier
PMT identifier.
Definition: JDAQPMTIdentifier.hh:25
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
KM3NETDAQ::JDAQChronometer::getDAQChronometer
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
Definition: JDAQChronometer.hh:88
JTRIGGER::JSuperFrame2D::value_type
JFrame< JElement_t, JAllocator_t > value_type
Definition: JSuperFrame2D.hh:48
JDAQSuperFrame.hh
JTRIGGER::JSuperFrame2D::operator()
JSuperFrame2D & operator()(const JDAQSuperFrame &input, const JModule &module)
Process DAQ super frame.
Definition: JSuperFrame2D.hh:71
KM3NETDAQ::JDAQSuperFrame
Data frame of one optical module.
Definition: JDAQSuperFrame.hh:27
JTRIGGER::JSuperFrame2D::iterator
std::vector< value_type >::iterator iterator
Definition: JSuperFrame2D.hh:50
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
KM3NETDAQ::JDAQFrame::begin
const_iterator begin() const
Definition: JDAQFrame.hh:139
JTRIGGER::JSuperFrame2D
2-dimensional frame with time calibrated data from one optical module.
Definition: JSuperFrame2D.hh:41
KM3NETDAQ::JDAQPMTIdentifier::setPMTIdentifier
void setPMTIdentifier(const JDAQPMTIdentifier &pmt)
Set PMT identifier.
Definition: JDAQPMTIdentifier.hh:67
JFrame.hh