Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JAstronomyToolkit.hh
Go to the documentation of this file.
1#ifndef __JASTRONOMYTOOLKIT__
2#define __JASTRONOMYTOOLKIT__
3
4#include <cmath>
5
7
8#include "JMath/JConstants.hh"
9#include "JTools/JGrid.hh"
12
13
14/**
15 * \author mdejong
16 */
17
18namespace JASTRONOMY {}
19namespace JPP { using namespace JASTRONOMY; }
20
21namespace JASTRONOMY {
22
24
25
26 /**
27 * Auxiliary class for source tracking.
28 * This class constitutes a function object corresponding to the normalised probability
29 *
30 * \f[ \frac{dP}{d\Omega}(cos\theta) \f]
31 *
32 * for a source to be at an observed zenith angle, \f$ \theta \f$, in local coordinates.
33 * A simulation of a diffuse flux of neutrinos can thus be used to determine
34 * the number of detected events from an astrophysical source with the given telescope.
35 */
36 struct JStarTrek :
38 {
39 /**
40 * Constructor.
41 *
42 * \param telescope telescope
43 * \param source astrophysical source
44 * \param number_of_bins number of bins
45 * \param number_of_samples number of samples
46 */
47 JStarTrek(const JAstronomy& telescope,
48 const JSourceLocation& source,
49 const int number_of_bins = 401,
50 const int number_of_samples = 20000)
51 {
52 using namespace JPP;
53
54 const double epsilon = 0.005;
55 const double W = 1.0 / (double) (number_of_samples * 2*PI); // dP/dphi
56
57 JGridHistogram1D_t histogram(make_grid(number_of_bins, -1.0 - epsilon, +1.0 + epsilon));
58
59 for (int i = 0; i != number_of_samples; ++i) {
60
61 const double t1 = (double) i * NUMBER_OF_SECONDS_PER_SEDERIAL_DAY / (double) number_of_samples;
62 const double ct = cos(telescope.getDirectionOfNeutrino(t1, source).getZenith());
63
64 histogram.fill(ct, W);
65 }
66
67 makePDF(histogram, *this); // dP/dOmega
68
69 this->setExceptionHandler(new JGridPolint1Function1D_t::JDefaultResult(0.0));
70 this->compile();
71 }
72 };
73}
74
75#endif
Interface methods for slalib and auxiliary classes and methods for astronomy.
Mathematical constants.
Auxiliary class to make coordinate transformations for a specific geographical location of the detect...
JNeutrinoDirection getDirectionOfNeutrino(const double &t1, const JSourceLocation &pos) const
Get direction pointing to source.
const double & getZenith() const
Location of astrophysical source.
Histogram in 1D.
void fill(typename JClass< abscissa_type >::argument_type x, typename JClass< contents_type >::argument_type w)
Fill histogram.
static const double NUMBER_OF_SECONDS_PER_SEDERIAL_DAY
Definition JAstronomy.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for source tracking.
JStarTrek(const JAstronomy &telescope, const JSourceLocation &source, const int number_of_bins=401, const int number_of_samples=20000)
Constructor.
Type definition of a 1st degree polynomial interpolation based on a JGridCollection with result type ...