1 #ifndef __JTRIGGER__JTIMESLICEROUTER__
2 #define __JTRIGGER__JTIMESLICEROUTER__
28 namespace JPP {
using namespace JTRIGGER; }
117 using namespace KM3NETDAQ;
120 this->
set(×lice);
123 for (
const_iterator i = this->
get()->begin(); i != this->
get()->end(); ++i) {
134 if (Tmin < TMIN) { Tmin = TMIN; }
135 if (Tmax > TMAX) { Tmax = TMAX; }
138 int number_of_elements = 2;
140 for (
const_iterator i = this->
get()->begin(); i != this->
get()->end(); ++i) {
141 if (i->size() > number_of_elements) {
142 number_of_elements = i->size();
156 JBuffer_t buffer(bounds.
getSize() + 1);
158 for (
int i = 0; i != bounds.
getSize(); ++i) {
162 buffer[bounds.
getSize()] = TMAX;
165 table.resize(this->
get()->size());
167 const JDAQHit JDAQHitMin(0, TMIN, 0);
168 const JDAQHit JDAQHitMax(0, TMAX, 0);
176 for (
const_iterator frame = this->
get()->begin(); frame != this->
get()->end(); ++frame, ++grid) {
178 grid->configure(bounds);
180 if (!frame->empty()) {
182 if (frame-> begin()->getT() < grid->getXmin()) {
183 THROW(
JTriggerException,
"Hit time out of range " << frame-> begin()->getT() <<
" < " << grid->getXmin());
186 if (frame->rbegin()->getT() > grid->getXmax()) {
187 THROW(
JTriggerException,
"Hit time out of range " << frame->rbegin()->getT() <<
" > " << grid->getXmax());
190 zbuf.resize(frame->size() + 2);
192 copy(frame->begin(), frame->end(), zbuf.begin() + 1);
194 *zbuf. begin() = JDAQHitMin;
195 *zbuf.rbegin() = JDAQHitMax;
198 JDAQFrame_t::const_iterator hit = zbuf.begin(); ++hit;
199 JBuffer_t ::const_iterator t1 = buffer.begin();
203 while (hit->getT() < *t1) { ++hit; }
205 i->getY().lpos =
distance(static_cast<const JDAQFrame_t&>(zbuf).begin(), hit) - 1;
210 JDAQFrame_t::const_reverse_iterator hit = zbuf.rbegin(); ++hit;
211 JBuffer_t ::const_reverse_iterator t1 = buffer.rbegin();
215 while (hit->getT() >= *t1) { ++hit; }
217 i->getY().rpos =
distance(static_cast<const JDAQFrame_t&>(zbuf).begin(), hit.base()) - 1;
257 return (*(this->
get()))[this->
getAddress(module)];
279 const int second = grid.
getIndex(timeRange.getUpperLimit());
281 if (first < 0 || second >= grid.
getSize()) {
285 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.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [ns]).
#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.
virtual void set(JClass_t *p) override
Set pointer.
int numberOfBins
number of bins for average CDF integral of optical module
JDAQFrameSubset subset(const int i1, const int i2) const
Get subset of data.