1 #ifndef __JTRIGGER__JTIMESLICEROUTER__
2 #define __JTRIGGER__JTIMESLICEROUTER__
28 namespace JPP {
using namespace JTRIGGER; }
99 const int numberOfBins) :
116 using namespace KM3NETDAQ;
119 this->
set(×lice);
122 for (
const_iterator i = this->
get()->begin(); i != this->
get()->end(); ++i) {
133 if (Tmin < TMIN) { Tmin = TMIN; }
134 if (Tmax > TMAX) { Tmax = TMAX; }
137 int number_of_elements = 2;
139 for (
const_iterator i = this->
get()->begin(); i != this->
get()->end(); ++i) {
140 if (i->size() > number_of_elements) {
141 number_of_elements = i->size();
155 JBuffer_t buffer(bounds.
getSize() + 1);
157 for (
int i = 0; i != bounds.
getSize(); ++i) {
161 buffer[bounds.
getSize()] = TMAX;
164 table.resize(this->
get()->size());
166 const JDAQHit JDAQHitMin(0, TMIN, 0);
167 const JDAQHit JDAQHitMax(0, TMAX, 0);
175 for (
const_iterator frame = this->
get()->begin(); frame != this->
get()->end(); ++frame, ++grid) {
177 grid->configure(bounds);
179 if (!frame->empty()) {
181 if (frame-> begin()->getT() < grid->getXmin()) {
182 THROW(
JTriggerException,
"Hit time out of range " << frame-> begin()->getT() <<
" < " << grid->getXmin());
185 if (frame->rbegin()->getT() > grid->getXmax()) {
186 THROW(
JTriggerException,
"Hit time out of range " << frame->rbegin()->getT() <<
" > " << grid->getXmax());
189 zbuf.resize(frame->size() + 2);
191 copy(frame->begin(), frame->end(), zbuf.begin() + 1);
193 *zbuf. begin() = JDAQHitMin;
194 *zbuf.rbegin() = JDAQHitMax;
197 JDAQFrame_t::const_iterator hit = zbuf.begin(); ++hit;
198 JBuffer_t ::const_iterator t1 = buffer.begin();
202 while (hit->getT() < *t1) { ++hit; }
204 i->getY().lpos =
distance(static_cast<const JDAQFrame_t&>(zbuf).begin(), hit) - 1;
209 JDAQFrame_t::const_reverse_iterator hit = zbuf.rbegin(); ++hit;
210 JBuffer_t ::const_reverse_iterator t1 = buffer.rbegin();
214 while (hit->getT() >= *t1) { ++hit; }
216 i->getY().rpos =
distance(static_cast<const JDAQFrame_t&>(zbuf).begin(), hit.base()) - 1;
256 return (*(this->
get()))[this->
getAddress(module)];
278 const int second = grid.
getIndex(timeRange.getUpperLimit());
280 if (first < 0 || second >= grid.
getSize()) {
284 return frame.
subset(grid.
getY(first).lpos, grid.
getY(second).rpos);
bool hasSuperFrame(const JDAQModuleIdentifier &module) const
Check presence of module.
const JDAQSuperFrame & getSuperFrame(const JDAQModuleIdentifier &module) const
Get super frame.
int getModuleID() const
Get module identifier.
std::vector< grid_type > table
JTimesliceRouter(const int numberOfBins)
Constructor.
The elements in a collection are sorted according to their abscissa values and a given distance opera...
void configure(const JDAQTimeslice ×lice)
Configure.
JTOOLS::JRouter< int > router_type
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JDAQTimeslice::const_iterator const_iterator
unsigned int JTDC_t
leading edge [ns]
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
JTOOLS::JGridCollection< element_type > grid_type
int getFrameIndex(const double t_ns)
Get frame index for a given time in ns.
Auxiliary structure for indexing hits in a data frame.
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
JDAQFrameSubset getFrameSubset(const JDAQModuleIdentifier &module, const JTimeRange &timeRange) const
Get subset of frame given module identifier and range of hit times.
double getFrameTime()
Get frame time duration.
Template implementation of class that holds pointer to object(s).
JTimesliceRouter(const JDAQTimeslice ×lice, const int numberOfBins)
Constructor.
JTOOLS::JElement2D< double, JPair_t > element_type
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
const int getAddress(const JDAQModuleIdentifier &module) const
Get address of module.
void copy(const Head &from, JHead &to)
Copy header from from to to.
KM3NeT DAQ constants, bit handling, etc.
Data frame of one optical module.
JDAQFrameSubset subset(const int i1, const int i2) const
Get subset of data.
virtual void set(const JDAQTimeslice *p)
Set pointer.