Jpp
JLED.hh
Go to the documentation of this file.
1 #ifndef __JPHYSICS__JLED__
2 #define __JPHYSICS__JLED__
3 
8 #include "JTools/JElement.hh"
9 #include "JTools/JQuadrature.hh"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JPHYSICS {}
17 namespace JPP { using namespace JPHYSICS; }
18 
19 namespace JPHYSICS {
20 
21 
22  using JTOOLS::JQuadrature;
24  using JTOOLS::JCotangent;
25 
28 
29 
30  /**
31  * Interface for emission profile from LED.
32  */
33  class JAbstractLED {
34  public:
35 
36  /**
37  * Virtual destructor.
38  */
39  virtual ~JAbstractLED()
40  {}
41 
42 
43  /**
44  * Light yield from LED (number of p.e. per unit solid angle per unit time).
45  *
46  * \param ct zenith angle of emission
47  * \param phi azimuth angle of emission
48  * \param dt time of emission [ns]
49  * \return d^2P / dOmega dt [npe/ns/sr]
50  */
51  virtual double getLightFromLED(const double ct,
52  const double phi,
53  const double dt) const = 0;
54  };
55 
56 
57  /**
58  * Probability Density Functions of the time response of a PMT.
59  */
60  class JLED :
61  public virtual JDispersionInterface,
62  public JAbstractPMT,
63  public JAbstractLED,
64  public JAbstractMedium
65  {
66  public:
67  /**
68  * Constructor.
69  *
70  * \param lambda wavelength photon [nm]
71  * \param Tmin_ns minimal time of emmision [ns]
72  * \param Tmax_ns minimal time of emmision [ns]
73  * \param engine scattering angle integrator
74  * \param numberOfPoints number of points for integration
75  * \param epsilon precision of points for integration
76  */
77  JLED(const double lambda,
78  const double Tmin_ns,
79  const double Tmax_ns,
80  const JQuadrature& engine = JCotangent(20),
81  const int numberOfPoints = 20,
82  const double epsilon = 1e-12) :
83  wavelength(lambda),
84  tmin(Tmin_ns),
85  tmax(Tmax_ns),
87  beta_engine(engine)
88  {
89  using JTOOLS::PI;
90 
91  const double dp = PI / numberOfPoints;
92 
93  for (double x = 0.5*dp; x < PI; x += dp) {
94  phi_engine.push_back(JElement3D_t(cos(x),sin(x), dp));
95  }
96  }
97 
98 
99  /**
100  * Probability density function for direct light from LED.
101  *
102  * \param D_m distance between LED and PMT [m]
103  * \param cd cosine angle LED orientation and LED - PMT position
104  * \param theta zenith angle orientation PMT
105  * \param phi azimuth angle orientation PMT
106  * \param t_ns time difference relative to direct light [ns]
107  * \return dP/dt [npe/ns]
108  */
109  double getDirectLightFromLED(const double D_m,
110  const double cd,
111  const double theta,
112  const double phi,
113  const double t_ns) const
114  {
115  const double sd = sqrt((1.0 + cd)*(1.0 - cd));
116  const double d = D_m; // photon path [m]
117 
118  const double A = getPhotocathodeArea();
119 
120  const double px = sin(theta)*cos(phi);
121  //const double py = sin(theta)*sin(phi);
122  const double pz = cos(theta);
123 
124  const double ct = sd*px + cd*pz; // cosine angle of incidence on PMT
125 
126  const double qe = getQE(wavelength);
127  const double l_abs = getAbsorptionLength(wavelength);
128  const double ls = getScatteringLength(wavelength);
129 
130  const double U = getAngularAcceptance(ct);
131  const double V = exp(-d/l_abs) * exp(-d/ls); // absorption & scattering
132  const double W = A/(d*d); // solid angle
133 
134  return qe * getLightFromLED(cd, 0.0, t_ns) * U * V * W;
135  }
136 
137 
138  /**
139  * Probability density function for scattered light from LED.
140  *
141  * \param D_m distance between LED and PMT [m]
142  * \param cd cosine angle LED orientation and LED - PMT position
143  * \param theta zenith angle orientation PMT
144  * \param phi azimuth angle orientation PMT
145  * \param t_ns time difference relative to direct light [ns]
146  * \return dP/dt [npe/ns]
147  */
148  double getScatteredLightFromLED(const double D_m,
149  const double cd,
150  const double theta,
151  const double phi,
152  const double t_ns) const
153  {
154  using namespace std;
155  using JTOOLS::PI;
156  using JTOOLS::C;
157 
158  double value = 0;
159 
160  if (t_ns >= tmin) {
161 
162  const double ng = getIndexOfRefractionGroup(wavelength);
163 
164  const double sd = sqrt((1.0 + cd)*(1.0 - cd));
165  const double l = D_m; // distance [m]
166 
167  const double A = getPhotocathodeArea();
168  //const double sr = sqrt(A/PI) / D_m;
169  //const double cr = sqrt((1.0 + sr)*(1.0 - sr));
170 
171  const double px = sin(theta)*cos(phi);
172  const double py = sin(theta)*sin(phi);
173  const double pz = cos(theta);
174 
175  const double qx = cd*px + 0 - sd*pz;
176  const double qy = 1*py;
177  const double qz = sd*px + 0 + cd*pz;
178 
179  const double qe = getQE(wavelength);
180  const double l_abs = getAbsorptionLength(wavelength);
181  const double ls = getScatteringLength(wavelength);
182 
183  const double Jc = 1.0 / ls; // dN/dx
184 
185  const double xmin = tmin;
186  const double xmax = std::min(tmax, t_ns);
187 
188  JQuadrature buffer;
189 
190  if (xmax > xmin) {
191 
192  for (JQuadrature::const_iterator i = main_engine.begin(); i != main_engine.end(); ++i) {
193 
194  const double t = 0.5 * (xmax + xmin) + i->getX() * 0.5 * (xmax - xmin);
195  const double dt = i->getY() * 0.5 * (xmax - xmin);
196 
197  buffer[t] = dt;
198  }
199 
200  } else {
201 
202  buffer[tmin] = 1.0;
203  }
204 
205  for (JQuadrature::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
206 
207  const double t = i->getX();
208  const double dt = i->getY();
209 
210  const double d = l + C*(t_ns - t)/ng; // photon path
211  const double V = exp(-d/l_abs); // absorption
212 
213  for (JQuadrature::const_iterator j = beta_engine.begin(); j != beta_engine.end(); ++j) {
214 
215  const double cb = j->getX();
216  const double dc = j->getY();
217 
218  const double sb = sqrt((1.0 + cb)*(1.0 - cb));
219 
220  const double v = 0.5 * (d + l) * (d - l) / (d - l*cb);
221  const double u = d - v;
222 
223  if (u <= 0) continue;
224  if (v <= 0) continue;
225 
226  const double cts = (l*cb - v) / u; // cosine scattering angle
227 
228  const double W = min(A/(v*v), 2.0*PI); // solid angle
229  const double Ja = getScatteringProbability(cts); // P(cos(),phi)
230  const double Jd = ng * (1.0 - cts) / C; // dt/du
231 
232  const double ca = (l - v*cb) / u;
233  const double sa = v*sb / u;
234 
235  for (std::vector<JElement3D_t>::const_iterator k = phi_engine.begin(); k != phi_engine.end(); ++k) {
236 
237  const double cp = k->getX();
238  const double sp = k->getY();
239  const double dp = k->getZ();
240 
241  const double dom = dc * dp * v*v / (u*u);
242 
243  const double ct0 = cd*ca - sd*sa*cp;
244  const double ph0 = atan2(sa*sp, cd*sa*cp + sd*ca);
245 
246  const double vx = -sb*cp * qx;
247  const double vy = -sb*sp * qy;
248  const double vz = cb * qz;
249 
250  const double U =
251  getAngularAcceptance(vx + vy + vz) * getLightFromLED(ct0, +ph0, t) +
252  getAngularAcceptance(vx - vy + vz) * getLightFromLED(ct0, -ph0, t);
253 
254  value += qe * dt * dom * Ja * Jc * U * V * W / Jd;
255  }
256  }
257  }
258  }
259 
260  return value;
261  }
262 
263  protected:
264  double wavelength; // wavelength photon [nm]
265 
266  double tmin; // minimal time of emmision [ns]
267  double tmax; // maximal time of emmision [ns]
268 
269  JQuadrature main_engine; // numerical integration
270  JQuadrature beta_engine; // numerical integration of scattering angle
271  std::vector<JElement3D_t> phi_engine; // numerical integration of phi angle
272  };
273 
274 
275  /**
276  * Probability Density Functions of the time response of a PMT (C-like interface)
277  */
278  class JLED_C :
279  public JLED,
280  public JDispersion
281  {
282  public:
283  /**
284  * Constructor.
285  *
286  * \param Area photo-cathode area [m^2]
287  * \param LED pointer to interface for emission profile from LED
288  * \param QE pointer to function for quantum efficiency of PMT
289  * \param Pmt pointer to function for angular acceptence of PMT
290  * \param L_abs absorption length [m]
291  * \param L_s scattering length [m]
292  * \param Km3 pointer to model specific function to describe light scattering in water
293  * \param P_atm ambient pressure [atm]
294  * \param wavelength wavelength of light [nm]
295  * \param Tmin_ns minimal time of emmision [ns]
296  * \param Tmax_ns minimal time of emmision [ns]
297  * \param engine scattering angle integrator
298  * \param numberOfPoints number of points for integration
299  * \param epsilon precision of points for integration
300  */
301  JLED_C(const double Area,
302  //
303  // pointers to static functions
304  //
305  const JAbstractLED* LED,
306  double (*QE) (const double),
307  double (*Pmt) (const double),
308  const double L_abs,
309  const double L_s,
310  double (*Km3) (const double),
311  //
312  // parameters for base class
313  //
314  const double P_atm,
315  const double wavelength,
316  const double Tmin_ns,
317  const double Tmax_ns,
318  const JQuadrature& engine = JCotangent(20),
319  const int numberOfPoints = 20,
320  const double epsilon = 1e-12) :
321  JLED(wavelength, Tmin_ns, Tmax_ns, engine, numberOfPoints, epsilon),
322  JDispersion(P_atm),
323  A (Area ),
324  led (LED ),
325  qe (QE ),
326  l_abs(L_abs),
327  ls (L_s ),
328  pmt (Pmt ),
329  km3 (Km3 )
330  {}
331 
332 
333  /**
334  * Light yield from LED (number of p.e. per unit solid angle per unit time).
335  *
336  * \param ct zenith angle of emission
337  * \param phi azimuth angle of emission
338  * \param dt time of emission [ns]
339  * \return d^2P / dOmega dt [npe/ns/sr]
340  */
341  virtual double getLightFromLED(const double ct,
342  const double phi,
343  const double dt) const
344  {
345  return led->getLightFromLED(ct, phi, dt);
346  }
347 
348 
349  /**
350  * Photo-cathode area of PMT.
351  *
352  * \return photo-cathode area [m^2]
353  */
354  virtual double getPhotocathodeArea() const
355  {
356  return A;
357  }
358 
359 
360  /**
361  * Quantum efficiency of PMT (incl. absorption in glass, gel, etc.).
362  *
363  * \param lambda wavelenth [nm]
364  * \return QE
365  */
366  virtual double getQE(const double lambda) const
367  {
368  return qe(lambda);
369  }
370 
371 
372  /**
373  * Angular acceptence of PMT (normalised to one at cos() = -1).
374  *
375  * \param ct cosine angle of incidence
376  * \return relative efficiency
377  */
378  virtual double getAngularAcceptance(const double ct) const
379  {
380  return pmt(ct);
381  }
382 
383 
384  /**
385  * Absorption length.
386  *
387  * \param lambda wavelenth [nm]
388  * \return absorption length [m]
389  */
390  virtual double getAbsorptionLength(const double lambda) const
391  {
392  return l_abs;
393  }
394 
395 
396  /**
397  * Scattering length.
398  *
399  * \param lambda wavelenth [nm]
400  * \return scattering length [m]
401  */
402  virtual double getScatteringLength(const double lambda) const
403  {
404  return ls;
405  }
406 
407 
408  /**
409  * Model specific function to describe light scattering in water
410  * (integral over full solid angle normalised to one).
411  *
412  * \param ct cosine scattering angle
413  * \return probability
414  */
415  virtual double getScatteringProbability(const double ct) const
416  {
417  return km3(ct);
418  }
419 
420  protected:
421  /**
422  * photo-cathode area [m2]
423  */
424  const double A;
425 
426  /**
427  * Pointer to interface for emission profile from LED
428  */
430 
431  /**
432  * Quantum efficiency of PMT (incl. absorption in glass, gel, etc.)
433  *
434  * \param lambda wavelenth [nm]
435  * \return QE
436  */
437  double (*qe)(const double lambda);
438 
439  /**
440  * Absorption length
441  */
442  double l_abs;
443 
444  /**
445  * Scattering length
446  */
447  double ls;
448 
449  /**
450  * Angular acceptence of PMT (normalised to one at cos() = -1)
451  *
452  * \param ct cosine angle of incidence
453  * \return relative efficiency
454  */
455  double (*pmt)(const double ct);
456 
457  /**
458  * Model specific function to describe light scattering in water
459  *
460  * \param ct cosine scattering angle
461  * \return probability
462  */
463  double (*km3)(const double ct);
464  };
465 }
466 
467 #endif
JPHYSICS::JLED_C::getPhotocathodeArea
virtual double getPhotocathodeArea() const
Photo-cathode area of PMT.
Definition: JLED.hh:354
JPHYSICS::JElement2D_t
JTOOLS::JElement2D< double, double > JElement2D_t
Definition: JLED.hh:26
JElement.hh
JPHYSICS::JAbstractLED
Interface for emission profile from LED.
Definition: JLED.hh:33
JTOOLS::JQuadrature
Type definition for numerical integration.
Definition: JQuadrature.hh:39
JAbstractMedium.hh
JPHYSICS::JAbstractPMT
PMT interface.
Definition: JAbstractPMT.hh:17
JPHYSICS::JAbstractMedium::getAbsorptionLength
virtual double getAbsorptionLength(const double lambda) const =0
Absorption length.
numberOfPoints
int numberOfPoints
Definition: JResultPDF.cc:22
JPHYSICS::JAbstractMedium::getScatteringProbability
virtual double getScatteringProbability(const double ct) const =0
Model specific function to describe light scattering in water (integral over full solid angle normali...
JTOOLS::u
double u[N+1]
Definition: JPolint.hh:706
JPHYSICS::JAbstractLED::~JAbstractLED
virtual ~JAbstractLED()
Virtual destructor.
Definition: JLED.hh:39
std::vector
Definition: JSTDTypes.hh:12
JPHYSICS::JLED_C::l_abs
double l_abs
Absorption length.
Definition: JLED.hh:442
JPHYSICS
Auxiliary classes and methods for calculation of PDF and muon energy loss.
Definition: JAbstractMedium.hh:9
JTOOLS::JCollection::getX
virtual abscissa_type getX(int index) const
Get abscissa value.
Definition: JCollection.hh:189
JPHYSICS::JAbstractPMT::getAngularAcceptance
virtual double getAngularAcceptance(const double ct) const =0
Angular acceptence of PMT.
JQuadrature.hh
JTOOLS::j
int j
Definition: JPolint.hh:634
JPHYSICS::JAbstractPMT::getQE
virtual double getQE(const double lambda) const =0
Quantum efficiency of PMT (incl.
JTOOLS::JElement3D
3D Element.
Definition: JElement.hh:492
JDispersionInterface.hh
JTOOLS::C
static const double C
Speed of light in vacuum [m/ns].
Definition: JConstants.hh:22
JPHYSICS::JLED
Probability Density Functions of the time response of a PMT.
Definition: JLED.hh:60
JPHYSICS::JLED::getDirectLightFromLED
double getDirectLightFromLED(const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for direct light from LED.
Definition: JLED.hh:109
JPHYSICS::JAbstractLED::getLightFromLED
virtual double getLightFromLED(const double ct, const double phi, const double dt) const =0
Light yield from LED (number of p.e.
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JPHYSICS::JLED_C::getScatteringLength
virtual double getScatteringLength(const double lambda) const
Scattering length.
Definition: JLED.hh:402
JPHYSICS::JAbstractPMT::getPhotocathodeArea
virtual double getPhotocathodeArea() const =0
Photo-cathode area of PMT.
JPHYSICS::JDispersionInterface
Light dispersion inteface.
Definition: JDispersionInterface.hh:19
JPHYSICS::JElement3D_t
JTOOLS::JElement3D< double, double > JElement3D_t
Definition: JLED.hh:27
LED
Light yield from LED (number of p.e.
Definition: JDrawLED.cc:47
JPHYSICS::JDispersion
Implementation of dispersion for water in deep sea.
Definition: JDispersion.hh:26
JPHYSICS::JLED_C
Probability Density Functions of the time response of a PMT (C-like interface)
Definition: JLED.hh:278
JPHYSICS::JLED::getScatteredLightFromLED
double getScatteredLightFromLED(const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from LED.
Definition: JLED.hh:148
JPHYSICS::JLED_C::JLED_C
JLED_C(const double Area, const JAbstractLED *LED, double(*QE)(const double), double(*Pmt)(const double), const double L_abs, const double L_s, double(*Km3)(const double), const double P_atm, const double wavelength, const double Tmin_ns, const double Tmax_ns, const JQuadrature &engine=JCotangent(20), const int numberOfPoints=20, const double epsilon=1e-12)
Constructor.
Definition: JLED.hh:301
JPHYSICS::JLED::beta_engine
JQuadrature beta_engine
Definition: JLED.hh:270
JPHYSICS::JLED_C::getScatteringProbability
virtual double getScatteringProbability(const double ct) const
Model specific function to describe light scattering in water (integral over full solid angle normali...
Definition: JLED.hh:415
JPHYSICS::JLED_C::getLightFromLED
virtual double getLightFromLED(const double ct, const double phi, const double dt) const
Light yield from LED (number of p.e.
Definition: JLED.hh:341
JPHYSICS::JAbstractMedium::getScatteringLength
virtual double getScatteringLength(const double lambda) const =0
Scattering length.
JDispersion.hh
JPHYSICS::JLED::phi_engine
std::vector< JElement3D_t > phi_engine
Definition: JLED.hh:271
JTOOLS::v
data_type v[N+1][M+1]
Definition: JPolint.hh:707
JPHYSICS::JLED_C::ls
double ls
Scattering length.
Definition: JLED.hh:447
JAbstractPMT.hh
JTOOLS::JGaussLegendre
Numerical integrator for W(x) = 1.
Definition: JQuadrature.hh:113
JPHYSICS::JLED_C::getAngularAcceptance
virtual double getAngularAcceptance(const double ct) const
Angular acceptence of PMT (normalised to one at cos() = -1).
Definition: JLED.hh:378
JTOOLS::JCotangent
Numerical integrator for W(x) = |x| / sqrt(1 - x*x)
Definition: JQuadrature.hh:488
JPHYSICS::JLED_C::A
const double A
photo-cathode area [m2]
Definition: JLED.hh:424
JPHYSICS::JDispersionInterface::getIndexOfRefractionGroup
virtual double getIndexOfRefractionGroup(const double lambda) const
Index of refraction for group velocity.
Definition: JDispersionInterface.hh:52
std
Definition: jaanetDictionary.h:36
JPHYSICS::JLED::tmin
double tmin
Definition: JLED.hh:266
JTOOLS::PI
static const double PI
Constants.
Definition: JConstants.hh:20
JPHYSICS::JLED_C::getQE
virtual double getQE(const double lambda) const
Quantum efficiency of PMT (incl.
Definition: JLED.hh:366
JPHYSICS::JLED::main_engine
JQuadrature main_engine
Definition: JLED.hh:269
JTOOLS::JElement2D
2D Element.
Definition: JElement.hh:44
JPHYSICS::JLED::wavelength
double wavelength
Definition: JLED.hh:264
JPHYSICS::JLED_C::led
const JAbstractLED * led
Pointer to interface for emission profile from LED.
Definition: JLED.hh:429
JTOOLS::JCollection< JElement2D_t >::const_iterator
container_type::const_iterator const_iterator
Definition: JCollection.hh:89
JPHYSICS::JLED::JLED
JLED(const double lambda, const double Tmin_ns, const double Tmax_ns, const JQuadrature &engine=JCotangent(20), const int numberOfPoints=20, const double epsilon=1e-12)
Constructor.
Definition: JLED.hh:77
JPHYSICS::JLED_C::getAbsorptionLength
virtual double getAbsorptionLength(const double lambda) const
Absorption length.
Definition: JLED.hh:390
JPHYSICS::JAbstractMedium
Medium interface.
Definition: JAbstractMedium.hh:17
JPHYSICS::JLED::tmax
double tmax
Definition: JLED.hh:267