Jpp
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | Friends | List of all members
JDETECTOR::JPMTAnalogueSignalProcessor Struct Reference

PMT analogue signal processor. More...

#include <JPMTAnalogueSignalProcessor.hh>

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

Public Member Functions

 JPMTAnalogueSignalProcessor (const JPMTParameters &parameters=JPMTParameters())
 Constructor. More...
 
void configure ()
 Configure internal parameters. More...
 
double getDecayTime () const
 Get decay time. More...
 
double getT1 () const
 Get time at transition point from Gaussian to exponential. More...
 
double getY1 () const
 Get amplitude at transition point from Gaussian to exponential. More...
 
double getStartOfLinearisation () const
 Get transition point from a model dependent to linear relation between time-over-threshold and number of photo-electrons. More...
 
double getAmplitude (const double t1_ns) const
 Get amplitude at given time for a one photo-electron pulse. More...
 
double getRiseTime (const double npe, const double th) const
 Get time to pass from threshold to top of analogue pulse. More...
 
double getDecayTime (const double npe, const double th) const
 Get time to pass from top of analogue pulse to threshold. More...
 
double getSaturation (const double y) const
 Get function value with saturation. More...
 
double getDerivativeOfSaturation (const double y) const
 Get derivative of function value with saturation. More...
 
double getGainSpread (int NPE) const
 Get gain spread for given number of photo-electrons. More...
 
double getIntegralOfProbability (const double xmin, const double xmax, const int NPE) const
 Get integral of probability. More...
 
void setPMTParameters (const JPMTParameters &parameters)
 Set PMT parameters. 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 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...
 
void operator() (const JCalibration &calibration, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const
 Process hits. 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...
 
const JPMTParametersgetPMTParameters () const
 Get PMT parameters. More...
 
bool is_valid () const
 Check validity of PMT parameters. More...
 
JProperties getProperties (const JEquationParameters &equation=JPMTParameters::getEquationParameters())
 Get properties of this class. More...
 
JProperties getProperties (const JEquationParameters &equation=JPMTParameters::getEquationParameters()) const
 Get properties of this class. More...
 

Static Public Member Functions

static double getMaximalRiseTime (const double th)
 Get maximal rise time for given threshold. More...
 
static double getTH0 ()
 Get lower threshold for rise time evaluation. More...
 
static double getTH1 ()
 Get upper threshold for rise time evaluation. More...
 
static double getTmin ()
 Get two photo-electron resolution for time-over-threshold. More...
 
static double getQmin ()
 Get minimal width of charge distribution. More...
 
static JEquationParametersgetEquationParameters ()
 Get equation parameters. More...
 
static void setEquationParameters (const JEquationParameters &equation)
 Set equation parameters. More...
 

Public Attributes

double QE
 relative quantum efficiency More...
 
double gain
 gain [unit] More...
 
double gainSpread
 gain spread [unit] More...
 
double riseTime_ns
 rise time of analogue pulse [ns] More...
 
double TTS_ns
 transition time spread [ns] More...
 
double threshold
 threshold [npe] More...
 
double slope
 slope [ns/npe] More...
 
double saturation
 saturation [ns] More...
 
bool slewing
 time slewing of analogue signal More...
 

Protected Attributes

double decayTime_ns
 decay time [ns] More...
 
double t1
 time at match point [ns] More...
 
double y1
 amplitude at match point [npe] More...
 
double x1
 Transition point from a logarithmic to a linear relation between time-over-threshold and number of photo-electrons. More...
 

Private Attributes

JPMTData< JPhotoElectronbuffer
 

Friends

std::istream & operator>> (std::istream &in, JPMTAnalogueSignalProcessor &object)
 Read PMT signal from input. More...
 

Detailed Description

PMT analogue signal processor.

This class provides for an implementation of the JDETECTOR::JPMTSignalProcessorInterface using a specific model for the analogue pulse of the PMT.
In this, the leading edge of the analogue pulse from the PMT is assumed to be a Gaussian and the tail an exponential.
The width of the Gaussian is referred to as the rise time and the inverse slope of the exponential to the decay time.
The two functions are matched at a point where the values and first derivatives are identical.
Note that the decay time is related to the rise time via the specification JDETECTOR::TIME_OVER_THRESHOLD_NS.

The charge distribution is assumed to be a Gaussian which is centered at the specified gain and truncated by the specified threshold.

The transition times are generated according the specified spread as follows.

Definition at line 46 of file JPMTAnalogueSignalProcessor.hh.

Constructor & Destructor Documentation

◆ JPMTAnalogueSignalProcessor()

JDETECTOR::JPMTAnalogueSignalProcessor::JPMTAnalogueSignalProcessor ( const JPMTParameters parameters = JPMTParameters())
inline

Constructor.

Parameters
parametersPMT parameters

Definition at line 55 of file JPMTAnalogueSignalProcessor.hh.

55  :
57  JPMTParameters(parameters),
58  decayTime_ns(0.0),
59  t1(0.0),
60  y1(0.0),
61  x1(std::numeric_limits<double>::max())
62  {
63  configure();
64  }

Member Function Documentation

◆ configure()

void JDETECTOR::JPMTAnalogueSignalProcessor::configure ( )
inline

Configure internal parameters.

This method provides the implementations for

  • matching of the leading edge of the analogue pulse (Gaussian) and the tail (exponential); and
  • determination of number of photo-electrons above which the time-over-threshold linearly depends on the number of photo-electrons (apart from saturation).

Note that this method will throw an error if the value of the rise time (i.e. width of the Gaussian) is too large with respect to the specification JDETECTOR::TIME_OVER_THRESHOLD_NS.

Definition at line 78 of file JPMTAnalogueSignalProcessor.hh.

79  {
80  static const int N = 100;
81  static const double precision = 1.0e-3;
82 
83  // check rise time
84 
86  THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::configure(): Invalid rise time [ns] " << riseTime_ns);
87  }
88 
89  // decay time
90 
91  const double y = -log(threshold);
92 
93  const double a = y;
94  const double b = riseTime_ns * sqrt(2.0*y) - TIME_OVER_THRESHOLD_NS;
95  const double c = 0.5*riseTime_ns*riseTime_ns;
96 
97  const double Q = b*b - 4.0*a*c;
98 
99  if (Q > 0.0)
100  decayTime_ns = (-b + sqrt(Q)) / (2.0*a);
101  else
102  decayTime_ns = -b / (2.0*a);
103 
104  // fix matching of Gaussian and exponential
105 
106  const double x = riseTime_ns / decayTime_ns;
107 
108  t1 = riseTime_ns*x;
109  y1 = exp(-0.5*x*x);
110 
111  // determine transition point to linear dependence of time-over-threshold as a function of number of photo-electrons
112 
113  const double v = slope / getDerivativeOfSaturation(getTimeOverThreshold(1.0));
114 
115  x1 = std::numeric_limits<double>::max(); // disable linearisation
116 
117  double xmin = 1.0;
118  double xmax = 1.0 / (getDerivative(1.0) * slope);
119 
120  for (int i = 0; i != N; ++i) {
121 
122  const double x = 0.5 * (xmin + xmax);
123  const double u = getDerivative(x) * v;
124 
125  if (fabs(1.0 - u) < precision) {
126  break;
127  }
128 
129  if (u < 1.0)
130  xmin = x;
131  else
132  xmax = x;
133  }
134 
135  x1 = 0.5 * (xmin + xmax);
136  }

◆ getDecayTime() [1/2]

double JDETECTOR::JPMTAnalogueSignalProcessor::getDecayTime ( ) const
inline

Get decay time.

Returns
decay time [ns]

Definition at line 144 of file JPMTAnalogueSignalProcessor.hh.

145  {
146  return decayTime_ns;
147  }

◆ getT1()

double JDETECTOR::JPMTAnalogueSignalProcessor::getT1 ( ) const
inline

Get time at transition point from Gaussian to exponential.

Returns
time [ns]

Definition at line 155 of file JPMTAnalogueSignalProcessor.hh.

156  {
157  return t1;
158  }

◆ getY1()

double JDETECTOR::JPMTAnalogueSignalProcessor::getY1 ( ) const
inline

Get amplitude at transition point from Gaussian to exponential.

Returns
amplitude [npe]

Definition at line 166 of file JPMTAnalogueSignalProcessor.hh.

167  {
168  return y1;
169  }

◆ getStartOfLinearisation()

double JDETECTOR::JPMTAnalogueSignalProcessor::getStartOfLinearisation ( ) const
inline

Get transition point from a model dependent to linear relation between time-over-threshold and number of photo-electrons.

Returns
number of photo-electrons [npe]

Definition at line 177 of file JPMTAnalogueSignalProcessor.hh.

178  {
179  return x1;
180  }

◆ getAmplitude()

double JDETECTOR::JPMTAnalogueSignalProcessor::getAmplitude ( const double  t1_ns) const
inline

Get amplitude at given time for a one photo-electron pulse.

Parameters
t1_nstime [ns]
Returns
amplitude [npe]

Definition at line 189 of file JPMTAnalogueSignalProcessor.hh.

190  {
191  if (t1_ns < t1) {
192 
193  const double x = t1_ns / riseTime_ns;
194 
195  return exp(-0.5*x*x); // Gaussian
196 
197  } else {
198 
199  const double x = t1_ns / decayTime_ns;
200 
201  return exp(-x) / y1; // exponential
202  }
203  }

◆ getRiseTime() [1/2]

double JDETECTOR::JPMTAnalogueSignalProcessor::getRiseTime ( const double  npe,
const double  th 
) const
inline

Get time to pass from threshold to top of analogue pulse.


In this, the leading edge of the analogue pulse is assumed to be Gaussian.

Parameters
npenumber of photo-electrons
ththreshold [npe]
Returns
time [ns]

Definition at line 214 of file JPMTAnalogueSignalProcessor.hh.

215  {
216  return riseTime_ns * sqrt(2.0*log(npe/th)); // Gaussian
217  }

◆ getDecayTime() [2/2]

double JDETECTOR::JPMTAnalogueSignalProcessor::getDecayTime ( const double  npe,
const double  th 
) const
inline

Get time to pass from top of analogue pulse to threshold.


In this, the trailing edge of the analogue pulse is assumed to be exponential.

Parameters
npenumber of photo-electrons
ththreshold [npe]
Returns
time [ns]

Definition at line 228 of file JPMTAnalogueSignalProcessor.hh.

229  {
230  if (npe*y1 > th)
231  return decayTime_ns * (log(npe/th) - log(y1)); // exponential
232  else
233  return riseTime_ns * sqrt(2.0*log(npe/th)); // Gaussian
234  }

◆ getMaximalRiseTime()

static double JDETECTOR::JPMTAnalogueSignalProcessor::getMaximalRiseTime ( const double  th)
inlinestatic

Get maximal rise time for given threshold.

Note that the rise time is entirely constraint by the specification JDETECTOR::TIME_OVER_THRESHOLD_NS.

Parameters
ththreshold [npe]
Returns
rise time [ns]

Definition at line 245 of file JPMTAnalogueSignalProcessor.hh.

246  {
247  if (th > 0.0 && th < 1.0)
248  return 0.5 * TIME_OVER_THRESHOLD_NS / sqrt(-2.0*log(th));
249  else
250  THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::getMaximalRiseTime(): Invalid threshold " << th);
251  }

◆ getSaturation()

double JDETECTOR::JPMTAnalogueSignalProcessor::getSaturation ( const double  y) const
inline

Get function value with saturation.

Parameters
yvalue
Returns
value

Definition at line 260 of file JPMTAnalogueSignalProcessor.hh.

261  {
262  return saturation / sqrt(y*y + saturation*saturation);
263  }

◆ getDerivativeOfSaturation()

double JDETECTOR::JPMTAnalogueSignalProcessor::getDerivativeOfSaturation ( const double  y) const
inline

Get derivative of function value with saturation.

Parameters
yvalue
Returns
value

Definition at line 272 of file JPMTAnalogueSignalProcessor.hh.

273  {
274  return (saturation*saturation + y*y) * sqrt(saturation*saturation + y*y) / (saturation * saturation * saturation);
275  }

◆ getGainSpread()

double JDETECTOR::JPMTAnalogueSignalProcessor::getGainSpread ( int  NPE) const
inline

Get gain spread for given number of photo-electrons.

Parameters
NPEnumber of photo-electrons
Returns
gain spread

Definition at line 284 of file JPMTAnalogueSignalProcessor.hh.

285  {
286  return sqrt((double) NPE * gain) * gainSpread;
287  }

◆ getIntegralOfProbability()

double JDETECTOR::JPMTAnalogueSignalProcessor::getIntegralOfProbability ( const double  xmin,
const double  xmax,
const int  NPE 
) const
inline

Get integral of probability.

Parameters
xminminimum number of photo-electrons
xmaxmaximum number of photo-electrons
NPEtrue number of photo-electrons
Returns
probability

Definition at line 298 of file JPMTAnalogueSignalProcessor.hh.

299  {
300  double zmin = xmin;
301  double zmax = xmax;
302 
303  if (zmin < threshold) { zmin = threshold; }
304  if (zmax < threshold) { zmax = threshold; }
305 
306  const double mu = NPE * gain;
307  const double sigma = getGainSpread(NPE);
308 
309  return (0.5 * TMath::Erfc((zmin - mu) / sqrt(2.0) / sigma) -
310  0.5 * TMath::Erfc((zmax - mu) / sqrt(2.0) / sigma));
311  }

◆ setPMTParameters()

void JDETECTOR::JPMTAnalogueSignalProcessor::setPMTParameters ( const JPMTParameters parameters)
inline

Set PMT parameters.

Parameters
parametersPMT parameters

Definition at line 319 of file JPMTAnalogueSignalProcessor.hh.

320  {
321  static_cast<JPMTParameters&>(*this).setPMTParameters(parameters);
322 
323  configure();
324  }

◆ applyQE()

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

Apply relative QE.

Returns
true if accepted; false if rejected

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 349 of file JPMTAnalogueSignalProcessor.hh.

350  {
351  if (QE <= 0.0)
352  return false;
353  else if (QE < 1.0)
354  return gRandom->Rndm() < QE;
355  else
356  return true;
357  }

◆ getRandomTime()

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

Get randomised time according transition time distribution.

Parameters
t_nstime [ns]
Returns
time [ns]

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 366 of file JPMTAnalogueSignalProcessor.hh.

367  {
368  if (TTS_ns < 0.0)
369  return t_ns + getTransitionTime(gRandom->Rndm());
370  else
371  return gRandom->Gaus(t_ns, TTS_ns);
372  }

◆ compare()

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

Compare (arrival times of) photo-electrons.

Parameters
firstfirst photo-electron
secondsecond photo-electron
Returns
true if arrival times of photo-electrons are within rise time of analogue pulses; else false

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 382 of file JPMTAnalogueSignalProcessor.hh.

383  {
384  return second.t_ns < first.t_ns + riseTime_ns;
385  }

◆ getRandomAmplitude()

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

Get randomised amplitude according gain and gain spread.

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 394 of file JPMTAnalogueSignalProcessor.hh.

395  {
396  double x;
397 
398  do {
399  x = gRandom->Gaus(NPE*gain, getGainSpread(NPE));
400  } while (x < 0.0);
401 
402  return x;
403  }

◆ getProbability()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::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 from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 413 of file JPMTAnalogueSignalProcessor.hh.

414  {
415  if (npe >= threshold) {
416 
417  const double mu = NPE * gain;
418  const double sigma = getGainSpread(NPE);
419  const double V = 0.5 * TMath::Erfc((threshold - mu) / sqrt(2.0) / sigma);
420 
421  return TMath::Gaus(npe, mu, sigma, kTRUE) / V;
422  }
423 
424  return 0.0;
425  }

◆ applyThreshold()

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

Apply threshold.

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 434 of file JPMTAnalogueSignalProcessor.hh.

435  {
436  return npe >= threshold;
437  }

◆ getRiseTime() [2/2]

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

Get time to reach threshold.

Note that the rise time is defined to be zero for a one photo-electron signal.

Parameters
npenumber of photo-electrons
Returns
time [ns]

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 448 of file JPMTAnalogueSignalProcessor.hh.

449  {
450  if (slewing)
451  return ((getRiseTime(npe, getTH0()) - getRiseTime(npe, this->threshold)) -
452  (getRiseTime(1.0, getTH0()) - getRiseTime(1.0, this->threshold)));
453  else
454  return 0.0;
455  }

◆ getTimeOverThreshold()

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

Get time-over-threshold (ToT).

Parameters
npenumber of photo-electrons
Returns
ToT [ns]

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 464 of file JPMTAnalogueSignalProcessor.hh.

465  {
466  if (npe > threshold) {
467 
468  double tot = 0.0;
469 
470  if (npe*y1 > threshold) {
471 
472  if (npe <= getStartOfLinearisation()) {
473 
474  tot += getRiseTime (npe, threshold); // Gaussian
475  tot += getDecayTime(npe, threshold); // exponential
476 
477  } else {
478 
479  tot += getRiseTime (getStartOfLinearisation(), threshold); // Gaussian
480  tot += getDecayTime(getStartOfLinearisation(), threshold); // exponential
481 
482  tot += slope * (npe - getStartOfLinearisation()); // linear
483  }
484 
485  } else {
486 
487  tot += getRiseTime(npe, threshold); // Gaussian
488  tot += getRiseTime(npe, threshold); // Gaussian
489  }
490 
491  return tot * getSaturation(tot);
492 
493  } else {
494 
495  return 0.0;
496  }
497  }

◆ getDerivative()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::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 from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 506 of file JPMTAnalogueSignalProcessor.hh.

507  {
508  if (npe >= threshold) {
509 
510  const double z = riseTime_ns / sqrt(2.0 * log(npe/threshold));
511 
512  double y = 0.0;
513 
514  if (npe*y1 > threshold) {
515 
516  if (npe <= getStartOfLinearisation())
517  y = npe / (z + decayTime_ns); // Gaussian + exponential
518  else
519  y = 1.0 / slope; // linear
520 
521  } else {
522 
523  y = npe / (2.0 * z); // Gaussian + Gaussian
524  }
525 
527 
528  } else {
529 
530  return 0.0;
531  }
532  }

◆ getSurvivalProbability()

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

Probability that a hit survives the simulation of the PMT.

Parameters
NPEnumber of photo-electrons
Returns
probability

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 541 of file JPMTAnalogueSignalProcessor.hh.

542  {
543  if (QE <= 0.0) {
544 
545  return 0.0;
546 
547  } else if (QE <= 1.0) {
548 
549  double P = 0.0;
550 
551  for (int i = 1; i <= NPE; ++i) {
552 
553  const double p = TMath::Binomial(NPE, i) * TMath::Power(QE, i) * TMath::Power(1.0 - QE, NPE - i);
554  const double mu = i * gain;
555  const double sigma = getGainSpread(i);
556  const double V = 0.5 * TMath::Erfc((threshold - mu) / sqrt(2.0) / sigma);
557  const double W = 0.5 * TMath::Erfc((0.0 - mu) / sqrt(2.0) / sigma);
558 
559  P += p*V/W;
560  }
561 
562  return P;
563 
564  } else {
565 
566  THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::getSurvivalProbability: Invalid QE " << QE);
567  }
568  }

◆ getTH0()

static double JDETECTOR::JPMTAnalogueSignalProcessor::getTH0 ( )
inlinestatic

Get lower threshold for rise time evaluation.

Returns
threshold [npe]

Definition at line 576 of file JPMTAnalogueSignalProcessor.hh.

577  {
578  return 0.1;
579  }

◆ getTH1()

static double JDETECTOR::JPMTAnalogueSignalProcessor::getTH1 ( )
inlinestatic

Get upper threshold for rise time evaluation.

Returns
threshold [npe]

Definition at line 587 of file JPMTAnalogueSignalProcessor.hh.

588  {
589  return 0.9;
590  }

◆ operator()()

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

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  }

◆ merge()

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

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
inlineinherited

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

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

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  }

◆ getPMTParameters()

const JPMTParameters& JDETECTOR::JPMTParameters::getPMTParameters ( ) const
inlineinherited

Get PMT parameters.

Returns
PMT parameters

Definition at line 95 of file JPMTParameters.hh.

96  {
97  return static_cast<const JPMTParameters&>(*this);
98  }

◆ is_valid()

bool JDETECTOR::JPMTParameters::is_valid ( ) const
inlineinherited

Check validity of PMT parameters.

Returns
true if valid; else false

Definition at line 117 of file JPMTParameters.hh.

118  {
119  if (this->QE < 0.0 ||
120  this->gain < 0.0 ||
121  this->gainSpread < 0.0 ||
122  this->threshold < 0.0) {
123  return false;
124  }
125 
126  return true;
127  }

◆ getEquationParameters()

static JEquationParameters& JDETECTOR::JPMTParameters::getEquationParameters ( )
inlinestaticinherited

Get equation parameters.

Returns
equation parameters

Definition at line 175 of file JPMTParameters.hh.

176  {
177  static JEquationParameters equation("=", ",", "./", "#");
178 
179  return equation;
180  }

◆ setEquationParameters()

static void JDETECTOR::JPMTParameters::setEquationParameters ( const JEquationParameters equation)
inlinestaticinherited

Set equation parameters.

Parameters
equationequation parameters

Definition at line 188 of file JPMTParameters.hh.

189  {
190  getEquationParameters() = equation;
191  }

◆ getProperties() [1/2]

JProperties JDETECTOR::JPMTParameters::getProperties ( const JEquationParameters equation = JPMTParameters::getEquationParameters())
inlineinherited

Get properties of this class.

Parameters
equationequation parameters

Definition at line 199 of file JPMTParameters.hh.

200  {
201  return JPMTParametersHelper(*this, equation);
202  }

◆ getProperties() [2/2]

JProperties JDETECTOR::JPMTParameters::getProperties ( const JEquationParameters equation = JPMTParameters::getEquationParameters()) const
inlineinherited

Get properties of this class.

Parameters
equationequation parameters

Definition at line 210 of file JPMTParameters.hh.

211  {
212  return JPMTParametersHelper(*this, equation);
213  }

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JPMTAnalogueSignalProcessor object 
)
friend

Read PMT signal from input.

Parameters
ininput stream
objectPMT signal
Returns
input stream

Definition at line 334 of file JPMTAnalogueSignalProcessor.hh.

335  {
336  in >> static_cast<JPMTParameters&>(object);
337 
338  object.configure();
339 
340  return in;
341  }

Member Data Documentation

◆ decayTime_ns

double JDETECTOR::JPMTAnalogueSignalProcessor::decayTime_ns
protected

decay time [ns]

Definition at line 593 of file JPMTAnalogueSignalProcessor.hh.

◆ t1

double JDETECTOR::JPMTAnalogueSignalProcessor::t1
protected

time at match point [ns]

Definition at line 594 of file JPMTAnalogueSignalProcessor.hh.

◆ y1

double JDETECTOR::JPMTAnalogueSignalProcessor::y1
protected

amplitude at match point [npe]

Definition at line 595 of file JPMTAnalogueSignalProcessor.hh.

◆ x1

double JDETECTOR::JPMTAnalogueSignalProcessor::x1
protected

Transition point from a logarithmic to a linear relation between time-over-threshold and number of photo-electrons.


Measurements by B. Schermer and R. Bruijn at Nikhef.

Definition at line 601 of file JPMTAnalogueSignalProcessor.hh.

◆ buffer

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

Definition at line 387 of file JPMTSignalProcessorInterface.hh.

◆ QE

double JDETECTOR::JPMTParameters::QE
inherited

relative quantum efficiency

Definition at line 216 of file JPMTParameters.hh.

◆ gain

double JDETECTOR::JPMTParameters::gain
inherited

gain [unit]

Definition at line 217 of file JPMTParameters.hh.

◆ gainSpread

double JDETECTOR::JPMTParameters::gainSpread
inherited

gain spread [unit]

Definition at line 218 of file JPMTParameters.hh.

◆ riseTime_ns

double JDETECTOR::JPMTParameters::riseTime_ns
inherited

rise time of analogue pulse [ns]

Definition at line 219 of file JPMTParameters.hh.

◆ TTS_ns

double JDETECTOR::JPMTParameters::TTS_ns
inherited

transition time spread [ns]

Definition at line 220 of file JPMTParameters.hh.

◆ threshold

double JDETECTOR::JPMTParameters::threshold
inherited

threshold [npe]

Definition at line 221 of file JPMTParameters.hh.

◆ slope

double JDETECTOR::JPMTParameters::slope
inherited

slope [ns/npe]

Definition at line 222 of file JPMTParameters.hh.

◆ saturation

double JDETECTOR::JPMTParameters::saturation
inherited

saturation [ns]

Definition at line 223 of file JPMTParameters.hh.

◆ slewing

bool JDETECTOR::JPMTParameters::slewing
inherited

time slewing of analogue signal

Definition at line 224 of file JPMTParameters.hh.


The documentation for this struct was generated from the following file:
JDETECTOR::JPMTAnalogueSignalProcessor::t1
double t1
time at match point [ns]
Definition: JPMTAnalogueSignalProcessor.hh:594
JDETECTOR::JPMTParameters::saturation
double saturation
saturation [ns]
Definition: JPMTParameters.hh:223
JDETECTOR::JPMTAnalogueSignalProcessor::x1
double x1
Transition point from a logarithmic to a linear relation between time-over-threshold and number of ph...
Definition: JPMTAnalogueSignalProcessor.hh:601
JDETECTOR::JPMTParameters::threshold
double threshold
threshold [npe]
Definition: JPMTParameters.hh:221
JDETECTOR::JPMTAnalogueSignalProcessor::getTimeOverThreshold
virtual double getTimeOverThreshold(const double npe) const
Get time-over-threshold (ToT).
Definition: JPMTAnalogueSignalProcessor.hh:464
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::TIME_OVER_THRESHOLD_NS
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
Definition: JDetector/JCalibration.hh:29
JDETECTOR::JPMTParameters::TTS_ns
double TTS_ns
transition time spread [ns]
Definition: JPMTParameters.hh:220
JDETECTOR::getTransitionTime
static const JTransitionTimeGenerator getTransitionTime
Function object to generate transition time.
Definition: JPMTTransitTimeGenerator.hh:1071
JDETECTOR::JPMTAnalogueSignalProcessor::getDerivativeOfSaturation
double getDerivativeOfSaturation(const double y) const
Get derivative of function value with saturation.
Definition: JPMTAnalogueSignalProcessor.hh:272
JTOOLS::u
double u[N+1]
Definition: JPolint.hh:706
JDETECTOR::putTime
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
Definition: JDetector/JCalibration.hh:216
JDETECTOR::JPMTAnalogueSignalProcessor::decayTime_ns
double decayTime_ns
decay time [ns]
Definition: JPMTAnalogueSignalProcessor.hh:593
JDETECTOR::JPMTSignalProcessorInterface::applyThreshold
virtual bool applyThreshold(const double npe) const
Apply threshold.
Definition: JPMTSignalProcessorInterface.hh:213
JDETECTOR::JPMTAnalogueSignalProcessor::getTH0
static double getTH0()
Get lower threshold for rise time evaluation.
Definition: JPMTAnalogueSignalProcessor.hh:576
JDETECTOR::JPMTSignalProcessorInterface::getTmin
static double getTmin()
Get two photo-electron resolution for time-over-threshold.
Definition: JPMTSignalProcessorInterface.hh:369
JDETECTOR::JPMTAnalogueSignalProcessor::getGainSpread
double getGainSpread(int NPE) const
Get gain spread for given number of photo-electrons.
Definition: JPMTAnalogueSignalProcessor.hh:284
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::JPMTParameters::gainSpread
double gainSpread
gain spread [unit]
Definition: JPMTParameters.hh:218
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::JPMTAnalogueSignalProcessor::getStartOfLinearisation
double getStartOfLinearisation() const
Get transition point from a model dependent to linear relation between time-over-threshold and number...
Definition: JPMTAnalogueSignalProcessor.hh:177
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::JPMTParameters::slewing
bool slewing
time slewing of analogue signal
Definition: JPMTParameters.hh:224
JDETECTOR::JPMTAnalogueSignalProcessor::configure
void configure()
Configure internal parameters.
Definition: JPMTAnalogueSignalProcessor.hh:78
JDETECTOR::JPMTSignalProcessorInterface::getRandomAmplitude
virtual double getRandomAmplitude(const int NPE) const
Get randomised amplitude according gain and gain spread.
Definition: JPMTSignalProcessorInterface.hh:187
JDETECTOR::JPMTParameters::getEquationParameters
static JEquationParameters & getEquationParameters()
Get equation parameters.
Definition: JPMTParameters.hh:175
JDETECTOR::JPMTPulse
Data structure for PMT digital pulse.
Definition: JPMTSimulator.hh:120
JDETECTOR::JPMTParameters::gain
double gain
gain [unit]
Definition: JPMTParameters.hh:217
JDETECTOR::JPMTAnalogueSignalProcessor::getMaximalRiseTime
static double getMaximalRiseTime(const double th)
Get maximal rise time for given threshold.
Definition: JPMTAnalogueSignalProcessor.hh:245
JDETECTOR::JPMTSignalProcessorInterface::JPMTSignalProcessorInterface
JPMTSignalProcessorInterface()
Default constructor.
Definition: JPMTSignalProcessorInterface.hh:74
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:669
JDETECTOR::JPMTSignalProcessorInterface::buffer
JPMTData< JPhotoElectron > buffer
Definition: JPMTSignalProcessorInterface.hh:387
JDETECTOR::JPMTAnalogueSignalProcessor::getRiseTime
double getRiseTime(const double npe, const double th) const
Get time to pass from threshold to top of analogue pulse.
Definition: JPMTAnalogueSignalProcessor.hh:214
JDETECTOR::JPMTAnalogueSignalProcessor::getDecayTime
double getDecayTime() const
Get decay time.
Definition: JPMTAnalogueSignalProcessor.hh:144
JDETECTOR::JPMTSignalProcessorInterface::applyQE
virtual bool applyQE() const
Apply relative QE.
Definition: JPMTSignalProcessorInterface.hh:145
JTOOLS::v
data_type v[N+1][M+1]
Definition: JPolint.hh:707
JDETECTOR::JPMTAnalogueSignalProcessor::getSaturation
double getSaturation(const double y) const
Get function value with saturation.
Definition: JPMTAnalogueSignalProcessor.hh:260
JLANG::JEquationParameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Definition: JEquationParameters.hh:20
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::JPMTParameters::slope
double slope
slope [ns/npe]
Definition: JPMTParameters.hh:222
JDETECTOR::JPMTAnalogueSignalProcessor::getDerivative
virtual double getDerivative(const double npe) const
Get derivative of number of photo-electrons to time-over-threshold.
Definition: JPMTAnalogueSignalProcessor.hh:506
JDETECTOR::JPMTAnalogueSignalProcessor::y1
double y1
amplitude at match point [npe]
Definition: JPMTAnalogueSignalProcessor.hh:595
JDETECTOR::JPMTParameters::QE
double QE
relative quantum efficiency
Definition: JPMTParameters.hh:216
JDETECTOR::JPMTParameters::riseTime_ns
double riseTime_ns
rise time of analogue pulse [ns]
Definition: JPMTParameters.hh:219
JDETECTOR::JPMTSignalProcessorInterface::getTimeOverThreshold
virtual double getTimeOverThreshold(const double npe) const
Get time over threshold (ToT).
Definition: JPMTSignalProcessorInterface.hh:239
JDETECTOR::JPMTParameters::JPMTParameters
JPMTParameters()
Default constructor.
Definition: JPMTParameters.hh:41