Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
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
 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).

Parameters
calibrationPMT calibration
inputPMT signals
outputPMT hits

Definition at line 89 of file JPMTSignalProcessorInterface.hh.

92 {
93 // apply transition time distribution to each photo-electron.
94
95 JPMTData<JPhotoElectron> buffer;
96
97 for (JPMTData<JPMTSignal>::const_iterator hit = input.begin(); hit != input.end(); ++hit) {
98
99 for (int i = 0; i != hit->npe; ++i) {
100
101 if (applyQE()) {
102 buffer.push_back(JPhotoElectron(getRandomTime(hit->t_ns)));
103 }
104 }
105 }
106
107 if (!buffer.empty()) {
108
109 buffer.push_back(JPhotoElectron::getEndMarker());
110
111 buffer.sort();
112
113
114 // generate PMT hits from time sequence of photo-electrons.
115
116 for (JPMTData<JPhotoElectron>::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++q) {
117
118 while (compare(*p,*q)) {
119 ++q;
120 }
121
122 const double npe = getRandomCharge(distance(p,q));
123
124 if (applyThreshold(npe)) {
125 output.push_back(JPMTPulse(putTime(p->t_ns + getRiseTime(npe), calibration), getTimeOverThreshold(npe)));
126 }
127
128 p = q;
129 }
130
131 // merge overlapping PMT hits.
132
133 merge(output);
134 }
135 }
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 144 of file JPMTSignalProcessorInterface.hh.

145 {
146 return true;
147 }

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

158 {
159 return t_ns;
160 }

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

172 {
173 return second.t_ns - first.t_ns <= getTmin();
174 }
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 184 of file JPMTSignalProcessorInterface.hh.

185 {
186 return (double) NPE;
187 }

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

198 {
199 return (fabs(npe - NPE) <= 0.5 * getQmin() ? 1.0 / getQmin() : 0.0);
200 }
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 210 of file JPMTSignalProcessorInterface.hh.

211 {
212 return (npe > 0.0);
213 }

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

224 {
225 return 0.0;
226 }

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

237 {
238 return TIME_OVER_THRESHOLD_NS + getTmin() * (round(npe) - 1.0);
239 }
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 248 of file JPMTSignalProcessorInterface.hh.

249 {
250 return 1.0 / getTmin();
251 }

◆ getSurvivalProbability()

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

Probability that a hit survives the simulation of the PMT.

The default implementation returns 1 if given value larger than 0.

Parameters
NPEnumber of photo-electrons
Returns
probability

Reimplemented in JDETECTOR::JPMTAnalogueSignalProcessor.

Definition at line 261 of file JPMTSignalProcessorInterface.hh.

262 {
263 if (NPE > 0)
264 return 1.0;
265 else
266 return 0.0;
267 }

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

278 {
279 return 1.0 + (tot_ns - TIME_OVER_THRESHOLD_NS) / getTmin();
280 }

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

294 {
295 using namespace std;
296
298
299 for (JPMTData<JPMTPulse>::iterator i = data.begin(); i != data.end(); ) {
300
301 double t1 = i->t_ns;
302 double t2 = i->t_ns + i->tot_ns;
303
304 while (++i != data.end() && i->t_ns < t2 + getTmin()) {
305 t2 = max(t2, i->t_ns + i->tot_ns);
306 }
307
308 out->t_ns = t1;
309 out->tot_ns = t2 - t1;
310
311 ++out;
312 }
313
314 data.resize(distance(data.begin(), out));
315 }
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 323 of file JPMTSignalProcessorInterface.hh.

324 {
325 return 1.0;
326 }

◆ getQmin()

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

Get width of charge distribution.

Returns
width charge distribution [npe]

Definition at line 334 of file JPMTSignalProcessorInterface.hh.

335 {
336 return 1.0e-3;
337 }

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