29int main(
int argc,
char **argv)
44 JParser<> zap(
"Auxiliary program to print the ranges of x, y and z values of 2D 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();
49 zap[
'z'] =
make_field(z,
"z range") = JRange_t();
54 catch(
const exception &error) {
55 FATAL(error.what() << endl);
59 JRange_t X = JRange_t::DEFAULT_RANGE();
60 JRange_t Y = JRange_t::DEFAULT_RANGE();
61 JRange_t Z = JRange_t::DEFAULT_RANGE();
63 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
65 DEBUG(
"Input: " << *input << endl);
67 TDirectory* dir = getDirectory(*input);
70 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
74 const TRegexp regexp(input->getObjectName());
76 TIter iter(dir->GetListOfKeys());
78 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
80 const TString tag(key->GetName());
82 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
86 if (tag.Contains(regexp) && isTObject(key)) {
88 TObject*
object = key->ReadObj();
92 TH2& h2 =
dynamic_cast<TH2&
>(*object);
94 X.combine(x.join(JRange_t(h2.GetXaxis()->GetXmin(), h2.GetXaxis()->GetXmax())));
95 Y.combine(y.join(JRange_t(h2.GetYaxis()->GetXmin(), h2.GetYaxis()->GetXmax())));
96 Z.combine(z.join(JRange_t(h2.GetMinimum(), h2.GetMaximum())));
102 TProfile2D& h2 =
dynamic_cast<TProfile2D&
>(*object);
104 X.combine(x.join(JRange_t(h2.GetXaxis()->GetXmin(), h2.GetXaxis()->GetXmax())));
105 Y.combine(y.join(JRange_t(h2.GetYaxis()->GetXmin(), h2.GetYaxis()->GetXmax())));
106 Z.combine(z.join(JRange_t(h2.GetMinimum(), h2.GetMaximum())));
112 TGraph2D& g2 =
dynamic_cast<TGraph2D&
>(*object);
114 for (Int_t i = 0; i != g2.GetN(); ++i) {
115 if (x(g2.GetX()[i]) &&
118 X.include(g2.GetX()[i]);
119 Y.include(g2.GetY()[i]);
120 Z.include(g2.GetZ()[i]);
130 cout <<
SCIENTIFIC(15,5) << X.getLowerLimit() <<
' '
131 <<
SCIENTIFIC(15,5) << Y.getLowerLimit() <<
' '
132 <<
SCIENTIFIC(15,5) << Z.getLowerLimit() <<
' '
133 <<
SCIENTIFIC(15,5) << X.getUpperLimit() <<
' '
134 <<
SCIENTIFIC(15,5) << Y.getUpperLimit() <<
' '
135 <<
SCIENTIFIC(15,5) << Z.getUpperLimit() << endl;