Gaudi Framework, version v23r2

Home   Generated: Thu Jun 28 2012

GaudiHistos.h

Go to the documentation of this file.
00001 // $Id: GaudiHistos.h,v 1.11 2008/10/27 19:22:20 marcocle Exp $
00002 // ============================================================================
00003 #ifndef GAUDIALG_GAUDIHISTOS_H
00004 #define GAUDIALG_GAUDIHISTOS_H 1
00005 // ============================================================================
00006 /* @file GaudiHistos.h
00007  *
00008  *  Header file for class : GaudiHistos
00009  *
00010  *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
00011  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
00012  *  @date   2005-08-08
00013  */
00014 // ============================================================================
00015 // Include files#
00016 // ============================================================================
00017 // STD& STL
00018 // ============================================================================
00019 #include <limits>
00020 #include <vector>
00021 // ============================================================================
00022 // GaudiKernel
00023 // ============================================================================
00024 #include "GaudiKernel/HistoProperty.h"
00025 // ============================================================================
00026 // GaudiAlg
00027 // ============================================================================
00028 #include "GaudiAlg/Maps.h"
00029 #include "GaudiAlg/HbookName.h"
00030 // ============================================================================
00031 // Forward declarations
00032 namespace AIDA
00033 {
00034   class IHistogram1D;
00035   class IHistogram2D;
00036   class IHistogram3D;
00037   class IProfile1D;
00038   class IProfile2D;
00039 }
00040 // ============================================================================
00050 template <class PBASE>
00051 class GAUDI_API GaudiHistos: public PBASE
00052 {
00053 public:
00054   // ==========================================================================
00056   typedef GaudiAlg::HistoID                HistoID;
00057   // ==========================================================================
00059   typedef GaudiAlg::Histo1DMapID           Histo1DMapID;
00061   typedef GaudiAlg::Histo1DMapTitle        Histo1DMapTitle;
00062   // ==========================================================================
00064   typedef GaudiAlg::Histo2DMapID           Histo2DMapID;
00066   typedef GaudiAlg::Histo2DMapTitle        Histo2DMapTitle;
00067   // ==========================================================================
00069   typedef GaudiAlg::Histo3DMapID           Histo3DMapID;
00071   typedef GaudiAlg::Histo3DMapTitle        Histo3DMapTitle;
00072   // ==========================================================================
00074   typedef GaudiAlg::Profile1DMapID         Profile1DMapID;
00076   typedef GaudiAlg::Profile1DMapTitle      Profile1DMapTitle;
00077   // ==========================================================================
00079   typedef GaudiAlg::Profile2DMapID         Profile2DMapID;
00081   typedef GaudiAlg::Profile2DMapTitle      Profile2DMapTitle;
00082   // ==========================================================================
00084   typedef GaudiAlg::HistoBinEdges          HistoBinEdges;
00085   // ==========================================================================
00086 public:
00087   // ==========================================================================
00088   // ================================= 1D Histograms ==========================
00089   // ================================= Fixed Binning ==========================
00090   // ==========================================================================
00133   AIDA::IHistogram1D*  plot1D
00134   ( const double        value        ,
00135     const std::string&  title        ,
00136     const double        low          ,
00137     const double        high         ,
00138     const unsigned long bins   = 100 ,
00139     const double        weight = 1.0 ) const ;
00140   // ==========================================================================
00154   inline AIDA::IHistogram1D*  plot
00155   ( const double        value        ,
00156     const std::string&  title        ,
00157     const double        low          ,
00158     const double        high         ,
00159     const unsigned long bins   = 100 ,
00160     const double        weight = 1.0 ) const
00161   {
00162     return plot1D ( value, title, low, high, bins, weight );
00163   }
00164   // ==========================================================================
00189   AIDA::IHistogram1D*  plot1D
00190   ( const double             value        ,
00191     const Gaudi::Histo1DDef& hdef         ,
00192     const double             weight = 1.0 ) const ;
00193   // ==========================================================================
00204   inline AIDA::IHistogram1D*  plot
00205   ( const double             value        ,
00206     const Gaudi::Histo1DDef& hdef         ,
00207     const double             weight = 1.0 ) const
00208   {
00209     return plot1D ( value, hdef, weight );
00210   }
00211   // ==========================================================================
00276   // ==========================================================================
00277   AIDA::IHistogram1D*  plot1D
00278   ( const double        value        ,
00279     const HistoID&      ID           ,
00280     const std::string&  title        ,
00281     const double        low          ,
00282     const double        high         ,
00283     const unsigned long bins   = 100 ,
00284     const double        weight = 1.0 ) const ;
00285   // ==========================================================================
00300   inline AIDA::IHistogram1D*  plot
00301   ( const double        value        ,
00302     const HistoID&      ID           ,
00303     const std::string&  title        ,
00304     const double        low          ,
00305     const double        high         ,
00306     const unsigned long bins   = 100 ,
00307     const double        weight = 1.0 ) const
00308   {
00309     return plot1D ( value, ID, title, low, high, bins, weight );
00310   }
00311   // ==========================================================================
00337   AIDA::IHistogram1D*  plot1D
00338   ( const double             value        ,
00339     const HistoID&           ID           ,
00340     const Gaudi::Histo1DDef& hdef         ,
00341     const double             weight = 1.0 ) const ;
00342   // ==========================================================================
00354   inline AIDA::IHistogram1D*  plot
00355   ( const double             value        ,
00356     const HistoID&           ID           ,
00357     const Gaudi::Histo1DDef& hdef         ,
00358     const double             weight = 1.0 ) const
00359   {
00360     return plot1D ( value, ID, hdef, weight );
00361   }
00425   template <class FUNCTION,class OBJECT>
00426   inline AIDA::IHistogram1D*   plot
00427   ( const FUNCTION&     func         ,
00428     OBJECT              first        ,
00429     OBJECT              last         ,
00430     const std::string&  title        ,
00431     const double        low          ,
00432     const double        high         ,
00433     const unsigned long bins  = 100  ) const
00434   {
00435     AIDA::IHistogram1D* h(0);
00436     if ( produceHistos() )
00437     {
00438       // retrieve or book the histogram
00439       h = histo1D ( title ) ;
00440       if ( 0 == h )     { h = book1D  ( title , low , high , bins ); }
00441       // fill histogram
00442       while( first != last && 0 != h  )
00443       { h = fill ( h , func( *first ) , 1.0 , title  ) ; ++first ; }
00444     }
00445     return h ;
00446   }
00447   // ==========================================================================
00503   template <class FUNCTION,class OBJECT>
00504   inline AIDA::IHistogram1D*   plot
00505   ( const FUNCTION&     func         ,
00506     OBJECT              first        ,
00507     OBJECT              last         ,
00508     const HistoID&      ID           ,
00509     const std::string&  title        ,
00510     const double        low          ,
00511     const double        high         ,
00512     const unsigned long bins  = 100  ) const
00513   {
00514     AIDA::IHistogram1D* h(0);
00515     if ( produceHistos() )
00516     {
00517       // retrieve or book the histogram
00518       h = histo1D ( ID ) ;
00519       if ( 0 == h )     { h = book1D  ( ID , title , low , high , bins ); }
00520       // fill histogram
00521       while( first != last && 0 != h )
00522       { h = fill( h , func( *first ) , 1.0 , title  ) ; ++first ; }
00523     }
00524     return h;
00525   }
00526   // ==========================================================================
00595   template <class FUNCTION,class OBJECT,class WEIGHT>
00596   inline AIDA::IHistogram1D*   plot
00597   ( const FUNCTION&     func         ,
00598     OBJECT              first        ,
00599     OBJECT              last         ,
00600     const std::string&  title        ,
00601     const double        low          ,
00602     const double        high         ,
00603     const unsigned long bins         ,
00604     const WEIGHT&       weight       ) const
00605   {
00606     AIDA::IHistogram1D* h(0);
00607     if ( produceHistos() )
00608     {
00609       // retrieve or book the histogram
00610       h = histo1D ( title ) ;
00611       if ( 0 == h ) { h = book1D  ( title , low , high , bins ); }
00612       // fill histogram
00613       while ( first != last && 0 != h )
00614       { h = fill ( h                 ,
00615                    func   ( *first ) ,
00616                    weight ( *first ) , title  ) ; ++first ; }
00617     }
00618     return h;
00619   }
00620   // ==========================================================================
00687   template <class FUNCTION,class OBJECT,class WEIGHT>
00688   inline AIDA::IHistogram1D*   plot
00689   ( const FUNCTION&     func         ,
00690     OBJECT              first        ,
00691     OBJECT              last         ,
00692     const HistoID&      ID           ,
00693     const std::string&  title        ,
00694     const double        low          ,
00695     const double        high         ,
00696     const unsigned long bins         ,
00697     const WEIGHT&       weight       ) const
00698   {
00699     AIDA::IHistogram1D* h(0);
00700     if ( produceHistos() )
00701     {
00702       // retrieve or book the histogram
00703       h = histo1D ( ID ) ;
00704       if ( 0 == h ) { h = book1D  ( ID , title , low , high , bins ); }
00705       // fill histogram
00706       while( first != last && 0 != h )
00707       { h  = fill ( h                 ,
00708                     func   ( *first ) ,
00709                     weight ( *first ) , title  ) ; ++first ; }
00710     }
00711     return h ;
00712   }
00713   // ==========================================================================
00714   // ================================= 1D Histograms ==========================
00715   // =============================== Variable Binning =========================
00716   // ==========================================================================
00756   AIDA::IHistogram1D*  plot1D
00757   ( const double         value        ,
00758     const std::string&   title        ,
00759     const HistoBinEdges& edges        ,
00760     const double         weight = 1.0 ) const ;
00761   // ==========================================================================
00825   // ==========================================================================
00826   AIDA::IHistogram1D*  plot1D
00827   ( const double         value        ,
00828     const HistoID&       ID           ,
00829     const std::string&   title        ,
00830     const HistoBinEdges& edges        ,
00831     const double         weight = 1.0 ) const ;
00832   // ==========================================================================
00833   // ================================= 2D Histograms ==========================
00834   // ==========================================================================
00885   AIDA::IHistogram2D*  plot2D
00886   ( const double        valueX       ,
00887     const double        valueY       ,
00888     const std::string&  title        ,
00889     const double        lowX         ,
00890     const double        highX        ,
00891     const double        lowY         ,
00892     const double        highY        ,
00893     const unsigned long binsX  = 50  ,
00894     const unsigned long binsY  = 50  ,
00895     const double        weight = 1.0 ) const;
00896   // ==========================================================================
00973   AIDA::IHistogram2D*  plot2D
00974   ( const double        valueX       ,
00975     const double        valueY       ,
00976     const HistoID&      ID           ,
00977     const std::string&  title        ,
00978     const double        lowX         ,
00979     const double        highX        ,
00980     const double        lowY         ,
00981     const double        highY        ,
00982     const unsigned long binsX  = 50  ,
00983     const unsigned long binsY  = 50  ,
00984     const double        weight = 1.0 ) const;
00985   // ==========================================================================
00986   // ================================= 2D Histograms ==========================
00987   // =============================== Variable Binning =========================
00988   // ==========================================================================
01034   AIDA::IHistogram2D*  plot2D
01035   ( const double         valueX       ,
01036     const double         valueY       ,
01037     const std::string&   title        ,
01038     const HistoBinEdges& edgesX       ,
01039     const HistoBinEdges& edgesY       ,
01040     const double         weight = 1.0 ) const ;
01041   // ==========================================================================
01117   AIDA::IHistogram2D*  plot2D
01118   ( const double         valueX       ,
01119     const double         valueY       ,
01120     const HistoID&       ID           ,
01121     const std::string&   title        ,
01122     const HistoBinEdges& edgesX       ,
01123     const HistoBinEdges& edgesY       ,
01124     const double         weight = 1.0 ) const ;
01125   // ==========================================================================
01126   // ================================= 3D Histograms ==========================
01127   // ==========================================================================
01186   AIDA::IHistogram3D*  plot3D
01187   ( const double        valueX       ,
01188     const double        valueY       ,
01189     const double        valueZ       ,
01190     const std::string&  title        ,
01191     const double        lowX         ,
01192     const double        highX        ,
01193     const double        lowY         ,
01194     const double        highY        ,
01195     const double        lowZ         ,
01196     const double        highZ        ,
01197     const unsigned long binsX  = 10  ,
01198     const unsigned long binsY  = 10  ,
01199     const unsigned long binsZ  = 10  ,
01200     const double        weight = 1.0 ) const;
01201   // ==========================================================================
01288   AIDA::IHistogram3D*  plot3D
01289   ( const double        valueX       ,
01290     const double        valueY       ,
01291     const double        valueZ       ,
01292     const HistoID&      ID           ,
01293     const std::string&  title        ,
01294     const double        lowX         ,
01295     const double        highX        ,
01296     const double        lowY         ,
01297     const double        highY        ,
01298     const double        lowZ         ,
01299     const double        highZ        ,
01300     const unsigned long binsX  = 10  ,
01301     const unsigned long binsY  = 10  ,
01302     const unsigned long binsZ  = 10  ,
01303     const double        weight = 1.0 ) const;
01304   // ==========================================================================
01305   // ================================= 3D Histograms ==========================
01306   // =============================== Variable Binning =========================
01307   // ==========================================================================
01355   AIDA::IHistogram3D*  plot3D
01356   ( const double         valueX       ,
01357     const double         valueY       ,
01358     const double         valueZ       ,
01359     const std::string&   title        ,
01360     const HistoBinEdges& edgesX       ,
01361     const HistoBinEdges& edgesY       ,
01362     const HistoBinEdges& edgesZ       ,
01363     const double         weight = 1.0 ) const ;
01364   // ==========================================================================
01365   // ==========================================================================
01450   AIDA::IHistogram3D*  plot3D
01451   ( const double         valueX       ,
01452     const double         valueY       ,
01453     const double         valueZ       ,
01454     const HistoID&       ID           ,
01455     const std::string&   title        ,
01456     const HistoBinEdges& edgesX       ,
01457     const HistoBinEdges& edgesY       ,
01458     const HistoBinEdges& edgesZ       ,
01459     const double         weight = 1.0 ) const ;
01460   // ==========================================================================
01461   // ================================= 1D Profile =============================
01462   // ================================= Fixed binning ==========================
01463   // ==========================================================================
01512   AIDA::IProfile1D* profile1D
01513   ( const double        valueX       ,
01514     const double        valueY       ,
01515     const std::string&  title        ,
01516     const double        lowX         ,
01517     const double        highX        ,
01518     const unsigned long binsX  = 100 ,
01519     const std::string&  opt    = ""  ,
01520     const double        lowY   = -std::numeric_limits<double>::max() ,
01521     const double        highY  =  std::numeric_limits<double>::max() ,
01522     const double        weight = 1.0 ) const ;
01523   // ==========================================================================
01589   AIDA::IProfile1D* profile1D
01590   ( const double        valueX       ,
01591     const double        valueY       ,
01592     const HistoID&      ID           ,
01593     const std::string&  title        ,
01594     const double        lowX         ,
01595     const double        highX        ,
01596     const unsigned long binsX  = 100 ,
01597     const std::string&  opt    = ""  ,
01598     const double        lowY   = -std::numeric_limits<double>::max() ,
01599     const double        highY  =  std::numeric_limits<double>::max() ,
01600     const double        weight = 1.0 ) const;
01601   // ==========================================================================
01602   // ================================= 1D Profile =============================
01603   // ============================== Variable binning ==========================
01604   // ==========================================================================
01647   AIDA::IProfile1D* profile1D
01648   ( const double         valueX       ,
01649     const double         valueY       ,
01650     const std::string&   title        ,
01651     const HistoBinEdges& edges        ,
01652     const double         weight = 1.0 ) const ;
01653   // ==========================================================================
01715   AIDA::IProfile1D* profile1D
01716   ( const double         valueX       ,
01717     const double         valueY       ,
01718     const HistoID&       ID           ,
01719     const std::string&   title        ,
01720     const HistoBinEdges& edges        ,
01721     const double         weight = 1.0 ) const;
01722   // ==========================================================================
01723   // ================================= 2D Profile =============================
01724   // ==========================================================================
01775   AIDA::IProfile2D* profile2D
01776   ( const double        valueX       ,
01777     const double        valueY       ,
01778     const double        valueZ       ,
01779     const std::string&  title        ,
01780     const double        lowX         ,
01781     const double        highX        ,
01782     const double        lowY         ,
01783     const double        highY        ,
01784     const unsigned long binsX  = 50  ,
01785     const unsigned long binsY  = 50  ,
01786     const double        weight = 1.0 ) const;
01787   // ==========================================================================
01855   AIDA::IProfile2D* profile2D
01856   ( const double        valueX       ,
01857     const double        valueY       ,
01858     const double        valueZ       ,
01859     const HistoID&      ID           ,
01860     const std::string&  title        ,
01861     const double        lowX         ,
01862     const double        highX        ,
01863     const double        lowY         ,
01864     const double        highY        ,
01865     const unsigned long binsX  = 50  ,
01866     const unsigned long binsY  = 50  ,
01867     const double        weight = 1.0 ) const;
01868   // ==========================================================================
01869   // ================================= 2D Profile =============================
01870   // ============================== Variable binning ==========================
01871   // ==========================================================================
01917   AIDA::IProfile2D* profile2D
01918   ( const double         valueX       ,
01919     const double         valueY       ,
01920     const double         valueZ       ,
01921     const std::string&   title        ,
01922     const HistoBinEdges& edgesX       ,
01923     const HistoBinEdges& edgesY       ,
01924     const double         weight = 1.0 ) const ;
01925   // ==========================================================================
01988   AIDA::IProfile2D* profile2D
01989   ( const double         valueX       ,
01990     const double         valueY       ,
01991     const double         valueZ       ,
01992     const HistoID&       ID           ,
01993     const std::string&   title        ,
01994     const HistoBinEdges& edgesX       ,
01995     const HistoBinEdges& edgesY       ,
01996     const double         weight = 1.0 ) const;
01997   // ==========================================================================
01998 
01999 public: // 1D Fixed
02000 
02001   // ==========================================================================
02013   AIDA::IHistogram1D*  book1D
02014   ( const std::string&  title        ,
02015     const double        low    =   0 ,
02016     const double        high   = 100 ,
02017     const unsigned long bins   = 100 ) const ;
02018   // ==========================================================================
02031   inline AIDA::IHistogram1D*  book
02032   ( const std::string&  title        ,
02033     const double        low    =   0 ,
02034     const double        high   = 100 ,
02035     const unsigned long bins   = 100 ) const
02036   {
02037     return book1D( title, low, high, bins );
02038   }
02039   // ==========================================================================
02048   AIDA::IHistogram1D*  book
02049   ( const Gaudi::Histo1DDef& hdef ) const ;
02050   // ==========================================================================
02061   AIDA::IHistogram1D*  book1D
02062   ( const HistoID&      ID           ,
02063     const std::string&  title        ,
02064     const double        low    =   0 ,
02065     const double        high   = 100 ,
02066     const unsigned long bins   = 100 ) const ;
02067   // ==========================================================================
02081   inline AIDA::IHistogram1D*  book
02082   ( const HistoID&      ID           ,
02083     const std::string&  title        ,
02084     const double        low    =   0 ,
02085     const double        high   = 100 ,
02086     const unsigned long bins   = 100 ) const
02087   {
02088     return book1D( ID, title, low, high, bins );
02089   }
02090   // ==========================================================================
02098   inline AIDA::IHistogram1D*  book
02099   ( const HistoID&           ID   ,
02100     const Gaudi::Histo1DDef& hdef ) const ;
02101   // ==========================================================================
02102 
02103 public: // 1D Variable
02104 
02105   // ==========================================================================
02116   AIDA::IHistogram1D*  book1D
02117   ( const std::string&   title       ,
02118     const HistoBinEdges& edges       ) const ;
02119   // ==========================================================================
02129   AIDA::IHistogram1D*  book1D
02130   ( const HistoID&       ID           ,
02131     const std::string&   title        ,
02132     const HistoBinEdges& edges        ) const ;
02133   // ==========================================================================
02134 
02135 public: // 2D Fixed
02136 
02137   // ==========================================================================
02152   AIDA::IHistogram2D*  book2D
02153   ( const std::string&  title         ,
02154     const double        lowX    =   0 ,
02155     const double        highX   = 100 ,
02156     const unsigned long binsX   =  50 ,
02157     const double        lowY    =   0 ,
02158     const double        highY   = 100 ,
02159     const unsigned long binsY   =  50 ) const ;
02160   // ==========================================================================
02171   AIDA::IHistogram2D*  book2D
02172   ( const HistoID&      ID            ,
02173     const std::string&  title         ,
02174     const double        lowX    =   0 ,
02175     const double        highX   = 100 ,
02176     const unsigned long binsX   =  50 ,
02177     const double        lowY    =   0 ,
02178     const double        highY   = 100 ,
02179     const unsigned long binsY   =  50 ) const ;
02180   // ==========================================================================
02181 
02182 public: // 2D Variable
02183 
02184   // ==========================================================================
02196   AIDA::IHistogram2D * book2D
02197   ( const std::string&   title    ,
02198     const HistoBinEdges& edgesX   ,
02199     const HistoBinEdges& edgesY   ) const ;
02200   // ==========================================================================
02211   AIDA::IHistogram2D * book2D
02212   ( const HistoID&       ID           ,
02213     const std::string&   title        ,
02214     const HistoBinEdges& edgesX       ,
02215     const HistoBinEdges& edgesY       ) const ;
02216   // ==========================================================================
02217 
02218 public: // 3D Fixed
02219 
02220   // ==========================================================================
02238   AIDA::IHistogram3D*  book3D
02239   ( const std::string&  title         ,
02240     const double        lowX    =   0 ,
02241     const double        highX   = 100 ,
02242     const unsigned long binsX   =  10 ,
02243     const double        lowY    =   0 ,
02244     const double        highY   = 100 ,
02245     const unsigned long binsY   =  10 ,
02246     const double        lowZ    =   0 ,
02247     const double        highZ   = 100 ,
02248     const unsigned long binsZ   =  10 ) const ;
02249   // ==========================================================================
02266   AIDA::IHistogram3D*  book3D
02267   ( const HistoID&      ID            ,
02268     const std::string&  title         ,
02269     const double        lowX    =   0 ,
02270     const double        highX   = 100 ,
02271     const unsigned long binsX   =  10 ,
02272     const double        lowY    =   0 ,
02273     const double        highY   = 100 ,
02274     const unsigned long binsY   =  10 ,
02275     const double        lowZ    =   0 ,
02276     const double        highZ   = 100 ,
02277     const unsigned long binsZ   =  10 ) const ;
02278   // ==========================================================================
02279 
02280 public: // 3D Variable
02281 
02282   // ==========================================================================
02295   AIDA::IHistogram3D * book3D
02296   ( const std::string&   title    ,
02297     const HistoBinEdges& edgesX   ,
02298     const HistoBinEdges& edgesY   ,
02299     const HistoBinEdges& edgesZ   ) const ;
02300   // ==========================================================================
02312   AIDA::IHistogram3D * book3D
02313   ( const HistoID&       ID           ,
02314     const std::string&   title        ,
02315     const HistoBinEdges& edgesX       ,
02316     const HistoBinEdges& edgesY       ,
02317     const HistoBinEdges& edgesZ       ) const ;
02318   // ==========================================================================
02319 
02320 public: // 1D Fixed Profiles
02321 
02322   // ==========================================================================
02337   AIDA::IProfile1D*  bookProfile1D
02338   ( const std::string&  title        ,
02339     const double        low    =   0 ,
02340     const double        high   = 100 ,
02341     const unsigned long bins   = 100 ,
02342     const std::string&  opt    = ""  ,
02343     const double        lowY   = -std::numeric_limits<double>::max() ,
02344     const double        highY  =  std::numeric_limits<double>::max() ) const;
02345   // ==========================================================================
02361   AIDA::IProfile1D*  bookProfile1D
02362   ( const HistoID&      ID           ,
02363     const std::string&  title        ,
02364     const double        low    =   0 ,
02365     const double        high   = 100 ,
02366     const unsigned long bins   = 100 ,
02367     const std::string&  opt    = ""  ,
02368     const double        lowY   = -std::numeric_limits<double>::max() ,
02369     const double        highY  =  std::numeric_limits<double>::max() ) const;
02370  // ==========================================================================
02371 
02372 public: // 1D Variable Profiles
02373 
02374   // ==========================================================================
02384   AIDA::IProfile1D*  bookProfile1D
02385   ( const std::string&  title        ,
02386     const HistoBinEdges&        edges        ) const;
02387   // ==========================================================================
02397   AIDA::IProfile1D*  bookProfile1D
02398   ( const HistoID&       ID           ,
02399     const std::string&   title        ,
02400     const HistoBinEdges& edges        ) const;
02401  // ==========================================================================
02402 
02403 public: // 2D Profiles
02404 
02405   // ==========================================================================
02420   AIDA::IProfile2D*  bookProfile2D
02421   ( const std::string&  title         ,
02422     const double        lowX    =   0 ,
02423     const double        highX   = 100 ,
02424     const unsigned long binsX   =  50 ,
02425     const double        lowY    =   0 ,
02426     const double        highY   = 100 ,
02427     const unsigned long binsY   =  50 ) const ;
02428   // ==========================================================================
02442   AIDA::IProfile2D*  bookProfile2D
02443   ( const HistoID&      ID            ,
02444     const std::string&  title         ,
02445     const double        lowX    =   0 ,
02446     const double        highX   = 100 ,
02447     const unsigned long binsX   =  50 ,
02448     const double        lowY    =   0 ,
02449     const double        highY   = 100 ,
02450     const unsigned long binsY   =  50 ) const ;
02451   // ==========================================================================
02452 
02453 public: // 2D Profiles
02454 
02455   // ==========================================================================
02466   AIDA::IProfile2D*  bookProfile2D
02467   ( const std::string&   title         ,
02468     const HistoBinEdges& edgesX,
02469     const HistoBinEdges& edgesY ) const ;
02470   // ==========================================================================
02480   AIDA::IProfile2D*  bookProfile2D
02481   ( const HistoID&       ID            ,
02482     const std::string&   title         ,
02483     const HistoBinEdges& edgesX,
02484     const HistoBinEdges& edgesY  ) const ;
02485   // ==========================================================================
02486 
02487 public:
02488 
02489   // ==========================================================================
02497   AIDA::IHistogram1D* fill
02498   ( AIDA::IHistogram1D* histo  ,
02499     const double        value  ,
02500     const double        weight ,
02501     const std::string&  title  = "" ) const ;
02502   // ==========================================================================
02511   AIDA::IHistogram2D* fill
02512   ( AIDA::IHistogram2D* histo  ,
02513     const double        valueX ,
02514     const double        valueY ,
02515     const double        weight ,
02516     const std::string&  title  = "" ) const ;
02517   // ==========================================================================
02527   AIDA::IHistogram3D* fill
02528   ( AIDA::IHistogram3D* histo  ,
02529     const double        valueX ,
02530     const double        valueY ,
02531     const double        valueZ ,
02532     const double        weight ,
02533     const std::string&  title  = "" ) const ;
02534   // ==========================================================================
02543   AIDA::IProfile1D* fill
02544   ( AIDA::IProfile1D*   histo  ,
02545     const double        valueX ,
02546     const double        valueY ,
02547     const double        weight ,
02548     const std::string&  title  = "" ) const ;
02549   // ==========================================================================
02559   AIDA::IProfile2D* fill
02560   ( AIDA::IProfile2D*   histo  ,
02561     const double        valueX ,
02562     const double        valueY ,
02563     const double        valueZ ,
02564     const double        weight ,
02565     const std::string&  title  = "" ) const ;
02566   // ==========================================================================
02567 public:
02568   // ==========================================================================
02572   inline AIDA::IHistogram1D* histo1D ( const std::string& title  )  const
02573   {
02574     Histo1DMapTitle::const_iterator found = histo1DMapTitle().find( title ) ;
02575     return ( histo1DMapTitle().end() == found ? 0 : found->second );
02576   }
02577   // ==========================================================================
02585   inline AIDA::IHistogram1D* histo ( const std::string& title  )  const
02586   {
02587     return histo1D( title );
02588   }
02589   // ==========================================================================
02593   inline AIDA::IHistogram2D* histo2D ( const std::string& title  )  const
02594   {
02595     Histo2DMapTitle::const_iterator found = histo2DMapTitle().find( title ) ;
02596     return ( histo2DMapTitle().end() == found ? 0 : found->second );
02597   }
02598   // ==========================================================================
02602   inline AIDA::IHistogram3D* histo3D ( const std::string& title  )  const
02603   {
02604     Histo3DMapTitle::const_iterator found = histo3DMapTitle().find( title ) ;
02605     return ( histo3DMapTitle().end() == found ? 0 : found->second );
02606   }
02607   // ==========================================================================
02611   inline AIDA::IProfile1D* profile1D ( const std::string& title  )  const
02612   {
02613     Profile1DMapTitle::const_iterator found = profile1DMapTitle().find( title ) ;
02614     return ( profile1DMapTitle().end() == found ? 0 : found->second );
02615   }
02616   // ==========================================================================
02620   inline AIDA::IProfile2D* profile2D ( const std::string& title  )  const
02621   {
02622     Profile2DMapTitle::const_iterator found = profile2DMapTitle().find( title ) ;
02623     return ( profile2DMapTitle().end() == found ? 0 : found->second );
02624   }
02625   // ==========================================================================
02626 public:
02627   // ==========================================================================
02631   AIDA::IHistogram1D* histo1D ( const HistoID&     ID     )  const;
02632   // ==========================================================================
02640   inline AIDA::IHistogram1D* histo ( const HistoID&     ID     )  const
02641   {
02642     return histo1D( ID );
02643   }
02644   // ==========================================================================
02648   AIDA::IHistogram2D* histo2D ( const HistoID&     ID     )  const;
02649   // ==========================================================================
02653   AIDA::IHistogram3D* histo3D ( const HistoID&     ID     )  const;
02654   // ==========================================================================
02658   AIDA::IProfile1D* profile1D ( const HistoID&     ID  )  const;
02659   // ==========================================================================
02663   AIDA::IProfile2D* profile2D ( const HistoID&     ID  )  const;
02664   // ==========================================================================
02665 public:
02666   // ==========================================================================
02668   inline bool histoExists ( const std::string& title  )  const
02669   {
02670     return
02671       ( 0 != histo     ( title ) ||
02672         0 != histo2D   ( title ) ||
02673         0 != histo3D   ( title ) ||
02674         0 != profile1D ( title ) ||
02675         0 != profile2D ( title ) );
02676   }
02677   // ==========================================================================
02679   inline bool histoExists ( const HistoID&     ID     )  const
02680   {
02681     return
02682       ( 0 != histo     ( ID ) ||
02683         0 != histo2D   ( ID ) ||
02684         0 != histo3D   ( ID ) ||
02685         0 != profile1D ( ID ) ||
02686         0 != profile2D ( ID ) );
02687   }
02689   unsigned int totalNumberOfHistos() const;
02690   // ==========================================================================
02691 public: // trivial & non-trivial accessors
02692   // ==========================================================================
02694   inline bool               produceHistos () const { return m_produceHistos ; }
02696   inline bool               fullDetail    () const { return m_fullDetail    ; }
02698   inline bool               checkForNaN   () const { return m_checkForNaN   ; }
02700   inline bool               splitHistoDir () const { return m_splitHistoDir ; }
02702   inline HistoID::NumericID histoOffSet   () const { return m_histoOffSet ; }
02704   inline const std::string& histoTopDir   () const { return m_histoTopDir   ; }
02706   inline const std::string& histoDir      () const { return m_histoDir      ; }
02708   inline std::string histoPath () const
02709   {
02710     const std::string path = histoTopDir() + histoDir();
02711     return ( splitHistoDir() ? dirHbookName(path) : path );
02712   }
02714   inline bool histosPrint () const  { return m_histosPrint ; }
02716   inline bool useNumericAutoIDs() const { return m_useNumericAutoIDs; }
02717   // ==========================================================================
02722   int printHistos ( const MSG::Level level = MSG::ALWAYS ) const ;
02723   // ==========================================================================
02751   const Histo1DMapTitle & histo1DMapTitle() const { return m_histo1DMapTitle; }
02752   // ==========================================================================
02777   const Histo1DMapID & histo1DMapID () const { return m_histo1DMapID ; }
02778   // ==========================================================================
02806   const Histo2DMapTitle & histo2DMapTitle() const { return m_histo2DMapTitle ; }
02807   // ==========================================================================
02832   const Histo2DMapID& histo2DMapID () const { return m_histo2DMapID ; }
02833   // ==========================================================================
02861   const Histo3DMapTitle & histo3DMapTitle () const { return m_histo3DMapTitle ; }
02862   // ==========================================================================
02887   const Histo3DMapID & histo3DMapID () const { return m_histo3DMapID; }
02888   // ==========================================================================
02916   const Profile1DMapTitle & profile1DMapTitle() const { return m_profile1DMapTitle; }
02917   // ==========================================================================
02942   const Profile1DMapID & profile1DMapID () const { return m_profile1DMapID; }
02943   // ==========================================================================
02971   const Profile2DMapTitle & profile2DMapTitle() const { return m_profile2DMapTitle; }
02972   // ==========================================================================
02997   const Profile2DMapID & profile2DMapID () const { return m_profile2DMapID; }
02998   // ==========================================================================
02999 public: // trivial setters
03000   // ==========================================================================
03002   inline void setProduceHistos ( const bool         val ) { m_produceHistos = val ; }
03004   inline void setFullDetail    ( const bool         val ) { m_fullDetail    = val ; }
03006   inline void setCheckForNaN   ( const bool         val ) { m_checkForNaN   = val ; }
03008   inline void setSplitHistoDir ( const bool         val ) { m_splitHistoDir = val ; }
03010   inline void setHistoOffSet   ( const HistoID::NumericID val )
03011   { m_histoOffSet   = val ; }
03012   // ==========================================================================
03014   inline void setHistoTopDir   ( const std::string& val ) { m_histoTopDir   = val ; }
03015   // ==========================================================================
03017   inline void setHistoDir      ( const std::string& val ) { m_histoDir      = val ; }
03018   // ==========================================================================
03019 public:
03020   // ==========================================================================
03022   GaudiHistos ( const std::string & name,
03023                 ISvcLocator * pSvcLocator );
03024   // ==========================================================================
03026   GaudiHistos ( const std::string& type   ,
03027                 const std::string& name   ,
03028                 const IInterface*  parent );
03029   // ==========================================================================
03031   virtual ~GaudiHistos() {}
03032   // ==========================================================================
03033 protected:
03034   // ==========================================================================
03038   virtual StatusCode initialize()
03039 #ifdef __ICC
03040     { return i_ghInitialize(); }
03041   StatusCode i_ghInitialize()
03042 #endif
03043   ;
03044   // ==========================================================================
03048   virtual StatusCode finalize()
03049 #ifdef __ICC
03050     { return i_ghFinalize(); }
03051   StatusCode i_ghFinalize()
03052 #endif
03053   ;
03054   // ==========================================================================
03055 private:
03056   // ==========================================================================
03058   bool noHistos() const;
03059   // ===========================================unsigned===============================
03061   void initGaudiHistosConstructor();
03062   // ==========================================================================
03068   void monitorHisto( const AIDA::IBaseHistogram* hist,
03069                      const HistoID& ID ) const;
03070   // ==========================================================================
03075   void newHistoID( const std::string & title,
03076                    HistoID& ID ) const;
03077   // ==========================================================================
03079   void stringSearchReplace( std::string & title,
03080                             const std::string & A,
03081                             const std::string & B ) const;
03082   // ==========================================================================
03083 protected:
03084   // ==========================================================================
03086   std::string convertTitleToID( const std::string & title ) const;
03087   // ==========================================================================
03088 private:
03089   // ==========================================================================
03091   void printHistoHandler ( Property& /* theProp */ ) ;          // "HistoPrint"
03092   // ==========================================================================
03093 private:
03094   // ==========================================================================
03096   bool        m_produceHistos ;
03098   bool        m_fullDetail;
03100   bool        m_checkForNaN   ;
03102   bool        m_splitHistoDir ;
03104   HistoID::NumericID     m_histoOffSet ;
03106   std::string m_histoTopDir   ;
03108   std::string m_histoDir      ;
03110   bool        m_histosPrint   ;
03112   bool        m_declareMoniHists;
03113   // ==========================================================================
03115   mutable Histo1DMapTitle     m_histo1DMapTitle ;
03117   mutable Histo1DMapID        m_histo1DMapID    ;
03118   // ==========================================================================
03120   mutable Histo2DMapTitle     m_histo2DMapTitle ;
03122   mutable Histo2DMapID        m_histo2DMapID    ;
03123   // ==========================================================================
03125   mutable Histo3DMapTitle     m_histo3DMapTitle ;
03127   mutable Histo3DMapID        m_histo3DMapID    ;
03128   // ==========================================================================
03130   mutable Profile1DMapTitle   m_profile1DMapTitle ;
03132   mutable Profile1DMapID      m_profile1DMapID    ;
03133   // ==========================================================================
03135   mutable Profile2DMapTitle   m_profile2DMapTitle ;
03137   mutable Profile2DMapID      m_profile2DMapID    ;
03138   // ==========================================================================
03140   std::string  m_histo1DTableFormat      ;
03142   std::string  m_histo1DTableFormatShort ;
03144   std::string  m_histo1DTableHeader      ;
03146   bool        m_useNumericAutoIDs;
03150   std::map<std::string,std::string> m_idReplaceInfo;
03151   // ==========================================================================
03152 };
03153 // ============================================================================
03154 // The END
03155 // ============================================================================
03156 #endif // GAUDIALG_GAUDIHISTOS_H
03157 // ============================================================================
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 23:27:14 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004