Jpp  18.0.0-rc.2
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 "Jeep/JPrint.hh"
7 #include "Jeep/JParser.hh"
8 #include "Jeep/JMessage.hh"
9 
10 #include "JOscProb/JOscChannel.hh"
13 
14 
15 /**
16  * \file
17  * Example program to print oscillation probabilities interpolated in energy and zenith-angle.
18  *
19  * \author bjung
20  */
21 int main(int argc, char **argv)
22 {
23  using namespace std;
24  using namespace JPP;
25 
26  string inputFile;
27  JOscParameters parameters;
28  map<double, double> interpolationValues;
29  JOscChannel channel;
30  int debug;
31 
32  try {
33 
34  JParser<> zap;
35 
36  zap['f'] = make_field(inputFile, "8D oscillation probability table file");
37  zap['x'] = make_field(interpolationValues, "Map of interpolation values in (energy [GeV], cos(theta))")
39  zap['@'] = make_field(parameters, "Oscillation parameters")
41  zap['#'] = make_field(channel, "Oscillation channel")
42  = JOscChannel(JFlavour_t::MUON, JFlavour_t::MUON, JChargeParity_t::PARTICLE);
43  zap['d'] = make_field(debug)
44  = 3;
45 
46  zap(argc, argv);
47  }
48  catch (const exception& error) {
49  FATAL(error.what() << endl);
50  }
51 
52 
53  JOscProbInterpolator<> interpolator(inputFile.c_str(), parameters);
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 energy = i->first;
62  const double costh = i->second;
63 
64  const double oscProb = interpolator(channel, energy, costh);
65 
66  NOTICE(FIXED(15,3) << energy <<
67  FIXED(15,3) << costh <<
68  FIXED(15,3) << oscProb << '\r'); DEBUG(endl);
69  }
70 }
Utility class to parse command line options.
Definition: JParser.hh:1514
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:83
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:1989
#define NOTICE(A)
Definition: JMessage.hh:64
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.
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62