8 #include "TApplication.h"
13 #include "TProfile2D.h"
30 int main(
int argc,
char **argv)
35 typedef JRange<double> JRange_t;
45 JParser<> zap(
"Auxiliary program to print the ranges of x, y and z values of 2D ROOT objects.");
47 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
48 zap[
'x'] =
make_field(x,
"x range") = JRange_t();
49 zap[
'y'] =
make_field(y,
"y range") = JRange_t();
50 zap[
'z'] =
make_field(z,
"z range") = JRange_t();
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
60 JRange_t
X = JRange_t::DEFAULT_RANGE;
61 JRange_t
Y = JRange_t::DEFAULT_RANGE;
62 JRange_t Z = JRange_t::DEFAULT_RANGE;
66 DEBUG(
"Input: " << *input << endl);
71 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
75 const TRegexp regexp(input->getObjectName());
77 TIter iter(dir->GetListOfKeys());
79 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
81 const TString tag(key->GetName());
83 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
87 if (tag.Contains(regexp)) {
89 TObject*
object = key->ReadObj();
93 TH2& h2 =
dynamic_cast<TH2&
>(*object);
95 X.combine(x.join(JRange_t(h2.GetXaxis()->GetXmin(), h2.GetXaxis()->GetXmax())));
96 Y.combine(y.join(JRange_t(h2.GetYaxis()->GetXmin(), h2.GetYaxis()->GetXmax())));
97 Z.combine(z.join(JRange_t(h2.GetMinimum(), h2.GetMaximum())));
103 TProfile2D& h2 =
dynamic_cast<TProfile2D&
>(*object);
105 X.combine(x.join(JRange_t(h2.GetXaxis()->GetXmin(), h2.GetXaxis()->GetXmax())));
106 Y.combine(y.join(JRange_t(h2.GetYaxis()->GetXmin(), h2.GetYaxis()->GetXmax())));
107 Z.combine(z.join(JRange_t(h2.GetMinimum(), h2.GetMaximum())));
113 TGraph2D& g2 =
dynamic_cast<TGraph2D&
>(*object);
115 for (Int_t i = 0; i != g2.GetN(); ++i) {
116 if (x(g2.GetX()[i]) &&
119 X.include(g2.GetX()[i]);
120 Y.include(g2.GetY()[i]);
121 Z.include(g2.GetZ()[i]);
131 cout <<
FIXED(15,3) <<
X.getLowerLimit() <<
' '
132 <<
FIXED(15,3) <<
Y.getLowerLimit() <<
' '
133 <<
FIXED(15,3) << Z.getLowerLimit() <<
' '
134 <<
FIXED(15,3) <<
X.getUpperLimit() <<
' '
135 <<
FIXED(15,3) <<
Y.getUpperLimit() <<
' '
136 <<
FIXED(15,3) << Z.getUpperLimit() << endl;
Utility class to parse command line options.
int main(int argc, char *argv[])
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
Auxiliary data structure for floating point format specification.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then break fi done getCenter read X Y Z let X
General purpose messaging.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.