Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
*fatal Wrong number of arguments esac JCookie sh JRuns D $DETECTOR d sort n k
Definition: JRunrange.sh:16
JTOOLS::JElement3D< double, double > JElement3D_t
Definition: JLED.hh:27
double tmin
Definition: JLED.hh:266
Numerical integrator for W(x) = 1.
Definition: JQuadrature.hh:111
virtual ~JAbstractLED()
Virtual destructor.
Definition: JLED.hh:39
The elements in a collection are sorted according to their abscissa values and a given distance opera...
const JAbstractLED * led
Pointer to interface for emission profile from LED.
Definition: JLED.hh:429
virtual double getAngularAcceptance(const double ct) const
Angular acceptence of PMT (normalised to one at cos() = -1).
Definition: JLED.hh:378
Implementation of dispersion for water in deep sea.
Definition: JDispersion.hh:26
JQuadrature main_engine
Definition: JLED.hh:269
Numerical integrator for W(x) = |x| / sqrt(1 - x*x)
Definition: JQuadrature.hh:486
double tmax
Definition: JLED.hh:267
virtual double getPhotocathodeArea() const
Photo-cathode area of PMT.
Definition: JLED.hh:354
static const double PI
Constants.
Definition: JConstants.hh:20
3D Element.
Definition: JElement.hh:492
Interface for emission profile from LED.
Definition: JLED.hh:33
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
Light yield from LED (number of p.e.
Definition: JDrawLED.cc:47
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
Definition: JTransitTime.sh:36
PMT interface.
Definition: JAbstractPMT.hh:17
virtual double getQE(const double lambda) const
Quantum efficiency of PMT (incl.
Definition: JLED.hh:366
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
std::vector< JElement3D_t > phi_engine
Definition: JLED.hh:271
virtual abscissa_type getX(int index) const
Get abscissa value.
Definition: JCollection.hh:208
virtual double getScatteringLength(const double lambda) const =0
Scattering length.
double l_abs
Absorption length.
Definition: JLED.hh:442
Probability Density Functions of the time response of a PMT (C-like interface)
Definition: JLED.hh:278
JQuadrature beta_engine
Definition: JLED.hh:270
then print_variable DETECTOR INPUT_FILE INTERMEDIATE_FILE check_input_file $DETECTOR $INPUT_FILE check_output_file $INTERMEDIATE_FILE $OUTPUT_FILE JMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JPath.sh:52
virtual double getAbsorptionLength(const double lambda) const =0
Absorption length.
virtual double getAbsorptionLength(const double lambda) const
Absorption length.
Definition: JLED.hh:390
virtual double getPhotocathodeArea() const =0
Photo-cathode area of PMT.
Type definition for numerical integration.
Definition: JQuadrature.hh:37
double ls
Scattering length.
Definition: JLED.hh:447
const double A
photo-cathode area [m2]
Definition: JLED.hh:424
Auxiliary classes for numerical integration.
virtual double getIndexOfRefractionGroup(const double lambda) const
Index of refraction for group velocity.
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
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
int numberOfPoints
Definition: JResultPDF.cc:22
Probability Density Functions of the time response of a PMT.
Definition: JLED.hh:60
virtual double getAngularAcceptance(const double ct) const =0
Angular acceptence of PMT.
virtual double getLightFromLED(const double ct, const double phi, const double dt) const =0
Light yield from LED (number of p.e.
2D Element.
Definition: JElement.hh:44
JTOOLS::JElement2D< double, double > JElement2D_t
Definition: JLED.hh:26
container_type::const_iterator const_iterator
Definition: JCollection.hh:90
int j
Definition: JPolint.hh:634
virtual double getScatteringLength(const double lambda) const
Scattering length.
Definition: JLED.hh:402
virtual double getQE(const double lambda) const =0
Quantum efficiency of PMT (incl.
data_type v[N+1][M+1]
Definition: JPolint.hh:707
double u[N+1]
Definition: JPolint.hh:706
static const double C
Speed of light in vacuum [m/ns].
Definition: JConstants.hh:22
Light dispersion inteface.
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
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
virtual double getScatteringProbability(const double ct) const =0
Model specific function to describe light scattering in water (integral over full solid angle normali...
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
double wavelength
Definition: JLED.hh:264
then set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable OUTPUT_FILE histogram.root JHistogram1D -o $WORKDIR/$OUTPUT_FILE -F "$FORMULA" -