Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
JFluxDictionary.hh
Go to the documentation of this file.
1#ifndef __JAANET__JFLUXDICTIONARY__
2#define __JAANET__JFLUXDICTIONARY__
3
4#include <map>
5
10
11#include "JAAnet/JFluxHelper.hh"
12
14
15
16/**
17 * \author bjung
18 */
19namespace JAANET {}
20namespace JPP { using namespace JAANET; }
21
22namespace JAANET {
23
25
26
27 /**
28 * Dictionary to map distinct flux function categories to unique identifiers.
29 * The identifiers are provided by the enum `fluxes`.
30 */
32 public std::map<int, JFluxHelper>
33 {
34 public:
35
36 /**
37 * Indices of flux factors in flux factor dictionary.
38 */
39 enum fluxes {
40 FLUX_FUNCTIONS_BEGIN = 0, //!< Start of flux functions
41
42 FLAT_FLUX = 1, //!< Flat flux
43 POWER_LAW_FLUX = 2, //!< Power-law flux
44 ATMOSPHERIC_NEUTRINO_FLUX = 3, //!< Atmospheric neutrino flux (c.f. `Flux_Atmospheric` in `<jpp>/externals/flux/Flux.hh`)
45 HONDA_FLUX = 4, //!< Interpolated azimuth-averaged Honda flux
46
47 FLUX_FUNCTIONS_END = 99 //!< End of flux functions
48 };
49
50
51 /**
52 * Constructor.
53 *
54 * \param oscProb oscillation probability calculator
55 */
58 {
59 using namespace std;
60
61 const JHondaFluxInterpolator2D<> interpolator;
62
63 this->insert(make_pair(FLAT_FLUX, make_shared<JConstantFlux>()));
64 this->insert(make_pair(POWER_LAW_FLUX, make_shared<JPowerLawFlux>()));
65 this->insert(make_pair(ATMOSPHERIC_NEUTRINO_FLUX, make_shared<JAtmosphericNeutrinoFlux>(oscProb)));
66 this->insert(make_pair(HONDA_FLUX, make_shared<JOscFlux>(interpolator, oscProb)));
67 }
68
69
70 /**
71 * Default constructor.
72 */
76
77
78 /**
79 * Look-up function.
80 *
81 * \param identifier flux category ID
82 */
83 const JFlux& at(const int identifier) const
84 {
85 using namespace std;
86 using namespace JPP;
87
88 const_iterator i = this->find(identifier);
89
90 if (i != this->cend()) {
91 return i->second.getFlux();
92 } else {
93 THROW(JValueOutOfRange, "JFluxDictionary::at(): Invalid identifier " << identifier);
94 }
95 }
96
97
98 /**
99 * Look-up operator.
100 *
101 * \param identifier flux category ID
102 */
103 const JFlux& operator[](const int identifier) const
104 {
105 return this->at(identifier);
106 }
107
108
109 private:
110
111 JOscProbHelper oscProb; //!< Oscillation probability calculator
112 };
113}
114
115#endif
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Dictionary to map distinct flux function categories to unique identifiers.
JFluxDictionary(const JOscProbHelper &oscProb)
Constructor.
JOscProbHelper oscProb
Oscillation probability calculator.
const JFlux & at(const int identifier) const
Look-up function.
JFluxDictionary()
Default constructor.
fluxes
Indices of flux factors in flux factor dictionary.
@ HONDA_FLUX
Interpolated azimuth-averaged Honda flux.
@ FLUX_FUNCTIONS_END
End of flux functions.
@ POWER_LAW_FLUX
Power-law flux.
@ ATMOSPHERIC_NEUTRINO_FLUX
Atmospheric neutrino flux (c.f. Flux_Atmospheric in <jpp>/externals/flux/Flux.hh)
@ FLUX_FUNCTIONS_BEGIN
Start of flux functions.
const JFlux & operator[](const int identifier) const
Look-up operator.
Exception for accessing a value in a collection that is outside of its range.
Extensions to Evt data format.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Low-level interface for retrieving the flux corresponding to a given event.
Definition JFlux.hh:23
Helper class for oscillation probability calculators.