| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines