#include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "JMath/JMathSupportkit.hh" #include "JROOT/JManager.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to plot mathematical functions. * \author mdejong */ int main(int argc, char**argv) { using namespace std; using namespace JPP; string outputFile; int debug; try { JParser<> zap("Example program to plot mathematical functions."); zap['o'] = make_field(outputFile) = "math.root"; zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JManager H1(new TH1D("[%]", NULL, 1000, -1.0, +1.0)); for (int ix = 1; ix <= H1->GetXaxis()->GetNbins(); ++ix) { const Double_t x = H1->GetXaxis()->GetBinCenter(ix); for (unsigned int n = 0; n <= 5; ++ n) { H1[n]->SetBinContent(ix, legendre(n,x)); } } TFile out(outputFile.c_str(), "recreate"); out << H1; out.Write(); out.Close(); return 0; }