Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JPlotOscillogram.cc File Reference

Example program to plot oscillogram. More...

#include <iostream>
#include <iomanip>
#include <string>
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JOscProb/JOscChannel.hh"
#include "JOscProb/JOscParameters.hh"
#include "JOscProb/JOscillogram.hh"
#include "JOscProb/JOscProbToolkit.hh"
#include "JOscProb/JOscProbInterpolator.hh"
#include "TFile.h"
#include "TH2D.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to plot oscillogram.

Author
bjung

Definition in file JPlotOscillogram.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 25 of file JPlotOscillogram.cc.

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
49 JParser<> zap;
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 const JOscProbInterpolator<> interpolator(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
83 const JOscillogram oscillogram(abscissaType, abscissaGrid,
84 ordinateType, ordinateGrid,
85 channel, interpolator);
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
#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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Data structure for single set of oscillation parameters.
Template definition of a multi-dimensional oscillation probability interpolation table.
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.
Auxiliary class for creating oscillograms.
Simple data structure for an abstract collection of equidistant abscissa values.
Definition JGrid.hh:40
Auxiliary data structure for alignment of data.
Definition JManip.hh:298