8 #include "TApplication.h"
30 int main(
int argc,
char **argv)
35 typedef JRange<double> JRange_t;
44 JParser<> zap(
"Auxiliary program to print the ranges of x and y values of 1D ROOT objects.");
46 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
47 zap[
'x'] =
make_field(x,
"x range") = JRange_t();
48 zap[
'y'] =
make_field(y,
"y range") = JRange_t();
53 catch(
const exception &error) {
54 FATAL(error.what() << endl);
58 JRange_t X = JRange_t::DEFAULT_RANGE;
59 JRange_t Y = JRange_t::DEFAULT_RANGE;
63 DEBUG(
"Input: " << *input << endl);
68 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
72 const TRegexp regexp(input->getObjectName());
74 TIter iter(dir->GetListOfKeys());
76 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
78 const TString tag(key->GetName());
80 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
84 if (tag.Contains(regexp)) {
86 TObject*
object = key->ReadObj();
90 TH1& h1 = dynamic_cast<TH1&>(*
object);
92 X.combine(x.join(JRange_t(h1.GetXaxis()->GetXmin(), h1.GetXaxis()->GetXmax())));
93 Y.combine(y.join(JRange_t(h1.GetMinimum(), h1.GetMaximum())));
99 TProfile& h1 = dynamic_cast<TProfile&>(*
object);
101 X.combine(x.join(JRange_t(h1.GetXaxis()->GetXmin(), h1.GetXaxis()->GetXmax())));
102 Y.combine(y.join(JRange_t(h1.GetMinimum(), h1.GetMaximum())));
108 TGraph&
g1 = dynamic_cast<TGraph&>(*
object);
110 for (Int_t i = 0; i !=
g1.GetN(); ++i) {
111 if (x(
g1.GetX()[i]) &&
113 X.include(
g1.GetX()[i]);
114 Y.include(
g1.GetY()[i]);
124 cout <<
FIXED(15,3) << X.getLowerLimit() <<
' '
125 <<
FIXED(15,3) << Y.getLowerLimit() <<
' '
126 <<
FIXED(15,3) << X.getUpperLimit() <<
' '
127 <<
FIXED(15,3) << Y.getUpperLimit() << endl;