13 #include "TGraphErrors.h" 
   35 int main(
int argc, 
char **argv)
 
   52     JParser<> zap(
"Auxiliary program to scale ROOT histograms."\
 
   53                   "\nNote that the formula may contain method names of the specified object.");
 
   55     zap[
'f'] = 
make_field(inputFile,  
"<input file>:<object name>");
 
   57     zap[
'F'] = 
make_field(formula,    
"ROOT TFormula (may contain method names of object)");
 
   60     zap[
'O'] = 
make_field(option)     = 
"", 
"nosw2", 
"width", 
"nosw2 width";
 
   65   catch(
const exception &error) {
 
   66     FATAL(error.what() << endl);
 
   74     DEBUG(
"Input: " << *input << endl);
 
   79       ERROR(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
   83     const TRegexp regexp(input->getObjectName());
 
   85     TIter iter(dir->GetListOfKeys());
 
   87     for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
 
   89       const TString tag(key->GetName());
 
   91       DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
   95       if (tag.Contains(regexp) && 
isTObject(key)) {
 
   97         TObject* 
object = key->ReadObj();
 
   99         TH1*          h1 = 
dynamic_cast<TH1*
>         (object);
 
  100         TGraphErrors* ge = 
dynamic_cast<TGraphErrors*
>(object);
 
  101         TGraph*       
g1 = 
dynamic_cast<TGraph*
>      (object);
 
  107           const double factor = 
getResult(formula, 
object);
 
  114             h1->Scale(factor, option.c_str());
 
  116           } 
else if (ge != NULL) { 
 
  118             for (Int_t i = 0; i != ge->GetN(); ++i) {
 
  119               ge->GetY() [i] *= factor;
 
  120               ge->GetEY()[i] *= factor;
 
  123           } 
else if (
g1 != NULL) { 
 
  125             for (Int_t i = 0; i != 
g1->GetN(); ++i) {
 
  126               g1->GetY() [i] *= factor;
 
  130           out.WriteTObject(
object);
 
General purpose messaging.
 
#define DEBUG(A)
Message macros.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Double_t g1(const Double_t x)
Function.
 
Auxiliary class to define a range between two values.
 
int main(int argc, char **argv)
 
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.
 
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Type definition of range.