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>");
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) &&
isTObject(key)) {
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 <<
SCIENTIFIC(15,5) <<
X.getLowerLimit() <<
' '
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
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
no fit printf nominal n $STRING awk v X
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
Auxiliary data structure for floating point format specification.
#define DEBUG(A)
Message macros.
Double_t g1(const Double_t x)
Function.