Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JF1.cc File Reference

Auxiliary program to write ROOT function. More...

#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

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JF1.cc.

21 {
22  using namespace std;
23 
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 }
Utility class to parse command line options.
Definition: JParser.hh:1493
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
int debug
debug level
Definition: JSirene.cc:61
#define FATAL(A)
Definition: JMessage.hh:67
JRange< Double_t > JRange_t
Definition: JFitToT.hh:34
then echo n User name
Definition: JCookie.sh:45