Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JSuperFrame2D.hh
Go to the documentation of this file.
1#ifndef __JTRIGGER__JSUPERFRAME2D__
2#define __JTRIGGER__JSUPERFRAME2D__
3
4#include <vector>
5#include <algorithm>
6
11#include "JTrigger/JFrame.hh"
15
16
17/**
18 * \author mdejong
19 */
20
21namespace JTRIGGER {}
22namespace JPP { using namespace JTRIGGER; }
23
24namespace JTRIGGER {
25
28
29
30 /**
31 * 2-dimensional frame with time calibrated data from one optical module.
32 *
33 * For each PMT, data are stored in a separate frame.
34 * In the following, the data of a single PMT are assumed to be time ordered.
35 *
36 * Note that the data of each PMT are terminated with an end marker (see class JFrame_t).\n
37 * The data of a given PMT are cleared when the return value of
38 * method JTRIGGER::getDAQStatus or JTRIGGER::getPMTStatus is false.
39 *
40 * The static data member JSuperFrame2D::demultiplex can be used as an I/O buffer.
41 */
42 template<class JElement_t, class JAllocator_t = std::allocator<JElement_t> >
44 public JModuleHeader,
45 public std::vector< JFrame<JElement_t, JAllocator_t> >
46 {
47 public:
48
51
53 typedef typename std::vector<value_type>::const_iterator const_iterator;
55 typedef typename std::vector<value_type>::const_reverse_iterator const_reverse_iterator;
56
57
58 /**
59 * Default constructor.
60 */
63
64
65 /**
66 * Process DAQ super frame.
67 *
68 * The time calibration is applied and an appropriate end marker is added.
69 *
70 * \param input DAQ super frame
71 * \param module module data
72 * \param selector DAQ hit selector
73 * \return this 2D super frame
74 */
76 const JModule& module,
77 const JDAQHitSelector& selector = JDAQHitDefaultSelector())
78 {
79 using KM3NETDAQ::NUMBER_OF_PMTS;
80 using namespace JPP;
81
84 this->setPosition (module.getPosition());
85
86 this->resize(NUMBER_OF_PMTS);
87
88 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
89
90 JFrame<JElement_t, JAllocator_t>& frame = (*this)[i];
91
92 frame.clear();
93
96 frame.setAxis (module.getPMT(i).getAxis());
97 frame.setCalibration (module.getPMT(i).getCalibration());
98 }
99
100 int n = input.size();
101
102 if (dynamic_cast<const JDAQHitDefaultSelector*>(&selector) != NULL) {
103
104 for (JDAQSuperFrame::const_iterator i = input.begin(); n != 0; --n, ++i) {
105 (*this)[i->getPMT()].push_back(*i);
106 }
107
108 } else {
109
110 for (JDAQSuperFrame::const_iterator i = input.begin(); n != 0; --n, ++i) {
111 if (selector(*i)) {
112 (*this)[i->getPMT()].push_back(*i);
113 }
114 }
115 }
116
117 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
118 if (!getDAQStatus(input, module, i) ||
119 !getPMTStatus(input, module, i) ||
120 module.getPMT(i).has(PMT_DISABLE)) {
121 (*this)[i].clear();
122 }
123 }
124
125 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
126 (*this)[i].putEndMarker();
127 }
128
129 return *this;
130 }
131
132
133 /**
134 * Apply high-rate veto.
135 *
136 * \param rate_Hz high-rate veto [Hz]
137 */
138 void applyHighRateVeto(const double rate_Hz)
139 {
140 for (iterator i = this->begin(); i != this->end(); ++i) {
141 i->applyHighRateVeto(rate_Hz);
142 }
143 }
144
145
146 /**
147 * Pre-process data.
148 *
149 * \param option option
150 * \param match match criterion
151 */
153 {
154 switch (option) {
155
157 for (iterator i = this->begin(); i != this->end(); ++i) {
158 i->join(match);
159 }
160 break;
161
163 for (iterator i = this->begin(); i != this->end(); ++i) {
164 i->filter(match);
165 }
166 break;
167
169 for (iterator i = this->begin(); i != this->end(); ++i) {
170 i->remove(match);
171 }
172 break;
173
174 default:
175 break;
176 }
177 }
178
179
180 /**
181 * Demultiplexer.
182 */
184 };
185
186
187 /**
188 * Demultiplexer.
189 */
190 template<class JElement_t, class JAllocator_t>
192}
193
194#endif
KM3NeT DAQ constants, bit handling, etc.
Data structure for optical module.
Auxiliaries for pre-processing of hits.
const JCalibration & getCalibration() const
Get calibration.
void setCalibration(const JCalibration &cal)
Set calibration.
Data structure for a composite optical module.
Definition JModule.hh:75
const JPMT & getPMT(const int index) const
Get PMT.
Definition JModule.hh:172
void setAxis(const JAxis3D &axis)
Set axis.
Definition JAxis3D.hh:109
const JAxis3D & getAxis() const
Get axis.
Definition JAxis3D.hh:98
void setPosition(const JVector3D &pos)
Set position.
const JPosition3D & getPosition() const
Get position.
Data frame for calibrated hits of one PMT.
Definition JFrame.hh:38
Function object interface for hit matching.
Definition JMatch.hh:27
2-dimensional frame with time calibrated data from one optical module.
JMatch< JElement_t > match_type
static JSuperFrame2D< JElement_t, JAllocator_t > demultiplex
Demultiplexer.
std::vector< value_type >::iterator iterator
JSuperFrame2D()
Default constructor.
std::vector< value_type >::const_iterator const_iterator
std::vector< value_type >::reverse_iterator reverse_iterator
void preprocess(JPreprocessor::JOption_t option, const match_type &match)
Pre-process data.
JFrame< JElement_t, JAllocator_t > value_type
JSuperFrame2D & operator()(const JDAQSuperFrame &input, const JModule &module, const JDAQHitSelector &selector=JDAQHitDefaultSelector())
Process DAQ super frame.
void applyHighRateVeto(const double rate_Hz)
Apply high-rate veto.
std::vector< value_type >::const_reverse_iterator const_reverse_iterator
const JDAQChronometer & getDAQChronometer() const
Get DAQ chronometer.
void setDAQChronometer(const JDAQChronometer &chronometer)
Set DAQ chronometer.
const_iterator begin() const
Definition JDAQFrame.hh:165
Hit data structure.
Definition JDAQHit.hh:35
int getModuleID() const
Get module identifier.
const JDAQModuleIdentifier & getModuleIdentifier() const
Get Module identifier.
void setModuleIdentifier(const JDAQModuleIdentifier &module)
Set Module identifier.
void setPMTIdentifier(const JDAQPMTIdentifier &pmt)
Set PMT identifier.
Data frame of one optical module.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const int n
Definition JPolint.hh:791
Auxiliary classes and methods for triggering.
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition JDAQ.hh:26
static const int PMT_DISABLE
KM3NeT Data Definitions v3.5.1-1-gd514d72 https://git.km3net.de/common/km3net-dataformat.
Definition pmt_status.hh:12
bool has(const int bit) const
Test PMT status.
Definition JStatus.hh:120
Default class to select DAQ hits.
Auxiliary class to select DAQ hits.
Header for Module.
JOption_t
Preprocessing options.
@ filter_t
filter consecutive hits according match criterion
@ remove_t
remove consecutive hits according match criterion
@ join_t
join consecutive hits according match criterion