Jpp  17.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPlotOscillogram.cc File Reference

Example program to plot oscillogram. More...

#include <iostream>
#include <iomanip>
#include <string>
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JOscProb/JOscChannel.hh"
#include "JOscProb/JOscParameters.hh"
#include "JOscProb/JOscillogram.hh"
#include "JOscProb/JOscProbToolkit.hh"
#include "JOscProb/JOscProbInterpolator.hh"
#include "JOscProb/JOscProbInterpolatorInterface.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 to plot oscillogram.

Author
bjung

Definition in file JPlotOscillogram.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file JPlotOscillogram.cc.

27 {
28  using namespace std;
29  using namespace JPP;
30 
31  typedef JGrid<double> JGrid_t;
32 
33 
34  string inputFile;
35  string outputFile;
36 
37  string abscissaType;
38  JGrid_t abscissaGrid;
39 
40  string ordinateType;
41  JGrid_t ordinateGrid;
42 
43  JOscParameters parameters;
44  JOscChannel channel;
45 
46  int debug;
47 
48  try {
49 
50  JParser<> zap;
51 
52  zap['f'] = make_field(inputFile, "oscillation probability table file");
53  zap['o'] = make_field(outputFile, "output file");
54  zap['X'] = make_field(abscissaType, "abscissa type") =
56  JOscVars::log10E(),
57  JOscVars::LoE();
58  zap['x'] = make_field(abscissaGrid, "abscissa binning");
59  zap['Y'] = make_field(ordinateType, "ordinate type") =
60  JOscVars::costh(),
61  JOscVars::sinth(),
62  JOscVars::L();
63  zap['y'] = make_field(ordinateGrid, "ordinate binning");
64  zap['@'] = make_field(parameters, "oscillation parameters")
65  = JOscParameters(false);
66  zap['#'] = make_field(channel, "oscillation channel")
67  = JOscChannel(JFlavour_t::MUON, JFlavour_t::MUON, JChargeParity_t::PARTICLE);
68  zap['d'] = make_field(debug)
69  = 2;
70 
71  zap(argc, argv);
72  }
73  catch (const exception& error) {
74  FATAL(error.what() << endl);
75  }
76 
77 
78  const JOscProbInterpolator<> interpolator(inputFile.c_str(), parameters);
79 
80  TH2D h0("h0", NULL,
81  abscissaGrid.getSize(), abscissaGrid.getXmin(), abscissaGrid.getXmax(),
82  ordinateGrid.getSize(), ordinateGrid.getXmin(), ordinateGrid.getXmax());
83 
84  const JOscillogram oscillogram(abscissaType, abscissaGrid,
85  ordinateType, ordinateGrid,
86  channel, &interpolator);
87 
88  NOTICE(RIGHT(15) << abscissaType << RIGHT(15) << ordinateType << RIGHT(15) << "P" << endl);
89 
90  for (int ix = 0; ix < abscissaGrid.getSize(); ++ix) {
91  for (int iy = 0; iy < ordinateGrid.getSize(); ++iy) {
92 
93  const double x = abscissaGrid.getX(ix);
94  const double y = ordinateGrid.getX(iy);
95 
96  const double P = oscillogram.getP(ix, iy);
97 
98  NOTICE(FIXED(15,3) << x << FIXED(15,3) << y << FIXED(15,3) << P << '\r'); DEBUG(endl);
99 
100  h0.SetBinContent(ix+1, iy+1, P);
101  }
102  }
103 
104  TFile out(outputFile.c_str(), "recreate");
105 
106  h0.Write();
107 
108  out.Write();
109  out.Close();
110 }
Utility class to parse command line options.
Definition: JParser.hh:1517
*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
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
int debug
debug level
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62