Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JBlurPDF.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <fstream>
4 #include <iomanip>
5 
6 #include "Jeep/JParser.hh"
7 #include "Jeep/JMessage.hh"
10 #include "JPhysics/JPDFTable.hh"
11 
12 
13 /**
14  * \file
15  * Auxiliary program to apply the transition time spread (TTS) of the PMTs to interpolation tables of PDFs.
16  * \author mdejong
17  */
18 int main(int argc, char **argv)
19 {
20  using namespace std;
21 
22  string inputFile;
23  string outputFile;
24  int numberOfPoints;
25  double epsilon;
26  double TTS;
27  int debug;
28 
29  try {
30 
31  JParser<> zap("Auxiliary program to apply the transition time spread (TTS) of the PMTs to interpolation tables of PDFs.");
32 
33  zap['f'] = make_field(inputFile);
34  zap['o'] = make_field(outputFile);
35  zap['n'] = make_field(numberOfPoints) = 25;
36  zap['e'] = make_field(epsilon) = 1.0e-10;
37  zap['T'] = make_field(TTS) = 0.0; // [ns]
38  zap['d'] = make_field(debug) = 0;
39 
40  zap(argc, argv);
41  }
42  catch(const exception &error) {
43  FATAL(error.what() << endl);
44  }
45 
46 
47  using namespace JPP;
48 
49  typedef JSplineFunction1D_t JFunction1D_t;
50  typedef JMAPLIST<JPolint1FunctionalMap,
51  JPolint1FunctionalGridMap,
52  JPolint1FunctionalGridMap>::maplist JMapList_t;
53  typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
54 
55  JPDF_t pdf;
56 
57 
58  try {
59 
60  NOTICE("loading input from file " << inputFile << "... " << flush);
61 
62  pdf.load(inputFile.c_str());
63 
64  NOTICE("OK" << endl);
65  }
66  catch(const JException& error) {
67  FATAL(error.what() << endl);
68  }
69 
70 
71  pdf.setExceptionHandler(new JFunction1D_t::JDefaultResult(0.0));
72 
73  NOTICE("Gauss-Hermite integration... " << flush);
74 
75  pdf.blur(TTS, numberOfPoints, epsilon);
76 
77  NOTICE("OK" << endl);
78 
79 
80  NOTICE("storing output to file " << outputFile << "... " << flush);
81 
82  pdf.store(outputFile.c_str());
83 
84  NOTICE("OK" << endl);
85 }
Utility class to parse command line options.
Definition: JParser.hh:1711
int main(int argc, char *argv[])
Definition: Main.cc:15
string outputFile
Various implementations of functional maps.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
#define NOTICE(A)
Definition: JMessage.hh:64
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
int numberOfPoints
Definition: JResultPDF.cc:22
const double epsilon
Definition: JQuadrature.cc:21
int debug
debug level