Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

GaudiHistos_3DFixedBinning.icpp

Go to the documentation of this file.
00001 // ============================================================================
00002 // ==================================== 3D ====================================
00003 // ============================================================================
00004 // book the 3D histogram (book on demand)
00005 // ============================================================================
00006 template <class PBASE>
00007 AIDA::IHistogram3D*  GaudiHistos<PBASE>::book3D
00008 ( const std::string&  title   ,
00009   const double        lowX    ,
00010   const double        highX   ,
00011   const unsigned long binsX   ,
00012   const double        lowY    ,
00013   const double        highY   ,
00014   const unsigned long binsY   ,
00015   const double        lowZ    ,
00016   const double        highZ   ,
00017   const unsigned long binsZ   ) const
00018 {
00019   // exist?
00020   AIDA::IHistogram3D* hist = histo3D ( title ) ;
00021   // histogram is already booked
00022   if( 0 != hist      )                           { return hist ; } // RETURN !!
00023 
00024   // propose the histogram ID
00025   HistoID ID;
00026   newHistoID( title, ID );
00027 
00028   // Create a new histogram and return
00029   return this -> book3D ( ID, title,
00030                           lowX, highX, binsX,
00031                           lowY, highY, binsY,
00032                           lowZ, highZ, binsZ );
00033 }
00034 // ============================================================================
00035 // book the 3D histogram with forced ID (book on demand)
00036 // ============================================================================
00037 template <class PBASE>
00038 AIDA::IHistogram3D*  GaudiHistos<PBASE>::book3D
00039 ( const HistoID&      ID           ,
00040   const std::string&  title   ,
00041   const double        lowX    ,
00042   const double        highX   ,
00043   const unsigned long binsX   ,
00044   const double        lowY    ,
00045   const double        highY   ,
00046   const unsigned long binsY   ,
00047   const double        lowZ    ,
00048   const double        highZ   ,
00049   const unsigned long binsZ   ) const
00050 {
00051   // Check ID
00052   if (ID.undefined())
00053   {
00054     this->Error("Undefined Histogram ID : Title='"+title+"'");
00055     return NULL;
00056   }
00057 
00058   // exist?
00059   AIDA::IHistogram3D* hist = histo3D( ID ) ;
00060   // histogram is already booked
00061   if( 0 != hist       )                        { return hist ; } // RETURN !!
00062 
00063   // Histogram title
00064   const std::string & htitle =
00065     ( title.empty() ? "Unnamed 3D Histogram ID="+ID.idAsString() : title ) ;
00066 
00067   // book the histogram
00068   if ( ID.numeric() )
00069   {
00070     hist = this->histoSvc() -> book ( histoPath()  ,
00071                                       ID.numericID() ,
00072                                       htitle       ,
00073                                       binsX        ,
00074                                       lowX         ,
00075                                       highX        ,
00076                                       binsY        ,
00077                                       lowY         ,
00078                                       highY        ,
00079                                       binsZ        ,
00080                                       lowZ         ,
00081                                       highZ        ) ;
00082   }
00083   else if ( ID.literal() )
00084   {
00085     hist = this->histoSvc() -> book ( histoPath()+"/"+
00086                                       ID.literalID() ,
00087                                       htitle       ,
00088                                       binsX        ,
00089                                       lowX         ,
00090                                       highX        ,
00091                                       binsY        ,
00092                                       lowY         ,
00093                                       highY        ,
00094                                       binsZ        ,
00095                                       lowZ         ,
00096                                       highZ        ) ;
00097   }
00098 
00099   // Check OK
00100   if( 0 == hist )
00101   { this->Error( "IHistogram3D* points to NULL! ID='" + ID.idAsString() +
00102                  "' title='"+htitle+"'" ) ; return 0; } // RETURN !!
00103 
00104   // add histogram into histogram storages
00105   if      ( ID.numeric() )
00106   { m_histo3DMapNumID [ ID.numericID() ] = hist ; }
00107   else if ( ID.literal() )
00108   { m_histo3DMapLitID [ ID.literalID() ] = hist ; }
00109   m_histo3DMapTitle [ title ] = hist ;
00110 
00111   // Declare to monitoring service
00112   monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
00113 
00114   // Printout and return
00115   if ( this->msgLevel(MSG::DEBUG) )
00116   { this->debug() << "Booked 3D Histogram : ID='"
00117                   << ID << "' Path=" << histoPath()
00118                   << " Title='"
00119                   << Gaudi::Utils::Histos::htitle ( hist )
00120                   << "'" << endmsg; }
00121   return hist ;
00122 }
00123 // ============================================================================
00124 // fill the 3D histogram with the values and weight
00125 // ============================================================================
00126 template <class PBASE>
00127 AIDA::IHistogram3D* GaudiHistos<PBASE>::fill
00128 ( AIDA::IHistogram3D* histo  ,
00129   const double        valueX ,
00130   const double        valueY ,
00131   const double        valueZ ,
00132   const double        weight ,
00133   const std::string&  title  ) const
00134 {
00135   if ( 0 != histo && produceHistos() )
00136   {
00137     if ( !checkForNaN() )
00138     { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , valueZ , weight ) ; }
00139     else if  ( lfin ( valueX ) && lfin ( valueY ) &&
00140                lfin ( valueZ ) && lfin ( weight ) )
00141     { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , valueZ , weight ) ; }
00142     else if  ( lnan ( valueX ) || lnan ( valueY ) ||
00143                lnan ( valueZ ) || lnan ( weight ) )
00144     {
00145       this -> Warning
00146         ("fill():: 'NaN'      value is skipped from the histogram '"
00147          + Gaudi::Utils::Histos::htitle ( histo , title  ) + "'" ) ;
00148     }
00149     else
00150     {
00151       this -> Warning
00152         ("fill():: 'Infinite' value is skipped from the histogram '"
00153          + Gaudi::Utils::Histos::htitle ( histo , title  ) + "'" ) ;
00154     }
00155   }
00156   // return
00157   return histo ;
00158 }
00159 // ============================================================================
00160 // fill the 3D histogram (book on demand)
00161 // ============================================================================
00162 template <class PBASE>
00163 AIDA::IHistogram3D*  GaudiHistos<PBASE>::plot3D
00164 ( const double        valueX       ,
00165   const double        valueY       ,
00166   const double        valueZ       ,
00167   const std::string&  title        ,
00168   const double        lowX         ,
00169   const double        highX        ,
00170   const double        lowY         ,
00171   const double        highY        ,
00172   const double        lowZ         ,
00173   const double        highZ        ,
00174   const unsigned long binsX        ,
00175   const unsigned long binsY        ,
00176   const unsigned long binsZ        ,
00177   const double        weight       ) const
00178 {
00179   AIDA::IHistogram3D * h(0);
00180   if ( produceHistos() )
00181   {
00182     // retrieve or book the histogram
00183     h = histo3D ( title ) ;
00184     if ( 0 == h ) { h = book3D ( title ,
00185                                  lowX , highX , binsX ,
00186                                  lowY , highY , binsY ,
00187                                  lowZ , highZ , binsZ ) ; }
00188     // fill the histogram
00189     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
00190   }
00191   return h;
00192 }
00193 // ============================================================================
00194 // fill the 3D histogram with forced ID assignment (book on demand)
00195 // ============================================================================
00196 template <class PBASE>
00197 AIDA::IHistogram3D* GaudiHistos<PBASE>::plot3D
00198 ( const double        valueX       ,
00199   const double        valueY       ,
00200   const double        valueZ       ,
00201   const HistoID&      ID           ,
00202   const std::string&  title        ,
00203   const double        lowX         ,
00204   const double        highX        ,
00205   const double        lowY         ,
00206   const double        highY        ,
00207   const double        lowZ         ,
00208   const double        highZ        ,
00209   const unsigned long binsX        ,
00210   const unsigned long binsY        ,
00211   const unsigned long binsZ        ,
00212   const double        weight       ) const
00213 {
00214   AIDA::IHistogram3D * h(0);
00215   if ( produceHistos() )
00216   {
00217     // retrieve or book the histogram
00218     h = histo3D ( ID ) ;
00219     if ( 0 == h ) { h = book3D ( ID , title ,
00220                                  lowX , highX , binsX ,
00221                                  lowY , highY , binsY ,
00222                                  lowZ , highZ , binsZ ) ; }
00223     // fill the histogram
00224     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
00225   }
00226   return h;
00227 }

Generated at Mon Sep 7 18:05:34 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004