1 #ifndef __JTRIGGER__JTIMESLICEROUTER__
2 #define __JTRIGGER__JTIMESLICEROUTER__
29 namespace JPP {
using namespace JTRIGGER; }
53 numberOfBins(numberOfBins)
144 using namespace KM3NETDAQ;
152 this->
set(×lice);
166 int number_of_elements = 2;
169 if (
i->size() > number_of_elements) {
170 number_of_elements =
i->size();
184 const JGrid<double> bounds(number_of_elements, Tmin_ns, Tmax_ns);
196 table.resize(this->
get()->size());
202 for (
const_iterator frame = this->
get()->begin(); frame != this->
get()->end(); ++frame, ++grid) {
204 grid->configure(bounds);
206 if (!frame->empty()) {
208 buffer.resize(frame->size() + 2);
210 copy(frame->begin(), frame->end(), buffer.begin() + 1);
216 frame_type ::const_iterator hit = buffer.begin(); ++hit;
217 buffer_type::const_iterator t1 = limits.begin();
221 while (hit->getT() < *t1) { ++hit; }
223 i->getY().lpos =
distance(buffer.cbegin(), hit) - 1;
228 frame_type ::const_reverse_iterator hit = buffer.rbegin(); ++hit;
229 buffer_type::const_reverse_iterator t1 = limits.rbegin();
233 while (hit->getT() >= *t1) { ++hit; }
235 i->getY().rpos =
distance(buffer.cbegin(), hit.base()) - 1;
275 return (*(this->
get()))[this->
getAddress(module)];
297 int second = grid.
getIndex(timeRange.getUpperLimit());
299 if (first < 0) { first = 0; }
300 if (second >= grid.
getSize()) { second = grid.size() - 1; }
302 return frame.
subset(grid.
getY(first).lpos, grid.
getY(second).rpos);
const JDAQSuperFrame & getSuperFrame(const JDAQModuleIdentifier &module) const
Get super frame.
int getModuleID() const
Get module identifier.
The elements in a collection are sorted according to their abscissa values and a given distance opera...
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
JTOOLS::JGridCollection< element_type > grid_type
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
General purpose class for hash map of unique elements.
void configure(const JDAQTimeslice ×lice)
Configure.
bool hasSuperFrame(const JDAQModuleIdentifier &module) const
Check presence of module.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary class for TDC constraints.
JDAQFrameSubset getFrameSubset(const JDAQModuleIdentifier &module, const JTimeRange &timeRange) const
Get subset of frame given module identifier and range of hit times.
const JDAQHit DAQHIT_MAX
end hit marker
unsigned int JTDC_t
leading edge [ns]
JTOOLS::JElement2D< double, pair_type > element_type
std::vector< JHitW0 > buffer_type
hits
JDAQTimeslice::const_iterator const_iterator
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Auxiliary base class for JTimesliceRouter.
JTimesliceRouter(const int numberOfBins)
Constructor.
Auxiliary structure for indexing hits in a data frame.
const int getAddress(const JDAQModuleIdentifier &module) const
Get address of module.
int getFrameIndex(const double t_ns)
Get frame index for a given time in ns.
double getFrameTime()
Get frame time duration.
Template implementation of class that holds pointer to object(s).
JTimesliceRouter(const JDAQTimeslice ×lice, const int numberOfBins)
Constructor.
JTimesliceRouter_t(const int numberOfBins)
Constructor.
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
const JDAQHit DAQHIT_MIN
begin hit marker
JTOOLS::JHashMap< int, int > router_type
const JDAQHit::JTDC_t TMAX_NS
maximal TDC value
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [ns]).
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.
virtual void set(JClass_t *p) override
Set pointer.
JDAQFrameSubset subset(const int i1, const int i2) const
Get subset of data.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).
std::vector< grid_type > table
const JDAQHit::JTDC_t TMIN_NS
minimal TDC value