Jpp
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Private Attributes | List of all members
JDETECTOR::JCLBDefaultSimulator Class Reference

Default CLB simulation. More...

#include <JCLBDefaultSimulator.hh>

Inheritance diagram for JDETECTOR::JCLBDefaultSimulator:
JDETECTOR::JCLBDefaultSimulatorInterface JDETECTOR::JCLBSimulator

Classes

class  JStateMachine
 Auxiliary class to mimic hit ordering effects due to state machine inside CLB. More...
 
class  JTDC
 Implementation of non-linearity of TDC. More...
 

Public Member Functions

 JCLBDefaultSimulator (const JDAQHit::JTDC_t Tmax=0)
 Constructor. More...
 
virtual void processData (const JCLBInput &input, JDAQFrame &output) const
 Process data. More...
 

Static Public Member Functions

static JTOT_t getMaximalToT ()
 Get maximal pulse length of time-over-threshold measurement. More...
 
static double getMinimalToT ()
 Get minimal pulse length of time-over-threshold measurement. More...
 

Protected Types

typedef JDAQHit::JPMT_t JPMT_t
 
typedef JDAQHit::JTDC_t JTDC_t
 
typedef JDAQHit::JTOT_t JTOT_t
 

Private Attributes

JLANG::JSinglePointer< JTDCTDC
 
JLANG::JSinglePointer< JStateMachinestate_machine
 
std::vector< JDAQHitbuffer
 

Detailed Description

Default CLB simulation.

This class provides for the implementation of the conversion of a time-over-threshold pulse to a so-called hit.
A hit consists of:

The time stamping and pulse length determination is done by a TDC which is integrated inside the FPGA. The observed non-linearity of the TDC is also implemented in this class.

Although the hits from the same PMT are striclty time sorted, hits from different PMTs will be reordered due to the occupancy of the buffers inside the FPGA. This reordering is implemented in the nested class JStateMachine.

Definition at line 139 of file JCLBDefaultSimulator.hh.

Member Typedef Documentation

◆ JPMT_t

Definition at line 45 of file JCLBDefaultSimulatorInterface.hh.

◆ JTDC_t

Definition at line 46 of file JCLBDefaultSimulatorInterface.hh.

◆ JTOT_t

Definition at line 47 of file JCLBDefaultSimulatorInterface.hh.

Constructor & Destructor Documentation

◆ JCLBDefaultSimulator()

JDETECTOR::JCLBDefaultSimulator::JCLBDefaultSimulator ( const JDAQHit::JTDC_t  Tmax = 0)
inline

Constructor.

Parameters
Tmaxmaximal time difference for swap [ns]

Definition at line 228 of file JCLBDefaultSimulator.hh.

228  :
229  JCLBDefaultSimulatorInterface(new JTDC(),
230  new JStateMachine(Tmax))
231  {}

Member Function Documentation

◆ processData()

virtual void JDETECTOR::JCLBDefaultSimulatorInterface::processData ( const JCLBInput input,
JDAQFrame output 
) const
inlinevirtualinherited

Process data.

Parameters
inputPMT data
outputCLB data

Implements JDETECTOR::JCLBSimulator.

Definition at line 126 of file JCLBDefaultSimulatorInterface.hh.

128  {
129  using namespace std;
130 
131 
132  const JTDC_t TMIN = 0; // [ns]
133  const JTDC_t TMAX = (JTDC_t) getRTS(); // [ns]
134 
135  buffer.clear();
136 
137 
138  for (JPMT_t pmt = 0; pmt != (JPMT_t) input.size(); ++pmt) {
139 
140 
141  const JPMTData<JPMTPulse>& in = input[pmt];
142 
143 
144  // TDC
145 
146  JPMTData<JPMTPulse>::const_iterator hit = in.begin();
147 
148  for ( ; hit != in.end() && hit->t_ns < TMIN; ++hit) {}
149 
150  for ( ; hit != in.end() && hit->t_ns < TMAX; ++hit) {
151 
152  double t1 = hit->t_ns;
153  double tot = hit->tot_ns;
154 
155  // generate multiple hits if time-over-threshold exceeds dynamic range
156 
157  while (tot > JDAQHit::getMaximalToT()) {
158 
159  buffer.push_back(TDC->makeHit(pmt, t1, JDAQHit::getMaximalToT()));
160 
161  t1 += JDAQHit::getMaximalToT();
162  tot -= JDAQHit::getMaximalToT();
163  }
164 
165  if (tot > getMinimalToT()) {
166  buffer.push_back(TDC->makeHit(pmt, t1, (JTOT_t) (tot + 0.5)));
167  }
168  }
169  }
170 
171 
172  if (buffer.size() > 1) {
173 
174  // process data through state machine
175 
176  sort(buffer.begin(), buffer.end());
177 
178  for (std::vector<JDAQHit>::iterator q = buffer.begin(), p = q++; q != buffer.end(); ++p, ++q) {
179 
180  if (state_machine->maybeSwapped(*p,*q)) {
181  iter_swap(p,q);
182  }
183  }
184  }
185 
186 
187  output.add(buffer.size(), buffer.data());
188  }

◆ getMaximalToT()

static JTOT_t JDETECTOR::JCLBDefaultSimulatorInterface::getMaximalToT ( )
inlinestaticinherited

Get maximal pulse length of time-over-threshold measurement.

Returns
TDC value [ns]

Definition at line 196 of file JCLBDefaultSimulatorInterface.hh.

197  {
198  return 0xFE;
199  }

◆ getMinimalToT()

static double JDETECTOR::JCLBDefaultSimulatorInterface::getMinimalToT ( )
inlinestaticinherited

Get minimal pulse length of time-over-threshold measurement.

Returns
TDC value [ns]

Definition at line 207 of file JCLBDefaultSimulatorInterface.hh.

208  {
209  return 0.5;
210  }

Member Data Documentation

◆ TDC

JLANG::JSinglePointer<JTDC> JDETECTOR::JCLBDefaultSimulatorInterface::TDC
privateinherited

Definition at line 213 of file JCLBDefaultSimulatorInterface.hh.

◆ state_machine

JLANG::JSinglePointer<JStateMachine> JDETECTOR::JCLBDefaultSimulatorInterface::state_machine
privateinherited

Definition at line 214 of file JCLBDefaultSimulatorInterface.hh.

◆ buffer

std::vector<JDAQHit> JDETECTOR::JCLBDefaultSimulatorInterface::buffer
mutableprivateinherited

Definition at line 215 of file JCLBDefaultSimulatorInterface.hh.


The documentation for this class was generated from the following file:
JDETECTOR::JCLBDefaultSimulatorInterface::JPMT_t
JDAQHit::JPMT_t JPMT_t
Definition: JCLBDefaultSimulatorInterface.hh:45
JDETECTOR::JCLBDefaultSimulatorInterface::getMinimalToT
static double getMinimalToT()
Get minimal pulse length of time-over-threshold measurement.
Definition: JCLBDefaultSimulatorInterface.hh:207
KM3NETDAQ::getRTS
double getRTS()
Get TDC dynamic range.
Definition: JDAQClock.hh:173
KM3NETDAQ::JDAQFrame::add
JDAQFrame & add(const JDAQFrame &frame)
Add data.
Definition: JDAQFrame.hh:190
std::vector
Definition: JSTDTypes.hh:12
JDETECTOR::JCLBDefaultSimulatorInterface::JTDC_t
JDAQHit::JTDC_t JTDC_t
Definition: JCLBDefaultSimulatorInterface.hh:46
JDETECTOR::JPMTData::const_iterator
std::vector< JElement_t >::const_iterator const_iterator
Definition: JPMTSimulator.hh:171
JDETECTOR::JCLBDefaultSimulatorInterface::JTOT_t
JDAQHit::JTOT_t JTOT_t
Definition: JCLBDefaultSimulatorInterface.hh:47
JDETECTOR::JCLBDefaultSimulatorInterface::buffer
std::vector< JDAQHit > buffer
Definition: JCLBDefaultSimulatorInterface.hh:215
KM3NETDAQ::JDAQHit::getMaximalToT
static JTOT_t getMaximalToT()
Get maximal time-over-threshold.
Definition: JDAQHit.hh:108
JDETECTOR::JCLBDefaultSimulatorInterface::JCLBDefaultSimulatorInterface
JCLBDefaultSimulatorInterface(JTDC *__TDC, JStateMachine *__state_machine)
Constructor.
Definition: JCLBDefaultSimulatorInterface.hh:113
JDETECTOR::JCLBDefaultSimulatorInterface::TDC
JLANG::JSinglePointer< JTDC > TDC
Definition: JCLBDefaultSimulatorInterface.hh:213
JDETECTOR::JPMTData
Template data structure for PMT I/O.
Definition: JPMTSimulator.hh:165
JDETECTOR::JCLBDefaultSimulatorInterface::state_machine
JLANG::JSinglePointer< JStateMachine > state_machine
Definition: JCLBDefaultSimulatorInterface.hh:214
std
Definition: jaanetDictionary.h:36