Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JHondaFluxInterpolator.cc File Reference

Example program for plotting the atmospheric neutrino fluxes given by an azimuth-averaged Honda flux table
and comparing them with the atmospheric neutrino flux from the KM3NeT flux library. More...

#include <iostream>
#include <iomanip>
#include <string>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JTools/JGrid.hh"
#include "JTools/JPolint.hh"
#include "JAAnet/JParticleTypes.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JAAnet/JDiffuseFluxHelper.hh"
#include "JAAnet/JHondaFluxInterpolator.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JEvtWeightFileScannerSet.hh"
#include "JOscProb/JOscParameters.hh"
#include "JOscProb/JOscProbInterpolator.hh"
#include "JOscProb/JOscProbHelper.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JROOT/JManager.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 for plotting the atmospheric neutrino fluxes given by an azimuth-averaged Honda flux table
and comparing them with the atmospheric neutrino flux from the KM3NeT flux library.

Author
bjjung

Definition in file JHondaFluxInterpolator.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 41 of file JHondaFluxInterpolator.cc.

42{
43 using namespace std;
44 using namespace JPP;
45
46 typedef JGrid<double> JGrid_t;
47
48
49 JMultipleFileScanner_t inputFiles;
50 string outputFile;
51 string HondaTable;
52 string oscProbTable;
53 JOscParameters<double> oscParameters;
54 JGrid_t log10Egrid;
55 JGrid_t coszGrid;
56 int debug;
57
58 try {
59
60 JParser<> zap;
61
62 zap['f'] = make_field(inputFiles);
63 zap['T'] = make_field(HondaTable);
64 zap['o'] = make_field(outputFile) = "honda.root";
65 zap['P'] = make_field(oscProbTable) = JPARSER::initialised();
66 zap['@'] = make_field(oscParameters) = JPARSER::initialised();
67 zap['X'] = make_field(log10Egrid) = make_grid(100, -1.0, 4.0);
68 zap['C'] = make_field(coszGrid) = make_grid(200, -1.0, 1.0);
69 zap['d'] = make_field(debug) = 1;
70
71 zap(argc, argv);
72 }
73 catch(const exception& error) {
74 FATAL(error.what() << endl);
75 }
76
77
78 // Create atmospheric neutrino flux function
79
82
83 const JFluxAtmospheric atmFlux;
84 const JHondaFluxInterpolator2D<> interpolator(HondaTable.c_str());
85
86 if (!oscProbTable.empty()) {
87
88 const JOscProbInterpolator<> oscProb(oscProbTable.c_str(), oscParameters);
89
90 const JOscFlux oscFlux1(atmFlux, oscProb);
91 const JOscFlux oscFlux2(interpolator, oscProb);
92
93 flux1.configure(oscFlux1);
94 flux2.configure(oscFlux2);
95
96 } else {
97
98 flux1.configure(atmFlux);
99 flux2.configure(interpolator);
100 }
101
102 const vector<int> nuTypes {
107 };
108
109 JManager<int, TH2D> h0(new TH2D("h0[%]", NULL,
110 log10Egrid.getSize(), log10Egrid.getXmin(), log10Egrid.getXmax(),
111 coszGrid .getSize(), coszGrid .getXmin(), coszGrid .getXmax()));
112
113 JManager<int, TH2D> h1(new TH2D("h1[%]", NULL,
114 log10Egrid.getSize(), log10Egrid.getXmin(), log10Egrid.getXmax(),
115 coszGrid .getSize(), coszGrid .getXmin(), coszGrid .getXmax()));
116
117 DEBUG(LEFT(15) << "E [GeV]" << RIGHT(10) << "cosz" << RIGHT(25) << "flux1" << RIGHT(52) << "flux2 [GeV^-1 * m^-2 * sr^-1 * s^-1]" << endl);
118
119 for (vector<int>::const_iterator type = nuTypes.cbegin(); type != nuTypes.cend(); ++type) {
120
121 for (int i = 0; i < log10Egrid.getSize(); ++i) {
122
123 const double X = log10Egrid.getX(i);
124
125 for (int j = 0; j < coszGrid.getSize(); ++j) {
126
127 const double cosz = coszGrid.getX(j);
128
129 const double F0 = flux1(*type, X, cosz);
130 const double F1 = flux2(*type, X, cosz);
131
132 DEBUG(SCIENTIFIC(15,3) << pow(10.0,X) <<
133 FIXED (10,3) << cosz <<
134 SCIENTIFIC(25,3) << F0 <<
135 SCIENTIFIC(25,3) << F1 << endl);
136
137 ASSERT(isfinite(F1));
138
139 h0[*type]->SetBinContent(i+1, j+1, F0);
140 h1[*type]->SetBinContent(i+1, j+1, F1);
141 }
142 }
143 }
144
145 TFile out(outputFile.c_str(), "recreate");
146
147 out << h0 << h1;
148
149 out.Write();
150 out.Close();
151
152 return 0;
153}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#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
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Definition JManager.hh:47
const JPolynome F1
Integral.
@ TRACK_TYPE_ANTINUMU
@ LEFT
Definition JTwosome.hh:18
@ RIGHT
Definition JTwosome.hh:18
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
int j
Definition JPolint.hh:801
JGrid< JAbscissa_t > make_grid(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax)
Helper method for JGrid.
Definition JGrid.hh:209
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Helper class for diffuse flux factor.
Specialisation of event-weight factor interface for atmospheric neutrino flux.
void configure(const pointer_type &p)
Configure event-weight factor.
Implementation of oscillated neutrino flux.
Definition JOscFlux.hh:44
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary base class for list of file names.
Simple data structure for an abstract collection of equidistant abscissa values.
Definition JGrid.hh:40
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488