Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
< JStateMachine
state_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

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::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  {}
JLANG::JSinglePointer< JStateMachine > state_machine
JCLBSimulator()
Default constructor.

Member Function Documentation

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

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

Definition at line 213 of file JCLBDefaultSimulatorInterface.hh.

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

Definition at line 214 of file JCLBDefaultSimulatorInterface.hh.

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: