Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JOscProbToolkit.hh
Go to the documentation of this file.
1#ifndef __JOSCPROB__JOSCPROBTOOLKIT__
2#define __JOSCPROB__JOSCPROBTOOLKIT__
3
4#include <string>
5
6#include "JLang/JException.hh"
7
9
10
11/**
12 * \author bjung
13 * Auxiliary methods for oscillation probabilities.
14 */
15
16namespace JOSCPROB {}
17namespace JPP { using namespace JOSCPROB; }
18
19namespace JOSCPROB {
20
22
23
24 /**
25 * OscProb neutrino flavour identifiers.
26 */
28 MUON,
29 TAU };
30
31
32 /**
33 * Auxiliary function for retrieving the OscProb flavour identifier corresponding to a JOscProb flavour identifier.
34 *
35 * \param flavour flavour identifier
36 * \return OscProb flavour identifier
37 */
39 {
40 switch(flavour) {
45 case JFlavour_t::TAU:
47 default:
48 THROW(JLANG::JValueOutOfRange, "getOscProbFlavour(...): Invalid flavour " << (int) flavour);
49 }
50 }
51
52
53 /**
54 * Auxiliary function for retrieving the OscProb flavour identifier corresponding to a JOscProb flavour identifier.
55 *
56 * \param pdgType PDG particle type
57 * \return OscProb flavour identifier
58 */
59 inline OscProbFlavour_t getOscProbFlavour(const int pdgType)
60 {
61 JFlavour_t flavour = getFlavour(pdgType);
62
63 return getOscProbFlavour(flavour);
64 }
65
66
67 /**
68 * Auxiliary data structure to hold oscillation variable names.
69 */
70 struct JOscVars
71 {
72 /**
73 * Oscillation variable types.
74 */
84
85
86 static const char* const energy() { return "energy"; } //!< energy [GeV]
87 static const char* const log10E() { return "log10E"; } //!< logarithmic energy [GeV]
88 static const char* const LoE() { return "LoE"; } //!< L/E [km GeV-1]
89
90 static const char* const costh() { return "costh"; } //!< cosine of zenith-angle
91 static const char* const sinth() { return "sinth"; } //!< sine of zenith-angle
92 static const char* const L() { return "L"; } //!< sine of zenith-angle
93
94
95 /**
96 * Get oscillation variable type.
97 *
98 * \param name oscillation variable name
99 * \return oscillation variable type
100 */
101 static inline type getType(const std::string& name)
102 {
103 if (name == energy()) {
104 return ENERGY;
105 } else if (name == costh()) {
106 return COSTH;
107 } else if (name == sinth()) {
108 return SINTH;
109 } else if (name == log10E()) {
110 return LOG10E;
111 } else if (name == LoE()) {
112 return LOE;
113 } else if (name == L()) {
114 return BASELINE;
115 } else {
116 THROW(JValueOutOfRange, "JOscVars::getType(): Invalid oscillation variable " << name);
117 }
118 }
119 };
120}
121
122#endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.
OscProbFlavour_t
OscProb neutrino flavour identifiers.
JFlavour_t
Neutrino flavours.
OscProbFlavour_t getOscProbFlavour(const JFlavour_t flavour)
Auxiliary function for retrieving the OscProb flavour identifier corresponding to a JOscProb flavour ...
JFlavour_t getFlavour(const int pdgType)
Auxiliary function for retrieving the flavour corresponding to a given PDG identifier.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure to hold oscillation variable names.
type
Oscillation variable types.
static const char *const log10E()
logarithmic energy [GeV]
static const char *const costh()
cosine of zenith-angle
static const char *const sinth()
sine of zenith-angle
static type getType(const std::string &name)
Get oscillation variable type.
static const char *const L()
sine of zenith-angle
static const char *const LoE()
L/E [km GeV-1].
static const char *const energy()
energy [GeV]