Jpp 21.0.1
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 "TFile.h"
#include "TH2D.h"
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JTools/JAbstractHistogram.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"

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 40 of file JHondaFluxInterpolator.cc.

41{
42 using namespace std;
43 using namespace JPP;
44
45 typedef JAbstractHistogram<double> JAbstractHistogram_t;
46
47
48 JMultipleFileScanner_t inputFiles;
49 string outputFile;
50 string HondaTable;
51 string oscProbTable;
52 JOscParameters<double> oscParameters;
53 JAbstractHistogram_t log10Ebinning;
54 JAbstractHistogram_t coszBinning;
55 int debug;
56
57 try {
58
59 JParser<> zap;
60
61 zap['f'] = make_field(inputFiles);
62 zap['T'] = make_field(HondaTable);
63 zap['o'] = make_field(outputFile) = "honda.root";
64 zap['P'] = make_field(oscProbTable) = JPARSER::initialised();
65 zap['@'] = make_field(oscParameters) = JPARSER::initialised();
66 zap['X'] = make_field(log10Ebinning) = make_histogram(100, -1.0, 4.0);
67 zap['C'] = make_field(coszBinning) = make_histogram(200, -1.0, 1.0);
68 zap['d'] = make_field(debug) = 1;
69
70 zap(argc, argv);
71 }
72 catch(const exception& error) {
73 FATAL(error.what() << endl);
74 }
75
76
77 // Create atmospheric neutrino flux function
78
81
82 const JFluxAtmospheric atmFlux;
83 const JHondaFluxInterpolator2D<> interpolator(HondaTable.c_str());
84
85 if (!oscProbTable.empty()) {
86
87 const JOscProbInterpolator<> oscProb(oscProbTable.c_str(), oscParameters);
88
89 const JOscFlux oscFlux1(atmFlux, oscProb);
90 const JOscFlux oscFlux2(interpolator, oscProb);
91
92 flux1.configure(oscFlux1);
93 flux2.configure(oscFlux2);
94
95 } else {
96
97 flux1.configure(atmFlux);
98 flux2.configure(interpolator);
99 }
100
101 const vector<int> nuTypes {
108 };
109
110 JManager<int, TH2D> h0(new TH2D("h0[%]", NULL,
111 log10Ebinning.getNumberOfBins(), log10Ebinning.getLowerLimit(), log10Ebinning.getUpperLimit(),
112 coszBinning .getNumberOfBins(), coszBinning .getLowerLimit(), coszBinning .getUpperLimit()));
113
114 JManager<int, TH2D> h1(new TH2D("h1[%]", NULL,
115 log10Ebinning.getNumberOfBins(), log10Ebinning.getLowerLimit(), log10Ebinning.getUpperLimit(),
116 coszBinning .getNumberOfBins(), coszBinning .getLowerLimit(), coszBinning .getUpperLimit()));
117
118 JManager<int, TH2D> h2(new TH2D("h2[%]", NULL,
119 log10Ebinning.getNumberOfBins(), log10Ebinning.getLowerLimit(), log10Ebinning.getUpperLimit(),
120 coszBinning .getNumberOfBins(), coszBinning .getLowerLimit(), coszBinning .getUpperLimit()));
121
122 DEBUG(LEFT(15) << "E [GeV]" << RIGHT(10) << "cosz"
123 << RIGHT(25) << "flux1 [GeV^-1 * m^-2 * sr^-1 * s^-1]"
124 << RIGHT(52) << "flux2 [GeV^-1 * m^-2 * sr^-1 * s^-1]"
125 << RIGHT(52) << "flux3 [GeV^2 * m^-2 * sr^-1 * s^-1]" << endl);
126
127 for (vector<int>::const_iterator type = nuTypes.cbegin(); type != nuTypes.cend(); ++type) {
128
129 for (int i = 1; i <= h0->GetXaxis()->GetNbins(); ++i) {
130
131 const double X = h0->GetXaxis()->GetBinCenter(i);
132 const double E = pow(10.0, X);
133
134 for (int j = 1; j <= h0->GetYaxis()->GetNbins(); ++j) {
135
136 const double cosz = h0->GetYaxis()->GetBinCenter(j);
137
138 const double F0 = flux1(*type, X, cosz);
139 const double F1 = flux2(*type, X, cosz);
140 const double F2 = F1 * E * E * E;
141
142 DEBUG(SCIENTIFIC(15,3) << pow(10.0,X) <<
143 FIXED (10,3) << cosz <<
144 SCIENTIFIC(25,3) << F0 <<
145 SCIENTIFIC(25,3) << F1 <<
146 SCIENTIFIC(25,3) << F2 << endl);
147
148 ASSERT(isfinite(F1));
149
150 h0[*type]->SetBinContent(i, j, F0);
151 h1[*type]->SetBinContent(i, j, F1);
152 h2[*type]->SetBinContent(i, j, F2);
153 }
154 }
155 }
156
157 TFile out(outputFile.c_str(), "recreate");
158
159 out << h0 << h1 << h2;
160
161 out.Write();
162 out.Close();
163
164 return 0;
165}
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:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2107
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:1664
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Definition JManager.hh:47
@ TRACK_TYPE_ANTINUMU
@ TRACK_TYPE_ANTINUTAU
@ LEFT
Definition JTwosome.hh:18
@ RIGHT
Definition JTwosome.hh:18
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97
static const JX X
Definition JMathlib.hh:1613
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JAbstractHistogram< JAbscissa_t > make_histogram(const int nx, const JAbscissa_t xmin, const JAbscissa_t xmax)
Helper method for JAbstractHistogram.
int j
Definition JPolint.hh:801
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:66
Auxiliary base class for list of file names.
Simple data structure for histogram binning.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488