1 #ifndef __JDETECTOR__JCLBDEFAULTSIMULATOR__
2 #define __JDETECTOR__JCLBDEFAULTSIMULATOR__
20 namespace JDETECTOR {}
21 namespace JPP {
using namespace JDETECTOR; }
31 template<
class JAbscissa_t,
class JOrdinate_t>
34 JTOOLS::JElement2D<JAbscissa_t, JOrdinate_t>,
35 JTOOLS::JGridCollection,
63 void set(
const int nx,
64 const JAbscissa_t Xmin,
65 const JAbscissa_t Xmax,
71 const int N = std::distance(__begin, __end);
75 for (T i = __begin; i != __end; ++i) {
79 for (
int i = 0, j = 1; j != N; ++i, ++j) {
83 for (
int i = 0; i != N; ++i) {
94 while (j != N && Xmin + X[j] * (Xmax - Xmin) < i->getX()) {
98 i->getY() = (JOrdinate_t) (Xmin + j * (Xmax - Xmin) / N);
101 JFunction1D_t::compile();
113 const long long int n = (
long long int) (x / (this->getXmax() - this->getXmin()));
114 const JAbscissa_t x1 = x - n * (this->getXmax() - this->getXmin());
116 return (JOrdinate_t) (x - x1) + JFunction1D_t::operator()(x1);
156 const double Tmin_ns = 0.0;
157 const double Tmax_ns = 4.0;
159 const double W[] = { 0.2413,
164 getTDC.
set(4000, Tmin_ns, Tmax_ns, W, W +
sizeof(W)/
sizeof(W[0]));
178 const JTOT_t tot_ns)
const
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.
JTOOLS::JPolintFunction1D< 0, JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >, JTOOLS::JGridCollection, JOrdinate_t > JFunction1D_t
JTDC()
Default constructor.
JTDC_t getT() const
Get time.
JPMT_t getPMT() const
Get PMT.
unsigned int JTDC_t
leading edge [ns]
Auxiliary class to mimic hit ordering effects due to state machine inside CLB.
JOrdinate_t operator()(const JAbscissa_t x) const
Get the function value including non-linearity.
JTransferFunction1D< double, JTDC_t > getTDC
TDC non-linearity function.
General purpose class for a collection of sorted elements.
JTransferFunction1D()
Default constructor.
virtual JDAQHit makeHit(const JPMT_t pmt, const double t_ns, const JTOT_t tot_ns) const
Make DAQ hit.
virtual bool maybeSwapped(const JDAQHit &first, const JDAQHit &second) const
Test whether two consecutive hits may be swapped.
Auxiliary class for a non-linear transfer function of TDC inside FPGA.
JCLBDefaultSimulator(const JDAQHit::JTDC_t Tmax=0)
Constructor.
void set(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax, T __begin, T __end)
Set the non-linearity function.
Implementation of non-linearity of TDC.
JStateMachine(const JDAQHit::JTDC_t Tmax)
Constructor.