Jpp
Classes | Typedefs | Functions
JDrawLED.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JPhysics/JLED.hh"
#include "JPhysics/JPDFToolkit.hh"
#include "JPhysics/Antares.hh"
#include "JPhysics/KM3NeT.hh"
#include "JTools/JSpline.hh"
#include "JTools/JQuantiles.hh"
#include "JTools/JToolsToolkit.hh"

Go to the source code of this file.

Classes

class  LED
 Light yield from LED (number of p.e. More...
 

Typedefs

typedef std::pair< double, double > orientation
 

Functions

std::istream & operator>> (std::istream &in, orientation &x)
 
std::ostream & operator<< (std::ostream &out, const orientation &x)
 
double henyey_greenstein (const double ct)
 
double rayleigh (const double ct)
 
double getAngularAcceptance (const double x)
 Angular acceptence of PMT. More...
 
int main (int argc, char **argv)
 

Detailed Description

Example program to draw PDF from LED beacon.

Author
mdejong

Definition in file JDrawLED.cc.

Typedef Documentation

◆ orientation

typedef std::pair<double,double> orientation

Definition at line 22 of file JDrawLED.cc.

Function Documentation

◆ operator>>()

std::istream& operator>> ( std::istream &  in,
orientation x 
)

Definition at line 24 of file JDrawLED.cc.

24 { return in >> x.first >> x.second; }

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const orientation x 
)

Definition at line 25 of file JDrawLED.cc.

25 { return out << x.first << ' ' << x.second; }

◆ henyey_greenstein()

double henyey_greenstein ( const double  ct)
inline

Definition at line 28 of file JDrawLED.cc.

29 {
30  static const double a = 0.924;
31 
32  return ANTARES::henyey_greenstein(a, ct);
33 }

◆ rayleigh()

double rayleigh ( const double  ct)
inline

Definition at line 36 of file JDrawLED.cc.

37 {
38  static const double a = 0.853;
39 
40  return ANTARES::rayleigh(a, ct);
41 }

◆ getAngularAcceptance()

double getAngularAcceptance ( const double  x)
inline

Angular acceptence of PMT.

Parameters
xcosine of angle of incidence
Returns
probability

Definition at line 84 of file JDrawLED.cc.

85 {
87 }

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 96 of file JDrawLED.cc.

97 {
98  using namespace std;
99 
100  string outputFile;
101  int numberOfPoints;
102  int number_of_points;
103  double epsilon;
104  double D;
105  double ct;
106  orientation dir;
107  double wavelength;
108  double absorptionLength;
109  double scatteringLength;
110  int debug;
111 
112  try {
113 
114  JParser<> zap("Example program to draw PDF from LED beacon.");
115 
116  zap['o'] = make_field(outputFile) = "led.root";
117  zap['n'] = make_field(numberOfPoints) = 25;
118  zap['N'] = make_field(number_of_points) = 25;
119  zap['e'] = make_field(epsilon) = 1.0e-10;
120  zap['A'] = make_field(absorptionLength) = 50.0;
121  zap['S'] = make_field(scatteringLength) = 50.0;
122  zap['R'] = make_field(D);
123  zap['c'] = make_field(ct);
124  zap['D'] = make_field(dir);
125  zap['w'] = make_field(wavelength) = 470;
126  zap['d'] = make_field(debug) = 2;
127 
128  zap(argc, argv);
129  }
130  catch(const exception &error) {
131  FATAL(error.what() << endl);
132  }
133 
134 
135  const double theta = dir.first;
136  const double phi = dir.second;
137 
138  using namespace JPP;
139 
140  // set global parameters
141 
142  const double P_atm = 240.0; // ambient pressure [Atm]
143  const double tmin = -10.0; // minimal time of emission [ns]
144  const double tmax = +10.0; // maximal time of emission [ns]
145  const double A = 440e-4; // ANTARES photo-cathode area [m2]
146  const double R_Hz = 0.0e3; // singles rate [Hz]
147 
148  const JDispersion dispersion(P_atm);
149 
150  //const double ng = dispersion.getIndexOfRefractionGroup(wavelength);
151  const double lm = scatteringLength / 0.83;
152  const double lr = scatteringLength / 0.17;
153 
154  const double cs = 0.83 * 0.92; // average cosine scattering angle
155 
156  const double l_abs = absorptionLength;
157  const double ls = scatteringLength;
158  const double l_att = l_abs * lr / (l_abs + lr);
159 
160 
161  LED* led = new LED();
162 
163  cout << "Rayleigh scattering length " << lr << " m" << endl;
164  cout << "Mie scattering length " << lm << " m" << endl;
165  cout << "Absorption length " << l_abs << " m" << endl;
166 
167  const JLED_C
168  pdfMie(A,
169  led,
172  l_abs,
173  lm,
175  P_atm,
176  wavelength,
177  tmin,
178  tmax,
179  JCotangent(number_of_points),
181  epsilon);
182 
183 
184  const JLED_C
185  pdfRayleigh(A,
186  led,
189  l_att,
190  lr,
191  rayleigh,
192  P_atm,
193  wavelength,
194  tmin,
195  tmax,
196  JCotangent(number_of_points),
198  epsilon);
199 
200 
201 
202  TFile out(outputFile.c_str(), "recreate");
203 
204  TH1D h0("h0", NULL, 430, -15.0, +200.0);
205  TH1D h1("h1", NULL, 430, -15.0, +200.0);
206  TH1D h2("h2", NULL, 430, -15.0, +200.0);
207  TH1D h3("h3", NULL, 430, -15.0, +200.0);
208  TH1D ha("ha", NULL, 430, -15.0, +200.0);
209 
210  JSplineFunction1S_t f[4];
211  JSplineFunction1S_t f1;
212 
213 
214  for (int i = 1; i <= h1.GetNbinsX(); ++i) {
215 
216  const double t1 = h1.GetBinCenter(i);
217 
218  const double F1 = pdfMie .getDirectLightFromLED (D, ct, theta, phi, t1);
219  const double F2 = pdfMie .getScatteredLightFromLED(D, ct, theta, phi, t1);
220  const double F3 = pdfRayleigh.getScatteredLightFromLED(D, ct, theta, phi, t1);
221 
222 
223  h0.SetBinContent(i, F1 + F2 + F3);
224  h1.SetBinContent(i, F1);
225  h2.SetBinContent(i, F2);
226  h3.SetBinContent(i, F3);
227 
228  f[0][t1] = F1;
229  f[1][t1] = F2;
230  f[2][t1] = F3;
231  f[3][t1] = F1 + F2 + F3;
232 
233  f1[t1] = F1 + F2 + F3;
234  }
235 
236  f1.compile();
237 
238  for (int i = 3; i != sizeof(f)/sizeof(f[0]); ++i) {
239 
240  f[i].compile();
241 
242  JQuantiles quantiles(f[i]);
243 
244 
245  const double lz = l_abs * ls / (l_abs*(1.0-cs) + ls);
246 
247  NOTICE("int " << quantiles.getIntegral() * D*D * exp(D/lz) << endl);
248 
249  DEBUG("D " << D << endl);
250  DEBUG("ct " << ct << endl);
251  DEBUG("theta " << theta << endl);
252  DEBUG("phi " << phi << endl);
253  DEBUG("int " << quantiles.getIntegral() << endl);
254  DEBUG("t1 " << quantiles.getX() << endl);
255  DEBUG("max " << quantiles.getY() << endl);
256  DEBUG("FWHM " << quantiles.getFWHM() << endl);
257  }
258 
259 
260  const double Tmin = ha.GetXaxis()->GetXmin();
261  const double Tmax = ha.GetXaxis()->GetXmax();
262 
263  const double V = f1.rbegin()->getIntegral() + R_Hz * 1e-9 * (Tmax - Tmin); // integral [Tmin,Tmax]
264 
265  for (int i = 1; i <= ha.GetNbinsX(); ++i) {
266 
267  const double t1 = ha.GetBinCenter(i);
268 
269  JSplineFunction1S_t::result_type p = f1(t1);
270 
271  double v = p.v + R_Hz * 1e-9 * (t1 - Tmin);
272  double y = p.f + R_Hz * 1e-9; // function value
273 
274  const double W = exp(-v) * y / (1.0 - exp(-V));
275 
276  ha.SetBinContent(i,W);
277  }
278 
279  delete led;
280 
281  out.Write();
282  out.Close();
283 }
ANTARES::getQE
double getQE(const double lambda, const bool option)
Quantum efficiency of 10-inch Hamamatsu PMT.
Definition: Antares.hh:376
numberOfPoints
int numberOfPoints
Definition: JResultPDF.cc:22
rayleigh
double rayleigh(const double ct)
Definition: JDrawLED.cc:36
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
NOTICE
#define NOTICE(A)
Definition: JMessage.hh:64
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
LED
Light yield from LED (number of p.e.
Definition: JDrawLED.cc:47
std::pair
Definition: JSTDTypes.hh:15
JTOOLS::v
data_type v[N+1][M+1]
Definition: JPolint.hh:707
ANTARES::henyey_greenstein
double henyey_greenstein(const double g, const double x)
Auxiliary method to describe light scattering in water (Heneyey-Greenstein)
Definition: Antares.hh:201
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
ANTARES::rayleigh
double rayleigh(const double a, const double x)
Auxiliary method to describe light scattering in water (Rayleigh)
Definition: Antares.hh:233
getAngularAcceptance
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition: JDrawLED.cc:84
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37
ANTARES::getAngularAcceptance
double getAngularAcceptance(const double x)
Angular acceptence of Antares PMT.
Definition: Antares.hh:363
henyey_greenstein
double henyey_greenstein(const double ct)
Definition: JDrawLED.cc:28