29{
32
34
38 JRange_t z;
39 JRange_t c;
41
42 try {
43
44 JParser<> zap(
"Auxiliary program to print the ranges of x, y, z and c values of 3D ROOT objects.");
45
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();
50 zap[
'c'] =
make_field(c,
"c range") = JRange_t();
52
53 zap(argc, argv);
54 }
55 catch(const exception &error) {
56 FATAL(error.what() << endl);
57 }
58
59
60 JRange_t X = JRange_t::DEFAULT_RANGE();
61 JRange_t Y = JRange_t::DEFAULT_RANGE();
62 JRange_t Z = JRange_t::DEFAULT_RANGE();
63 JRange_t C = JRange_t::DEFAULT_RANGE();
64
65 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
66
67 DEBUG(
"Input: " << *input << endl);
68
70
71 if (dir == NULL) {
72 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
73 continue;
74 }
75
76 const TRegexp regexp(input->getObjectName());
77
78 TIter iter(dir->GetListOfKeys());
79
80 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
81
82 const TString tag(key->GetName());
83
84 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
85
86
87
88 if (tag.Contains(regexp) &&
isTObject(key)) {
89
90 TObject*
object = key->ReadObj();
91
92 try {
93
94 TH3& h3 = dynamic_cast<TH3&>(*object);
95
96 X.combine(
x.join(JRange_t(h3.GetXaxis()->GetXmin(), h3.GetXaxis()->GetXmax())));
97 Y.combine(
y.join(JRange_t(h3.GetYaxis()->GetXmin(), h3.GetYaxis()->GetXmax())));
98 Z.combine(z.join(JRange_t(h3.GetZaxis()->GetXmin(), h3.GetZaxis()->GetXmax())));
99 C.combine(c.join(JRange_t(h3.GetMinimum(), h3.GetMaximum())));
100 }
101 catch(exception&) {}
102 }
103 }
104 }
105
106
107 cout <<
SCIENTIFIC(15,5) << X.getLowerLimit() <<
' '
108 <<
SCIENTIFIC(15,5) << Y.getLowerLimit() <<
' '
109 <<
SCIENTIFIC(15,5) << Z.getLowerLimit() <<
' '
110 <<
SCIENTIFIC(15,5) << C.getLowerLimit() <<
' '
111 <<
SCIENTIFIC(15,5) << X.getUpperLimit() <<
' '
112 <<
SCIENTIFIC(15,5) << Y.getUpperLimit() <<
' '
113 <<
SCIENTIFIC(15,5) << Z.getUpperLimit() <<
' '
114 <<
SCIENTIFIC(15,5) << C.getUpperLimit() << endl;
115}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.