Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
examples/JPhysics/JPDFSupportkit.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4
5#include "TROOT.h"
6#include "TFile.h"
7#include "TH1D.h"
8
9#include "JPhysics/Antares.hh"
10#include "JPhysics/KM3NeT.hh"
12
13#include "Jeep/JProperties.hh"
14#include "Jeep/JParser.hh"
15#include "Jeep/JMessage.hh"
16
17
18/**
19 * \file
20 *
21 * Program to plot PDF support data.
22 * \author mdejong
23 */
24int main(int argc, char **argv)
25{
26 using namespace std;
27 using namespace JPP;
28
29 PDF::configuration_type configuration;
30 string outputFile;
31 int debug;
32
33
34 JProperties properties = configuration.getProperties();
35
36 try {
37
38 JParser<> zap("Program to plot PDF support data.");
39
40 zap['@'] = make_field(properties, PDF::help() << configuration) = JPARSER::initialised();
41 zap['o'] = make_field(outputFile) = "pdf.root";
42 zap['d'] = make_field(debug) = 0;
43
44 zap(argc, argv);
45 }
46 catch(const exception &error) {
47 FATAL(error.what() << endl);
48 }
49
50 TFile out(outputFile.c_str(), "recreate");
51
52 TH1D h1("h1", NULL, 900, 240.0, 800.0);
53 TH1D h2("h2", NULL, 900, 240.0, 800.0);
54 TH1D h3("h3", NULL, 900, 240.0, 800.0);
55 TH1D h4("h4", NULL, 900, -1.0, +1.0);
56 TH1D h5("h5", NULL, 900, -1.0, +1.0);
57
58 for(int ix = 1; ix <= h1.GetNbinsX(); ++ix) {
59
60 const double x = h1.GetBinCenter(ix);
61 const double y = PDF::getAbsorptionLength(x);
62
63 h1.SetBinContent(ix, y);
64 }
65
66 for(int ix = 1; ix <= h2.GetNbinsX(); ++ix) {
67
68 const double x = h2.GetBinCenter(ix);
69 const double y = PDF::getScatteringLength(x);
70
71 h2.SetBinContent(ix, y);
72 }
73
74 for(int ix = 1; ix <= h3.GetNbinsX(); ++ix) {
75
76 const double x = h3.GetBinCenter(ix);
77 const double y = PDF::getQE(x);
78
79 h3.SetBinContent(ix, y);
80 }
81
82 for(int ix = 1; ix <= h4.GetNbinsX(); ++ix) {
83
84 const double x = h4.GetBinCenter(ix);
85 const double y = PDF::getAngularAcceptance(x);
86
87 h4.SetBinContent(ix, y);
88 }
89
90 for(int ix = 1; ix <= h5.GetNbinsX(); ++ix) {
91
92 const double x = h5.GetBinCenter(ix);
93 const double y = PDF::getScatteringProbability(x);
94
95 h5.SetBinContent(ix, y);
96 }
97
98 out.Write();
99 out.Close();
100}
Properties of Antares PMT and deep-sea water.
string outputFile
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2107
Utility class to parse parameter values.
Properties of KM3NeT PMT and deep-sea water.
Utility class to parse parameter values.
Utility class to parse command line options.
Definition JParser.hh:1664
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:66
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.