| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# IHistoTool.h

Go to the documentation of this file.

    00001 // $Id: IHistoTool.h,v 1.3 2005/01/18 15:51:53 mato Exp $
    00002 // ============================================================================
    00003 #ifndef GAUDIALG_IHISTOTOOL_H
    00004 #define GAUDIALG_IHISTOTOOL_H 1
    00005 // ============================================================================
    00006 // Include files
    00007 // ============================================================================
    00008 // from STL
    00009 // ============================================================================
    00010 #include <string>
    00011 // ============================================================================
    00012 // from Gaudi
    00013 // ============================================================================
    00014 #include "GaudiKernel/IAlgTool.h"
    00015 #include "GaudiAlg/HistoID.h"
    00016 // ============================================================================
    00017
    00018 namespace AIDA
    00019 {
    00020   class IHistogram1D;
    00021   class IHistogram2D;
    00022   class IHistogram3D;
    00023 };
    00024
    00033 class IHistoTool : virtual public IAlgTool
    00034 {
    00035 public:
    00036
    00038   typedef Histos::HistoID       HistoID       ;
    00039
    00040 public:
    00041
    00043   static const InterfaceID& interfaceID()  ;
    00044
    00045 public:
    00046
    00047   // ================================= 1D Histograms ========================================
    00048
    00077   virtual AIDA::IHistogram1D*  plot1D
    00078   ( const double        value        ,
    00079     const std::string&  title        ,
    00080     const double        low          ,
    00081     const double        high         ,
    00082     const unsigned long bins   = 100 ,
    00083     const double        weight = 1.0 ) const  = 0 ;
    00084
    00098   AIDA::IHistogram1D*  plot
    00099   ( const double        value        ,
    00100     const std::string&  title        ,
    00101     const double        low          ,
    00102     const double        high         ,
    00103     const unsigned long bins   = 100 ,
    00104     const double        weight = 1.0 ) const
    00105   {
    00106     return plot1D ( value, title, low, high, bins, weight );
    00107   }
    00108
    00149   virtual AIDA::IHistogram1D*  plot1D
    00150   ( const double        value        ,
    00151     const HistoID&      ID           ,
    00152     const std::string&  title        ,
    00153     const double        low          ,
    00154     const double        high         ,
    00155     const unsigned long bins   = 100 ,
    00156     const double        weight = 1.0 ) const = 0 ;
    00157
    00172   AIDA::IHistogram1D*  plot
    00173   ( const double        value        ,
    00174     const HistoID&      ID           ,
    00175     const std::string&  title        ,
    00176     const double        low          ,
    00177     const double        high         ,
    00178     const unsigned long bins   = 100 ,
    00179     const double        weight = 1.0 ) const
    00180   {
    00181     return plot1D ( value, ID, title, low, high, bins, weight );
    00182   };
    00183
    00184   // ================================= 2D Histograms ========================================
    00185
    00220   virtual AIDA::IHistogram2D*  plot2D
    00221   ( const double        valueX       ,
    00222     const double        valueY       ,
    00223     const std::string&  title        ,
    00224     const double        lowX         ,
    00225     const double        highX        ,
    00226     const double        lowY         ,
    00227     const double        highY        ,
    00228     const unsigned long binsX  = 50  ,
    00229     const unsigned long binsY  = 50  ,
    00230     const double        weight = 1.0 ) const = 0;
    00231
    00278   virtual AIDA::IHistogram2D*  plot2D
    00279   ( const double        valueX       ,
    00280     const double        valueY       ,
    00281     const HistoID&      ID           ,
    00282     const std::string&  title        ,
    00283     const double        lowX         ,
    00284     const double        highX        ,
    00285     const double        lowY         ,
    00286     const double        highY        ,
    00287     const unsigned long binsX  = 50  ,
    00288     const unsigned long binsY  = 50  ,
    00289     const double        weight = 1.0 ) const = 0;
    00290
    00291   // ================================= 3D Histograms ========================================
    00292
    00333   virtual AIDA::IHistogram3D*  plot3D
    00334   ( const double        valueX       ,
    00335     const double        valueY       ,
    00336     const double        valueZ       ,
    00337     const std::string&  title        ,
    00338     const double        lowX         ,
    00339     const double        highX        ,
    00340     const double        lowY         ,
    00341     const double        highY        ,
    00342     const double        lowZ         ,
    00343     const double        highZ        ,
    00344     const unsigned long binsX  = 10  ,
    00345     const unsigned long binsY  = 10  ,
    00346     const unsigned long binsZ  = 10  ,
    00347     const double        weight = 1.0 ) const = 0;
    00348
    00401   virtual AIDA::IHistogram3D*  plot3D
    00402   ( const double        valueX       ,
    00403     const double        valueY       ,
    00404     const double        valueZ       ,
    00405     const HistoID&      ID           ,
    00406     const std::string&  title        ,
    00407     const double        lowX         ,
    00408     const double        highX        ,
    00409     const double        lowY         ,
    00410     const double        highY        ,
    00411     const double        lowZ         ,
    00412     const double        highZ        ,
    00413     const unsigned long binsX  = 10  ,
    00414     const unsigned long binsY  = 10  ,
    00415     const unsigned long binsZ  = 10  ,
    00416     const double        weight = 1.0 ) const = 0;
    00417
    00418 public:
    00419
    00431   virtual AIDA::IHistogram1D*  book1D
    00432   ( const std::string&  title        ,
    00433     const double        low    =   0 ,
    00434     const double        high   = 100 ,
    00435     const unsigned long bins   = 100 ) const = 0 ;
    00436
    00449   AIDA::IHistogram1D*  book
    00450   ( const std::string&  title        ,
    00451     const double        low    =   0 ,
    00452     const double        high   = 100 ,
    00453     const unsigned long bins   = 100 ) const
    00454   {
    00455     return book1D( title, low, high, bins );
    00456   }
    00457
    00472   virtual AIDA::IHistogram2D*  book2D
    00473   ( const std::string&  title         ,
    00474     const double        lowX    =   0 ,
    00475     const double        highX   = 100 ,
    00476     const unsigned long binsX   =  50 ,
    00477     const double        lowY    =   0 ,
    00478     const double        highY   = 100 ,
    00479     const unsigned long binsY   =  50 ) const = 0;
    00480
    00498   virtual AIDA::IHistogram3D*  book3D
    00499   ( const std::string&  title         ,
    00500     const double        lowX    =   0 ,
    00501     const double        highX   = 100 ,
    00502     const unsigned long binsX   =  10 ,
    00503     const double        lowY    =   0 ,
    00504     const double        highY   = 100 ,
    00505     const unsigned long binsY   =  10 ,
    00506     const double        lowZ    =   0 ,
    00507     const double        highZ   = 100 ,
    00508     const unsigned long binsZ   =  10 ) const = 0;
    00509
    00520   virtual AIDA::IHistogram1D*  book1D
    00521   ( const HistoID&      ID           ,
    00522     const std::string&  title  = ""  ,
    00523     const double        low    =   0 ,
    00524     const double        high   = 100 ,
    00525     const unsigned long bins   = 100 ) const = 0 ;
    00526
    00540   AIDA::IHistogram1D*  book
    00541   ( const HistoID&      ID           ,
    00542     const std::string&  title  = ""  ,
    00543     const double        low    =   0 ,
    00544     const double        high   = 100 ,
    00545     const unsigned long bins   = 100 ) const
    00546   {
    00547     return book1D( ID, title, low, high, bins );
    00548   }
    00549
    00560   virtual AIDA::IHistogram2D*  book2D
    00561   ( const HistoID&      ID            ,
    00562     const std::string&  title         ,
    00563     const double        lowX    =   0 ,
    00564     const double        highX   = 100 ,
    00565     const unsigned long binsX   = 100 ,
    00566     const double        lowY    =   0 ,
    00567     const double        highY   = 100 ,
    00568     const unsigned long binsY   = 100 ) const = 0;
    00569
    00586   virtual AIDA::IHistogram3D*  book3D
    00587   ( const HistoID&      ID            ,
    00588     const std::string&  title         ,
    00589     const double        lowX    =   0 ,
    00590     const double        highX   = 100 ,
    00591     const unsigned long binsX   =  10 ,
    00592     const double        lowY    =   0 ,
    00593     const double        highY   = 100 ,
    00594     const unsigned long binsY   =  10 ,
    00595     const double        lowZ    =   0 ,
    00596     const double        highZ   = 100 ,
    00597     const unsigned long binsZ   =  10 ) const = 0;
    00598
    00606   virtual AIDA::IHistogram1D* fill
    00607   ( AIDA::IHistogram1D* histo  ,
    00608     const double        value  ,
    00609     const double        weight ,
    00610     const std::string&  title  = "") const = 0 ;
    00611
    00620   virtual AIDA::IHistogram2D* fill
    00621   ( AIDA::IHistogram2D* histo  ,
    00622     const double        valueX ,
    00623     const double        valueY ,
    00624     const double        weight ,
    00625     const std::string&  title  = "" ) const = 0 ;
    00626
    00636   virtual AIDA::IHistogram3D* fill
    00637   ( AIDA::IHistogram3D* histo  ,
    00638     const double        valueX ,
    00639     const double        valueY ,
    00640     const double        valueZ ,
    00641     const double        weight ,
    00642     const std::string&  title  = "" ) const = 0 ;
    00643
    00647   virtual AIDA::IHistogram1D*  histo1D ( const std::string& title  )  const = 0 ;
    00648
    00656   AIDA::IHistogram1D* histo ( const std::string& title  )  const
    00657   {
    00658     return histo1D( title );
    00659   };
    00660
    00664   virtual AIDA::IHistogram2D* histo2D ( const std::string& title  )  const = 0;
    00665
    00666
    00670   virtual AIDA::IHistogram3D* histo3D ( const std::string& title  )  const = 0;
    00671
    00675   virtual AIDA::IHistogram1D*  histo1D ( const HistoID&     ID     )  const = 0 ;
    00676
    00684   AIDA::IHistogram1D* histo ( const HistoID&     ID     )  const
    00685   {
    00686     return histo1D( ID );
    00687   };
    00688
    00692   virtual AIDA::IHistogram2D* histo2D ( const HistoID&     ID     )  const = 0;
    00693
    00697   virtual AIDA::IHistogram3D* histo3D ( const HistoID&     ID     )  const = 0;
    00698
    00700   virtual bool histoExists ( const std::string& title  )  const = 0 ;
    00701
    00703   virtual bool histoExists ( const HistoID&     ID     )  const = 0 ;
    00704
    00705 public:  // non-virtual methods
    00706
    00756   template <class FUNCTION,class OBJECT>
    00757   AIDA::IHistogram1D*  plot
    00758   ( const FUNCTION&     func         ,
    00759     OBJECT              first        ,
    00760     OBJECT              last         ,
    00761     const std::string&  title        ,
    00762     const double        low          ,
    00763     const double        high         ,
    00764     const unsigned long bins  = 100  ) const
    00765   {
    00766     // retrieve or book the histogram
    00767     AIDA::IHistogram1D* h = histo1D ( title ) ;
    00768     if ( 0 == h )     { h = book1D  ( title , low , high , bins ); }
    00769     while ( first != last && 0 != h  )
    00770     { h = fill ( h , func( *first ) , 1.0 , title  ) ; ++first ; }
    00771     return h ;
    00772   };
    00773
    00823   template <class FUNCTION,class OBJECT>
    00824   AIDA::IHistogram1D*  plot
    00825   ( const FUNCTION&     func         ,
    00826     OBJECT              first        ,
    00827     OBJECT              last         ,
    00828     const HistoID&      ID           ,
    00829     const std::string&  title        ,
    00830     const double        low          ,
    00831     const double        high         ,
    00832     const unsigned long bins  = 100  ) const
    00833   {
    00834     // retrieve or book the histogram
    00835     AIDA::IHistogram1D* h = histo1D ( ID ) ;
    00836     if ( 0 == h )     { h = book1D  ( ID , title , low , high , bins ); }
    00837     while ( first != last && 0 != h )
    00838     { h = fill( h , func( *first ) , 1.0 , title  ) ; ++first ; }
    00839     return h ;
    00840   };
    00841
    00896   template <class FUNCTION,class OBJECT,class WEIGHT>
    00897   AIDA::IHistogram1D*  plot
    00898   ( const FUNCTION&     func         ,
    00899     OBJECT              first        ,
    00900     OBJECT              last         ,
    00901     const std::string&  title        ,
    00902     const double        low          ,
    00903     const double        high         ,
    00904     const unsigned long bins         ,
    00905     const WEIGHT&       weight       ) const
    00906   {
    00907     // retrieve or book the histogram
    00908     AIDA::IHistogram1D* h = histo1D ( title ) ;
    00909     if ( 0 == h     ) { h = book1D  ( title , low , high , bins ); }
    00910     while( first != last && 0 != h )
    00911     { h = fill ( h                 ,
    00912                  func   ( *first ) ,
    00913                  weight ( *first ) , title  ) ; ++first ; }
    00914     return h ;
    00915   };
    00916
    00976   template <class FUNCTION,class OBJECT,class WEIGHT>
    00977   AIDA::IHistogram1D*  plot
    00978   ( const FUNCTION&     func         ,
    00979     OBJECT              first        ,
    00980     OBJECT              last         ,
    00981     const HistoID&      ID           ,
    00982     const std::string&  title        ,
    00983     const double        low          ,
    00984     const double        high         ,
    00985     const unsigned long bins         ,
    00986     const WEIGHT&       weight       ) const
    00987   {
    00988     // retrieve or book the histogram
    00989     AIDA::IHistogram1D* h = histo1D ( ID ) ;
    00990     if ( 0 == h     ) { h = book1D  ( ID , title , low , high , bins ); }
    00991     while( first != last && 0 != h )
    00992     { h  = fill ( h                 ,
    00993                   func   ( *first ) ,
    00994                   weight ( *first ) , title  ) ; ++first ; }
    00995     return h ;
    00996   };
    00997
    00998 protected:
    00999
    01000   virtual ~IHistoTool() ;
    01001
    01002 };
    01003
    01004 #endif // GAUDIALG_IHISTOTOOL_H