Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
JMergePDF.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 
7 #include "JPhysics/JPDFTable.hh"
8 
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 
13 /**
14  * \file
15  *
16  * Program to merge interpolation tables of muon light for PDFs.
17  * \author mdejong
18  */
19 int main(int argc, char **argv)
20 {
21  using namespace std;
22  using namespace JPP;
23 
24  vector<string> inputFile;
25  string outputFile;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Program to merge interpolation tables of muon light for PDFs.");
31 
32  zap['f'] = make_field(inputFile);
33  zap['o'] = make_field(outputFile);
34  zap['d'] = make_field(debug) = 0;
35 
36  zap(argc, argv);
37  }
38  catch(const exception &error) {
39  FATAL(error.what() << endl);
40  }
41 
42 
43  typedef JSplineFunction1D_t JFunction1D_t;
46  JPolint1FunctionalGridMap>::maplist JMapList_t;
48 
49  JPDF_t pdf;
50 
51  bool clone = true;
52 
53  for (vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
54 
55  NOTICE("loading input from file " << *file_name << "... " << flush);
56 
57  try {
58 
59  JPDF_t fcn;
60 
61  fcn.load(file_name->c_str());
62 
63  if (clone) {
64 
65  pdf.transformer.reset(fcn.transformer->clone());
66 
67  clone = false;
68  }
69 
70  for (JPDF_t::super_const_iterator i = fcn.super_begin(); i != fcn.super_end(); ++i)
71  pdf.insert(*i);
72  }
73  catch(const JException& error) {
74  FATAL(error.what() << endl);
75  }
76 
77  NOTICE("OK" << endl);
78  }
79 
80  try {
81 
82  NOTICE("storing output to file " << outputFile << "... " << flush);
83 
84  pdf.store(outputFile.c_str());
85 
86  NOTICE("OK" << endl);
87  }
88  catch(const JException& error) {
89  FATAL(error.what() << endl);
90  }
91 }
string outputFile
Various implementations of functional maps.
int main(int argc, char **argv)
Definition: JMergePDF.cc:19
General purpose messaging.
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
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
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
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.