1#ifndef __JAANET__JHONDAFLUXINTERPOLATOR__
2#define __JAANET__JHONDAFLUXINTERPOLATOR__
90 const double maximum) :
122 if (in >> min >> buffer >> max &&
156 const double maxCosz,
158 const double maxPhi) :
182 return in >> properties;
194 template<
class JPhiFunction_t = JConstantFunction1D<
double, JArray<4,
double> >,
198 public JMultiFunction <JPhiFunction_t, typename JMAPLIST<JEnergyFunctionalMap_t, JCoszFunctionalMap_t>::maplist>,
199 public JClonable<JFlux, JHondaFluxInterpolator <JPhiFunction_t, JCoszFunctionalMap_t, JEnergyFunctionalMap_t> >,
200 public JObjectStreamIO <JHondaFluxInterpolator <JPhiFunction_t, JCoszFunctionalMap_t, JEnergyFunctionalMap_t> >,
201 public JMessage <JHondaFluxInterpolator <JPhiFunction_t, JCoszFunctionalMap_t, JEnergyFunctionalMap_t> >
242 table (*this, filename),
272 return (!
table.empty() ?
290 const double phi)
const
295 static const double epsilon_costh = 1.0e-3;
296 static const double epsilon_phi = 1.0;
298 static const JRange_t mod(0.0, 360.0);
302 const double _costh = min(max(costh, -1.0), 1.0);
303 const double _phi = mod.
mod(180.0 - phi);
310 lnFluxes = function(log10E, _costh, _phi);
319 const result_type& y1 = function(log10E, x1, _phi);
320 const result_type& y2 = function(log10E, x2, _phi);
322 lnFluxes = y1 + ((y2 - y1) / (x2 - x1)) * (_costh - x1);
329 const result_type& y1 = function(log10E, x1, _phi);
330 const result_type& y2 = function(log10E, x2, _phi);
332 lnFluxes = y1 + ((y2 - y1) / (x2 - x1)) * (_costh - x1);
339 const result_type& y1 = function(log10E, _costh, x1);
340 const result_type& y2 = function(log10E, _costh, x2);
342 lnFluxes = y1 + ((y2 - y1) / (x2 - x1)) * (_phi - x1);
349 const result_type& y1 = function(log10E, _costh, x1);
350 const result_type& y2 = function(log10E, _costh, x2);
352 lnFluxes = y1 + ((y2 - y1) / (x2 - x1)) * (_phi - x1);
365 lnFluxes = y1 + ((y2 - y1) / (c2 -
c1) / (p2 -
p1)) * (_costh -
p1) * (_phi -
p1);
378 lnFluxes = y1 + ((y2 - y1) / (c2 -
c1) / (p2 -
p1)) * (_costh -
p1) * (_phi -
p1);
391 lnFluxes = y1 + ((y2 - y1) / (c2 -
c1) / (p2 -
p1)) * (_costh -
p1) * (_phi -
p1);
404 lnFluxes = y1 + ((y2 - y1) / (c2 -
c1) / (p2 -
p1)) * (_costh -
p1) * (_phi -
p1);
410 return exp(lnFluxes[0]);
412 return exp(lnFluxes[1]);
414 return exp(lnFluxes[2]);
416 return exp(lnFluxes[3]);
435 const double phi)
const
437 return getFactor(type, log10E, costh, phi);
453 const double phi)
const
455 return getFactor(type, log10E, costh, phi);
469 const double log10E = log10(neutrino.
E);
470 const double costh = neutrino.
dir.
z;
473 const double phi = atan(neutrino.
dir.
y / neutrino.
dir.
x) * 180.0 / M_PI;
499 if (!
table.empty()) {
501 NOTICE(
"Loading Honda flux table from file " <<
table <<
"... " << flush);
505 this->check_validity();
562 for (
string line; getline(ifs, line); ) {
568 istringstream iss1(line);
576 if (iss1 >> energy >> values) {
578 const double log10E = log10(energy);
580 for (
typename result_type::iterator i = values.begin(); i != values.end(); ++i) {
584 zmap[log10E][cosz][phi] = values;
591 if (
p1 != string::npos && p2 != string::npos) {
593 const string binspecstr = line.substr(
p1 + 1, p2 -
p1 - 1);
595 istringstream iss2(binspecstr);
622 template<
class JHondaFluxInterpolator_t>
646 template<
template<
class,
class,
class>
class JCoszFunctionalMap_t,
647 template<
class,
class,
class>
class JEnergyFunctionalMap_t>
649 public JMultiFunction <JConstantFunction1D<double, JArray<4, double> >, typename JMAPLIST<JEnergyFunctionalMap_t, JCoszFunctionalMap_t>::maplist>,
650 public JClonable<JDiffuseFlux, JHondaFluxInterpolator <JConstantFunction1D<double, JArray<4, double> >, JCoszFunctionalMap_t, JEnergyFunctionalMap_t> >,
651 public JObjectStreamIO <JHondaFluxInterpolator <JConstantFunction1D<double, JArray<4, double> >, JCoszFunctionalMap_t, JEnergyFunctionalMap_t> >,
652 public JMessage <JHondaFluxInterpolator <JConstantFunction1D<double, JArray<4, double> >, JCoszFunctionalMap_t, JEnergyFunctionalMap_t> >
694 table (*this, filename),
737 const double costh)
const override final
742 static const double epsilon_costh = 1.0e-3;
746 const double _costh = min(max(costh, -1.0), 1.0);
752 lnFluxes = function(log10E, _costh);
764 lnFluxes = y1 + ((y2 - y1) / (x2 - x1)) * (_costh - x1);
774 lnFluxes = y1 + ((y2 - y1) / (x2 - x1)) * (_costh - x1);
780 return exp(lnFluxes[0]);
782 return exp(lnFluxes[1]);
784 return exp(lnFluxes[2]);
786 return exp(lnFluxes[3]);
801 if (!
table.empty()) {
803 NOTICE(
"Loading Honda flux table from file " <<
table <<
"... " << flush);
807 this->check_validity();
864 for (
string line; getline(ifs, line); ) {
870 istringstream iss1(line);
876 if (iss1 >> energy >> values) {
878 const double log10E = log10(energy);
880 for (
typename result_type::iterator i = values.begin(); i != values.end(); ++i) {
884 zmap[log10E][cosz] = values;
891 if (
p1 != string::npos && p2 != string::npos) {
893 const string binspecstr = line.substr(
p1 + 1, p2 -
p1 - 1);
895 istringstream iss2(binspecstr);
922 template<
class JHondaFluxInterpolator_t>
948 JCoszFunctionalMap_t,
949 JEnergyFunctionalMap_t>;
958 template<
class JPhiFunction_t,
959 template<
class,
class,
class>
class JCoszFunctionalMap_t,
960 template<
class,
class,
class>
class JEnergyFunctionalMap_t>
970 template<
class JPhiFunction_t,
971 template<
class,
class,
class>
class JCoszFunctionalMap_t,
972 template<
class,
class,
class>
class JEnergyFunctionalMap_t>
General purpose class for a collection of sorted elements.
TCanvas * c1
Global variables to handle mouse events.
Various implementations of functional maps.
General purpose messaging.
I/O formatting auxiliaries.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary class to define a range between two values.
Template specialisation for interpolator of azimuth-averaged Honda flux table.
void load()
Load Honda flux table.
multifunction_type::result_type result_type
multifunction_type::super_const_iterator super_const_iterator
JMultiFunction< JPhiFunction_t, JFunctionalMaplist_t > multifunction_type
JHondaFluxInterpolator()
Default constructor.
multifunction_type::value_type value_type
multifunction_type::multimap_type multimap_type
multifunction_type::function_type function_type
JHondaFluxInterpolator(const interpolator_type &interpolator)
Copy constructor.
double dNdEdOmega(const int type, const double log10E, const double costh) const override final
Get diffuse flux for given particle PDG-identifier, energy and zenith-angle.
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
Get properties of this class.
JLoadProperty< interpolator_type, std::string > table
Honda flux table filename.
multifunction_type::argument_type argument_type
void load(const char *table)
Load Honda flux table.
JRange< abscissa_type > JRange_t
JRange_t coszRange
Cosine zenith angle range.
friend std::ifstream & operator>>(std::ifstream &ifs, interpolator_type &interpolator)
Read Honda atmospheric neutrino flux interpolator from file.
JHondaFluxInterpolator< JPhiFunction_t, JCoszFunctionalMap_t, JEnergyFunctionalMap_t > interpolator_type
multifunction_type::super_iterator super_iterator
JHondaFluxInterpolator(const char *filename)
Constructor.
JConstantFunction1D< double, JArray< 4, double > > JPhiFunction_t
bool is_valid() const override final
Check whether this interpolator is valid.
JMAPLIST< JEnergyFunctionalMap_t, JCoszFunctionalMap_t >::maplist JFunctionalMaplist_t
multifunction_type::abscissa_type abscissa_type
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.
Template definition for Honda flux table interpolator.
multifunction_type::super_iterator super_iterator
bool is_valid() const override final
Check whether this interpolator is valid.
multifunction_type::multimap_type multimap_type
multifunction_type::function_type function_type
JMAPLIST< JEnergyFunctionalMap_t, JCoszFunctionalMap_t >::maplist JFunctionalMaplist_t
double getFlux(const Evt &event) const
Get flux of given event.
JHondaFluxInterpolator(const interpolator_type &interpolator)
Copy constructor.
double getFactor(const Evt &evt) const override final
Get flux of given event.
void load()
Load Honda flux table.
double getFactor(const int type, const double log10E, const double costh, const double phi) const
Get diffuse flux for given particle PDG-identifier, energy, cosine zenith angle and azimuth angle.
multifunction_type::result_type result_type
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.
double getFlux(const int type, const double log10E, const double costh, const double phi) const
Get flux of given event.
friend std::ifstream & operator>>(std::ifstream &ifs, interpolator_type &interpolator)
Read Honda atmospheric neutrino flux interpolator from file.
JHondaFluxInterpolator()
Default constructor.
multifunction_type::abscissa_type abscissa_type
multifunction_type::super_const_iterator super_const_iterator
JRange_t phiRange
Azimuth angle range [deg].
JHondaFluxInterpolator< JPhiFunction_t, JCoszFunctionalMap_t, JEnergyFunctionalMap_t > interpolator_type
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
Get properties of this class.
multifunction_type::value_type value_type
JHondaFluxInterpolator(const char *filename)
Constructor.
JRange_t coszRange
Zenith angle range.
void load(const char *table)
Load Honda flux table.
multifunction_type::argument_type argument_type
double operator()(const int type, const double log10E, const double costh, const double phi) const
Get diffuse flux for given particle PDG-identifier, energy, cosine zenith angle and azimuth angle.
JLoadProperty< interpolator_type, std::string > table
Table filename.
JRange< abscissa_type > JRange_t
JMultiFunction< JPhiFunction_t, JFunctionalMaplist_t > multifunction_type
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Data structure for object properties which require reloading whenever the property is reread.
Extensions to Evt data format.
static const char *const HONDA_MUON_ANTINEUTRINO_FLUX_KEYWORD
static const char *const HONDA_MUON_NEUTRINO_FLUX_KEYWORD
static const char *const HONDA_ENERGY_KEYWORD
static const char *const HONDA_ELECTRON_ANTINEUTRINO_FLUX_KEYWORD
static const char *const HONDA_AZIMUTH_ANGLE_KEYWORD
static const char *const HONDA_ELECTRON_NEUTRINO_FLUX_KEYWORD
static const char *const HONDA_COSINE_ZENITH_ANGLE_KEYWORD
static const char HONDA_BINSPECS_END
static const char *const HONDA_BINSPECS_SEPARATOR
static const char HONDA_BINSPECS_BEGIN
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
General puprpose classes and methods.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
static const char *const getTypeKey()
Get type keyword.
static JEquationParameters & getEquationParameters()
Get equation parameters.
Auxiliary data structure for reading angular binning specifications of Honda flux table.
JHondaBinRange coszRange
Cosine zenith-angle range.
JHondaBinRange phiRange
Azimuthal angle range [deg].
JHondaAngularBinSpecs(const double minCosz, const double maxCosz, const double minPhi, const double maxPhi)
Constructor.
friend std::istream & operator>>(std::istream &in, JHondaAngularBinSpecs &binspecs)
Read bin specifications from input.
JHondaAngularBinSpecs()
Default constructor.
Auxiliary data structure for reading Honda bin ranges.
friend std::istream & operator>>(std::istream &in, JHondaBinRange &object)
Read bin range from input.
JHondaBinRange()
Default constructor.
JHondaBinRange(const double minimum, const double maximum)
Constructor.
JRange< double > JRange_t
double getCentralValue() const
Get central value of this range.
Auxiliary class for I/O of Honda flux interpolator.
JHondaFluxInterpolatorHelper(JHondaFluxInterpolator_t &interpolator, const JEquationParameters &eqpars)
Constructor.
Auxiliary class for I/O of Honda flux interpolator.
JHondaFluxInterpolatorHelper(JHondaFluxInterpolator_t &interpolator, const JEquationParameters &eqpars)
Constructor.
Auxiliary class for handling debug parameter within a class.
static int debug
debug level (default is off).
Template class for object cloning.
Auxiliary base class for storing and loading a single object to and from an ASCII file,...
void load(const char *file_name)
Load from input file.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
int type
MC: particle type in PDG encoding.
double E
Energy [GeV] (either MC truth or reconstructed)