Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JAddPDG.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
10#include "JTools/JRange.hh"
11#include "JPhysics/JPDFTable.hh"
12
13#include "Jeep/JParser.hh"
14#include "Jeep/JMessage.hh"
15
16
17/**
18 * \file
19 *
20 * Auxiliary program to add PDF tables of the arrival time of the Cherenkov light from an EM-shower.
21 * \author mdejong
22 */
23int main(int argc, char **argv)
24{
25 using namespace std;
26 using namespace JPP;
27
28 typedef JRange<double> JRange_t;
29
30 vector<string> inputFile;
31 string outputFile;
32 double Rmax_m;
33 JRange_t T_ns;
34 int debug;
35
36 try {
37
38 JParser<> zap("Auxiliary program to add PDF tables of the arrival time of the Cherenkov light from an EM-shower.");
39
40 zap['f'] = make_field(inputFile);
41 zap['o'] = make_field(outputFile);
42 zap['R'] = make_field(Rmax_m, "maximal distance [m]") = numeric_limits<double>::max();
43 zap['T'] = make_field(T_ns, "time range [ns]") = JRange_t();
44 zap['d'] = make_field(debug) = 2;
45
46 zap(argc, argv);
47 }
48 catch(const exception &error) {
49 FATAL(error.what() << endl);
50 }
51
52
53 if (inputFile.empty()) {
54 FATAL("No input file(s)." << endl);
55 }
56
57 typedef JSplineFunction1D_t JFunction1D_t;
61 JPolint1FunctionalGridMap>::maplist JMapList_t;
63
64 JPDF_t pdf;
65
66 const JFunction1D_t::JSupervisor supervisor(new JFunction1D_t::JDefaultResult(0.0));
67
68 for (vector<string>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
69
70 try {
71
72 NOTICE("loading input from file " << *i << "... " << flush);
73
74 JPDF_t buffer;
75
76 buffer.load(i->c_str());
77 buffer.compile();
78 buffer.setExceptionHandler(supervisor);
79
80 NOTICE("OK" << endl);
81
82 if (pdf.empty())
83 pdf = buffer;
84 else
85 pdf.add(buffer);
86 }
87 catch(const JException& error) {
88 FATAL(error.what() << endl);
89 }
90 }
91
92 pdf.compress(Rmax_m, T_ns);
93
94 try {
95
96 NOTICE("storing output to file " << outputFile << "... " << flush);
97
98 pdf.store(outputFile.c_str());
99
100 NOTICE("OK" << endl);
101 }
102 catch(const JException& error) {
103 FATAL(error << endl);
104 }
105}
int main(int argc, char **argv)
Definition JAddPDG.cc:23
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.