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
Functions
JPlotOscProbInterpolation2D.cc File Reference

Example program to plot oscillogram from 2D oscillations probability table. More...

#include <iostream>
#include <iomanip>
#include <string>
#include "JLang/JVectorize.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JOscProb/JOscChannel.hh"
#include "JOscProb/JOscParameters.hh"
#include "JOscProb/JOscProbToolkit.hh"
#include "JOscProb/JOscProbInterpolator2D.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 from 2D oscillations probability table.

Author
bjung

Definition in file JPlotOscProbInterpolation2D.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file JPlotOscProbInterpolation2D.cc.

27 {
28  using namespace std;
29  using namespace JPP;
30 
31  string inputFile;
32  string outputFile;
35  JOscChannel channel;
36  int debug;
37 
38  try {
39 
40  JParser<> zap;
41 
42  zap['f'] = make_field(inputFile, "2D oscillation probability table file");
43  zap['o'] = make_field(outputFile, "output file");
44  zap['x'] = make_field(X, "histogram binning in energy [GeV]");
45  zap['y'] = make_field(Y, "histogram binning in cos(theta)");
46  zap['#'] = make_field(channel, "Oscillation channel") = JOscChannel(JOscChannel::MUON, JOscChannel::MUON, JOscChannel::ANTIPARTICLE);
47  zap['d'] = make_field(debug) = 2;
48 
49  zap(argc, argv);
50  }
51  catch (const exception& error) {
52  FATAL(error.what() << endl);
53  }
54 
55 
56  TH2D h0("h0", "; energy [GeV]; cos(#theta)", X.size()-1, &X[0], Y.size()-1, &Y[0]);
57 
58  const JOscProbTable2D<> g2(inputFile.c_str());
59  const JOscProbInterpolator2D<> interpolator(&g2);
60 
61  NOTICE(RIGHT(15) << "energy [GeV]" <<
62  RIGHT(15) << "cos(theta)" <<
63  RIGHT(15) << "P" << endl);
64 
65  for (Int_t ix = 1; ix <= h0.GetNbinsX(); ++ix) {
66  for (Int_t iy = 1; iy <= h0.GetNbinsY(); ++iy) {
67 
68  const Double_t energy = h0.GetXaxis()->GetBinCenter(ix);
69  const Double_t costh = h0.GetYaxis()->GetBinCenter(iy);
70 
71  const Double_t prob = interpolator(channel, energy, costh);
72 
73  NOTICE(FIXED(15,3) << energy <<
74  FIXED(15,3) << costh <<
75  FIXED(15,3) << prob << '\r'); DEBUG(endl);
76 
77  h0.SetBinContent(ix, iy, prob);
78  }
79  }
80 
81  TFile out(outputFile.c_str(), "recreate");
82 
83  h0.Write();
84 
85  out.Write();
86  out.Close();
87 }
Utility class to parse command line options.
Definition: JParser.hh:1500
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
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:1961
#define NOTICE(A)
Definition: JMessage.hh:64
int debug
debug level
Definition: JSirene.cc:66
#define FATAL(A)
Definition: JMessage.hh:67
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
no fit printf nominal n $STRING awk v X
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62