| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

# GaudiHistos_2DProfFixedBinning.icpp

Go to the documentation of this file.

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

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