Jpp  18.0.0-rc.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 getRandomCharge (const int NPE) const
 Get randomised charge according to gain and gain spread. More...
 
virtual double getChargeProbability (const double npe, const int NPE) const
 Get probability density for given charge. More...
 
virtual bool applyThreshold (const double npe) const
 Apply threshold. More...
 
virtual double getRiseTime (const double npe) const
 Get time to reach 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 double getNPE (const double tot_ns) const
 Get number of photo-electrons. More...
 
virtual void merge (JPMTData< JPMTPulse > &data) const
 Merging of PMT hits. More...
 

Static Public Member Functions

static double getTmin ()
 Get two photo-electron resolution for time-over-threshold. More...
 
static double getQmin ()
 Get 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 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. A relative QE is applied via method applyQE(). All photo-electrons are then time sorted. The photo-electrons which simultaneously arrive are merged. The corresponding condition is defined by member method 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 via method getRiseTime(). 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 getRandomCharge(). 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 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 times the number of photo-electrons. The width of the charge distribution and the two photo-electron resolution are implemented in methods getQmin() and getTmin(), respectively.

For a realistic PMT simulation, the derived class should provide for an implementation of each of these virtual methods.

Definition at line 63 of file JPMTSignalProcessorInterface.hh.

Constructor & Destructor Documentation

JDETECTOR::JPMTSignalProcessorInterface::JPMTSignalProcessorInterface ( )
inline

Default constructor.

Definition at line 68 of file JPMTSignalProcessorInterface.hh.

69  {}
virtual JDETECTOR::JPMTSignalProcessorInterface::~JPMTSignalProcessorInterface ( )
inlinevirtual

Virtual destructor.

Definition at line 75 of file JPMTSignalProcessorInterface.hh.

76  {}

Member Function Documentation

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

Process hits.

Two (or more) photo-electrons are combined if they are comparable according method compare.
Two (or more) consecutive hits hits maybe merged (according method merge).

Parameters
calibrationPMT calibration
inputPMT signals
outputPMT hits

Definition at line 89 of file JPMTSignalProcessorInterface.hh.

92  {
93  // apply transition time distribution to each photo-electron.
94 
95  buffer.clear();
96 
97  for (JPMTData<JPMTSignal>::const_iterator hit = input.begin(); hit != input.end(); ++hit) {
98  for (int i = 0; i != hit->npe; ++i) {
99  if (applyQE()) {
100  buffer.push_back(JPhotoElectron(getRandomTime(hit->t_ns)));
101  }
102  }
103  }
104 
105  if (!buffer.empty()) {
106 
108 
109  buffer.sort();
110 
111 
112  // generate PMT hits from time sequence of photo-electrons.
113 
114  for (JPMTData<JPhotoElectron>::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++q) {
115 
116  while (compare(*p,*q)) {
117  ++q;
118  }
119 
120  const double npe = getRandomCharge(distance(p,q));
121 
122  if (applyThreshold(npe)) {
123  output.push_back(JPMTPulse(putTime(p->t_ns + getRiseTime(npe), calibration), getTimeOverThreshold(npe)));
124  }
125 
126  p = q;
127  }
128 
129  // merge overlapping PMT hits.
130 
131  merge(output);
132  }
133  }
Data structure for PMT digital pulse.
virtual double getRandomCharge(const int NPE) const
Get randomised charge according to gain and gain spread.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Data structure for single photo-electron.
virtual void merge(JPMTData< JPMTPulse > &data) const
Merging of PMT hits.
virtual bool applyQE() const
Apply relative QE.
virtual double getRiseTime(const double npe) const
Get time to reach threshold.
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
virtual bool applyThreshold(const double npe) const
Apply threshold.
virtual bool compare(const JPhotoElectron &first, const JPhotoElectron &second) const
Compare arrival times of photo-electrons.
static JPhotoElectron getEndMarker()
Get end marker.
virtual double getRandomTime(const double t_ns) const
Get randomised time according transition time distribution.
virtual double getTimeOverThreshold(const double npe) const
Get time-over-threshold (ToT).
std::vector< JElement_t >::const_iterator const_iterator
virtual bool JDETECTOR::JPMTSignalProcessorInterface::applyQE ( ) const
inlinevirtual

Apply relative QE.

The default implementation returns true.

Returns
true if accepted; false if rejected

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 142 of file JPMTSignalProcessorInterface.hh.

143  {
144  return true;
145  }
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 155 of file JPMTSignalProcessorInterface.hh.

156  {
157  return t_ns;
158  }
virtual bool JDETECTOR::JPMTSignalProcessorInterface::compare ( const JPhotoElectron first,
const JPhotoElectron second 
) const
inlinevirtual

Compare arrival times of photo-electrons.

The default implementation uses method getTmin as two photo-electron resolution.

Parameters
firstfirst photo-electron
secondsecond photo-electron
Returns
true if arrival times of photo-electrons are within two photo-electron resolution; else false

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 169 of file JPMTSignalProcessorInterface.hh.

170  {
171  return second.t_ns - first.t_ns <= getTmin();
172  }
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
virtual double JDETECTOR::JPMTSignalProcessorInterface::getRandomCharge ( const int  NPE) const
inlinevirtual

Get randomised charge according to 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 182 of file JPMTSignalProcessorInterface.hh.

183  {
184  return (double) NPE;
185  }
virtual double JDETECTOR::JPMTSignalProcessorInterface::getChargeProbability ( const double  npe,
const int  NPE 
) const
inlinevirtual

Get probability density 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 195 of file JPMTSignalProcessorInterface.hh.

196  {
197  return (fabs(npe - NPE) <= 0.5 * getQmin() ? 1.0 / getQmin() : 0.0);
198  }
static double getQmin()
Get width of charge distribution.
virtual bool JDETECTOR::JPMTSignalProcessorInterface::applyThreshold ( const double  npe) const
inlinevirtual

Apply threshold.

The default implementation returns true.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 208 of file JPMTSignalProcessorInterface.hh.

209  {
210  return (npe > 0.0);
211  }
virtual double JDETECTOR::JPMTSignalProcessorInterface::getRiseTime ( const double  npe) const
inlinevirtual

Get time to reach threshold.

The default implementation returns 0.

Parameters
npenumber of photo-electrons
Returns
time [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 221 of file JPMTSignalProcessorInterface.hh.

222  {
223  return 0.0;
224  }
virtual double JDETECTOR::JPMTSignalProcessorInterface::getTimeOverThreshold ( const double  npe) const
inlinevirtual

Get time-over-threshold (ToT).

The default implementation corresponds to a linear relation between the number of photo-electrons and the time-over-threshold.

Parameters
npenumber of photo-electrons
Returns
ToT [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 234 of file JPMTSignalProcessorInterface.hh.

235  {
236  return TIME_OVER_THRESHOLD_NS + getTmin() * (round(npe) - 1.0);
237  }
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
virtual double JDETECTOR::JPMTSignalProcessorInterface::getDerivative ( const double  npe) const
inlinevirtual

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

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 246 of file JPMTSignalProcessorInterface.hh.

247  {
248  return 1.0 / getTmin();
249  }
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
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 259 of file JPMTSignalProcessorInterface.hh.

260  {
261  if (NPE > 0)
262  return 1.0;
263  else
264  return 0.0;
265  }
virtual double JDETECTOR::JPMTSignalProcessorInterface::getNPE ( const double  tot_ns) const
inlinevirtual

Get number of photo-electrons.

The default implementation corresponds to a linear relation between the number of photo-electrons and the time-over-threshold.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 275 of file JPMTSignalProcessorInterface.hh.

276  {
277  return 1.0 + (tot_ns - TIME_OVER_THRESHOLD_NS) / getTmin();
278  }
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
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 (I/O)

Definition at line 291 of file JPMTSignalProcessorInterface.hh.

292  {
293  using namespace std;
294 
295  JPMTData<JPMTPulse>::iterator out = data.begin();
296 
297  for (JPMTData<JPMTPulse>::iterator i = data.begin(); i != data.end(); ) {
298 
299  double t1 = i->t_ns;
300  double t2 = i->t_ns + i->tot_ns;
301 
302  while (++i != data.end() && i->t_ns < t2 + getTmin()) {
303  t2 = max(t2, i->t_ns + i->tot_ns);
304  }
305 
306  out->t_ns = t1;
307  out->tot_ns = t2 - t1;
308 
309  ++out;
310  }
311 
312  data.resize(distance(data.begin(), out));
313  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
std::vector< JElement_t >::iterator iterator
static double JDETECTOR::JPMTSignalProcessorInterface::getTmin ( )
inlinestatic

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

Returns
minimal time [ns]

Definition at line 321 of file JPMTSignalProcessorInterface.hh.

322  {
323  return 1.0;
324  }
static double JDETECTOR::JPMTSignalProcessorInterface::getQmin ( )
inlinestatic

Get width of charge distribution.

Returns
width charge distribution [npe]

Definition at line 332 of file JPMTSignalProcessorInterface.hh.

333  {
334  return 1.0e-3;
335  }

Member Data Documentation

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

Definition at line 339 of file JPMTSignalProcessorInterface.hh.


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