29int main(
int argc,
char **argv)
43 JParser<> zap(
"Auxiliary program to print the ranges of x and y values of 1D ROOT objects.");
45 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
46 zap[
'x'] =
make_field(x,
"x range") = JRange_t();
47 zap[
'y'] =
make_field(y,
"y range") = JRange_t();
52 catch(
const exception &error) {
53 FATAL(error.what() << endl);
57 JRange_t X = JRange_t::DEFAULT_RANGE();
58 JRange_t Y = JRange_t::DEFAULT_RANGE();
60 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
62 DEBUG(
"Input: " << *input << endl);
64 TDirectory* dir = getDirectory(*input);
67 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
71 const TRegexp regexp(input->getObjectName());
73 TIter iter(dir->GetListOfKeys());
75 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
77 const TString tag(key->GetName());
79 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
83 if (tag.Contains(regexp) && isTObject(key)) {
85 TObject*
object = key->ReadObj();
89 TH1& h1 =
dynamic_cast<TH1&
>(*object);
91 X.combine(x.join(JRange_t(h1.GetXaxis()->GetXmin(), h1.GetXaxis()->GetXmax())));
92 Y.combine(y.join(JRange_t(h1.GetMinimum(), h1.GetMaximum())));
98 TProfile& h1 =
dynamic_cast<TProfile&
>(*object);
100 X.combine(x.join(JRange_t(h1.GetXaxis()->GetXmin(), h1.GetXaxis()->GetXmax())));
101 Y.combine(y.join(JRange_t(h1.GetMinimum(), h1.GetMaximum())));
107 TGraph&
g1 =
dynamic_cast<TGraph&
>(*object);
109 for (Int_t i = 0; i !=
g1.GetN(); ++i) {
110 if (x(
g1.GetX()[i]) &&
112 X.include(
g1.GetX()[i]);
113 Y.include(
g1.GetY()[i]);
123 cout <<
SCIENTIFIC(15,5) << X.getLowerLimit() <<
' '
124 <<
SCIENTIFIC(15,5) << Y.getLowerLimit() <<
' '
125 <<
SCIENTIFIC(15,5) << X.getUpperLimit() <<
' '
126 <<
SCIENTIFIC(15,5) << Y.getUpperLimit() << endl;