Go to the documentation of this file.    1 #ifndef __JTRIGGER__JTIMESLICEROUTER__ 
    2 #define __JTRIGGER__JTIMESLICEROUTER__ 
   99                      const int numberOfBins) :
 
  119       this->
set(×lice);
 
  133       if (Tmin < TMIN) { Tmin = TMIN; }
 
  134       if (Tmax > TMAX) { Tmax = TMAX; }
 
  137       int number_of_elements = 2;
 
  140         if (i->size() > number_of_elements) {
 
  141           number_of_elements = i->size();
 
  150       const JGrid<double> bounds(number_of_elements, Tmin, Tmax);
 
  155       JBuffer_t buffer(bounds.getSize() + 1);
 
  157       for (
int i = 0; i != bounds.getSize(); ++i) {
 
  161       buffer[bounds.getSize()] = TMAX;
 
  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;
 
  277       const int first  = grid.
getIndex(timeRange.getLowerLimit());
 
  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);
 
 
Auxiliary structure for indexing hits in a data frame.
virtual void set(const JDAQTimeslice *p)
Set pointer.
JTOOLS::JGridCollection< element_type > grid_type
virtual const JDAQTimeslice * get() const
Get pointer.
JDAQFrameSubset getFrameSubset(const JDAQModuleIdentifier &module, const JTimeRange &timeRange) const
Get subset of frame given module identifier and range of hit times.
JTimesliceRouter(const JDAQTimeslice ×lice, const int numberOfBins)
Constructor.
int getModuleID() const
Get module identifier.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
void copy(const Head &from, JHead &to)
Copy header from from to to.
double getFrameTime()
Get frame time duration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template implementation of class that holds pointer to object(s).
const JDAQSuperFrame & getSuperFrame(const JDAQModuleIdentifier &module) const
Get super frame.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JTimesliceRouter(const int numberOfBins)
Constructor.
JDAQFrameSubset subset(const int i1, const int i2) const
Get subset of data.
std::vector< grid_type > table
void configure(const JDAQTimeslice ×lice)
Configure.
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
unsigned int JTDC_t
leading edge [ns]
const int getAddress(const JDAQModuleIdentifier &module) const
Get address of module.
KM3NeT DAQ data structures and auxiliaries.
JTOOLS::JRouter< int > router_type
Data frame of one optical module.
bool hasSuperFrame(const JDAQModuleIdentifier &module) const
Check presence of module.
JDAQTimeslice::const_iterator const_iterator
JTOOLS::JElement2D< double, JPair_t > element_type
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
int getFrameIndex(const double t_ns)
Get frame index for a given time in ns.