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

enum  JThresholdDomains { BELOW_THRESHOLDBAND = -1, IN_THRESHOLDBAND = 0, ABOVE_THRESHOLD = 2 }
 Threshold domain specifiers. More...
 

Public Member Functions

 JPMTSignalProcessorInterface (const double max_charge=100.0)
 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 in accordance with gain and gain spread. More...
 
virtual double getChargeProbability (const double npe, const int NPE) const
 Get probability for given charge. More...
 
virtual JThresholdDomains 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...
 
virtual 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...
 

Protected Attributes

double MAX_CHARGE
 Maximum charge [npe]. 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::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 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.

Member Enumeration Documentation

Threshold domain specifiers.

Enumerator
BELOW_THRESHOLDBAND 

below threshold band

IN_THRESHOLDBAND 

inside threshold band

ABOVE_THRESHOLD 

above threshold band

Definition at line 89 of file JPMTSignalProcessorInterface.hh.

89  {
90  BELOW_THRESHOLDBAND = -1, //!< below threshold band
91  IN_THRESHOLDBAND = 0, //!< inside threshold band
92  ABOVE_THRESHOLD = 2 //!< above threshold band
93  };

Constructor & Destructor Documentation

JDETECTOR::JPMTSignalProcessorInterface::JPMTSignalProcessorInterface ( const double  max_charge = 100.0)
inline

Default constructor.

Definition at line 74 of file JPMTSignalProcessorInterface.hh.

74  :
75  MAX_CHARGE(max_charge)
76  {}
virtual JDETECTOR::JPMTSignalProcessorInterface::~JPMTSignalProcessorInterface ( )
inlinevirtual

Virtual destructor.

Definition at line 82 of file JPMTSignalProcessorInterface.hh.

83  {}

Member Function Documentation

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 103 of file JPMTSignalProcessorInterface.hh.

106  {
107  // apply transition time distribution to each photo-electron.
108 
109  buffer.clear();
110 
111  for (JPMTData<JPMTSignal>::const_iterator hit = input.begin(); hit != input.end(); ++hit) {
112  for (int i = 0; i != hit->npe; ++i) {
113  if (applyQE()) {
114  buffer.push_back(JPhotoElectron(getRandomTime(hit->t_ns)));
115  }
116  }
117  }
118 
119  if (!buffer.empty()) {
120 
122 
123  buffer.sort();
124 
125 
126  // generate PMT hits from time sequence of photo-electrons.
127 
128  for (JPMTData<JPhotoElectron>::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++q) {
129 
130  while (compare(*p,*q)) {
131  ++q;
132  }
133 
134  const double npe = getRandomCharge(distance(p,q));
135  if (applyThreshold(npe) > BELOW_THRESHOLDBAND) {
136  output.push_back(JPMTPulse(putTime(p->t_ns + getRiseTime(npe), calibration), getTimeOverThreshold(npe)));
137  }
138 
139  p = q;
140  }
141 
142  // merge overlapping PMT hits.
143 
144  merge(output);
145  }
146  }
Data structure for PMT digital pulse.
virtual double getRandomCharge(const int NPE) const
Get randomised charge in accordance with 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 pass threshold.
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
virtual JThresholdDomains 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 always true.

Returns
true

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 155 of file JPMTSignalProcessorInterface.hh.

156  {
157  return true;
158  }
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 168 of file JPMTSignalProcessorInterface.hh.

169  {
170  return t_ns;
171  }
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 184 of file JPMTSignalProcessorInterface.hh.

185  {
186  return second.t_ns - first.t_ns <= getTmin();
187  }
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 in accordance with 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 197 of file JPMTSignalProcessorInterface.hh.

198  {
199  return (double) NPE;
200  }
virtual double JDETECTOR::JPMTSignalProcessorInterface::getChargeProbability ( 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 210 of file JPMTSignalProcessorInterface.hh.

211  {
212  return (fabs(npe - NPE) < 0.5*getQmin() ? 1.0/getQmin() : 0.0);
213  }
static double getQmin()
Get minimal width of charge distribution.
virtual JThresholdDomains JDETECTOR::JPMTSignalProcessorInterface::applyThreshold ( const double  npe) const
inlinevirtual

Apply threshold.

The default implementation returns always ABOVE_THRESHOLD.

Parameters
npenumber of photo-electrons
Returns
threshold domain;

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 223 of file JPMTSignalProcessorInterface.hh.

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 236 of file JPMTSignalProcessorInterface.hh.

237  {
238  return 0.0;
239  }
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 249 of file JPMTSignalProcessorInterface.hh.

250  {
251  return getTmin();
252  }
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.

The default implementation returns infinity.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 262 of file JPMTSignalProcessorInterface.hh.

263  {
264  return std::numeric_limits<double>::max();
265  }
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 275 of file JPMTSignalProcessorInterface.hh.

276  {
277  if (NPE > 0)
278  return 1.0;
279  else
280  return 0.0;
281  }
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 294 of file JPMTSignalProcessorInterface.hh.

295  {
296  using namespace std;
297 
298  JPMTData<JPMTPulse>::iterator out = data.begin();
299 
300  for (JPMTData<JPMTPulse>::iterator i = data.begin(); i != data.end(); ) {
301 
302  double t1 = i->t_ns;
303  double t2 = i->t_ns + i->tot_ns;
304 
305  while (++i != data.end() && i->t_ns < t2 + getTmin()) {
306  t2 = max(t2, i->t_ns + i->tot_ns);
307  }
308 
309  out->t_ns = t1;
310  out->tot_ns = t2 - t1;
311 
312  ++out;
313  }
314 
315  data.resize(distance(data.begin(), out));
316  }
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
virtual double JDETECTOR::JPMTSignalProcessorInterface::getNPE ( const double  tot_ns,
const double  eps = 1.0e-3 
) const
inlinevirtual

Get number of photo-electrons.

The default implementation finds the time-over-threshold iteratively.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 327 of file JPMTSignalProcessorInterface.hh.

329  {
330  static const int N = 100;
331 
332  if (tot_ns > 0.0) {
333 
334  double xmin = 0.0;
335  double xmax = MAX_CHARGE;
336 
337  for (int i = 0; i != N; ++i) {
338 
339  const double x = 0.5 * (xmin + xmax);
340  const double y = this->getTimeOverThreshold(x);
341 
342  if (fabs(y - tot_ns) < eps) {
343  return x;
344  }
345 
346  if (y < tot_ns)
347  xmin = x;
348  else
349  xmax = x;
350  }
351 
352  return 0.5 * (xmin + xmax);
353 
354  } else {
355 
356  double xmin = 0.0;
357  double xmax = 2.0;
358 
359  for (int i = 0; i != N; ++i) {
360 
361  const double x = 0.5 * (xmin + xmax);
362  const double y = this->getTimeOverThreshold(x);
363 
364  if (y == 0.0)
365  xmin = x;
366  else
367  xmax = x;
368  }
369 
370  return 0.5 * (xmin + xmax);
371  }
372  }
virtual double getTimeOverThreshold(const double npe) const
Get time over threshold (ToT).
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
static double JDETECTOR::JPMTSignalProcessorInterface::getTmin ( )
inlinestatic

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

Returns
minimal time [ns]

Definition at line 380 of file JPMTSignalProcessorInterface.hh.

381  {
382  return 1.0;
383  }
static double JDETECTOR::JPMTSignalProcessorInterface::getQmin ( )
inlinestatic

Get minimal width of charge distribution.

Returns
minimal charge [npe]

Definition at line 391 of file JPMTSignalProcessorInterface.hh.

392  {
393  return 1.0e-3;
394  }

Member Data Documentation

double JDETECTOR::JPMTSignalProcessorInterface::MAX_CHARGE
protected

Maximum charge [npe].

Definition at line 398 of file JPMTSignalProcessorInterface.hh.

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

Definition at line 401 of file JPMTSignalProcessorInterface.hh.


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