Jpp  16.0.0
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"
15 
16 
17 /**
18  * \file
19  * Example program to print oscillation probabilities interpolated in energy and zenith-angle.
20  *
21  * \author bjung
22  */
23 int main(int argc, char **argv)
24 {
25  using namespace std;
26  using namespace JPP;
27 
28  string inputFile;
29  JOscParameters parameters;
30  map<double, double> interpolationValues;
31  JOscChannel channel;
32  int debug;
33 
34  try {
35 
36  JParser<> zap;
37 
38  zap['f'] = make_field(inputFile, "oscillation probability table file");
39  zap['x'] = make_field(interpolationValues, "Map of interpolation values in (energy [GeV], cos(theta)") = JPARSER::initialised();
40  zap['@'] = make_field(parameters, "oscillation parameters") = JPARSER::initialised();
41  zap['#'] = make_field(channel, "Oscillation channel") = JOscChannel(JOscChannel::MUON, JOscChannel::MUON, JOscChannel::PARTICLE);
42  zap['d'] = make_field(debug) = 3;
43 
44  zap(argc, argv);
45  }
46  catch (const exception& error) {
47  FATAL(error.what() << endl);
48  }
49 
50  const JOscProbTable6D<> g6(inputFile.c_str());
51  const JOscProbTable2D<> g2(g6, parameters);
52 
53  const JOscProbInterpolator2D<> interpolator(&g2);
54 
55  NOTICE(RIGHT(15) << "Energy [GeV]" <<
56  RIGHT(15) << "cos(theta)" <<
57  RIGHT(15) << "P" << endl);
58 
59  for (map<double, double>::const_iterator i = interpolationValues.cbegin(); i != interpolationValues.cend(); ++i) {
60 
61  const double E = i->first;
62  const double costh = i->second;
63  const double oscProb = interpolator(channel, log10(E), costh);
64 
65  NOTICE(FIXED(15,3) << E <<
66  FIXED(15,3) << costh <<
67  FIXED(15,3) << oscProb << '\r'); DEBUG(endl);
68  }
69 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
then usage E
Definition: JMuonPostfit.sh:35
*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
set_variable E_E log10(E_{fit}/E_{#mu})"
#define NOTICE(A)
Definition: JMessage.hh:64
int debug
debug level
Definition: JSirene.cc:63
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
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG