Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
JDETECTOR::JPMTSignalProcessorInterface Class Reference

PMT signal processor interface. More...

#include <JPMTSignalProcessorInterface.hh>

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

Public Member Functions

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

Static Public Member Functions

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

Detailed Description

PMT signal processor interface.

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

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

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

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

The default implementation of these virtual methods corresponds to no smearing and a time-over-threshold value equal to a fixed two photo-electron resolution times the number of photo-electrons. The width of the charge distribution and the two photo-electron resolution are implemented in methods getQmin() and getTmin(), respectively.

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

Definition at line 63 of file JPMTSignalProcessorInterface.hh.

Constructor & Destructor Documentation

◆ JPMTSignalProcessorInterface()

JDETECTOR::JPMTSignalProcessorInterface::JPMTSignalProcessorInterface ( )
inline

Default constructor.

Definition at line 68 of file JPMTSignalProcessorInterface.hh.

69 {}

◆ ~JPMTSignalProcessorInterface()

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

Virtual destructor.

Definition at line 75 of file JPMTSignalProcessorInterface.hh.

76 {}

Member Function Documentation

◆ operator()()

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

Process hits.

Two (or more) photo-electrons are combined if they are comparable according method compare.
Two (or more) consecutive hits hits maybe merged (according method merge).
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.

◆ applyQE()

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

Apply relative QE.

The default implementation returns true.

Returns
true if accepted; false if rejected

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 149 of file JPMTSignalProcessorInterface.hh.

150 {
151 return true;
152 }

◆ getRandomTime()

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

Get randomised time according transition time distribution.

The default implementation returns the given value.

Parameters
t_nstime [ns]
Returns
time [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 162 of file JPMTSignalProcessorInterface.hh.

163 {
164 return t_ns;
165 }

◆ compare()

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

Compare arrival times of photo-electrons.

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

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 176 of file JPMTSignalProcessorInterface.hh.

177 {
178 return second.t_ns - first.t_ns <= getTmin();
179 }
static double getTmin()
Get two photo-electron resolution for time-over-threshold.

◆ getRandomCharge()

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

Get randomised charge according to gain and gain spread.

The default implementation returns the given value.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 189 of file JPMTSignalProcessorInterface.hh.

190 {
191 return (double) NPE;
192 }

◆ getChargeProbability()

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

Get probability density for given charge.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 202 of file JPMTSignalProcessorInterface.hh.

203 {
204 return (fabs(npe - NPE) <= 0.5 * getQmin() ? 1.0 / getQmin() : 0.0);
205 }
static double getQmin()
Get width of charge distribution.

◆ applyThreshold()

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

Apply threshold.

The default implementation returns true.

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 215 of file JPMTSignalProcessorInterface.hh.

216 {
217 return (npe > 0.0);
218 }

◆ getRiseTime()

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

Get time to reach threshold.

The default implementation returns 0.

Parameters
npenumber of photo-electrons
Returns
time [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 228 of file JPMTSignalProcessorInterface.hh.

229 {
230 return 0.0;
231 }

◆ getTimeOverThreshold()

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

Get time-over-threshold (ToT).

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

Parameters
npenumber of photo-electrons
Returns
ToT [ns]

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 241 of file JPMTSignalProcessorInterface.hh.

242 {
243 return TIME_OVER_THRESHOLD_NS + getTmin() * (round(npe) - 1.0);
244 }
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.

◆ getDerivative()

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

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

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 253 of file JPMTSignalProcessorInterface.hh.

254 {
255 return 1.0 / getTmin();
256 }

◆ getSurvivalProbability()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getSurvivalProbability ( const int NPE,
const bool option = true ) const
inlinevirtual

Probability that a hit survives the simulation of the PMT.

The default implementation returns one (zero) if given number of photo-electrons is larger than (less or equal to) zero.
The QE is excluded when the option is set to false.

Parameters
NPEnumber of photo-electrons
optioninclude QE
Returns
probability

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 268 of file JPMTSignalProcessorInterface.hh.

269 {
270 if (NPE > 0)
271 return 1.0;
272 else
273 return 0.0;
274 }

◆ getNPE()

virtual double JDETECTOR::JPMTSignalProcessorInterface::getNPE ( const double tot_ns) const
inlinevirtual

Get number of photo-electrons.

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

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

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 284 of file JPMTSignalProcessorInterface.hh.

285 {
286 return 1.0 + (tot_ns - TIME_OVER_THRESHOLD_NS) / getTmin();
287 }

◆ merge()

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

Merging of PMT hits.

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

Parameters
dataPMT hits (I/O)

Definition at line 300 of file JPMTSignalProcessorInterface.hh.

301 {
302 using namespace std;
303
305
306 for (JPMTData<JPMTPulse>::iterator i = data.begin(); i != data.end(); ) {
307
308 double t1 = i->t_ns;
309 double t2 = i->t_ns + i->tot_ns;
310
311 while (++i != data.end() && i->t_ns < t2 + getTmin()) {
312 t2 = max(t2, i->t_ns + i->tot_ns);
313 }
314
315 out->t_ns = t1;
316 out->tot_ns = t2 - t1;
317
318 ++out;
319 }
320
321 data.resize(distance(data.begin(), out));
322 }
std::vector< JElement_t >::iterator iterator

◆ getTmin()

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

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

Returns
minimal time [ns]

Definition at line 330 of file JPMTSignalProcessorInterface.hh.

331 {
332 return 1.0;
333 }

◆ getQmin()

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

Get width of charge distribution.

Returns
width charge distribution [npe]

Definition at line 341 of file JPMTSignalProcessorInterface.hh.

342 {
343 return 1.0e-3;
344 }

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