Auxiliary program to print ROOT fit results.
More...
#include <string>
#include <iomanip>
#include <iostream>
#include <vector>
#include <set>
#include "TROOT.h"
#include "TFile.h"
#include "TH1.h"
#include "TGraph.h"
#include "TGraph2D.h"
#include "TF1.h"
#include "JTools/JRange.hh"
#include "JGizmo/JRootObjectID.hh"
#include "JGizmo/JGizmoToolkit.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
std::istream & | operator>> (std::istream &in, TString &object) |
| Read formula from input stream. More...
|
|
std::ostream & | operator<< (std::ostream &out, const TString &object) |
| Write formula to output stream. More...
|
|
int | main (int argc, char **argv) |
|
Auxiliary program to print ROOT fit results.
- Author
- mdejong
Definition in file JPrintFit.cc.
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
TString & |
object |
|
) |
| |
|
inline |
Read formula from input stream.
- Parameters
-
in | input stream |
object | formula |
- Returns
- input stream
Definition at line 30 of file JPrintFit.cc.
32 return object.ReadLine(
in);
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const TString & |
object |
|
) |
| |
|
inline |
Write formula to output stream.
- Parameters
-
out | output stream |
object | formula |
- Returns
- output stream
Definition at line 42 of file JPrintFit.cc.
44 return out <<
object.Data();
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 53 of file JPrintFit.cc.
58 JRootObjectID inputFile;
67 JParser<> zap(
"Auxiliary program to print ROOT fit results.");
69 zap[
'f'] =
make_field(inputFile,
"histogram, e.g: <file name>:<object name>");
70 zap[
'F'] =
make_field(fcn,
"function name") =
"user";
78 catch(
const exception &error) {
79 FATAL(error.what() << endl);
86 FATAL(
"No object at " << inputFile << endl);
91 if (f1 == NULL && dynamic_cast<TF1*> (p) != NULL) { f1 =
dynamic_cast<TF1*
> (p); }
92 if (f1 == NULL && dynamic_cast<TH1*> (p) != NULL) { f1 =
dynamic_cast<TH1*
> (p)->GetFunction(fcn.c_str()); };
93 if (f1 == NULL && dynamic_cast<TGraph*>(p) != NULL) { f1 =
dynamic_cast<TGraph*
>(p)->GetFunction(fcn.c_str()); };
95 if (f1 == NULL && dynamic_cast<TGraph2D*>(p) != NULL) {
97 for (TIter i = dynamic_cast<TGraph2D*>(p)->GetListOfFunctions(); (f1 = (TF1*) i()) != NULL; ) {
98 if (fcn == f1->GetName()) {
104 if (f1 == NULL || fcn != f1->GetName()) {
105 FATAL(
"No function at " << inputFile <<
" " << fcn << endl);
108 for (
int i = 0; i != f1->GetNpar(); ++i) {
109 if (parameter.count(f1->GetParName(i)) != 0) {
110 cout <<
FIXED(20,10) << f1->GetParameter(i) <<
' '
111 <<
FIXED(20,10) << f1->GetParError (i) << endl;
116 cout << f1->EvalPar(
x.data()) << endl;
Utility class to parse command line options.
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
Auxiliary data structure for floating point format specification.