1 #ifndef __JTIMESLICE__JRANDOMTIMESLICE__
2 #define __JTIMESLICE__JRANDOMTIMESLICE__
63 for (JDetector::const_iterator module = simbad->begin(); module != simbad->end(); ++module) {
65 if (!module->empty()) {
67 buffer.
reset(module->size());
73 simbad(*module, buffer, *(this->rbegin()));
102 if (N < 100) { N = 100; }
103 if (N > 50000) { N = 50000; }
110 for (
iterator frame = this->begin(); frame != this->end(); ++frame) {
112 if (!frame->empty()) {
114 for (
size_t i = 0; i != N; ++i) {
121 numeric_limits<JTDC_t>::max());
125 T_max[hit->getPMT()] = hit->getT();
127 const int i = hit->getT() / Ts;
129 buffer[i].push_back(*hit);
135 if (frame->testHighRateVeto(pmt)) {
136 keep.insert(T_max[pmt] / Ts);
146 for (
size_t in = 0; in != N; ++in) {
148 const size_t out = index [in];
151 const JTDC_t T_in = in * Ts;
152 const JTDC_t T_out = out * Ts;
154 for (buffer_type::iterator i = zbuf.begin(); i != zbuf.end(); ++i, ++hit) {
155 *hit =
JDAQHit(i->getPMT(), (i->getT() - T_out) + T_in, i->getToT());
185 for (
size_t i = 0; i != this->size(); ++i) {
191 for (
const size_t i2 : keep) {
193 random_shuffle(i1, i2);
198 random_shuffle(i1, this->size());
210 for (
int i = i2 - 1; i > i1; --i) {
212 const int l = i1 + gRandom->Integer(i - i1);
214 std::swap((*
this)[i], (*
this)[l]);
KM3NeT DAQ constants, bit handling, etc.
Auxiliaries for creation of time slice data.
virtual void generateHits(const JModule &module, const JTimeRange &period, JModuleData &output) const override
Generate hits.
bool hasPMTSimulator() const
Check availability of PMT simulator.
bool hasK40Simulator() const
Check availability of K40 simulator.
bool hasCLBSimulator() const
Check availability of CLB simulator.
Data structure for PMT data corresponding to a detector module.
void reset(size_t size)
Reset buffers.
void setDAQChronometer(const JDAQChronometer &chronometer)
Set DAQ chronometer.
int getFrameIndex() const
Get frame index.
unsigned int JTDC_t
leading edge [ns]
Data frame of one optical module.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Auxiliary class for TDC constraints.
Auxiliary data structure for randomisation of indices.
random_indices_t(const size_t N)
Constructor.
void random_shuffle(const int i1, const int i2)
Randomly shuffle values between given indices.
void random_shuffle(const std::set< size_t > &keep)
Randomly shuffle values between fixed indices.
Timeslice with random data.
JRandomTimeslice(const JDAQChronometer &chronometer, const JDetectorSimulator &simbad)
Constructor.
JRandomTimeslice()
Default constructor.
void recycle(const double T_ns)
Recycle time slice by randomly shuffling time intervals of data.
Base class class for generation of time slice data.