Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JDETECTOR::JPMTAnalogueSignalProcessor Struct Reference

PMT analogue signal processor. More...

#include <JPMTAnalogueSignalProcessor.hh>

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

Public Types

enum  JThresholdDomain { BELOW_THRESHOLD = -1 , THRESHOLDBAND = 0 , ABOVE_THRESHOLD = 2 }
 Threshold domain specifiers. More...
 
enum class  JAmplificationMode { Nominal , Mixed , UnderAmplified }
 Amplification mode specifiers. More...
 
enum class  JAnaloguePulseDomain { Gaussian , Exponential , Linear }
 Analogue pulse domain specifiers. More...
 

Public Member Functions

 JPMTAnalogueSignalProcessor (const JPMTParameters &parameters=JPMTParameters())
 Constructor.
 
void configure ()
 Configure internal parameters.
 
double getDecayTime () const
 Get decay time.
 
double getT1 () const
 Get time at transition point from Gaussian to exponential.
 
double getY1 () const
 Get amplitude at transition point from Gaussian to exponential.
 
double getStartOfLinearisation () const
 Get transition point from a model-dependent to linear relation between time-over-threshold and number of photo-electrons.
 
double getAmplitude (const double t1_ns) const
 Get amplitude at given time for a one photo-electron pulse.
 
double getRiseTime (const double npe, const double th) const
 Get time to pass from threshold to top of analogue pulse.
 
double getDecayTime (const double npe, const double th) const
 Get time to pass from top of analogue pulse to threshold.
 
double applySaturation (const double tot_ns) const
 Get time-over-threshold with saturation.
 
double removeSaturation (const double tot_ns) const
 Get time-over-threshold without saturation.
 
double getDerivativeOfSaturation (const double tot_ns) const
 Get derivative of saturation factor.
 
double getGain (int NPE) const
 Get gain.
 
double getGainSpread () const
 Get gain spread for given number of photo-electrons.
 
double getGainSpread (int NPE) const
 Get gain spread for given number of photo-electrons.
 
double getUnderamplifiedGain () const
 Get gain of underamplified pulses.
 
double getUnderamplifiedGain (int NPE) const
 Get gain of underamplified pulses.
 
double getUnderamplifiedGainSpread () const
 Get gain spread of underamplified pulses.
 
double getUnderamplifiedGainSpread (int NPE) const
 Get gain spread of underamplified pulses.
 
void setPMTParameters (const JPMTParameters &parameters)
 Set PMT parameters.
 
JThresholdDomain getThresholdDomain (const double npe) const
 Get threshold domain.
 
JAmplificationMode getAmplificationMode () const
 Get amplification mode.
 
JAnaloguePulseDomain getChargeDomain (const double npe) const
 Get charge domain.
 
JAnaloguePulseDomain getToTDomain (const double tot_ns) const
 Get time-over-threshold domain.
 
virtual bool applyQE () const override
 Apply relative QE.
 
virtual double getRandomTime (const double t_ns) const override
 Get randomised time according transit-time distribution.
 
virtual bool compare (const JPhotoElectron &first, const JPhotoElectron &second) const override
 Compare arrival times of photo-electrons.
 
virtual double getRandomCharge (const int NPE) const override
 Get randomised charge according to gain and gain spread.
 
double getRandomChargeNominal (const int NPE) const
 Get randomised charge according to gain and gain spread with a nominal amplification mode.
 
double getRandomChargeMixed (const int NPE) const
 Get randomised charge according to gain and gain spread with a mixed amplification mode.
 
double getRandomChargeUnderAmplified (const int NPE) const
 Get randomised charge according to gain and gain spread with an underamplified amplification mode.
 
virtual double getChargeProbability (const double npe, const int NPE) const override
 Get probability density for given charge.
 
double getChargeProbabilityNominal (const double npe, const int NPE) const
 Get probability density for given charge with a Nominal amplification mode.
 
double getChargeProbabilityMixed (const double npe, const double NPE) const
 Get probability density for given charge with a mixed amplification mode.
 
double getChargeProbabilityUnderAmplified (const double npe, const int NPE) const
 Get probability density for given charge with an underamplified amplification mode.
 
double getIntegralOfChargeProbability (const double xmin, const double xmax, const int NPE) const
 Get integral of probability.
 
double getIntegralOfChargeProbabilityNominal (const double xmin, const double xmax, const int NPE) const
 Get integral of probability with a nominal amplification mode.
 
double getIntegralOfChargeProbabilityMixed (const double xmin, const double xmax, const int NPE) const
 Get integral of probability with a mixed amplification mode.
 
double getIntegralOfChargeProbabilityUnderAmplified (const double xmin, const double xmax, const int NPE) const
 Get integral of probability with an underamplified amplification mode.
 
double getIntegralOfChargeProbability (const JThresholdDomain domain, const int NPE) const
 Get integral of probability in specific threshold domain.
 
virtual bool applyThreshold (const double npe) const override
 Apply threshold.
 
virtual double getRiseTime (const double npe) const override
 Get time to reach threshold.
 
virtual double getTimeOverThreshold (const double npe) const override
 Get time-over-threshold.
 
virtual double getDerivative (const double npe) const override
 Get derivative of number of photo-electrons to time-over-threshold with saturation.
 
virtual double getSurvivalProbability (const int NPE) const override
 Probability that a hit survives the simulation of the PMT.
 
virtual double getThresholdProbability (const int NPE) const override
 Probability that a hit survives the threshold of the PMT.
 
double getThresholdProbabilityNominal (const int NPE) const
 Probability that a hit survives the threshold of the PMT with a nominal amplification mode.
 
double getThresholdProbabilityMixed (const int NPE) const
 Probability that a hit survives the threshold of the PMT with a mixed amplification mode.
 
double getThresholdProbabilityUnderAmplified (const int NPE) const
 Probability that a hit survives the threshold of the PMT with an underamplified amplification mode.
 
virtual double getNPE (const double tot_ns) const override
 Get number of photo-electrons.
 
double getTimeOverThresholdProbability (const double tot_ns, const int NPE) const
 Get probability of having a pulse with specific time-over-threshold.
 
double getIntegralOfTimeOverThresholdProbability (const double Tmin, const double Tmax, const int NPE) const
 Get cumulative probability of time-over-threshold distribution.
 
void operator() (const JCalibration &calibration, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const
 Process hits.
 
virtual void merge (JPMTData< JPMTPulse > &data) const
 Merging of PMT hits.
 
const JPMTParametersgetPMTParameters () const
 Get PMT parameters.
 
bool is_valid () const
 Check validity of PMT parameters.
 
int getType () const
 Get type for for time-slewing correction.
 
JProperties getProperties (const JEquationParameters &equation=JPMTParameters::getEquationParameters())
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &equation=JPMTParameters::getEquationParameters()) const
 Get properties of this class.
 

Static Public Member Functions

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

Public Attributes

double QE
 relative quantum efficiency
 
double gain
 gain [unit]
 
double gainSpread
 gain spread [unit]
 
double riseTime_ns
 rise time of analogue pulse [ns]
 
double TTS_ns
 transition time spread [ns]
 
double threshold
 threshold [npe]
 
double PunderAmplified
 probability of underamplified hit
 
double thresholdBand
 threshold-band [npe]
 
double mean_ns
 mean time-over-threshold of threshold-band hits [ns]
 
double sigma_ns
 time-over-threshold standard deviation of threshold-band hits [ns]
 
double slope
 slope [ns/npe]
 
double saturation
 saturation [ns]
 
bool slewing
 time slewing of analogue signal
 

Protected Attributes

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

Friends

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

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 transit times are generated according the specified spread as follows.

  • If the specified transit-time spread (TTS) is negative, the transit times are generated according to measurements (see method JDETECTOR::getTransitTime).
    In this, the negated integral value of the TTS corresponds to the option which in turn corresponds to the detector identifier of the measurements.
  • If the specified TTS is positive, the transit times are generated according a Gaussian with a sigma equals to the given TTS.
  • If the TTS is zero, the transit times are generated without any spread.

Definition at line 53 of file JPMTAnalogueSignalProcessor.hh.

Member Enumeration Documentation

◆ JThresholdDomain

Threshold domain specifiers.

Enumerator
BELOW_THRESHOLD 

below threshold

THRESHOLDBAND 

inside threshold band

ABOVE_THRESHOLD 

above threshold

Definition at line 60 of file JPMTAnalogueSignalProcessor.hh.

60 {
61 BELOW_THRESHOLD = -1, //!< below threshold
62 THRESHOLDBAND = 0, //!< inside threshold band
63 ABOVE_THRESHOLD = 2 //!< above threshold
64 };

◆ JAmplificationMode

Amplification mode specifiers.

Enumerator
Nominal 
Mixed 
UnderAmplified 

Definition at line 70 of file JPMTAnalogueSignalProcessor.hh.

◆ JAnaloguePulseDomain

Analogue pulse domain specifiers.

Enumerator
Gaussian 
Exponential 
Linear 

Definition at line 80 of file JPMTAnalogueSignalProcessor.hh.

Constructor & Destructor Documentation

◆ JPMTAnalogueSignalProcessor()

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

Constructor.

Parameters
parametersPMT parameters

Definition at line 92 of file JPMTAnalogueSignalProcessor.hh.

92 :
94 JPMTParameters(parameters),
95 decayTime_ns(0.0),
96 t1(0.0),
97 y1(0.0),
98 x1(std::numeric_limits<double>::max())
99 {
100 configure();
101 }
JPMTParameters()
Default constructor.
double x1
Transition point from a logarithmic to a linear relation between time-over-threshold and number of ph...
void configure()
Configure internal parameters.

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 115 of file JPMTAnalogueSignalProcessor.hh.

116 {
117 static const int N = 100;
118 static const double precision = 1.0e-4;
119
120 // check thresholdband
121
122 if (threshold - thresholdBand < getTH0()) {
123 THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::configure(): Invalid thresholdband [npe] " << thresholdBand);
124 }
125
126 // check rise time
127
129 THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::configure(): Invalid rise time [ns] " << riseTime_ns);
130 }
131
132 // check probability for under-amplified signal
133
134 if (PunderAmplified < 0.0) {
135 THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::configure(): Invalid probability of under-amplification " << PunderAmplified);
136 }
137
138 // decay time
139
140 const double y = -log(threshold);
141
142 const double a = y;
143 const double b = riseTime_ns * sqrt(2.0*y) - TIME_OVER_THRESHOLD_NS;
144 const double c = 0.5*riseTime_ns*riseTime_ns;
145 const double Q = b*b - 4.0*a*c;
146
147 if (Q > 0.0)
148 decayTime_ns = (-b + sqrt(Q)) / (2.0*a);
149 else
150 decayTime_ns = -b / (2.0*a);
151
152 // fix matching of Gaussian and exponential
153
154 const double x = riseTime_ns / decayTime_ns;
155
156 t1 = riseTime_ns*x;
157 y1 = exp(-0.5*x*x);
158
159 // determine transition point to linear dependence of time-over-threshold as a function of number of photo-electrons
160
161 const double xs = saturation; // disable saturation
162
163 saturation = 1.0e50;
164
165 x1 = std::numeric_limits<double>::max(); // disable linearisation
166
167 double xmin = 1.0;
168 double xmax = 1.0 / (getDerivative(1.0) * slope);
169
170 for (int i = 0; i != N; ++i) {
171
172 const double x = 0.5 * (xmin + xmax);
173 const double u = getDerivative(x) * slope;
174
175 if (fabs(1.0 - u) < precision) {
176 break;
177 }
178
179 if (u < 1.0)
180 xmin = x;
181 else
182 xmax = x;
183 }
184
185 x1 = 0.5 * (xmin + xmax);
186
187 saturation = xs; // restore saturation
188 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
double thresholdBand
threshold-band [npe]
double riseTime_ns
rise time of analogue pulse [ns]
double threshold
threshold [npe]
double slope
slope [ns/npe]
double PunderAmplified
probability of underamplified hit
double saturation
saturation [ns]
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
static double getMaximalRiseTime(const double th)
Get maximal rise time for given threshold.
static double getTH0()
Get lower threshold for rise time evaluation.
virtual double getDerivative(const double npe) const override
Get derivative of number of photo-electrons to time-over-threshold with saturation.

◆ getDecayTime() [1/2]

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

Get decay time.

Returns
decay time [ns]

Definition at line 196 of file JPMTAnalogueSignalProcessor.hh.

197 {
198 return decayTime_ns;
199 }

◆ getT1()

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

Get time at transition point from Gaussian to exponential.

Returns
time [ns]

Definition at line 207 of file JPMTAnalogueSignalProcessor.hh.

208 {
209 return t1;
210 }

◆ getY1()

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

Get amplitude at transition point from Gaussian to exponential.

Returns
amplitude [npe]

Definition at line 218 of file JPMTAnalogueSignalProcessor.hh.

219 {
220 return y1;
221 }

◆ 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 229 of file JPMTAnalogueSignalProcessor.hh.

230 {
231 return x1;
232 }

◆ 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 241 of file JPMTAnalogueSignalProcessor.hh.

242 {
243 if (t1_ns < t1) {
244
245 const double x = t1_ns / riseTime_ns;
246
247 return exp(-0.5*x*x); // Gaussian
248
249 } else {
250
251 const double x = t1_ns / decayTime_ns;
252
253 return exp(-x) / y1; // exponential
254 }
255 }

◆ 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 266 of file JPMTAnalogueSignalProcessor.hh.

267 {
268 return riseTime_ns * sqrt(2.0*log(npe/th)); // Gaussian
269 }

◆ 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 280 of file JPMTAnalogueSignalProcessor.hh.

281 {
282 if (npe*y1 > th)
283 return decayTime_ns * (log(npe/th) - log(y1)); // exponential
284 else
285 return getRiseTime(npe, th); // Gaussian
286 }
double getRiseTime(const double npe, const double th) const
Get time to pass from threshold to top of analogue pulse.

◆ getMaximalRiseTime()

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

Get maximal rise time for given threshold.

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

Parameters
ththreshold [npe]
Returns
rise time [ns]

Definition at line 297 of file JPMTAnalogueSignalProcessor.hh.

298 {
299 if (th > 0.0 && th < 1.0)
300 return 0.5 * TIME_OVER_THRESHOLD_NS / sqrt(-2.0*log(th));
301 else
302 THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::getMaximalRiseTime(): Invalid threshold " << th);
303 }

◆ applySaturation()

double JDETECTOR::JPMTAnalogueSignalProcessor::applySaturation ( const double tot_ns) const
inline

Get time-over-threshold with saturation.

Parameters
tot_nstime-over-threshold without saturation
Returns
time-over-threshold with saturation

Definition at line 312 of file JPMTAnalogueSignalProcessor.hh.

313 {
314 return saturation / sqrt(tot_ns*tot_ns + saturation*saturation) * tot_ns;
315 }

◆ removeSaturation()

double JDETECTOR::JPMTAnalogueSignalProcessor::removeSaturation ( const double tot_ns) const
inline

Get time-over-threshold without saturation.

Parameters
tot_nstime-over-threshold with saturation
Returns
time-over-threshold without saturation

Definition at line 324 of file JPMTAnalogueSignalProcessor.hh.

325 {
326 if (tot_ns < saturation)
327 return saturation / sqrt(saturation*saturation - tot_ns*tot_ns) * tot_ns;
328 else
329 return std::numeric_limits<double>::max();
330 }

◆ getDerivativeOfSaturation()

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

Get derivative of saturation factor.

Parameters
tot_nstime-over-threshold without saturation
Returns
derivative of saturation factor

Definition at line 339 of file JPMTAnalogueSignalProcessor.hh.

340 {
341 return saturation * saturation * saturation / ((saturation*saturation + tot_ns*tot_ns) * sqrt(saturation*saturation + tot_ns*tot_ns));
342 }

◆ getGain()

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

Get gain.

Parameters
NPEnumber of photo-electrons
Returns
gain

Definition at line 351 of file JPMTAnalogueSignalProcessor.hh.

352 {
353 return ((double) NPE) * gain;
354 }

◆ getGainSpread() [1/2]

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

Get gain spread for given number of photo-electrons.

Returns
gain spread

Definition at line 362 of file JPMTAnalogueSignalProcessor.hh.

363 {
364 return sqrt(gain) * gainSpread;
365 }
double gainSpread
gain spread [unit]

◆ getGainSpread() [2/2]

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 374 of file JPMTAnalogueSignalProcessor.hh.

375 {
376 return sqrt((double) NPE) * getGainSpread();
377 }
double getGainSpread() const
Get gain spread for given number of photo-electrons.

◆ getUnderamplifiedGain() [1/2]

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

Get gain of underamplified pulses.

Returns
gain of underamplified pulses

Definition at line 385 of file JPMTAnalogueSignalProcessor.hh.

386 {
387 return gain * gainSpread * gainSpread;
388 }

◆ getUnderamplifiedGain() [2/2]

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

Get gain of underamplified pulses.

Parameters
NPEnumber of photo-electrons
Returns
gain of underamplified pulses

Definition at line 397 of file JPMTAnalogueSignalProcessor.hh.

398 {
399 return ((double) NPE) * getUnderamplifiedGain();
400 }
double getUnderamplifiedGain() const
Get gain of underamplified pulses.

◆ getUnderamplifiedGainSpread() [1/2]

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

Get gain spread of underamplified pulses.

Returns
gain spread of underamplified pulses

Definition at line 408 of file JPMTAnalogueSignalProcessor.hh.

409 {
410 return sqrt(gain) * gainSpread * gainSpread;
411 }

◆ getUnderamplifiedGainSpread() [2/2]

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

Get gain spread of underamplified pulses.

Parameters
NPEnumber of photo-electrons
Returns
gain spread of underamplified pulses

Definition at line 420 of file JPMTAnalogueSignalProcessor.hh.

421 {
422 return sqrt((double) NPE) * getUnderamplifiedGainSpread();
423 }
double getUnderamplifiedGainSpread() const
Get gain spread of underamplified pulses.

◆ setPMTParameters()

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

Set PMT parameters.

Parameters
parametersPMT parameters

Definition at line 431 of file JPMTAnalogueSignalProcessor.hh.

432 {
433 static_cast<JPMTParameters&>(*this).setPMTParameters(parameters);
434
435 configure();
436 }

◆ getThresholdDomain()

JThresholdDomain JDETECTOR::JPMTAnalogueSignalProcessor::getThresholdDomain ( const double npe) const
inline

Get threshold domain.

Parameters
npenumber of photo-electrons
Returns
threshold domain

Definition at line 462 of file JPMTAnalogueSignalProcessor.hh.

463 {
464 if (npe > threshold) {
465
466 return ABOVE_THRESHOLD;
467
468 } else if (npe > threshold - thresholdBand) {
469
470 return THRESHOLDBAND;
471
472 } else {
473
474 return BELOW_THRESHOLD;
475 }
476 }

◆ getAmplificationMode()

JAmplificationMode JDETECTOR::JPMTAnalogueSignalProcessor::getAmplificationMode ( ) const
inline

Get amplification mode.

Returns
amplification mode

Definition at line 484 of file JPMTAnalogueSignalProcessor.hh.

485 {
486 if (PunderAmplified <= 0.0) {
487
489
490 } else if (PunderAmplified < 1.0) {
491
493
494 } else {
495
497 }
498 }

◆ getChargeDomain()

JAnaloguePulseDomain JDETECTOR::JPMTAnalogueSignalProcessor::getChargeDomain ( const double npe) const
inline

Get charge domain.

Parameters
npeobserved number of photo-electrons

Definition at line 506 of file JPMTAnalogueSignalProcessor.hh.

507 {
508 if (npe*y1 <= threshold) {
509
511
512 } else if (npe <= getStartOfLinearisation()) {
513
515
516 } else {
517
519 }
520 }
double getStartOfLinearisation() const
Get transition point from a model-dependent to linear relation between time-over-threshold and number...

◆ getToTDomain()

JAnaloguePulseDomain JDETECTOR::JPMTAnalogueSignalProcessor::getToTDomain ( const double tot_ns) const
inline

Get time-over-threshold domain.

Parameters
tot_nstime-over-threshold (with saturation) [ns]

Definition at line 528 of file JPMTAnalogueSignalProcessor.hh.

529 {
530 const double tot = removeSaturation(tot_ns);
531 const double TOT = (getRiseTime (getStartOfLinearisation(), threshold) +
533
534 if (tot <= 2*getRiseTime(threshold/y1,threshold)) { // Gaussian + Gaussian
535
537
538 } else if (tot <= TOT) { // Gaussian + Exponential
539
541
542 } else { // linear
543
545 }
546 }
double removeSaturation(const double tot_ns) const
Get time-over-threshold without saturation.

◆ applyQE()

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

Apply relative QE.

Returns
true if accepted; false if rejected

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 554 of file JPMTAnalogueSignalProcessor.hh.

555 {
556 if (QE <= 0.0)
557 return false;
558 else if (QE < 1.0)
559 return gRandom->Rndm() < QE;
560 else
561 return true;
562 }
double QE
relative quantum efficiency

◆ getRandomTime()

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

Get randomised time according transit-time distribution.

Parameters
t_nstime [ns]
Returns
time [ns]

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 571 of file JPMTAnalogueSignalProcessor.hh.

572 {
573 if (TTS_ns < 0.0)
574 return t_ns + getTransitTime(gRandom->Rndm(), getType());
575 else if (TTS_ns > 0.0)
576 return gRandom->Gaus(t_ns, TTS_ns);
577 else
578 return t_ns;
579 }
int getType() const
Get type for for time-slewing correction.
double TTS_ns
transition time spread [ns]
JDETECTOR::JTransitTimeGenerator_t getTransitTime
Function object to generate transit time.

◆ compare()

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

Compare arrival times of photo-electrons.

This implementation uses the internal rise time as two photo-electron resolution.

Two (or more) photo-electrons are merged if they are comparable.

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 592 of file JPMTAnalogueSignalProcessor.hh.

593 {
594 return second.t_ns < first.t_ns + riseTime_ns;
595 }

◆ getRandomCharge()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::getRandomCharge ( const int NPE) const
inlineoverridevirtual

Get randomised charge according to gain and gain spread.

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 604 of file JPMTAnalogueSignalProcessor.hh.

605 {
606 if (NPE > 0) {
607
608 if (gainSpread > 0.0) {
609
610 switch (getAmplificationMode()) {
611
613 return getRandomChargeNominal(NPE);
614
616 return getRandomChargeMixed(NPE);
617
620
621 default:
622 return 0.0;
623 }
624
625 } else {
626
627 return getGain(NPE);
628 }
629
630 } else {
631
632 return 0.0;
633 }
634 }
double getRandomChargeUnderAmplified(const int NPE) const
Get randomised charge according to gain and gain spread with an underamplified amplification mode.
double getRandomChargeMixed(const int NPE) const
Get randomised charge according to gain and gain spread with a mixed amplification mode.
JAmplificationMode getAmplificationMode() const
Get amplification mode.
double getRandomChargeNominal(const int NPE) const
Get randomised charge according to gain and gain spread with a nominal amplification mode.

◆ getRandomChargeNominal()

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

Get randomised charge according to gain and gain spread with a nominal amplification mode.

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

Definition at line 643 of file JPMTAnalogueSignalProcessor.hh.

644 {
645 double q;
646
647 do {
648
649 const double mu = getGain(NPE);
650 const double sigma = getGainSpread(NPE);
651
652 q = gRandom->Gaus(mu, sigma);
653
654 } while (q < 0.0);
655
656 return q;
657 }

◆ getRandomChargeMixed()

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

Get randomised charge according to gain and gain spread with a mixed amplification mode.

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

Definition at line 666 of file JPMTAnalogueSignalProcessor.hh.

667 {
668
669 double q;
670
671 do {
672 // Determine which contribution to sample from
673 // Method uses inverse transform sampling for a binomial distribution
674
675 const double X = gRandom->Uniform();
676 double sum_p = 0.0;
677 double weight = pow(1-PunderAmplified, NPE);
678 int k = 0; // k underamplified photo-electrons
679
680 for (; k <= NPE; ++k) {
681
682 sum_p += weight;
683 if (sum_p > X) { break; }
684
685 weight *= ((double) (NPE-k) / ((double) (k+1))) * PunderAmplified / (1.0 - PunderAmplified);
686 }
687
688 // Sample from chosen contribution
689 const double mu = (NPE-k) * gain + (k) * getUnderamplifiedGain();
690 const double sigma = gainSpread * sqrt(mu);
691
692 q = gRandom->Gaus(mu, sigma);
693
694 } while (q < 0.0);
695
696 return q;
697 }
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97

◆ getRandomChargeUnderAmplified()

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

Get randomised charge according to gain and gain spread with an underamplified amplification mode.

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

Definition at line 706 of file JPMTAnalogueSignalProcessor.hh.

707 {
708 double q;
709
710 do {
711
712 const double mu = getUnderamplifiedGain(NPE);
713 const double sigma = getUnderamplifiedGainSpread(NPE);
714
715 q = gRandom->Gaus(mu, sigma);
716
717 } while (q < 0.0);
718
719 return q;
720 }

◆ getChargeProbability()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::getChargeProbability ( const double npe,
const int NPE ) const
inlineoverridevirtual

Get probability density for given charge.

The normalisation is from (threshold-thresholdband) to infinity.

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 731 of file JPMTAnalogueSignalProcessor.hh.

732 {
733 if ((NPE > 0) && (getThresholdDomain(npe) > BELOW_THRESHOLD)) {
734
735 switch (getAmplificationMode()) {
736
738 return getChargeProbabilityNominal(npe, NPE);
739
741 return getChargeProbabilityMixed(npe, NPE);
742
744 return getChargeProbabilityUnderAmplified(npe, NPE);
745
746 default:
747 return 0.0;
748 }
749
750 } else {
751
752 return 0.0;
753 }
754 }
JThresholdDomain getThresholdDomain(const double npe) const
Get threshold domain.
double getChargeProbabilityMixed(const double npe, const double NPE) const
Get probability density for given charge with a mixed amplification mode.
double getChargeProbabilityNominal(const double npe, const int NPE) const
Get probability density for given charge with a Nominal amplification mode.
double getChargeProbabilityUnderAmplified(const double npe, const int NPE) const
Get probability density for given charge with an underamplified amplification mode.

◆ getChargeProbabilityNominal()

double JDETECTOR::JPMTAnalogueSignalProcessor::getChargeProbabilityNominal ( const double npe,
const int NPE ) const
inline

Get probability density for given charge with a Nominal amplification mode.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 764 of file JPMTAnalogueSignalProcessor.hh.

765 {
766 const double mu = getGain(NPE);
767 const double sigma = getGainSpread(NPE);
768
769 if (sigma > 0.0) {
770
771 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
772
773 const double prob = gauss.getValue(npe);
774
775 const double normLowerLimit = threshold - thresholdBand;
776 const double normUpperLimit = std::numeric_limits<double>::infinity();
777 const double norm = gauss.getIntegral(normLowerLimit, normUpperLimit);
778
779 return prob / norm;
780
781 } else if (std::fabs(npe - mu) <= 0.0001 * mu) {
782
783 return 1.0;
784
785 } else {
786
787 return 0.0;
788 }
789 }
double gauss(const double x, const double sigma)
Gauss function (normalised to 1 at x = 0).
Gauss function object.
Definition JMathlib.hh:2000

◆ getChargeProbabilityMixed()

double JDETECTOR::JPMTAnalogueSignalProcessor::getChargeProbabilityMixed ( const double npe,
const double NPE ) const
inline

Get probability density for given charge with a mixed amplification mode.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 800 of file JPMTAnalogueSignalProcessor.hh.

801 {
802 double norm = 0.0;
803 double prob = 0.0;
804 double weight = pow(1-PunderAmplified, NPE);
805
806 for (int k = 0; k <= NPE; ++k) { // k underamplified photo-electrons
807
808 const double mu = (NPE-k) * gain + (k) * getUnderamplifiedGain();
809 const double sigma = gainSpread * sqrt(mu);
810
811 if (sigma > 0.0) {
812
813 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
814
815 prob += weight * gauss.getValue(npe);
816
817 const double normLowerLimit = threshold - thresholdBand;
818 const double normUpperLimit = std::numeric_limits<double>::infinity();
819
820 norm += weight * gauss.getIntegral(normLowerLimit, normUpperLimit);
821
822 } else if (std::fabs(npe - mu) <= 0.0001 * mu) {
823
824 prob += weight;
825 norm += weight;
826
827 } else {
828
829 return 0.0;
830 }
831
832 weight *= ((double) (NPE-k) / ((double) (k+1))) * PunderAmplified / (1.0 - PunderAmplified);
833 }
834
835 return prob / norm;
836 }

◆ getChargeProbabilityUnderAmplified()

double JDETECTOR::JPMTAnalogueSignalProcessor::getChargeProbabilityUnderAmplified ( const double npe,
const int NPE ) const
inline

Get probability density for given charge with an underamplified amplification mode.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 847 of file JPMTAnalogueSignalProcessor.hh.

848 {
849 if (gainSpread > 0.0) {
850
851 const double mu = getUnderamplifiedGain(NPE);
852 const double sigma = getUnderamplifiedGainSpread(NPE);
853
854 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
855
856 const double prob = gauss.getValue(npe);
857
858 const double normLowerLimit = threshold - thresholdBand;
859 const double normUpperLimit = std::numeric_limits<double>::infinity();
860 const double norm = gauss.getIntegral(normLowerLimit, normUpperLimit);
861
862 return prob / norm;
863
864 } else {
865
866 return 0.0;
867 }
868 }

◆ getIntegralOfChargeProbability() [1/2]

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

Get integral of probability.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 880 of file JPMTAnalogueSignalProcessor.hh.

881 {
882 if (NPE > 0) {
883
884 double zmin = xmin;
885 double zmax = xmax;
886
887 const double th = threshold - thresholdBand;
888
889 if (zmin < th) { zmin = th; }
890 if (zmax < th) { zmax = th; }
891
892 switch (getAmplificationMode()) {
893
895 return getIntegralOfChargeProbabilityNominal(zmin, zmax, NPE);
896
898 return getIntegralOfChargeProbabilityMixed(zmin, zmax, NPE);
899
901 return getIntegralOfChargeProbabilityUnderAmplified(zmin, zmax, NPE);
902
903 default:
904 return 0.0;
905 }
906
907 } else {
908
909 return 0.0;
910 }
911 }
double getIntegralOfChargeProbabilityNominal(const double xmin, const double xmax, const int NPE) const
Get integral of probability with a nominal amplification mode.
double getIntegralOfChargeProbabilityMixed(const double xmin, const double xmax, const int NPE) const
Get integral of probability with a mixed amplification mode.
double getIntegralOfChargeProbabilityUnderAmplified(const double xmin, const double xmax, const int NPE) const
Get integral of probability with an underamplified amplification mode.

◆ getIntegralOfChargeProbabilityNominal()

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

Get integral of probability with a nominal amplification mode.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 923 of file JPMTAnalogueSignalProcessor.hh.

924 {
925 const double mu = getGain(NPE);
926 const double sigma = getGainSpread(NPE);
927
928 if (sigma > 0.0) {
929
930 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
931
932 const double cumulP = gauss.getIntegral(xmin, xmax);
933
934 const double normLowerLimit = threshold - thresholdBand;
935 const double normUpperLimit = std::numeric_limits<double>::infinity();
936 const double norm = gauss.getIntegral(normLowerLimit, normUpperLimit);
937
938 return cumulP / norm;
939
940 } else if ((mu >= xmin) && (mu <= xmax)) {
941
942 return 1.0;
943
944 } else {
945
946 return 0.0;
947 }
948 }

◆ getIntegralOfChargeProbabilityMixed()

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

Get integral of probability with a mixed amplification mode.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 960 of file JPMTAnalogueSignalProcessor.hh.

961 {
962 double cumulP = 0.0;
963 double norm = 0.0;
964 double weight = pow(1.0 - PunderAmplified, NPE);
965
966 for (int k = 0; k <= NPE; ++k) { // k underamplified photo-electrons
967
968 const double mu = (NPE-k) * gain + (k) * getUnderamplifiedGain();
969 const double sigma = gainSpread * sqrt(mu);
970
971 if (sigma > 0.0) {
972
973 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
974
975 const double normLowerLimit = threshold - thresholdBand;
976 const double normUpperLimit = std::numeric_limits<double>::infinity();
977
978 cumulP += weight * gauss.getIntegral(xmin, xmax);
979 norm += weight * gauss.getIntegral(normLowerLimit, normUpperLimit);
980
981 } else if ((mu >= xmin) && (mu <= xmax)) {
982
983 cumulP += weight;
984 norm += weight;
985
986 } else {
987
988 return 0.0;
989 }
990
991 weight *= ((double) (NPE-k) / ((double) (k+1))) * PunderAmplified / (1.0 - PunderAmplified);
992 }
993
994 return cumulP / norm;
995 }

◆ getIntegralOfChargeProbabilityUnderAmplified()

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

Get integral of probability with an underamplified amplification mode.

The normalisation is from (threshold-thresholdband) to infinity.

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

Definition at line 1007 of file JPMTAnalogueSignalProcessor.hh.

1008 {
1009 if (gainSpread > 0.0) {
1010
1011 const double mu = getUnderamplifiedGain(NPE);
1012 const double sigma = getUnderamplifiedGainSpread(NPE);
1013
1014 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
1015
1016 const double cumulP = gauss.getIntegral(xmin, xmax);
1017
1018 const double normLowerLimit = threshold - thresholdBand;
1019 const double normUpperLimit = std::numeric_limits<double>::infinity();
1020 const double norm = gauss.getIntegral(normLowerLimit, normUpperLimit);
1021
1022 return cumulP / norm;
1023
1024 } else {
1025
1026 return 0.0;
1027 }
1028 }

◆ getIntegralOfChargeProbability() [2/2]

double JDETECTOR::JPMTAnalogueSignalProcessor::getIntegralOfChargeProbability ( const JThresholdDomain domain,
const int NPE ) const
inline

Get integral of probability in specific threshold domain.

The normalisation is from (threshold-thresholdband) to infinity.

Parameters
domainthreshold domain
NPEtrue number of photo-electrons
Returns
probability

Definition at line 1039 of file JPMTAnalogueSignalProcessor.hh.

1040 {
1041 switch (domain) {
1042
1043 case ABOVE_THRESHOLD:
1044 return getIntegralOfChargeProbability(threshold, std::numeric_limits<double>::infinity(), NPE);
1045
1046 case THRESHOLDBAND:
1048
1049 default:
1050 return 0.0;
1051 }
1052 }
double getIntegralOfChargeProbability(const double xmin, const double xmax, const int NPE) const
Get integral of probability.

◆ applyThreshold()

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

Apply threshold.

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 1061 of file JPMTAnalogueSignalProcessor.hh.

1062 {
1063 return getThresholdDomain(npe) > BELOW_THRESHOLD;
1064 }

◆ getRiseTime() [2/2]

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

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 1075 of file JPMTAnalogueSignalProcessor.hh.

1076 {
1077 if (slewing) {
1078
1079 switch (getThresholdDomain(npe)) {
1080
1081 case THRESHOLDBAND:
1082 return ((getRiseTime(npe, getTH0()) - getRiseTime(npe, threshold-thresholdBand)) -
1083 (getRiseTime(1.0, getTH0()) - getRiseTime(1.0, threshold-thresholdBand))) + this->mean_ns;
1084
1085 case ABOVE_THRESHOLD:
1086 return ((getRiseTime(npe, getTH0()) - getRiseTime(npe, threshold)) -
1087 (getRiseTime(1.0, getTH0()) - getRiseTime(1.0, threshold)));
1088
1089 default:
1090 THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::getRiseTime: Invalid charge " << npe);
1091 }
1092
1093 } else {
1094
1095 return 0.0;
1096 }
1097 }
double mean_ns
mean time-over-threshold of threshold-band hits [ns]
bool slewing
time slewing of analogue signal

◆ getTimeOverThreshold()

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

Get time-over-threshold.

Parameters
npenumber of photo-electrons
Returns
time-over-threshold (with saturation) [ns]

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 1106 of file JPMTAnalogueSignalProcessor.hh.

1107 {
1108 switch (getThresholdDomain(npe)) {
1109
1110 case THRESHOLDBAND:
1111 return gRandom->Gaus(mean_ns, sigma_ns);
1112
1113 case ABOVE_THRESHOLD: {
1114
1115 double tot = 0.0;
1116
1117 switch (getChargeDomain(npe)) {
1118
1120 tot += getRiseTime(npe, threshold); // Gaussian
1121 tot += getRiseTime(npe, threshold); // Gaussian
1122 break;
1123
1125 tot += getRiseTime (npe, threshold); // Gaussian
1126 tot += getDecayTime(npe, threshold); // exponential
1127 break;
1128
1130 tot += getRiseTime (getStartOfLinearisation(), threshold); // Gaussian
1131 tot += getDecayTime(getStartOfLinearisation(), threshold); // exponential
1132
1133 tot += slope * (npe - getStartOfLinearisation()); // linear
1134 break;
1135 }
1136
1137 return applySaturation(tot);
1138 }
1139
1140 default:
1141 THROW(JValueOutOfRange, "JPMTAnalogueSignalProcessor::getTimeOverThreshold: Invalid charge " << npe);
1142 }
1143 }
double sigma_ns
time-over-threshold standard deviation of threshold-band hits [ns]
JAnaloguePulseDomain getChargeDomain(const double npe) const
Get charge domain.
double applySaturation(const double tot_ns) const
Get time-over-threshold with saturation.

◆ getDerivative()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::getDerivative ( const double npe) const
inlineoverridevirtual

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

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

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 1152 of file JPMTAnalogueSignalProcessor.hh.

1153 {
1154 switch (getThresholdDomain(npe)) {
1155
1156 case ABOVE_THRESHOLD: {
1157
1158 const double tot_ns = getTimeOverThreshold(npe);
1159
1160 if (tot_ns < saturation) {
1161
1162 const double z = riseTime_ns / sqrt(2.0 * log(npe/threshold));
1163
1164 double y = 0.0;
1165
1166 switch (getChargeDomain(npe)) {
1167
1169 y += npe / (2.0 * z);
1170 break;
1171
1173 y += npe / (z + decayTime_ns);
1174 break;
1175
1177 y += 1.0 / slope;
1178 break;
1179 }
1180
1182
1183 } else {
1184
1185 return 0.0;
1186 }
1187 }
1188
1189 default:
1190 return 0.0;
1191 }
1192 }
double getDerivativeOfSaturation(const double tot_ns) const
Get derivative of saturation factor.
virtual double getTimeOverThreshold(const double npe) const override
Get time-over-threshold.

◆ getSurvivalProbability()

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

Probability that a hit survives the simulation of the PMT.

The survival probability takes into account the number of photo-electrons, the analogue signal of the PMT and the threshold of the discriminator.

Parameters
NPEnumber of photo-electrons
Returns
probability

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 1202 of file JPMTAnalogueSignalProcessor.hh.

1203 {
1204 if (NPE > 0) {
1205
1206 if (QE <= 0.0) {
1207
1208 return 0.0;
1209
1210 } else if (QE < 1.0) {
1211
1212 double P = 0.0;
1213
1214 for (int i = 1; i <= NPE; ++i) { // i corresponds to number of photo-electrons passing relative QE
1215
1216 const double p = JMATH::binomial(NPE, i) * pow(QE, i) * pow(1.0 - QE, NPE - i);
1217
1218 P += p * getThresholdProbability(NPE);
1219 }
1220
1221 return P;
1222
1223 } else {
1224
1225 return getThresholdProbability(NPE);
1226 }
1227
1228 } else {
1229
1230 return 0.0;
1231 }
1232 }
double binomial(const size_t n, const size_t k)
Binomial function.
virtual double getThresholdProbability(const int NPE) const override
Probability that a hit survives the threshold of the PMT.

◆ getThresholdProbability()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::getThresholdProbability ( const int NPE) const
inlineoverridevirtual

Probability that a hit survives the threshold of the PMT.

Parameters
NPEnumber of photo-electrons
Returns
probability

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 1241 of file JPMTAnalogueSignalProcessor.hh.

1242 {
1243 if (NPE > 0) {
1244
1245 switch (getAmplificationMode()) {
1246
1249
1251 return getThresholdProbabilityMixed(NPE);
1252
1255
1256 default:
1257 return 0.0;
1258 }
1259
1260 } else {
1261
1262 return 0.0;
1263 }
1264 }
double getThresholdProbabilityUnderAmplified(const int NPE) const
Probability that a hit survives the threshold of the PMT with an underamplified amplification mode.
double getThresholdProbabilityNominal(const int NPE) const
Probability that a hit survives the threshold of the PMT with a nominal amplification mode.
double getThresholdProbabilityMixed(const int NPE) const
Probability that a hit survives the threshold of the PMT with a mixed amplification mode.

◆ getThresholdProbabilityNominal()

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

Probability that a hit survives the threshold of the PMT with a nominal amplification mode.

Parameters
NPEtrue number of photo-electrons
Returns
probability

Definition at line 1273 of file JPMTAnalogueSignalProcessor.hh.

1274 {
1275 const double mu = getGain(NPE);
1276 const double sigma = getGainSpread(NPE);
1277
1278 if (sigma > 0.0) {
1279
1280 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
1281
1282 const double probLowerLimit = threshold - thresholdBand;
1283 const double probUpperLimit = std::numeric_limits<double>::infinity();
1284 const double cumulP = gauss.getIntegral(probLowerLimit, probUpperLimit);
1285
1286 const double normLowerLimit = 0.0;
1287 const double normUpperLimit = std::numeric_limits<double>::infinity();
1288 const double norm = gauss.getIntegral(normLowerLimit, normUpperLimit);
1289
1290 return cumulP / norm;
1291
1292 } else if (mu >= threshold - thresholdBand) {
1293
1294 return 1.0;
1295
1296 } else {
1297
1298 return 0.0;
1299 }
1300 }

◆ getThresholdProbabilityMixed()

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

Probability that a hit survives the threshold of the PMT with a mixed amplification mode.

Parameters
NPEtrue number of photo-electrons
Returns
probability

Definition at line 1309 of file JPMTAnalogueSignalProcessor.hh.

1310 {
1311 double cumulP = 0.0;
1312 double norm = 0.0;
1313 double weight = pow(1.0 - PunderAmplified, NPE);
1314
1315 for (int k = 0; k <= NPE; ++k) { // k underamplified photo-electrons
1316
1317 const double mu = (NPE-k) * gain + (k) * getUnderamplifiedGain();
1318 const double sigma = gainSpread * sqrt(mu);
1319
1320 if (sigma > 0.0) {
1321
1322 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
1323
1324 const double probLowerLimit = threshold - thresholdBand;
1325 const double probUpperLimit = std::numeric_limits<double>::infinity();
1326
1327 cumulP += weight * gauss.getIntegral(probLowerLimit, probUpperLimit);
1328
1329 const double normLowerLimit = 0.0;
1330 const double normUpperLimit = std::numeric_limits<double>::infinity();
1331
1332 norm += weight * gauss.getIntegral(normLowerLimit, normUpperLimit);
1333
1334 } else if (mu >= threshold - thresholdBand) {
1335
1336 cumulP += weight;
1337 norm += weight;
1338
1339 } else {
1340
1341 return 0.0;
1342 }
1343
1344 weight *= ((double) (NPE-k) / ((double) (k+1))) * PunderAmplified / (1.0 - PunderAmplified);
1345 }
1346
1347 return cumulP / norm;
1348 }

◆ getThresholdProbabilityUnderAmplified()

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

Probability that a hit survives the threshold of the PMT with an underamplified amplification mode.

Parameters
NPEtrue number of photo-electrons
Returns
probability

Definition at line 1357 of file JPMTAnalogueSignalProcessor.hh.

1358 {
1359 if (gainSpread > 0.0) {
1360
1361 const double mu = getUnderamplifiedGain(NPE);
1362 const double sigma = getUnderamplifiedGainSpread(NPE);
1363
1364 JMATH::JGauss gauss = JMATH::JGauss(mu, sigma);
1365
1366 const double probLowerLimit = threshold - thresholdBand;
1367 const double probUpperLimit = std::numeric_limits<double>::infinity();
1368 const double cumulP = gauss.getIntegral(probLowerLimit, probUpperLimit);
1369
1370 const double normLowerLimit = 0.0;
1371 const double normUpperLimit = std::numeric_limits<double>::infinity();
1372 const double norm = gauss.getIntegral(normLowerLimit, normUpperLimit);
1373
1374 return cumulP / norm;
1375
1376 } else {
1377
1378 return 0.0;
1379 }
1380 }

◆ getNPE()

virtual double JDETECTOR::JPMTAnalogueSignalProcessor::getNPE ( const double tot_ns) const
inlineoverridevirtual

Get number of photo-electrons.

Parameters
tot_nstime-over-threshold (with saturation) [ns]
Returns
number of photo-electrons

Reimplemented from JDETECTOR::JPMTSignalProcessorInterface.

Definition at line 1389 of file JPMTAnalogueSignalProcessor.hh.

1390 {
1391 if (tot_ns >= saturation) {
1392 return std::numeric_limits<double>::max();
1393 }
1394
1395 const double tot = removeSaturation(tot_ns);
1396 const double TOT = (getRiseTime (getStartOfLinearisation(), threshold) +
1398
1399 switch (getToTDomain(tot_ns)) {
1400
1402 return threshold * exp(tot*tot/riseTime_ns/riseTime_ns/8.0);
1403
1405
1406 const double a = decayTime_ns;
1407 const double b = sqrt(2.0) * riseTime_ns;
1408 const double c = -(decayTime_ns*log(y1) + tot);
1409 const double z = (-b + sqrt(b*b - 4*a*c)) / (2*a);
1410
1411 return threshold * exp(z*z);
1412 }
1413
1415 return getStartOfLinearisation() + (tot - TOT) / slope;
1416
1417 default:
1418 return 0.0;
1419 }
1420 }
JAnaloguePulseDomain getToTDomain(const double tot_ns) const
Get time-over-threshold domain.

◆ getTimeOverThresholdProbability()

double JDETECTOR::JPMTAnalogueSignalProcessor::getTimeOverThresholdProbability ( const double tot_ns,
const int NPE ) const
inline

Get probability of having a pulse with specific time-over-threshold.

Parameters
tot_nstime-over-threshold (with saturation) [ns]
NPEtrue number of photo-electrons
Returns
probability [ns^-1]

Definition at line 1430 of file JPMTAnalogueSignalProcessor.hh.

1431 {
1432 if (tot_ns < saturation) {
1433
1434 const double npe = getNPE(tot_ns);
1435 const double y = getChargeProbability(npe, NPE);
1436 const double v = getDerivative(npe);
1437 const double RaboveTh = y * v;
1438
1439 const double w = getIntegralOfChargeProbability(ABOVE_THRESHOLD, NPE);
1441 const double gaussProb = gauss.getValue(tot_ns);
1442 const double gaussNorm = gauss.getIntegral(0, saturation);
1443 const double gaussDist = gaussProb / gaussNorm;
1444 const double RthBand = (1-w) * gaussDist;
1445
1446 return RaboveTh + RthBand;
1447
1448 } else {
1449
1450 return 0.0;
1451 }
1452 }
virtual double getChargeProbability(const double npe, const int NPE) const override
Get probability density for given charge.
virtual double getNPE(const double tot_ns) const override
Get number of photo-electrons.

◆ getIntegralOfTimeOverThresholdProbability()

double JDETECTOR::JPMTAnalogueSignalProcessor::getIntegralOfTimeOverThresholdProbability ( const double Tmin,
const double Tmax,
const int NPE ) const
inline

Get cumulative probability of time-over-threshold distribution.

Parameters
Tminminimum time-over-threshold (with saturation) [ns]
Tmaxmaximum time-over-threshold (with saturation) [ns]
NPEtrue number of photo-electrons
Returns
probability [ns^-1]

Definition at line 1463 of file JPMTAnalogueSignalProcessor.hh.

1464 {
1465 double Xmin = Tmin;
1466 double Xmax = Tmax;
1467
1468 if (Tmin > saturation) {Xmin = saturation;}
1469 if (Tmax > saturation) {Xmax = saturation;}
1470
1471 const double IaboveTh = getIntegralOfChargeProbability(getNPE(Xmin), getNPE(Xmax), NPE);
1472
1473 const double w = getIntegralOfChargeProbability(ABOVE_THRESHOLD, NPE);
1475 const double gaussCumulP = gauss.getIntegral(Xmin, Xmax);
1476 const double gaussNorm = gauss.getIntegral(0, saturation);
1477 const double gaussDist = gaussCumulP / gaussNorm;
1478 const double IthBand = (1-w) * gaussDist;
1479
1480 return IaboveTh + IthBand;
1481 }

◆ getTH0()

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

Get lower threshold for rise time evaluation.

Returns
threshold [npe]

Definition at line 1489 of file JPMTAnalogueSignalProcessor.hh.

1490 {
1491 return 0.1;
1492 }

◆ getTH1()

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

Get upper threshold for rise time evaluation.

Returns
threshold [npe]

Definition at line 1500 of file JPMTAnalogueSignalProcessor.hh.

1501 {
1502 return 0.9;
1503 }

◆ operator()()

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

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).
A PMT signal with negative number of photo-electrons is not subjected to the quantum efficiency and transit-time distribution.
This feature is used to simulate the singles rate of a PMT when the measured QE is zero.

Parameters
calibrationPMT calibration
inputPMT signals
outputPMT hits

Definition at line 91 of file JPMTSignalProcessorInterface.hh.

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

◆ 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 (I/O)

Definition at line 311 of file JPMTSignalProcessorInterface.hh.

312 {
313 using namespace std;
314
316
317 for (JPMTData<JPMTPulse>::iterator i = data.begin(); i != data.end(); ) {
318
319 double t1 = i->t_ns;
320 double t2 = i->t_ns + i->tot_ns;
321
322 while (++i != data.end() && i->t_ns < t2 + getTmin()) {
323 t2 = max(t2, i->t_ns + i->tot_ns);
324 }
325
326 out->t_ns = t1;
327 out->tot_ns = t2 - t1;
328
329 ++out;
330 }
331
332 data.resize(distance(data.begin(), out));
333 }
std::vector< JElement_t >::iterator iterator
static double getTmin()
Get two photo-electron resolution for time-over-threshold.

◆ getTmin()

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

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

Returns
minimal time [ns]

Definition at line 341 of file JPMTSignalProcessorInterface.hh.

342 {
343 return 1.0;
344 }

◆ getQmin()

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

Get width of charge distribution.

Returns
width charge distribution [npe]

Definition at line 352 of file JPMTSignalProcessorInterface.hh.

353 {
354 return 1.0e-3;
355 }

◆ getPMTParameters()

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

Get PMT parameters.

Returns
PMT parameters

Definition at line 112 of file JPMTParameters.hh.

113 {
114 return static_cast<const JPMTParameters&>(*this);
115 }

◆ is_valid()

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

Check validity of PMT parameters.

Returns
true if valid; else false

Definition at line 134 of file JPMTParameters.hh.

135 {
136 if (this->QE < 0.0 ||
137 this->gain < 0.0 ||
138 this->gainSpread < 0.0 ||
139 this->threshold < 0.0 ||
140 this->thresholdBand < 0.0) {
141 return false;
142 }
143
144 return true;
145 }

◆ getType()

int JDETECTOR::JPMTParameters::getType ( ) const
inlineinherited

Get type for for time-slewing correction.

Returns
type

Definition at line 153 of file JPMTParameters.hh.

154 {
155 if (this->TTS_ns < 0.0)
156 return -lrint(this->TTS_ns);
157 else
158 return 0;
159 }

◆ getEquationParameters()

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

Get equation parameters.

Returns
equation parameters

Definition at line 209 of file JPMTParameters.hh.

210 {
211 static JEquationParameters equation("=", ",", "./", "#");
212
213 return equation;
214 }
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ setEquationParameters()

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

Set equation parameters.

Parameters
equationequation parameters

Definition at line 222 of file JPMTParameters.hh.

223 {
224 getEquationParameters() = equation;
225 }
static JEquationParameters & getEquationParameters()
Get equation parameters.

◆ getProperties() [1/2]

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

Get properties of this class.

Parameters
equationequation parameters

Definition at line 233 of file JPMTParameters.hh.

234 {
235 return JPMTParametersHelper(*this, equation);
236 }

◆ 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 244 of file JPMTParameters.hh.

245 {
246 return JPMTParametersHelper(*this, equation);
247 }

Friends And Related Symbol 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 446 of file JPMTAnalogueSignalProcessor.hh.

447 {
448 in >> static_cast<JPMTParameters&>(object);
449
450 object.configure();
451
452 return in;
453 }

Member Data Documentation

◆ decayTime_ns

double JDETECTOR::JPMTAnalogueSignalProcessor::decayTime_ns
protected

decay time [ns]

Definition at line 1507 of file JPMTAnalogueSignalProcessor.hh.

◆ t1

double JDETECTOR::JPMTAnalogueSignalProcessor::t1
protected

time at match point [ns]

Definition at line 1508 of file JPMTAnalogueSignalProcessor.hh.

◆ y1

double JDETECTOR::JPMTAnalogueSignalProcessor::y1
protected

amplitude at match point [npe]

Definition at line 1509 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 1515 of file JPMTAnalogueSignalProcessor.hh.

◆ QE

double JDETECTOR::JPMTParameters::QE
inherited

relative quantum efficiency

Definition at line 250 of file JPMTParameters.hh.

◆ gain

double JDETECTOR::JPMTParameters::gain
inherited

gain [unit]

Definition at line 251 of file JPMTParameters.hh.

◆ gainSpread

double JDETECTOR::JPMTParameters::gainSpread
inherited

gain spread [unit]

Definition at line 252 of file JPMTParameters.hh.

◆ riseTime_ns

double JDETECTOR::JPMTParameters::riseTime_ns
inherited

rise time of analogue pulse [ns]

Definition at line 253 of file JPMTParameters.hh.

◆ TTS_ns

double JDETECTOR::JPMTParameters::TTS_ns
inherited

transition time spread [ns]

Definition at line 254 of file JPMTParameters.hh.

◆ threshold

double JDETECTOR::JPMTParameters::threshold
inherited

threshold [npe]

Definition at line 255 of file JPMTParameters.hh.

◆ PunderAmplified

double JDETECTOR::JPMTParameters::PunderAmplified
inherited

probability of underamplified hit

Definition at line 256 of file JPMTParameters.hh.

◆ thresholdBand

double JDETECTOR::JPMTParameters::thresholdBand
inherited

threshold-band [npe]

Definition at line 257 of file JPMTParameters.hh.

◆ mean_ns

double JDETECTOR::JPMTParameters::mean_ns
inherited

mean time-over-threshold of threshold-band hits [ns]

Definition at line 258 of file JPMTParameters.hh.

◆ sigma_ns

double JDETECTOR::JPMTParameters::sigma_ns
inherited

time-over-threshold standard deviation of threshold-band hits [ns]

Definition at line 259 of file JPMTParameters.hh.

◆ slope

double JDETECTOR::JPMTParameters::slope
inherited

slope [ns/npe]

Definition at line 260 of file JPMTParameters.hh.

◆ saturation

double JDETECTOR::JPMTParameters::saturation
inherited

saturation [ns]

Definition at line 261 of file JPMTParameters.hh.

◆ slewing

bool JDETECTOR::JPMTParameters::slewing
inherited

time slewing of analogue signal

Definition at line 262 of file JPMTParameters.hh.


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