9 #include "TApplication.h" 
   14 #include "TProfile2D.h" 
   30 int main(
int argc, 
char **argv)
 
   40     JParser<> zap(
"Auxiliary program to print (x,y) of the maximum of 2D ROOT objects.");
 
   42     zap[
'f'] = 
make_field(inputFile,  
"<input file>:<object name>");
 
   47   catch(
const exception &error) {
 
   48     FATAL(error.what() << endl);
 
   54     DEBUG(
"Input: " << *input << endl);
 
   59       ERROR(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
   63     const TRegexp regexp(input->getObjectName());
 
   65     TIter iter(dir->GetListOfKeys());
 
   67     for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
 
   69       const TString tag(key->GetName());
 
   71       DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
   75       if (tag.Contains(regexp) && 
isTObject(key)) {
 
   77         TObject* 
object = key->ReadObj();
 
   81         double zmax = numeric_limits<double>::lowest();
 
   85           TH2& h2 = 
dynamic_cast<TH2&
>(*object);
 
   87           for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
 
   88             for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
 
   90               double z = h2.GetBinContent(ix,iy);
 
   94                 x    = h2.GetXaxis()->GetBinCenter(ix);
 
   95                 y    = h2.GetYaxis()->GetBinCenter(iy);
 
  104           TProfile2D& h2 = 
dynamic_cast<TProfile2D&
>(*object);
 
  106           for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
 
  107             for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
 
  109               double z = h2.GetBinContent(ix,iy);
 
  113                 x    = h2.GetXaxis()->GetBinCenter(ix);
 
  114                 y    = h2.GetYaxis()->GetBinCenter(iy);
 
  123           TGraph2D& g2 = 
dynamic_cast<TGraph2D&
>(*object);
 
  125           for (Int_t 
i = 0; 
i != g2.GetN(); ++
i) {
 
  126             if (g2.GetZ()[
i] > zmax) {
 
  135         if (zmax != numeric_limits<double>::lowest()) {
 
  136           cout << setw(32) << left << key->GetName() << right << 
' ' << 
SCIENTIFIC(15,5) << x << 
' ' << 
SCIENTIFIC(15,5) << y << endl;
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
I/O formatting auxiliaries. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
General purpose messaging. 
 
Utility class to parse command line options. 
 
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject. 
 
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer. 
 
Auxiliary data structure for floating point format specification. 
 
#define DEBUG(A)
Message macros.