Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JTRIGGER {}
18 namespace JPP { using namespace JTRIGGER; }
19 
20 namespace JTRIGGER {
21 
23  using JDETECTOR::JModule;
24 
25 
26  /**
27  * 2-dimensional frame with time calibrated data from one optical module.\n
28  * For each PMT, data are stored in a separate frame.
29  * In the following, the data of a single PMT are assumed to be time ordered.\n
30  * Note that the data of each PMT are terminated with an end marker.
31  *
32  * The data of a given PMT are reduced to a single end marker when:
33  * - high-rate veto bit is on; or
34  * - FIFO (almost) full bit is on; or
35  * - PMT has status bit set.
36  *
37  * The data member JSuperFrame2D::demultiplex can be used as an I/O buffer.
38  */
39  template<class JElement_t>
40  class JSuperFrame2D :
41  public JModuleHeader,
42  public std::vector< JFrame<JElement_t> >
43  {
44  public:
45 
47 
52 
53 
54  /**
55  * Default constructor.
56  */
58  JModuleHeader(),
59  std::vector< JFrame<JElement_t> >()
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>& 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  (*this)[i].putEndMarker();
103  }
104 
105  if (input.testHighRateVeto()) {
106  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
107  if (input.testHighRateVeto(i)) {
108  (*this)[i].reset();
109  }
110  }
111  }
112 
113  if (input.testFIFOStatus()) {
114  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
115  if (input.testFIFOStatus(i)) {
116  (*this)[i].reset();
117  }
118  }
119  }
120 
121  for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
122  if (module.getPMT(i).has(JPMT::PMT_STATUS)) {
123  (*this)[i].reset();
124  }
125  }
126 
127  return *this;
128  }
129 
130 
131  /**
132  * Apply high-rate veto.
133  *
134  * \param rate_Hz high-rate veto [Hz]
135  */
136  void applyHighRateVeto(const double rate_Hz)
137  {
138  for (iterator i = this->begin(); i != this->end(); ++i) {
139  i->applyHighRateVeto(rate_Hz);
140  }
141  }
142 
143 
144  /**
145  * Demultiplexer.
146  */
148  };
149 
150 
151  /**
152  * Demultiplexer.
153  */
154  template<class JElement_t>
156 }
157 
158 #endif
JSuperFrame2D & operator()(const JDAQSuperFrame &input, const JModule &module)
Process DAQ super frame.
int getModuleID() const
Get module identifier.
Data structure for a composite optical module.
Definition: JModule.hh:47
static JSuperFrame2D< JElement_t > demultiplex
Demultiplexer.
JFrame< JElement_t > frame_type
const JCalibration & getCalibration() const
Get calibration.
void setAxis(const JAxis3D &axis)
Set axis.
Definition: JAxis3D.hh:119
std::vector< frame_type >::reverse_iterator reverse_iterator
General status.
Definition: JPMT.hh:65
std::vector< frame_type >::const_iterator const_iterator
Hit data structure.
Definition: JDAQHit.hh:36
void setPMTIdentifier(const JDAQPMTIdentifier &pmt)
Set PMT identifier.
const_iterator begin() const
Definition: JDAQFrame.hh:139
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:52
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
void applyHighRateVeto(const double rate_Hz)
Apply high-rate veto.
void setDAQChronometer(const JDAQChronometer &chronometer)
Set DAQ chronometer.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
const JPMT & getPMT(const int index) const
Get PMT.
Definition: JModule.hh:141
bool has(const JPMTStatusBits_t bit) const
Test PMT status.
Definition: JPMT.hh:143
Header for Module.
bool testHighRateVeto() const
Test high-rate veto status.
void setModuleIdentifier(const JDAQModuleIdentifier &module)
Set Module identifier.
void setCalibration(const JCalibration &cal)
Set calibration.
std::vector< frame_type >::iterator iterator
const JAxis3D & getAxis() const
Get axis.
Definition: JAxis3D.hh:108
2-dimensional frame with time calibrated data from one optical module.
const JDAQModuleIdentifier & getModuleIdentifier() const
Get Module identifier.
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
JSuperFrame2D()
Default constructor.
int size() const
Definition: JDAQFrame.hh:157
Data frame of one optical module.
void setPosition(const JVector3D &pos)
Set position.
Definition: JPosition3D.hh:151
Data structure for a composite optical module.
std::vector< frame_type >::const_reverse_iterator const_reverse_iterator
bool testFIFOStatus() const
Test FIFO status.