Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JGizmo
JPrintFit.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iomanip>
3
#include <iostream>
4
#include <set>
5
6
#include "TROOT.h"
7
#include "TFile.h"
8
#include "TH1.h"
9
#include "TGraph.h"
10
#include "TF1.h"
11
12
#include "
JTools/JRange.hh
"
13
#include "
JGizmo/JRootObjectID.hh
"
14
#include "
JGizmo/JGizmoToolkit.hh
"
15
16
#include "
Jeep/JPrint.hh
"
17
#include "
Jeep/JParser.hh
"
18
#include "
Jeep/JMessage.hh
"
19
20
21
/**
22
* \file
23
* Auxiliary program to print ROOT fit results.
24
* \author mdejong
25
*/
26
int
main
(
int
argc,
char
**argv)
27
{
28
using namespace
std;
29
using namespace
JPP;
30
31
JRootObjectID inputFile;
32
string
fcn;
33
set<string>
print
;
34
int
debug
;
35
36
try
{
37
38
JParser<>
zap(
"Auxiliary program to print ROOT fit results."
);
39
40
zap[
'f'
] =
make_field
(inputFile,
"histogram, e.g: <file name>:<object name>"
);
41
zap[
'F'
] =
make_field
(fcn,
"function name"
) =
"user"
;
42
zap[
'@'
] =
make_field
(
print
,
"(parameter)+"
);
43
zap[
'd'
] =
make_field
(
debug
) = 1;
44
45
zap(argc, argv);
46
}
47
catch
(
const
exception &error) {
48
FATAL
(error.what() << endl);
49
}
50
51
52
TObject
* p =
getObject
(inputFile);
53
54
if
(p == NULL) {
55
FATAL
(
"No object at "
<< inputFile << endl);
56
};
57
58
TF1* f1 = NULL;
59
60
if
(f1 == NULL && dynamic_cast<TF1*> (p) != NULL) { f1 =
dynamic_cast<
TF1*
>
(p); }
61
if
(f1 == NULL && dynamic_cast<TH1*> (p) != NULL) { f1 =
dynamic_cast<
TH1*
>
(p)->GetFunction(fcn.c_str()); };
62
if
(f1 == NULL && dynamic_cast<TGraph*>(p) != NULL) { f1 =
dynamic_cast<
TGraph*
>
(p)->GetFunction(fcn.c_str()); };
63
64
if
(f1 == NULL) {
65
FATAL
(
"No function at "
<< inputFile <<
" "
<< fcn << endl);
66
};
67
68
for
(
int
i = 0; i != f1->GetNpar(); ++i) {
69
if
(
print
.count(f1->GetParName(i)) != 0) {
70
cout <<
FIXED
(12,3) << f1->GetParameter(i) <<
' '
71
<<
FIXED
(12,3) << f1->GetParError (i) << endl;
72
}
73
}
74
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JGIZMO::getObject
TObject * getObject(const JRootObjectID &id)
Get TObject.
Definition:
JGizmoToolkit.hh:142
TObject
Definition:
JRoot.hh:19
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JPrint.hh:481
JPrint.hh
I/O formatting auxiliaries.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
JGizmoToolkit.hh
debug
int debug
debug level
Definition:
JSirene.cc:61
JRootObjectID.hh
print
print
Definition:
JConvertDusj.sh:44
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JRange.hh
Auxiliary class to define a range between two values.
JParser.hh
Utility class to parse command line options.
std::set
Definition:
JSTDTypes.hh:13
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5