33 int main(
int argc,
char **argv)
38 typedef JRange<double> JRange_t;
49 JParser<> zap(
"Auxiliary program to scale ROOT histograms."\
50 "\nNote that the formula may contain method names of the specified object.");
52 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
54 zap[
'F'] =
make_field(formula,
"ROOT TFormula (may contain method names of object)");
55 zap[
'x'] =
make_field(X,
"abscissa range (only for Integral)") = JRange_t();
56 zap[
'y'] =
make_field(Y,
"abscissa range (only for Integral)") = JRange_t();
61 catch(
const exception &error) {
62 FATAL(error.what() << endl);
70 DEBUG(
"Input: " << *input << endl);
75 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
79 const TRegexp regexp(input->getObjectName());
81 TIter iter(dir->GetListOfKeys());
83 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
85 const TString tag(key->GetName());
87 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
91 if (tag.Contains(regexp)) {
93 TObject*
object = key->ReadObj();
97 TH1& h1 = dynamic_cast<TH1&>(*
object);
99 if (X != JRange_t()) { h1.GetXaxis()->SetRangeUser(X.getLowerLimit(), X.getUpperLimit()); }
100 if (Y != JRange_t()) { h1.GetYaxis()->SetRangeUser(Y.getLowerLimit(), Y.getUpperLimit()); }
102 double factor =
getResult(formula,
object);
104 DEBUG(h1.GetName() <<
' ' << formula <<
' ' << factor << endl);
108 out.WriteTObject(&h1);