Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Types | 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
 

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

Definition at line 45 of file JCLBDefaultSimulatorInterface.hh.

Definition at line 46 of file JCLBDefaultSimulatorInterface.hh.

Definition at line 47 of file JCLBDefaultSimulatorInterface.hh.

Constructor & Destructor Documentation

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  {}
JCLBDefaultSimulatorInterface(JTDC *__TDC, JStateMachine *__state_machine)
Constructor.

Member Function Documentation

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  }
JLANG::JSinglePointer< JStateMachine > state_machine
double getRTS()
Get TDC dynamic range.
Definition: JDAQClock.hh:173
Template data structure for PMT I/O.
std::vector< JElement_t >::const_iterator const_iterator
static JTOT_t getMaximalToT()
Get maximal time-over-threshold.
Definition: JDAQHit.hh:107
static double getMinimalToT()
Get minimal pulse length of time-over-threshold measurement.
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  }
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  }

The documentation for this class was generated from the following file: