Jpp  master_rocky
the software that should make you happy
Functions
JMergePDG.cc File Reference

Program to merge interpolation tables of shower light for PDFs. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JTools/JFunction1D_t.hh"
#include "JTools/JFunctionalMap_t.hh"
#include "JPhysics/JPDFTable.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to merge interpolation tables of shower light for PDFs.

Author
mdejong

Definition in file JMergePDG.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 19 of file JMergePDG.cc.

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 shower 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;
47  JPolint1FunctionalGridMap>::maplist JMapList_t;
49 
50  JPDF_t pdf;
51 
52  bool clone = true;
53 
54  for (vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
55 
56  NOTICE("loading input from file " << *file_name << "... " << flush);
57 
58  try {
59 
60  JPDF_t fcn;
61 
62  fcn.load(file_name->c_str());
63 
64  if (clone) {
65 
66  pdf.transformer.reset(fcn.transformer->clone());
67 
68  clone = false;
69  }
70 
71  for (JPDF_t::super_const_iterator i = fcn.super_begin(); i != fcn.super_end(); ++i)
72  pdf.insert(*i);
73  }
74  catch(const JException& error) {
75  FATAL(error.what() << endl);
76  }
77 
78  NOTICE("OK" << endl);
79  }
80 
81  try {
82 
83  NOTICE("storing output to file " << outputFile << "... " << flush);
84 
85  pdf.store(outputFile.c_str());
86 
87  NOTICE("OK" << endl);
88  }
89  catch(const JException& error) {
90  FATAL(error.what() << endl);
91  }
92 }
string outputFile
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#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.