Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JAddPDF.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <fstream>
5#include <iomanip>
6#include <vector>
7#include <limits>
8
12#include "JTools/JRange.hh"
13#include "JPhysics/JPDFTable.hh"
14
15#include "Jeep/JParser.hh"
16#include "Jeep/JMessage.hh"
17
18
19/**
20 * \file
21 *
22 * Auxiliary program to add PDF tables of the arrival time of the Cherenkov light from a muon.
23 * \author mdejong
24 */
25int main(int argc, char **argv)
26{
27 using namespace std;
28 using namespace JPP;
29
30 typedef JRange<double> JRange_t;
31
32 vector<string> inputFile;
33 string outputFile;
34 double Rmax_m;
35 JRange_t T_ns;
36 int debug;
37
38 try {
39
40 JParser<> zap("Auxiliary program to add PDF tables of the arrival time of the Cherenkov light from a muon.");
41
42 zap['f'] = make_field(inputFile);
43 zap['o'] = make_field(outputFile);
44 zap['R'] = make_field(Rmax_m, "maximal distance [m]") = numeric_limits<double>::max();
45 zap['T'] = make_field(T_ns, "time range [ns]") = JRange_t();
46 zap['d'] = make_field(debug) = 2;
47
48 zap(argc, argv);
49 }
50 catch(const exception &error) {
51 FATAL(error.what() << endl);
52 }
53
54
55 if (inputFile.empty()) {
56 FATAL("No input file(s)." << endl);
57 }
58
59 typedef JSplineFunction1D_t JFunction1D_t;
62 JPolint1FunctionalGridMap>::maplist JMapList_t;
64
65 const JFunction1D_t::JSupervisor supervisor(new JFunction1D_t::JDefaultResult(0.0));
66
67 JPDF_t pdf;
68
69 for (vector<string>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
70
71 try {
72
73 NOTICE("loading input from file " << *i << "... " << flush);
74
75 JPDF_t buffer;
76
77 buffer.load(i->c_str());
78 buffer.compile();
79 buffer.setExceptionHandler(supervisor);
80
81 NOTICE("OK" << endl);
82
83 if (pdf.empty())
84 pdf = buffer;
85 else
86 pdf.add(buffer);
87 }
88 catch(const JException& error) {
89 FATAL(error.what() << endl);
90 }
91 }
92
93 pdf.compress(Rmax_m, T_ns);
94
95 try {
96
97 NOTICE("storing output to file " << outputFile << "... " << flush);
98
99 pdf.store(outputFile.c_str());
100
101 NOTICE("OK" << endl);
102 }
103 catch(const JException& error) {
104 FATAL(error << endl);
105 }
106}
int main(int argc, char **argv)
Definition JAddPDF.cc:25
string outputFile
Various implementations of functional maps.
General purpose messaging.
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Auxiliary class to define a range between two values.
General exception.
Definition JException.hh:24
virtual const char * what() const override
Get error message.
Definition JException.hh:64
Utility class to parse command line options.
Definition JParser.hh:1698
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
Range of values.
Definition JRange.hh:42
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for recursive map list generation.
Definition JMapList.hh:109
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JMap implementation.
Type definition of a spline interpolation method based on a JCollection with double result type.