Jpp
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
JDETECTOR::JPMTSignalProcessorInterface Class Reference

PMT signal processor interface. More...

#include <JPMTSignalProcessorInterface.hh>

Inheritance diagram for JDETECTOR::JPMTSignalProcessorInterface:
JDETECTOR::JPMTAnalogueSignalProcessor

Public Member Functions

 JPMTSignalProcessorInterface ()
 Default constructor. More...
 
virtual ~JPMTSignalProcessorInterface ()
 Virtual destructor. More...
 
void operator() (const JCalibration &calibration, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const
 Process hits. More...
 
virtual bool applyQE () const
 Apply relative QE. More...
 
virtual double getRandomTime (const double t_ns) const
 Get randomised time according transition time distribution. More...
 
virtual bool compare (const JPhotoElectron &first, const JPhotoElectron &second) const
 Compare arrival times of photo-electrons. More...
 
virtual double getRandomAmplitude (const int NPE) const
 Get randomised amplitude according gain and gain spread. More...
 
virtual double getProbability (const double npe, const int NPE) const
 Get probability for given charge. More...
 
virtual bool applyThreshold (const double npe) const
 Apply threshold. More...
 
virtual double getRiseTime (const double npe) const
 Get time to pass threshold. More...
 
virtual double getTimeOverThreshold (const double npe) const
 Get time over threshold (ToT). More...
 
virtual double getDerivative (const double npe) const
 Get derivative of number of photo-electrons to time over threshold. More...
 
virtual double getSurvivalProbability (const int NPE) const
 Probability that a hit survives the simulation of the PMT. More...
 
virtual void merge (JPMTData< JPMTPulse > &data) const
 Merging of PMT hits. More...
 
double getNPE (const double tot_ns, const double eps=1.0e-3) const
 Get number of photo-electrons. More...
 

Static Public Member Functions

static double getTmin ()
 Get two photo-electron resolution for time-over-threshold. More...
 
static double getQmin ()
 Get minimal width of charge distribution. More...
 

Private Attributes

JPMTData< JPhotoElectronbuffer
 

Detailed Description

PMT signal processor interface.

This class supports the implementation of the PMT simulator interface using an alternative set of virtual methods. These methods constitute a user interface to the expected performance of a PMT.

Each photon is converted to a photo-electron using member method JPMTSignalProcessorInterface::getRandomTime. For this, the data structure JPhotoElectron is used. Note that the quantum efficiency (QE) of the PMT actually is included in the simulation of the detector response. All photo-electrons are then time sorted. The photo-electrons which simultaneously arrive are merged. The corresponding condition is defined by member method JPMTSignalProcessorInterface::compare. The time of the combined signal is determined by the time of the first photo-electron and the rise time of the analogue pulse to the threshold of the discriminator. In this, the actual amplitude of the combined analogue signal and the calibration of the PMT are taken into account. The amplitude of the combined analogue signal is simulated using member method JPMTSignalProcessorInterface::getRandomAmplitude. For this, the data structure JPMTSignal is used.

The analogue signals of the PMT are processed by a discriminator. This discriminator produces a time-over-threshold signal for each analogue signal that passes a preset threshold. The output signal is described by the time of the leading edge and the length of the time-over-threshold signal. For this, the data structure JPMTPulse is used. The determination of the time of the leading edge and the length of the time-over-threshold signal require a designated model. The class JPMTAnalogueSignalProcessor provides for an implementation of such a model.

Overlapping time-over-threshold pulses are merged. The time of the leading edge is then set to the earliest leading edge and the time-over-threshold to the difference between the latest trailing edge and the earliest leading edge. The merging of hits is implemented in member method JPMTSignalProcessorInterface::merge.

The default implementation of these virtual methods corresponds to no smearing and a time-over-threshold value equal to a fixed two photo-electron resolution. The width of the charge distribution and the two photo-electron resolution are implemented in methods JPMTSignalProcessorInterface::getQmin() and JPMTSignalProcessorInterface::getTmin(), respectively. For a realistic PMT simulation, the derived class should provide for an implementation of each of these virtual methods.

Definition at line 69 of file JPMTSignalProcessorInterface.hh.

Constructor & Destructor Documentation

◆ JPMTSignalProcessorInterface()

JDETECTOR::JPMTSignalProcessorInterface::JPMTSignalProcessorInterface ( )
inline

Default constructor.

Definition at line 74 of file JPMTSignalProcessorInterface.hh.

75  {}

◆ ~JPMTSignalProcessorInterface()

virtual JDETECTOR::JPMTSignalProcessorInterface::~JPMTSignalProcessorInterface ( )
inlinevirtual

Virtual destructor.

Definition at line 81 of file JPMTSignalProcessorInterface.hh.

82  {}

Member Function Documentation

◆ operator()()

void JDETECTOR::JPMTSignalProcessorInterface::operator() ( const JCalibration calibration,
const JPMTData< JPMTSignal > &  input,
JPMTData< JPMTPulse > &  output 
) const
inline

Process hits.

Parameters
calibrationPMT calibration
inputPMT signals
outputPMT hits

Definition at line 92 of file JPMTSignalProcessorInterface.hh.

95  {
96  // apply transition time distribution to each photo-electron.
97 
98  buffer.clear();
99 
100  for (JPMTData<JPMTSignal>::const_iterator hit = input.begin(); hit != input.end(); ++hit) {
101  for (int i = 0; i != hit->npe; ++i) {
102  if (applyQE()) {
103  buffer.push_back(JPhotoElectron(getRandomTime(hit->t_ns)));
104  }
105  }
106  }
107 
108  if (!buffer.empty()) {
109 
111 
112  buffer.sort();
113 
114 
115  // generate PMT hits from time sequence of photo-electrons.
116 
117  for (JPMTData<JPhotoElectron>::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++q) {
118 
119  while (compare(*p,*q)) {
120  ++q;
121  }
122 
123  const double npe = getRandomAmplitude(distance(p,q));
124 
125  if (applyThreshold(npe)) {
126  output.push_back(JPMTPulse(putTime(p->t_ns + getRiseTime(npe), calibration), getTimeOverThreshold(npe)));
127  }
128 
129  p = q;
130  }
131 
132  // merge overlapping PMT hits.
133 
134  merge(output);
135  }
136  }

◆ applyQE()

virtual bool JDETECTOR::JPMTSignalProcessorInterface::applyQE ( ) const
inlinevirtual

Apply relative QE.

The default implementation returns always true.

Returns
true

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 145 of file JPMTSignalProcessorInterface.hh.

146  {
147  return true;
148  }

◆ getRandomTime()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getRandomTime ( const double  t_ns) const
inlinevirtual

Get randomised time according transition time distribution.

The default implementation returns the given value.

Parameters
t_nstime [ns]
Returns
time [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 158 of file JPMTSignalProcessorInterface.hh.

159  {
160  return t_ns;
161  }

◆ compare()

virtual bool JDETECTOR::JPMTSignalProcessorInterface::compare ( const JPhotoElectron first,
const JPhotoElectron second 
) const
inlinevirtual

Compare arrival times of photo-electrons.

Two (or more) photo-electrons are merged if they are comparable. The default implementation returns uses JPMTSignalProcessorInterface::getTmin() as time window.

Parameters
firstfirst photo-electron
secondsecond photo-electron
Returns
false

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 174 of file JPMTSignalProcessorInterface.hh.

175  {
176  return second.t_ns - first.t_ns <= getTmin();
177  }

◆ getRandomAmplitude()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getRandomAmplitude ( const int  NPE) const
inlinevirtual

Get randomised amplitude according gain and gain spread.

The default implementation returns the given value.

Parameters
NPEnumber of photo-electrons
Returns
number of photo-electrons

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 187 of file JPMTSignalProcessorInterface.hh.

188  {
189  return (double) NPE;
190  }

◆ getProbability()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getProbability ( const double  npe,
const int  NPE 
) const
inlinevirtual

Get probability for given charge.

Parameters
npeobserved number of photo-electrons
NPEtrue number of photo-electrons
Returns
probability [npe^-1]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 200 of file JPMTSignalProcessorInterface.hh.

201  {
202  return (fabs(npe - NPE) < 0.5*getQmin() ? 1.0/getQmin() : 0.0);
203  }

◆ applyThreshold()

virtual bool JDETECTOR::JPMTSignalProcessorInterface::applyThreshold ( const double  npe) const
inlinevirtual

Apply threshold.

The default implementation returns always true.

Parameters
npenumber of photo-electrons
Returns
true if pass; else false

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 213 of file JPMTSignalProcessorInterface.hh.

214  {
215  return true;
216  }

◆ getRiseTime()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getRiseTime ( const double  npe) const
inlinevirtual

Get time to pass threshold.

The default implementation returns 0.

Parameters
npenumber of photo-electrons
Returns
time [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 226 of file JPMTSignalProcessorInterface.hh.

227  {
228  return 0.0;
229  }

◆ getTimeOverThreshold()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getTimeOverThreshold ( const double  npe) const
inlinevirtual

Get time over threshold (ToT).

The default implementation returns JPMTSignalProcessorInterface::getTmin().

Parameters
npenumber of photo-electrons
Returns
ToT [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 239 of file JPMTSignalProcessorInterface.hh.

240  {
241  return getTmin();
242  }

◆ getDerivative()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getDerivative ( const double  npe) const
inlinevirtual

Get derivative of number of photo-electrons to time over threshold.

The default implementation returns infinity.

Parameters
npenumber of photo-electrons
Returns
dnpe/dToT [ns^-1]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 252 of file JPMTSignalProcessorInterface.hh.

253  {
254  return std::numeric_limits<double>::max();
255  }

◆ getSurvivalProbability()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getSurvivalProbability ( const int  NPE) const
inlinevirtual

Probability that a hit survives the simulation of the PMT.

The default implementation returns 1 if given value larger than 0.

Parameters
NPEnumber of photo-electrons
Returns
probability

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 265 of file JPMTSignalProcessorInterface.hh.

266  {
267  if (NPE > 0)
268  return 1.0;
269  else
270  return 0.0;
271  }

◆ merge()

virtual void JDETECTOR::JPMTSignalProcessorInterface::merge ( JPMTData< JPMTPulse > &  data) const
inlinevirtual

Merging of PMT hits.

Hits with overlapping time-over-threshold signals should -de facto- be combined. In this, the leading edge is maintained and the time-over-threshold is set to the difference between the overall trailing and leading edges. As a result, the number of PMT hits may be reduced.

Parameters
dataPMT hits

Definition at line 284 of file JPMTSignalProcessorInterface.hh.

285  {
286  using namespace std;
287 
288  JPMTData<JPMTPulse>::iterator out = data.begin();
289 
290  for (JPMTData<JPMTPulse>::iterator i = data.begin(); i != data.end(); ) {
291 
292  double t1 = i->t_ns;
293  double t2 = i->t_ns + i->tot_ns;
294 
295  while (++i != data.end() && i->t_ns < t2 + getTmin()) {
296  t2 = max(t2, i->t_ns + i->tot_ns);
297  }
298 
299  out->t_ns = t1;
300  out->tot_ns = t2 - t1;
301 
302  ++out;
303  }
304 
305  data.resize(distance(data.begin(), out));
306  }

◆ getNPE()

double JDETECTOR::JPMTSignalProcessorInterface::getNPE ( const double  tot_ns,
const double  eps = 1.0e-3 
) const
inline

Get number of photo-electrons.

Parameters
tot_nstime over threshold [ns]
epsprecision
Returns
number of photo-electrons

Definition at line 316 of file JPMTSignalProcessorInterface.hh.

318  {
319  static const int N = 100;
320 
321  if (tot_ns > 0.0) {
322 
323  double xmin = 0.0;
324  double xmax = 100.0;
325 
326  for (int i = 0; i != N; ++i) {
327 
328  const double x = 0.5 * (xmin + xmax);
329  const double y = this->getTimeOverThreshold(x);
330 
331  if (fabs(y - tot_ns) < eps) {
332  return x;
333  }
334 
335  if (y < tot_ns)
336  xmin = x;
337  else
338  xmax = x;
339  }
340 
341  return 0.5 * (xmin + xmax);
342 
343  } else {
344 
345  double xmin = 0.0;
346  double xmax = 2.0;
347 
348  for (int i = 0; i != N; ++i) {
349 
350  const double x = 0.5 * (xmin + xmax);
351  const double y = this->getTimeOverThreshold(x);
352 
353  if (y == 0.0)
354  xmin = x;
355  else
356  xmax = x;
357  }
358 
359  return 0.5 * (xmin + xmax);
360  }
361  }

◆ getTmin()

static double JDETECTOR::JPMTSignalProcessorInterface::getTmin ( )
inlinestatic

Get two photo-electron resolution for time-over-threshold.

Returns
minimal time [ns]

Definition at line 369 of file JPMTSignalProcessorInterface.hh.

370  {
371  return 1.0;
372  }

◆ getQmin()

static double JDETECTOR::JPMTSignalProcessorInterface::getQmin ( )
inlinestatic

Get minimal width of charge distribution.

Returns
minimal charge [npe]

Definition at line 380 of file JPMTSignalProcessorInterface.hh.

381  {
382  return 1.0e-3;
383  }

Member Data Documentation

◆ buffer

JPMTData<JPhotoElectron> JDETECTOR::JPMTSignalProcessorInterface::buffer
mutableprivate

Definition at line 387 of file JPMTSignalProcessorInterface.hh.


The documentation for this class was generated from the following file:
JDETECTOR::JPhotoElectron::t_ns
double t_ns
time [ns]
Definition: JPMTSimulator.hh:56
JDETECTOR::JPMTSignalProcessorInterface::getQmin
static double getQmin()
Get minimal width of charge distribution.
Definition: JPMTSignalProcessorInterface.hh:380
JDETECTOR::JPMTSignalProcessorInterface::getRiseTime
virtual double getRiseTime(const double npe) const
Get time to pass threshold.
Definition: JPMTSignalProcessorInterface.hh:226
JDETECTOR::JPhotoElectron::getEndMarker
static JPhotoElectron getEndMarker()
Get end marker.
Definition: JPMTSimulator.hh:50
JDETECTOR::putTime
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
Definition: JDetector/JCalibration.hh:216
JDETECTOR::JPMTSignalProcessorInterface::applyThreshold
virtual bool applyThreshold(const double npe) const
Apply threshold.
Definition: JPMTSignalProcessorInterface.hh:213
JDETECTOR::JPMTSignalProcessorInterface::getTmin
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
Definition: JPMTSignalProcessorInterface.hh:369
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JDETECTOR::JPMTSignalProcessorInterface::merge
virtual void merge(JPMTData< JPMTPulse > &data) const
Merging of PMT hits.
Definition: JPMTSignalProcessorInterface.hh:284
JDETECTOR::JPMTSignalProcessorInterface::compare
virtual bool compare(const JPhotoElectron &first, const JPhotoElectron &second) const
Compare arrival times of photo-electrons.
Definition: JPMTSignalProcessorInterface.hh:174
JDETECTOR::JPhotoElectron
Data structure for single photo-electron.
Definition: JPMTSimulator.hh:26
JDETECTOR::JPMTData::iterator
std::vector< JElement_t >::iterator iterator
Definition: JPMTSimulator.hh:170
JDETECTOR::JPMTData::const_iterator
std::vector< JElement_t >::const_iterator const_iterator
Definition: JPMTSimulator.hh:171
JDETECTOR::JPMTSignalProcessorInterface::getRandomAmplitude
virtual double getRandomAmplitude(const int NPE) const
Get randomised amplitude according gain and gain spread.
Definition: JPMTSignalProcessorInterface.hh:187
JDETECTOR::JPMTPulse
Data structure for PMT digital pulse.
Definition: JPMTSimulator.hh:120
JDETECTOR::JPMTSignalProcessorInterface::buffer
JPMTData< JPhotoElectron > buffer
Definition: JPMTSignalProcessorInterface.hh:387
JDETECTOR::JPMTSignalProcessorInterface::applyQE
virtual bool applyQE() const
Apply relative QE.
Definition: JPMTSignalProcessorInterface.hh:145
std
Definition: jaanetDictionary.h:36
JDETECTOR::JPMTSignalProcessorInterface::getRandomTime
virtual double getRandomTime(const double t_ns) const
Get randomised time according transition time distribution.
Definition: JPMTSignalProcessorInterface.hh:158
JDETECTOR::JPMTSignalProcessorInterface::getTimeOverThreshold
virtual double getTimeOverThreshold(const double npe) const
Get time over threshold (ToT).
Definition: JPMTSignalProcessorInterface.hh:239