34{
   37 
   41 
   42  try {
   43 
   44    JParser<> zap(
"Auxiliary program to print quantiles from ROOT histograms.");
 
   45    
   46    zap[
'f'] = 
make_field(inputFile,  
"<input file>:<object name>");
 
   49     
   50    zap(argc, argv);
   51  }
   52  catch(const exception &error) {
   53    FATAL(error.what() << endl);
 
   54  }
   55 
   56 
   57  for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
   58 
   59    DEBUG(
"Input: " << *input << endl);
 
   60 
   62 
   63    if (dir == NULL) {
   64      ERROR(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
   65      continue;
   66    }
   67 
   68    const TRegexp regexp(input->getObjectName());
   69 
   70    TIter iter(dir->GetListOfKeys());
   71 
   72    for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
   73 
   74      const TString tag(key->GetName());
   75 
   76      DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
   77        
   78      
   79 
   80      if (tag.Contains(regexp) && 
isTObject(key)) {
 
   81 
   82        TObject* 
object = key->ReadObj();
 
   83        
   85 
   86        try {
   87          
   88          TH1&    h1 = dynamic_cast<TH1&>(*object);
   89 
   90          h1.GetQuantiles(Q.size(), X.data(), Q.data());
   91        }
   92        catch(const exception&) {}
   93 
   94        try {
   95          
   96          TGraph& 
g1 = 
dynamic_cast<TGraph&
>(*object);
 
   97 
   99 
  100          for (Int_t i = 0; i != 
g1.GetN(); ++i) {
 
  101            Q1.put(
g1.GetX()[i], 
g1.GetY()[i]);
 
  102          }
  103          
  104          for (size_t i = 0; i != Q.size(); ++i) {
  105            X[i] = Q1.getQuantile(Q[i]);
  106          }
  107        }
  108        catch(const exception&) {}
  109 
  110        for (vector<Double_t>::const_iterator i = X.begin(); i != X.end(); ++i) {
  111          cout << ' ' << *i;
  112        }
  113 
  114        cout << endl;
  115      }
  116    }
  117  }
  118}
#define DEBUG(A)
Message macros.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Double_t g1(const Double_t x)
Function.
 
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.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).