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

Default CLB simulation. More...

#include <JCLBDefaultSimulatorInterface.hh>

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

Classes

class  JStateMachine
 Interface to mimic hit ordering effects due to state machine inside CLB. More...
 
class  JTDC
 Interface for TDC. More...
 

Public Member Functions

 JCLBDefaultSimulatorInterface (JTDC *__TDC, JStateMachine *__state_machine)
 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 a default implementation of the JCLBSimulator interface which is based on a simulation of the TDC and the state machine inside the CLB. In this, the number of hits may actually change due to the dynamic range of the TDC (loss of hits) and the dynamic range of the time-over-threshold (gain of hits). The nested class JStateMachine constitutes a user interface for the simulation of the state machine through method JStateMachine::maybeSwapped(). With the default implementation, the overall time ordering if hits is maintained. For a realistic simulation of the CLB, a pointer to an implementation of this interface should be provided.

Definition at line 40 of file JCLBDefaultSimulatorInterface.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

◆ JCLBDefaultSimulatorInterface()

JDETECTOR::JCLBDefaultSimulatorInterface::JCLBDefaultSimulatorInterface ( JTDC __TDC,
JStateMachine __state_machine 
)
inline

Constructor.

N.B: This class owns the object pointed to using JSinglePointer<>.

Parameters
__TDCpointer TDC simulator
__state_machinepointer state machine

Definition at line 113 of file JCLBDefaultSimulatorInterface.hh.

113  :
114  JCLBSimulator(),
115  TDC (__TDC),
116  state_machine(__state_machine)
117  {}

Member Function Documentation

◆ processData()

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

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 ( )
inlinestatic

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 ( )
inlinestatic

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
private

Definition at line 213 of file JCLBDefaultSimulatorInterface.hh.

◆ state_machine

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

Definition at line 214 of file JCLBDefaultSimulatorInterface.hh.

◆ buffer

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

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
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
JDETECTOR::JCLBSimulator::JCLBSimulator
JCLBSimulator()
Default constructor.
Definition: JCLBSimulator.hh:62
KM3NETDAQ::JDAQHit::getMaximalToT
static JTOT_t getMaximalToT()
Get maximal time-over-threshold.
Definition: JDAQHit.hh:111
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