Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
JPlotOscillogram.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3#include <string>
4
5#include "Jeep/JPrint.hh"
6#include "Jeep/JParser.hh"
7#include "Jeep/JMessage.hh"
8
14
15#include "TFile.h"
16#include "TH2D.h"
17
18
19/**
20 * \file
21 * Example program to plot oscillogram.
22 *
23 * \author bjung
24 */
25int main(int argc, char **argv)
26{
27 using namespace std;
28 using namespace JPP;
29
30 typedef JGrid<double> JGrid_t;
31
32
33 string inputFile;
34 string outputFile;
35
36 string abscissaType;
37 JGrid_t abscissaGrid;
38
39 string ordinateType;
40 JGrid_t ordinateGrid;
41
42 JOscParameters<double> parameters;
43 JOscChannel channel;
44
45 int debug;
46
47 try {
48
50
51 zap['f'] = make_field(inputFile, "oscillation probability table file");
52 zap['o'] = make_field(outputFile, "output file");
53 zap['X'] = make_field(abscissaType, "abscissa type") =
54 JOscVars::energy(),
55 JOscVars::log10E(),
56 JOscVars::LoE();
57 zap['x'] = make_field(abscissaGrid, "abscissa binning");
58 zap['Y'] = make_field(ordinateType, "ordinate type") =
59 JOscVars::costh(),
60 JOscVars::sinth(),
61 JOscVars::L();
62 zap['y'] = make_field(ordinateGrid, "ordinate binning");
63 zap['@'] = make_field(parameters, "oscillation parameters")
65 zap['#'] = make_field(channel, "oscillation channel")
66 = JOscChannel(JFlavour_t::MUON, JFlavour_t::MUON, JChargeParity_t::PARTICLE);
67 zap['d'] = make_field(debug)
68 = 2;
69
70 zap(argc, argv);
71 }
72 catch (const exception& error) {
73 FATAL(error.what() << endl);
74 }
75
76
77 JOscProbHelper::pointer_type p = make_shared<JOscProbInterpolator<> >(inputFile.c_str(), parameters);
78
79 TH2D h0("h0", NULL,
80 abscissaGrid.getSize(), abscissaGrid.getXmin(), abscissaGrid.getXmax(),
81 ordinateGrid.getSize(), ordinateGrid.getXmin(), ordinateGrid.getXmax());
82
85 channel, p);
86
87 NOTICE(RIGHT(15) << abscissaType << RIGHT(15) << ordinateType << RIGHT(15) << "P" << endl);
88
89 for (int ix = 0; ix < abscissaGrid.getSize(); ++ix) {
90 for (int iy = 0; iy < ordinateGrid.getSize(); ++iy) {
91
92 const double x = abscissaGrid.getX(ix);
93 const double y = ordinateGrid.getX(iy);
94
95 const double P = oscillogram.getP(ix, iy);
96
97 NOTICE(FIXED(15,3) << x << FIXED(15,3) << y << FIXED(15,3) << P << '\r'); DEBUG(endl);
98
99 h0.SetBinContent(ix+1, iy+1, P);
100 }
101 }
102
103 TFile out(outputFile.c_str(), "recreate");
104
105 h0.Write();
106
107 out.Write();
108 out.Close();
109}
string outputFile
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.
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.
std::shared_ptr< JOscProbInterface > pointer_type
Auxiliary class for creating oscillograms.
Auxiliary data structure for alignment of data.
Definition JManip.hh:298