Jpp  17.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPrintOscProb.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <string>
4 #include <map>
5 
6 #include "JLang/JVectorize.hh"
7 
8 #include "Jeep/JPrint.hh"
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 #include "JOscProb/JOscChannel.hh"
16 
17 
18 /**
19  * \file
20  * Example program to print oscillation probabilities interpolated in energy and zenith-angle.
21  *
22  * \author bjung
23  */
24 int main(int argc, char **argv)
25 {
26  using namespace std;
27  using namespace JPP;
28 
29  string inputFile;
30  JOscParameters parameters;
31  map<double, double> interpolationValues;
32  JOscChannel channel;
33  int debug;
34 
35  try {
36 
37  JParser<> zap;
38 
39  zap['f'] = make_field(inputFile, "8D oscillation probability table file");
40  zap['x'] = make_field(interpolationValues, "Map of interpolation values in (energy [GeV], cos(theta)") = JPARSER::initialised();
41  zap['@'] = make_field(parameters, "oscillation parameters") = JPARSER::initialised();
42  zap['#'] = make_field(channel, "Oscillation channel") = JOscChannel(JOscChannel::MUON, JOscChannel::MUON, JOscChannel::PARTICLE);
43  zap['d'] = make_field(debug) = 3;
44 
45  zap(argc, argv);
46  }
47  catch (const exception& error) {
48  FATAL(error.what() << endl);
49  }
50 
51  const JOscProbTable6D<> g6(inputFile.c_str());
52  const JOscProbTable2D<> g2(g6, parameters);
53 
54  const JOscProbInterpolator2D<> interpolator(&g2);
55 
56  NOTICE(RIGHT(15) << "Energy [GeV]" <<
57  RIGHT(15) << "cos(theta)" <<
58  RIGHT(15) << "P" << endl);
59 
60  for (map<double, double>::const_iterator i = interpolationValues.cbegin(); i != interpolationValues.cend(); ++i) {
61 
62  const double energy = i->first;
63  const double costh = i->second;
64 
65  const double oscProb = interpolator(channel, energy, costh);
66 
67  NOTICE(FIXED(15,3) << energy <<
68  FIXED(15,3) << costh <<
69  FIXED(15,3) << oscProb << '\r'); DEBUG(endl);
70  }
71 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
#define NOTICE(A)
Definition: JMessage.hh:64
int debug
debug level
Definition: JSirene.cc:66
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
Utility class to parse command line options.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62