| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Gaudi::Utils::Histos Namespace Reference

Collection of useful utilities for manipulations with AIDA hisgograms. More...


Classes

class  Table
 Simple class for the customizeble printout of the histogram tables. More...

Namespaces

namespace  Formats
 The 15 format fields are predefined now:.

Functions

std::string path (const AIDA::IBaseHistogram *aida)
 get the path in THS for AIDA histogram
std::string format (const AIDA::IHistogram1D *histo, const std::string &fmt)
 Make the string representation of the historgam according to the specified format.
std::string format (const AIDA::IHistogram1D *histo, const std::string &ID, const std::string &fmt1, const std::string &fmt2)
 format a full row in table, including ID, label, path or any other "extra" identifier in string form
template<class HISTO, class STREAM, class TERMINATOR>
STREAM & printList (HISTO first, HISTO last, const std::string &fmt, STREAM &stream, TERMINATOR term)
 print the simple sequence (list-like) of histograms as table
template<class LIST, class STREAM, class TERMINATOR>
STREAM & printList (const LIST &histos, const std::string &fmt, STREAM &stream, TERMINATOR term)
 print the simple container of histograms as table
template<class HISTO, class STREAM, class TERMINATOR>
STREAM & printMap (HISTO begin, HISTO end, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
 Print the "associative sequence" (e.g.
template<class MAP, class STREAM, class TERMINATOR>
STREAM & printMap (const MAP &histos, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
 Print the "associative sequence" (e.g.
std::string format (const std::string &val1, const std::string &val2, const std::string &fmt)
 helper method to merge the headers for short format table

Detailed Description

Collection of useful utilities for manipulations with AIDA hisgograms.

Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-08-08


Function Documentation

std::string Gaudi::Utils::Histos::path ( const AIDA::IBaseHistogram *  aida  ) 

get the path in THS for AIDA histogram

Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-08-08

std::string Gaudi::Utils::Histos::format ( const AIDA::IHistogram1D *  histo,
const std::string &  fmt 
)

Make the string representation of the historgam according to the specified format.

The method could be used to access/print various quantities

  using namespace Gaudi::Utils::Histos ;

  const AIDA::IHistogram1D* histo = ... ;

  // print title in a free format:
  std::cout << format   ( histo , "%2%" ) << std::endl ;

  // print the path in HTS in a free format:
  std::cout << format   ( histo , " path in HTS: %1% " ) << std::endl ;

  // print the formatted nEntries/Overflow/Underflow:
  std::cout << 
     format   ( histo , " #nEntries/Overflow/Underflow=%3%/%4%/%5%" )  
            << std::endl ;

  // print the formatted Mean+-ErrorMean:
  std::cout << 
     format   ( histo , " Mean+-Error=(%8%+-%9%)" ) 
            << std::endl ;

  // print the skewness and kurtosis:
  std::cout << 
     format   ( histo , " Skewness/Kurtosis=%12%/%14% " ) 
            << std::endl ;

Parameters:
histo reference to the histogram
fmt the printout format
Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-08-08

std::string Gaudi::Utils::Histos::format ( const AIDA::IHistogram1D *  histo,
const std::string &  ID,
const std::string &  fmt1,
const std::string &  fmt2 
)

format a full row in table, including ID, label, path or any other "extra" identifier in string form

  using namespace Gaudi::Utils::Histos 
  const AIDA::IHistogram1D* histo = ... ;
  
  // define short format
  const std::string fmt1 = " |%1$-30.30s %|33t| %2" ; 

  // define format for the histogram 
  const std::string fmt2 = ... ; 
  
  info () << 
        format   ( "My Histo" , histo , fmt1 , fmt2 ) 
          << endreq ;

Parameters:
histo pointer to the histogram
ID historgam ID, title, label or other extra information
fmt1 "short" format used for the table
fmt2 format used for the histogram printout
Returns:
formatted row
Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-08-08

template<class HISTO, class STREAM, class TERMINATOR>
STREAM& Gaudi::Utils::Histos::printList ( HISTO  first,
HISTO  last,
const std::string &  fmt,
STREAM &  stream,
TERMINATOR  term 
) [inline]

print the simple sequence (list-like) of histograms as table

  SEQUENCE histos = ... ;

  // print a table with three colums  path, title and #entries 

  Gaudi::Utils::Histos::printList 
    ( histos.begin () , 
      histos.end   () , 
      " | %1$|-40.40s | %2$-30.30s | %3$=7d | " , 
      std::cout       , 
      '\n'            ) ;

Parameters:
first begin-iterator for the sequence
last end-iterator for the sequence
stream the stream to be used for printout
term the terminmator for the stream
fmt the format to be used

Definition at line 194 of file HistoTableFormat.h.

00199       {
00200         for ( ; first != last ; ++first ) 
00201         { stream << format   ( *first , fmt ) << term ; }  // print table rows 
00202         return stream ;                                    // RETURN
00203       }

template<class LIST, class STREAM, class TERMINATOR>
STREAM& Gaudi::Utils::Histos::printList ( const LIST &  histos,
const std::string &  fmt,
STREAM &  stream,
TERMINATOR  term 
) [inline]

print the simple container of histograms as table

  using namespace Gaudi::Utils::Histos ;

  SEQUENCE histos = ... ;

  // print a table with three columns:  path, title and #entries 

  printList 
    ( histos          , 
      " | %1$|-40.40s | %2$-30.30s | %3$=7d | " , 
      std::cout       , 
      '\n'            ) ;

Parameters:
histos the sequence of histograms
stream the stream to be used for printout
term the terminmator for the stream
fmt the format to be used

Definition at line 230 of file HistoTableFormat.h.

00234       {
00235         return printList 
00236           ( histos.begin () , histos.end  () , fmt , stream , term ) ;
00237       }

template<class HISTO, class STREAM, class TERMINATOR>
STREAM& Gaudi::Utils::Histos::printMap ( HISTO  begin,
HISTO  end,
const std::string &  fmt1,
const std::string &  fmt2,
STREAM &  stream,
TERMINATOR  term 
) [inline]

Print the "associative sequence" (e.g.

part of std:map) of histograms as table:

  using namespace Gaudi::Utils::Histos ;

  const std::map<std::string,AIDA::IHistogram1D*>& m = ... ;

  printMap   
   ( m.begin () , 
     m.end   () ,
     "| %1$-10.10s | %2% " , // short format
     Gaudi::Utils::Histos::Formats::histoFormatOnly , 
     always()   , 
     endreq     ) ;

Print only mean and rms:

  using namespace Gaudi::Utils::Histos ;

  const std::map<GaudiAlg::ID,AIDA::IHistogram1D*>& m = ... ;

  printMap 
    ( m.begin () , 
      m.end   () ,
      "| %1$-10.10s | %2% "    , // short format
      " %8$10.5g+-%10$-10.5g|", // mean+-rms 
      always()   , 
      endreq     ) ;

Parameters:
begin 'begin'-iterator for the mapping sequence
end 'end'-iterator for the mapping sequence
fmt1 'short' format for the table printout
fmt3 format for the printout of the histogram
stream the stream for printout
term stream terminator

Definition at line 285 of file HistoTableFormat.h.

00291       {
00292         for ( ; begin != end ; ++begin ) 
00293         {
00294           stream << format   
00295             ( begin -> second , // the histogram
00296               begin -> first  , // the key 
00297               fmt1  ,  fmt2   ) << term ;
00298         }
00299         return stream ;
00300       }  

template<class MAP, class STREAM, class TERMINATOR>
STREAM& Gaudi::Utils::Histos::printMap ( const MAP &  histos,
const std::string &  fmt1,
const std::string &  fmt2,
STREAM &  stream,
TERMINATOR  term 
) [inline]

Print the "associative sequence" (e.g.

part of std:map) of histograms as table:

  using namespace Gaudi::Utils::Histos ;

  const std::map<std::string,AIDA::IHistogram1D*>& m = ... ;

  printMap   
   ( m          , 
     "| %1$-10.10s | %2% " , // short format
     Gaudi::Utils::Histos::Formats::histoFormatOnly , 
     always()   , 
     endreq     ) ;

Print only mean and rms:

  using namespace Gaudi::Utils::Histos ;

  const std::map<GaudiAlg::ID,AIDA::IHistogram1D*>& m = ... ;

  printMap 
    ( m          , 
      "| %1$-10.10s | %2% "    , // short format
      " %8$10.5g+-%10$-10.5g|", // mean+-rms 
      always()   , 
      endreq     ) ;

Parameters:
begin 'begin'-iterator for the mapping sequence
end 'end'-iterator for the mapping sequence
fmt1 'short' format for the table printout
fmt3 format for the printout of the histogram
stream the stream for printout
term stream terminator

Definition at line 346 of file HistoTableFormat.h.

00351       {
00352         return printMap 
00353           ( histos.begin () , histos.end() , fmt1 , fmt2 , stream , term ) ;
00354       }  

std::string Gaudi::Utils::Histos::format ( const std::string &  val1,
const std::string &  val2,
const std::string &  fmt 
)

helper method to merge the headers for short format table

Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-08-07

| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:58:04 2011 for GaudiUtils by doxygen 1.4.7