Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
Functions
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
50 string outputFile;
51 string HondaTable;
52 string oscProbTable;
54 JGrid_t log10Egrid;
55 JGrid_t coszGrid;
56 int debug;
57
58 try {
59
61
64 zap['o'] = make_field(outputFile) = "honda.root";
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
85
86 if (!oscProbTable.empty()) {
87
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
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
Template definition of a multi-dimensional oscillation probability interpolation table.
@ 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.
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.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488