Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
16 namespace JOSCPROB {}
17 namespace JPP { using namespace JOSCPROB; }
18 
19 namespace JOSCPROB {
20 
22 
23 
24  /**
25  * OscProb neutrino flavour identifiers.
26  */
27  enum class OscProbFlavour_t { ELECTRON,
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) {
41  case JFlavour_t::ELECTRON:
42  return OscProbFlavour_t::ELECTRON;
43  case JFlavour_t::MUON:
44  return OscProbFlavour_t::MUON;
45  case JFlavour_t::TAU:
46  return OscProbFlavour_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  */
75  enum type {
80  LOE,
83  };
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
static const char *const LoE()
L/E [km GeV-1].
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
OscProbFlavour_t getOscProbFlavour(const JFlavour_t flavour)
Auxiliary function for retrieving the OscProb flavour identifier corresponding to a JOscProb flavour ...
type
Oscillation variable types.
JFlavour_t
Neutrino flavours.
Definition: JOscChannel.hh:31
then awk string
static type getType(const std::string &name)
Get oscillation variable type.
static const char *const log10E()
logarithmic energy [GeV]
static const char *const sinth()
sine of zenith-angle
OscProbFlavour_t
OscProb neutrino flavour identifiers.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:178
static const char *const L()
sine of zenith-angle
JFlavour_t getFlavour(const int pdgType)
Auxiliary function for retrieving the flavour corresponding to a given PDG identifier.
Definition: JOscChannel.hh:50
static const char *const costh()
cosine of zenith-angle
static const char *const energy()
energy [GeV]
Auxiliary data structure to hold oscillation variable names.