38 return object.ReadLine(in);
50 return out <<
object.Data();
64 int main(
int argc,
char **argv)
76 JParser<> zap(
"Auxiliary program to print result from ROOT histograms."\
77 "\nNote that the formula may contain method names of the specified object.");
79 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
81 zap[
'O'] =
make_field(option,
"format, e.g. \"%s %d\", where '%s' will be replaced by name and '%d' by value") =
"";
86 catch(
const exception &error) {
87 FATAL(error.what() << endl);
91 const TRegexp STRING(
"%[+-]?[0-9]*s *");
92 const TRegexp DOUBLE(
"%[+-]?[0-9]*\\.?[0-9]*f");
97 DEBUG(
"Input: " << *input << endl);
102 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
106 const TRegexp regexp(input->getObjectName());
108 TIter iter(dir->GetListOfKeys());
110 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
112 const TString tag(key->GetName());
114 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
118 if (tag.Contains(regexp)) {
120 TObject*
object = key->ReadObj();
126 TString buffer = option;
131 pos = buffer.Index(STRING, &len);
134 buffer.Replace(pos, len, TString::Format(TString(buffer(pos, len).Data(), len), object->GetName()));
137 TString sub(
"%12.3f");
143 pos = buffer.Index(DOUBLE, &len);
147 sub = TString(buffer(pos, len).Data(), len);
149 buffer.Replace(pos, len, TString::Format(sub,
result));
153 if (i != formula.begin()) {
157 buffer.Append(TString::Format(sub,
result));
160 cout << buffer << endl;