Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JPrintOscProb.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3#include <string>
4#include <map>
5
6#include "Jeep/JPrint.hh"
7#include "Jeep/JParser.hh"
8#include "Jeep/JMessage.hh"
9
13
14
15/**
16 * \file
17 * Example program to print oscillation probabilities interpolated in energy and zenith-angle.
18 *
19 * \author bjung
20 */
21int main(int argc, char **argv)
22{
23 using namespace std;
24 using namespace JPP;
25
26 string inputFile;
27 JOscParameters<double> parameters;
28 map<double, double> interpolationValues;
29 JOscChannel channel;
30 int debug;
31
32 try {
33
34 JParser<> zap;
35
36 zap['f'] = make_field(inputFile, "8D oscillation probability table file");
37 zap['x'] = make_field(interpolationValues, "Map of interpolation values in (energy [GeV], cos(theta))")
39 zap['@'] = make_field(parameters, "Oscillation parameters")
41 zap['#'] = make_field(channel, "Oscillation channel")
42 = JOscChannel(JFlavour_t::MUON, JFlavour_t::MUON, JChargeParity_t::PARTICLE);
43 zap['d'] = make_field(debug)
44 = 3;
45
46 zap(argc, argv);
47 }
48 catch (const exception& error) {
49 FATAL(error.what() << endl);
50 }
51
52
53 JOscProbInterpolator<> interpolator(inputFile.c_str(), parameters);
54
55 NOTICE(RIGHT(15) << "Energy [GeV]" <<
56 RIGHT(15) << "cos(theta)" <<
57 RIGHT(15) << "P" << endl);
58
59 for (map<double, double>::const_iterator i = interpolationValues.cbegin(); i != interpolationValues.cend(); ++i) {
60
61 const double energy = i->first;
62 const double costh = i->second;
63
64 const double oscProb = interpolator.getP(channel, energy, costh);
65
66 NOTICE(FIXED(15,3) << energy <<
67 FIXED(15,3) << costh <<
68 FIXED(15,3) << oscProb << '\r'); DEBUG(endl);
69 }
70}
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
I/O formatting auxiliaries.
Data structure for single set of oscillation parameters.
Template definition of a multi-dimensional oscillation probability interpolation table.
double getP(const JOscChannel &channel, const double E, const double costh) const override final
Get oscillation probability for a given oscillation channel.
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Neutrino oscillation channel.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary data structure for alignment of data.
Definition JManip.hh:298