Jpp
Functions
JF1.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TF1.h"
#include "JTools/JRange.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

Auxiliary program to write ROOT function.

Author
mdejong

Definition in file JF1.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JF1.cc.

21 {
22  using namespace std;
23 
24  typedef JTOOLS::JRange<double> JRange_t;
25 
26  string formula;
27  string name;
28  string outputFile;
29  JRange_t x;
30  int debug;
31 
32  try {
33 
34  JParser<> zap("Auxiliary program to write ROOT function.");
35 
36  zap['F'] = make_field(formula, "function, e.g: \"[0]+[1]*x\"");
37  zap['T'] = make_field(name, "name of ROOT function") = "user";
38  zap['o'] = make_field(outputFile, "ROOT file with formula") = "f1.root";
39  zap['x'] = make_field(x, "abscissa range") = JRange_t();
40  zap['d'] = make_field(debug) = 1;
41 
42  zap(argc, argv);
43  }
44  catch(const exception &error) {
45  FATAL(error.what() << endl);
46  }
47 
48  TF1 f1(name.c_str(), formula.c_str(), x.getLowerLimit(), x.getUpperLimit());
49 
50  TFile out(outputFile.c_str(), "recreate");
51 
52  out.WriteTObject(&f1);
53 
54  out.Write();
55  out.Close();
56 }
JTOOLS::JRange< double >
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
debug
int debug
debug level
Definition: JSirene.cc:59
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37