1#ifndef __JDETECTOR__JCLBDEFAULTSIMULATOR__
2#define __JDETECTOR__JCLBDEFAULTSIMULATOR__
27 template<
class JAbscissa_t,
class JOrdinate_t>
30 JTOOLS::JElement2D<JAbscissa_t, JOrdinate_t>,
31 JTOOLS::JGridCollection,
59 void set(
const int nx,
60 const JAbscissa_t Xmin,
61 const JAbscissa_t Xmax,
67 const int N = std::distance(__begin, __end);
71 for (T i = __begin; i != __end; ++i) {
75 for (
int i = 0,
j = 1;
j != N; ++i, ++
j) {
79 for (
int i = 0; i != N; ++i) {
90 while (
j != N && Xmin + X[
j] * (Xmax - Xmin) < i->getX()) {
94 i->getY() = (JOrdinate_t) (Xmin +
j * (Xmax - Xmin) / N);
97 JFunction1D_t::compile();
109 const long long int n = (
long long int) (x / (this->getXmax() - this->getXmin()));
110 const JAbscissa_t x1 = x -
n * (this->getXmax() - this->getXmin());
112 return (JOrdinate_t) (x - x1) + JFunction1D_t::operator()(x1);
151 const double Tmin_ns = 0.0;
152 const double Tmax_ns = 4.0;
154 const double W[] = { 0.2413,
159 getTDC.
set(4000, Tmin_ns, Tmax_ns, W, W +
sizeof(W)/
sizeof(W[0]));
173 const JTOT_t tot_ns)
const override
General purpose class for a collection of sorted elements.
The elements in a collection are sorted according to their abscissa values and a given distance opera...
Interface to mimic hit ordering effects due to state machine inside CLB.
Auxiliary class to mimic hit ordering effects due to state machine inside CLB.
virtual bool maybeSwapped(const JDAQHit &first, const JDAQHit &second) const override
Test whether two consecutive hits may be swapped.
JStateMachine(const JDAQHit::JTDC_t Tmax)
Constructor.
Implementation of non-linearity of TDC.
JTDC()
Default constructor.
virtual JDAQHit makeHit(const JPMT_t pmt, const double t_ns, const JTOT_t tot_ns) const override
Make DAQ hit.
JTransferFunction1D< double, JTDC_t > getTDC
TDC non-linearity function.
JCLBDefaultSimulator(const JDAQHit::JTDC_t Tmax=0)
Constructor.
Auxiliary class for a non-linear transfer function of TDC inside FPGA.
JTOOLS::JPolintFunction1D< 0, JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >, JTOOLS::JGridCollection, JOrdinate_t > JFunction1D_t
JOrdinate_t operator()(const JAbscissa_t x) const
Get the function value including non-linearity.
JTransferFunction1D()
Default constructor.
void set(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax, T __begin, T __end)
Set the non-linearity function.
unsigned int JTDC_t
leading edge [ns]
JPMT_t getPMT() const
Get PMT.
JTDC_t getT() const
Get time.
file Auxiliary data structures and methods for detector calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).