1 #ifndef __JTIMESLICE__JRANDOMTIMESLICE__
2 #define __JTIMESLICE__JRANDOMTIMESLICE__
62 for (JDetector::const_iterator module = simbad->begin(); module != simbad->end(); ++module) {
64 buffer.
reset(module->size());
70 simbad(*module, buffer, *(this->rbegin()));
112 for (
iterator frame = this->begin(); frame != this->end(); ++frame) {
114 if (!frame->empty()) {
117 for (
size_t i = 0; i !=
N; ++i) {
127 T_max[hit->getPMT()] = hit->getT();
132 const size_t N_i = (T_max[i] + T_step) / T_step;
134 if (N_i < N_max[i]) {
139 sort(N_max.begin(), N_max.end());
141 for (
size_t i = 0, L = 0; i != N_max.size(); ++i) {
146 for (
size_t i = M - L - 1; i != 0; --i) {
147 std::swap(index[L + i], index[L + gRandom->Integer(i+1)]);
161 for (
size_t in = 0;
in !=
M; ++
in) {
163 const size_t out = index[
in];
164 buffer_type& zbuf = buffer[out];
166 const JTDC_t T_in =
in * T_step;
167 const JTDC_t T_out = out * T_step;
169 for ( ; hit != frame->end() && hit->
getT() < T_in + T_step; ++hit) {
177 for (
size_t i = 0, number_of_hits = 0; i !=
M; ++i) {
179 memcpy(frame->data() + number_of_hits, buffer[i].data(), buffer[i].size() *
sizeof(
JDAQHit));
181 number_of_hits += buffer[i].size();
void reset(size_t size)
Reset buffers.
Data structure for PMT data corresponding to a detector module.
JRandomTimeslice()
Default constructor.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
JTDC_t getT() const
Get time.
JPMT_t getPMT() const
Get PMT.
unsigned int JTDC_t
leading edge [ns]
int getFrameIndex() const
Get frame index.
virtual void generateHits(const JModule &module, const JTimeRange &period, JModuleData &output) const
Generate hits.
JTOT_t getToT() const
Get time-over-threshold.
bool hasPMTSimulator() const
Check availability of PMT simulator.
double getFrameTime()
Get frame time duration.
void setDAQChronometer(const JDAQChronometer &chronometer)
Set DAQ chronometer.
bool hasK40Simulator() const
Check availability of K40 simulator.
bool hasCLBSimulator() const
Check availability of CLB simulator.
double getTimeSinceRTS(const int frame_index)
Get time in ns since last RTS for a given frame index.
JRandomTimeslice(const JDAQChronometer &chronometer, const JDetectorSimulator &simbad)
Constructor.
Base class class for generation of time slice data.
Auxiliaries for creation of time slice data.
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Timeslice with random data.
then usage $script[input file[working directory[option]]] nWhere option can be N
Data frame of one optical module.
void recycle(const double T_ns)
Recycle time slice by randomly shuffling time intervals of data.